X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/efd689d86ad25be72d38cf012d90ffe0203850d1..1d5e845a26a006ed88985816d86a5769b6a713b0:/Execute.cpp diff --git a/Execute.cpp b/Execute.cpp index c871ef5..89a796a 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -358,17 +358,9 @@ static JSValueRef System_print(JSContextRef context, JSObjectRef object, JSObjec return CYJSUndefined(context); } CYCatch(NULL) } -static size_t Nonce_(0); - -static JSValueRef $cyq(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { - CYPool pool; - const char *name(pool.strcat(CYPoolCString(pool, context, arguments[0]), pool.itoa(Nonce_++), NULL)); - return CYCastJSValue(context, name); -} CYCatch(NULL) } - static void (*JSSynchronousGarbageCollectForDebugging$)(JSContextRef); -void CYGarbageCollect(JSContextRef context) { +_visible void CYGarbageCollect(JSContextRef context) { (JSSynchronousGarbageCollectForDebugging$ ?: &JSGarbageCollect)(context); } @@ -1538,7 +1530,7 @@ static JSStaticFunction Type_staticFunctions[14] = { static JSObjectRef (*JSObjectMakeArray$)(JSContextRef, size_t, const JSValueRef[], JSValueRef *); -void CYSetArgs(int argc, const char *argv[]) { +_visible void CYSetArgs(int argc, const char *argv[]) { JSContextRef context(CYGetJSContext()); JSValueRef args[argc]; for (int i(0); i != argc; ++i) @@ -1596,7 +1588,7 @@ static bool CYShouldTerminate(JSContextRef context, void *arg) { return cancel_; } -const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code) { +_visible const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code) { JSValueRef exception(NULL); if (false) error: return CYPoolCString(pool, context, CYJSString(context, exception)); @@ -1624,7 +1616,7 @@ const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code) { return json; } -void CYCancel() { +_visible void CYCancel() { cancel_ = true; } @@ -1759,8 +1751,6 @@ JSGlobalContextRef CYGetJSContext(JSContextRef context) { return reinterpret_cast(JSObjectGetPrivate(CYCastJSObject(context, CYGetProperty(context, CYGetGlobalObject(context), cy_s))))->context_; } -extern "C" bool CydgetMemoryParse(const uint16_t **data, size_t *size); - void *CYMapFile(const char *path, size_t *psize) { int fd(_syscall_(open(path, O_RDONLY), 1, ENOENT)); if (fd == -1) @@ -1929,8 +1919,6 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) { CYSetPrototype(context, last, all); } - CYSetProperty(context, global, CYJSString("$cyq"), &$cyq, kJSPropertyAttributeDontEnum); - JSObjectRef System(JSObjectMake(context, NULL, NULL)); CYSetProperty(context, cy, CYJSString("System"), System); @@ -1960,7 +1948,7 @@ extern "C" void CYSetupContext(JSGlobalContextRef context) { static JSGlobalContextRef context_; -JSGlobalContextRef CYGetJSContext() { +_visible JSGlobalContextRef CYGetJSContext() { CYInitializeDynamic(); if (context_ == NULL) { @@ -1971,7 +1959,7 @@ JSGlobalContextRef CYGetJSContext() { return context_; } -void CYDestroyContext() { +_visible void CYDestroyContext() { if (context_ == NULL) return; JSGlobalContextRelease(context_);