From 2385c806df15d62fc4ec2cac7913a975e3bafa13 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 7 Nov 2009 22:41:25 +0000 Subject: [PATCH] Attempting to wedge Cycript into a WebView. --- Bridge.def | 197 +++++++++++++++++++++++++++++++++++++++++- Console.cpp | 1 + Library.cpp | 46 ++++++---- ObjectiveC/Library.mm | 14 +-- ObjectiveC/Replace.mm | 15 ++-- ObjectiveC/Syntax.hpp | 2 +- cycript.hpp | 4 +- 7 files changed, 245 insertions(+), 34 deletions(-) diff --git a/Bridge.def b/Bridge.def index 26797e3..8030f8f 100644 --- a/Bridge.def +++ b/Bridge.def @@ -1,6 +1,7 @@ C YES true C NO false C nil null +C NULL null : applicationDidFinishLaunching: v12@0:4@8 @@ -369,6 +370,27 @@ F UIAccessibilityPostNotification vI@ F UIGetScreenImage @ +V UIAbbreviatedMonthDayFormat @ +V UIAbbreviatedWeekdayDateFormat @ +V UIAbbreviatedWeekdayFormat @ +V UIAbbreviatedWeekdayMonthDayFormat @ +V UIAbbreviatedWeekdayMonthDayMinutelessFormat @ +V UIAbbreviatedWeekdayMonthDayTimeFormat @ +V UIDatePickerDayFormat @ +V UIDatePickerMonthFormat @ +V UIDatePickerYearFormat @ +V UIHourFormat @ +V UIMinutelessTimeFormat @ +V UIMonthYearFormat @ +V UINoAMPMTimeFormat @ +V UIShortMonthDayFormat @ +V UIWeekdayAbbreviatedDateFormat @ +V UIWeekdayAbbreviatedNoYearDateFormat @ +V UIWeekdayFormat @ +V UIWeekdayNoYearDateFormat @ + +F UIDateFormatStringForFormatType @@ + F UIApplicationUseLegacyEvents vB F UIKeyboardDisableAutomaticAppearance v @@ -761,6 +783,8 @@ F CFRangeMake {CFRange}{CFIndex}{CFIndex} # Time Utilities +F CFAbsoluteTimeGetCurrent {CFAbsoluteTime} + T CFAbsoluteTime {CFTimeInterval} S CFGregorianDate "year"{SInt32}"month"{SInt8}"day"{SInt8}"hour"{SInt8}"minute"{SInt8}"second"{double} S CFGregorianUnits "years"{SInt32}"months"{SInt32}"days"{SInt32}"hours"{SInt32}"minutes"{SInt32}"second"{double} @@ -869,7 +893,8 @@ F CFAllocatorGetTypeID {CFTypeID} S CFAllocatorContext "version"{CFIndex}"info"^v"retain"{CFAllocatorRetainCallBack}"release"{CFAllocatorReleaseCallBack}"copyDescription"{CFAllocatorCopyDescriptionCallBack}"allocate"{CFAllocatorAllocateCallBack}"reallocate"{CFAllocatorReallocateCallBack}"deallocate"{CFAllocatorDeallocateCallBack}"preferredSize"{CFAllocatorPreferredSizeCallBack} # CFAllocatorContext CFAllocatorContext -T CFAllocatorRef ^r{__CFAllocator} +T CFAllocatorRef @ +# CFAllocatorRef ^r{__CFAllocator} V kCFAllocatorDefault {CFAllocatorRef} V kCFAllocatorSystemDefault {CFAllocatorRef} @@ -890,6 +915,173 @@ T CFByteOrder __CFByteOrder T CFArrayRef @ +# CFData + +F CFDataCreate {CFDataRef}{CFAllocatorRef}^r{UInt8}{CFIndex} +F CFDataCreateCopy {CFDataRef}{CFAllocatorRef}{CFDataRef} +F CFDataCreateWithBytesNoCopy {CFDataRef}{CFAllocatorRef}^r{UInt8}{CFIndex}{CFAllocatorRef} + +F CFDataGetBytePtr ^r{UInt8}{CFDataRef} +F CFDataGetBytes v{CFDataRef}{CFRange}^{UInt8} +F CFDataGetLength {CFIndex}{CFDataRef} + +F CFDataGetTypeID {CFTypeID} + +T CFDataRef @ +# CFDataRef ^r{__CFData} + +# CFDate + +F CFDateCompare {CFComparisonResult}{CFDateRef}{CFDateRef}^v +F CFDateCreate {CFDateRef}{CFAllocatorRef}{CFAbsoluteTime} +F CFDateGetAbsoluteTime {CFAbsoluteTime}{CFDateRef} +F CFDateGetTimeIntervalSinceDate {CFTimeInterval}{CFDateRef}{CFDateRef} +F CFDateGetTypeID {CFTypeID} + +T CFDateRef @ +# CFDateRef ^r{__CFDate} + +# CFDateFormatter + +F CFDateFormatterCreate {CFDateFormatterRef}{CFAllocatorRef}{CFLocaleRef}{CFDateFormatterStyle}{CFDateFormatterStyle} + +F CFDateFormatterSetFormat v{CFDateFormatterRef}{CFStringRef} +F CFDateFormatterSetProperty v{CFDateFormatterRef}{CFStringRef}{CFTypeRef} + +F CFDateFormatterCreateDateFromString {CFDateRef}{CFAllocatorRef}{CFDateFormatterRef}{CFStringRef}^{CFRange} +F CFDateFormatterGetAbsoluteTimeFromString {Boolean}{CFDateFormatterRef}{CFStringRef}^{CFRange}^{CFAbsoluteTime} + +F CFDateFormatterCreateStringWithAbsoluteTime {CFStringRef}{CFAllocatorRef}{CFDateFormatterRef}{CFAbsoluteTime} +F CFDateFormatterCreateStringWithDate {CFStringRef}{CFAllocatorRef}{CFDateFormatterRef}{CFDateRef} +F CFDateFormatterCreateDateFormatFromTemplate {CFStringRef}{CFAllocatorRef}{CFStringRef}{CFOptionFlags}{CFLocaleRef} + +F CFDateFormatterCopyProperty {CFTypeRef}{CFDateFormatterRef}{CFStringRef} +F CFDateFormatterGetDateStyle {CFDateFormatterStyle}{CFDateFormatterRef} +F CFDateFormatterGetFormat {CFStringRef}{CFDateFormatterRef} +F CFDateFormatterGetLocale {CFLocaleRef}{CFDateFormatterRef} +F CFDateFormatterGetTimeStyle {CFDateFormatterStyle}{CFDateFormatterRef} + +F CFDateFormatterGetTypeID {CFTypeID} + +T CFDateFormatterRef @ +# CFDateFormatterRef ^r{__CFDateFormatter} + +T CFDateFormatterStyle {CFIndex} + +C kCFDateFormatterNoStyle 0 +C kCFDateFormatterShortStyle 1 +C kCFDateFormatterMediumStyle 2 +C kCFDateFormatterLongStyle 3 +C kCFDateFormatterFullStyle 4 + +V kCFDateFormatterIsLenient @ +V kCFDateFormatterTimeZone @ +V kCFDateFormatterCalendarName @ +V kCFDateFormatterDefaultFormat @ + +V kCFDateFormatterTwoDigitStartDate @ +V kCFDateFormatterDefaultDate @ +V kCFDateFormatterCalendar @ +V kCFDateFormatterEraSymbols @ +V kCFDateFormatterMonthSymbols @ +V kCFDateFormatterShortMonthSymbols @ +V kCFDateFormatterWeekdaySymbols @ +V kCFDateFormatterShortWeekdaySymbols @ +V kCFDateFormatterAMSymbol @ +V kCFDateFormatterPMSymbol @ + +V kCFDateFormatterLongEraSymbols @ +V kCFDateFormatterVeryShortMonthSymbols @ +V kCFDateFormatterStandaloneMonthSymbols @ +V kCFDateFormatterShortStandaloneMonthSymbols @ +V kCFDateFormatterVeryShortStandaloneMonthSymbols @ +V kCFDateFormatterVeryShortWeekdaySymbols @ +V kCFDateFormatterStandaloneWeekdaySymbols @ +V kCFDateFormatterShortStandaloneWeekdaySymbols @ +V kCFDateFormatterVeryShortStandaloneWeekdaySymbols @ +V kCFDateFormatterQuarterSymbols @ +V kCFDateFormatterShortQuarterSymbols @ +V kCFDateFormatterStandaloneQuarterSymbols @ +V kCFDateFormatterShortStandaloneQuarterSymbols @ +V kCFDateFormatterGregorianStartDate @ + +V CFGregorianCalendar @ + +# CFLocale + +F CFLocaleCopyCurrent {CFLocaleRef} +F CFLocaleCreate {CFLocaleRef}{CFAllocatorRef}{CFStringRef} +F CFLocaleCreateCopy {CFLocaleRef}{CFAllocatorRef}{CFLocaleRef} +F CFLocaleGetSystem {CFLocaleRef} + +F CFLocaleCopyAvailableLocaleIdentifiers {CFArrayRef} + +F CFLocaleCopyISOCountryCodes {CFArrayRef} +F CFLocaleCopyISOLanguageCodes {CFArrayRef} +F CFLocaleCopyISOCurrencyCodes {CFArrayRef} +F CFLocaleCopyCommonISOCurrencyCodes {CFArrayRef} + +F CFLocaleCopyPreferredLanguages {CFArrayRef} + +F CFLocaleCopyDisplayNameForPropertyValue {CFStringRef}{CFLocaleRef}{CFStringRef}{CFStringRef} +F CFLocaleGetValue {CFTypeRef}{CFLocaleRef}{CFStringRef} +F CFLocaleGetIdentifier {CFStringRef}{CFLocaleRef} + +F CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes {CFStringRef}{CFAllocatorRef}{LangCode}{RegionCode} +F CFLocaleCreateCanonicalLanguageIdentifierFromString {CFStringRef}{CFAllocatorRef}{CFStringRef} +F CFLocaleCreateCanonicalLocaleIdentifierFromString {CFStringRef}{CFAllocatorRef}{CFStringRef} +F CFLocaleCreateComponentsFromLocaleIdentifier {CFDictionaryRef}{CFAllocatorRef}{CFStringRef} +F CFLocaleCreateLocaleIdentifierFromComponents {CFStringRef}{CFAllocatorRef}{CFDictionaryRef} + +F CFLocaleGetTypeID {CFTypeID} + +F CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode {CFStringRef}{CFAllocatorRef}{uint32_t} +F CFLocaleGetLanguageCharacterDirection {CFLocaleLanguageDirection}{CFStringRef} +F CFLocaleGetLanguageLineDirection {CFLocaleLanguageDirection}{CFStringRef} +F CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier {uint32_t}{CFStringRef} + +T CFLocaleRef @ +# CFLocaleRef ^r{__CFLocale} + +C kCFLocaleLanguageDirectionUnknown 0 +C kCFLocaleLanguageDirectionLeftToRight 1 +C kCFLocaleLanguageDirectionRightToLeft 2 +C kCFLocaleLanguageDirectionTopToBottom 3 +C kCFLocaleLanguageDirectionBottomToTop 4 + +T CFLocaleLanguageDirection {CFIndex} + +V kCFLocaleMeasurementSystem @ +V kCFLocaleDecimalSeparator @ +V kCFLocaleGroupingSeparator @ +V kCFLocaleCurrencySymbol @ +V kCFLocaleCurrencyCode @ + +V kCFLocaleIdentifier @ +V kCFLocaleLanguageCode @ +V kCFLocaleCountryCode @ +V kCFLocaleScriptCode @ +V kCFLocaleVariantCode @ +V kCFLocaleExemplarCharacterSet @ +V kCFLocaleCalendarIdentifier @ +V kCFLocaleCalendar @ +V kCFLocaleCollationIdentifier @ +V kCFLocaleUsesMetricSystem @ + +V kCFGregorianCalendar @ +V kCFBuddhistCalendar @ +V kCFChineseCalendar @ +V kCFHebrewCalendar @ +V kCFIslamicCalendar @ +V kCFIslamicCivilCalendar @ +V kCFJapaneseCalendar @ +V kCFRepublicOfChinaCalendar @ +V kCFPersianCalendar @ +V kCFIndianCalendar @ +V kCFISO8601Calendar @ + +V kCFLocaleCurrentLocaleDidChangeNotificatio @ + # CFRunLoop F CFRunLoopGetCurrent {CFRunLoopRef} @@ -957,8 +1149,9 @@ F CFShow v{CFTypeRef} T CFHashCode L T CFTypeID L -# technically ^v + T CFTypeRef @ +# CFTypeRef ^rv # Private diff --git a/Console.cpp b/Console.cpp index f65323e..719e6f0 100644 --- a/Console.cpp +++ b/Console.cpp @@ -332,6 +332,7 @@ static void Console(apr_pool_t *pool, int client) { if (debug) std::cout << code << std::endl; + code = "with(Cycript.all){" + code + "}"; Run(client, code, fout, expand); } diff --git a/Library.cpp b/Library.cpp index 78f0fd0..5517565 100644 --- a/Library.cpp +++ b/Library.cpp @@ -113,7 +113,7 @@ void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, J CYThrow(context, exception); } -void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, JSValueRef (*callback)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef *), JSPropertyAttributes attributes = kJSPropertyAttributeNone) { +void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, JSValueRef (*callback)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef *), JSPropertyAttributes attributes) { CYSetProperty(context, object, name, JSObjectMakeFunctionWithCallback(context, name, callback), attributes); } /* }}} */ @@ -300,11 +300,11 @@ bool CYIsKey(CYUTF8String value) { } /* }}} */ +static JSClassRef All_; static JSClassRef Context_; static JSClassRef Functor_; static JSClassRef Global_; static JSClassRef Pointer_; -static JSClassRef Runtime_; static JSClassRef Struct_; JSStringRef Array_s; @@ -1120,7 +1120,13 @@ static void *CYCastSymbol(const char *name) { return dlsym(RTLD_DEFAULT, name); } -static JSValueRef Runtime_getProperty(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry { +static JSValueRef All_getProperty(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry { + JSObjectRef global(CYGetGlobalObject(context)); + JSObjectRef cycript(CYCastJSObject(context, CYGetProperty(context, global, CYJSString("Cycript")))); + if (JSValueRef value = CYGetProperty(context, cycript, property)) + if (!JSValueIsUndefined(context, value)) + return value; + CYPool pool; CYUTF8String name(CYPoolUTF8String(pool, context, property)); @@ -1444,6 +1450,11 @@ void CYInitialize() { JSClassDefinition definition; + definition = kJSClassDefinitionEmpty; + definition.className = "All"; + definition.getProperty = &All_getProperty; + All_ = JSClassCreate(&definition); + definition = kJSClassDefinitionEmpty; definition.className = "Context"; definition.finalize = &CYFinalize; @@ -1482,11 +1493,6 @@ void CYInitialize() { definition.finalize = &CYFinalize; Type_privateData::Class_ = JSClassCreate(&definition); - definition = kJSClassDefinitionEmpty; - definition.className = "Runtime"; - definition.getProperty = &Runtime_getProperty; - Runtime_ = JSClassCreate(&definition); - definition = kJSClassDefinitionEmpty; //definition.getProperty = &Global_getProperty; Global_ = JSClassCreate(&definition); @@ -1585,12 +1591,15 @@ JSGlobalContextRef CYGetJSContext(JSContextRef context) { return reinterpret_cast(JSObjectGetPrivate(CYCastJSObject(context, CYGetProperty(context, CYGetGlobalObject(context), cy_s))))->context_; } -void CYSetupContext(JSGlobalContextRef context) { +extern "C" void CYSetupContext(JSGlobalContextRef context) { + CYInitialize(); + JSObjectRef global(CYGetGlobalObject(context)); JSObjectRef cy(JSObjectMake(context, Context_, new Context(context))); CYSetProperty(context, global, cy_s, cy, kJSPropertyAttributeDontEnum); +/* Cache Globals {{{ */ JSObjectRef Array(CYCastJSObject(context, CYGetProperty(context, global, CYJSString("Array")))); CYSetProperty(context, cy, CYJSString("Array"), Array); @@ -1614,21 +1623,23 @@ void CYSetupContext(JSGlobalContextRef context) { JSObjectRef String(CYCastJSObject(context, CYGetProperty(context, global, CYJSString("String")))); CYSetProperty(context, cy, CYJSString("String"), String); - - JSObjectSetPrototype(context, global, JSObjectMake(context, Runtime_, NULL)); +/* }}} */ CYSetProperty(context, Array_prototype, toCYON_s, &Array_callAsFunction_toCYON, kJSPropertyAttributeDontEnum); + JSObjectRef cycript(JSObjectMake(context, NULL, NULL)); + CYSetProperty(context, global, CYJSString("Cycript"), cycript); + CYSetProperty(context, cycript, CYJSString("gc"), &Cycript_gc_callAsFunction); + JSObjectRef Functor(JSObjectMakeConstructor(context, Functor_, &Functor_new)); JSObjectSetPrototype(context, CYCastJSObject(context, CYGetProperty(context, Functor, prototype_s)), Function_prototype); - CYSetProperty(context, global, CYJSString("Functor"), Functor); + CYSetProperty(context, cycript, CYJSString("Functor"), Functor); - CYSetProperty(context, global, CYJSString("Pointer"), JSObjectMakeConstructor(context, Pointer_, &Pointer_new)); - CYSetProperty(context, global, CYJSString("Type"), JSObjectMakeConstructor(context, Type_privateData::Class_, &Type_new)); + CYSetProperty(context, cycript, CYJSString("Pointer"), JSObjectMakeConstructor(context, Pointer_, &Pointer_new)); + CYSetProperty(context, cycript, CYJSString("Type"), JSObjectMakeConstructor(context, Type_privateData::Class_, &Type_new)); - JSObjectRef cycript(JSObjectMake(context, NULL, NULL)); - CYSetProperty(context, global, CYJSString("Cycript"), cycript); - CYSetProperty(context, cycript, CYJSString("gc"), &Cycript_gc_callAsFunction); + JSObjectRef all(JSObjectMake(context, All_, NULL)); + CYSetProperty(context, cycript, CYJSString("all"), all); CYSetProperty(context, global, CYJSString("$cyq"), &$cyq); @@ -1652,6 +1663,7 @@ JSGlobalContextRef CYGetJSContext() { if (context_ == NULL) { context_ = JSGlobalContextCreate(Global_); CYSetupContext(context_); + JSObjectSetPrototype(context_, CYGetGlobalObject(context_), JSObjectMake(context_, All_, NULL)); } return context_; diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 63da8cb..a39d4c3 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2399,9 +2399,11 @@ void CYObjectiveC_Initialize() { /*XXX*/ JSContextRef context(NULL); CYPoolTry { void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry { JSObjectRef global(CYGetGlobalObject(context)); JSObjectRef cy(CYCastJSObject(context, CYGetProperty(context, global, cy_s))); + JSObjectRef cycript(CYCastJSObject(context, CYGetProperty(context, global, CYJSString("Cycript")))); + JSObjectRef all(CYCastJSObject(context, CYGetProperty(context, cycript, CYJSString("all")))); JSObjectRef ObjectiveC(JSObjectMake(context, NULL, NULL)); - CYSetProperty(context, global, CYJSString("ObjectiveC"), ObjectiveC); + CYSetProperty(context, cycript, CYJSString("ObjectiveC"), ObjectiveC); CYSetProperty(context, ObjectiveC, CYJSString("classes"), JSObjectMake(context, ObjectiveC_Classes_, NULL)); CYSetProperty(context, ObjectiveC, CYJSString("protocols"), JSObjectMake(context, ObjectiveC_Protocols_, NULL)); @@ -2418,15 +2420,15 @@ void CYObjectiveC_SetupContext(JSContextRef context) { CYPoolTry { JSObjectRef Instance_prototype(CYCastJSObject(context, CYGetProperty(context, Instance, prototype_s))); CYSetProperty(context, cy, CYJSString("Instance_prototype"), Instance_prototype); - CYSetProperty(context, global, CYJSString("Instance"), Instance); - CYSetProperty(context, global, CYJSString("Selector"), Selector); - CYSetProperty(context, global, CYJSString("Super"), Super); + CYSetProperty(context, cycript, CYJSString("Instance"), Instance); + CYSetProperty(context, cycript, CYJSString("Selector"), Selector); + CYSetProperty(context, cycript, CYJSString("Super"), Super); #if defined(__APPLE__) && defined(__arm__) - CYSetProperty(context, global, CYJSString("objc_registerClassPair"), JSObjectMakeFunctionWithCallback(context, CYJSString("objc_registerClassPair"), &objc_registerClassPair_)); + CYSetProperty(context, all, CYJSString("objc_registerClassPair"), &objc_registerClassPair_); #endif - CYSetProperty(context, global, CYJSString("objc_msgSend"), JSObjectMakeFunctionWithCallback(context, CYJSString("objc_msgSend"), &$objc_msgSend)); + CYSetProperty(context, all, CYJSString("objc_msgSend"), &$objc_msgSend); JSObjectRef Function_prototype(CYGetCachedObject(context, CYJSString("Function_prototype"))); JSObjectSetPrototype(context, CYCastJSObject(context, CYGetProperty(context, Message, prototype_s)), Function_prototype); diff --git a/ObjectiveC/Replace.mm b/ObjectiveC/Replace.mm index 10083b1..494c6dd 100644 --- a/ObjectiveC/Replace.mm +++ b/ObjectiveC/Replace.mm @@ -135,13 +135,17 @@ CYString *CYSelectorPart::Replace(CYContext &context) { CYExpression *CYSendDirect::Replace(CYContext &context) { std::ostringstream name; CYArgument **argument(&arguments_); + CYSelectorPart *selector(NULL), *current(NULL); while (*argument != NULL) { if ((*argument)->name_ != NULL) { - name << *(*argument)->name_; + CYSelectorPart *part($ CYSelectorPart((*argument)->name_, (*argument)->value_ != NULL)); + if (selector == NULL) + selector = part; + if (current != NULL) + current->SetNext(part); + current = part; (*argument)->name_ = NULL; - if ((*argument)->value_ != NULL) - name << ':'; } if ((*argument)->value_ == NULL) @@ -150,10 +154,7 @@ CYExpression *CYSendDirect::Replace(CYContext &context) { argument = &(*argument)->next_; } - SEL sel(sel_registerName(name.str().c_str())); - double address(static_cast(reinterpret_cast(sel))); - - return $C2($V("objc_msgSend"), self_, $D(address), arguments_); + return $C2($V("objc_msgSend"), self_, ($ CYSelector(selector))->Replace(context), arguments_); } CYExpression *CYSendSuper::Replace(CYContext &context) { diff --git a/ObjectiveC/Syntax.hpp b/ObjectiveC/Syntax.hpp index 39695d0..f4101fb 100644 --- a/ObjectiveC/Syntax.hpp +++ b/ObjectiveC/Syntax.hpp @@ -49,7 +49,7 @@ struct CYSelectorPart : CYWord *name_; bool value_; - CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next) : + CYSelectorPart(CYWord *name, bool value, CYSelectorPart *next = NULL) : CYNext(next), name_(name), value_(value) diff --git a/cycript.hpp b/cycript.hpp index 24ed1cd..f73a7e8 100644 --- a/cycript.hpp +++ b/cycript.hpp @@ -79,7 +79,7 @@ JSGlobalContextRef CYGetJSContext(); apr_pool_t *CYGetGlobalPool(); JSObjectRef CYGetGlobalObject(JSContextRef context); -void CYSetupContext(JSGlobalContextRef context); +extern "C" void CYSetupContext(JSGlobalContextRef context); const char *CYExecute(apr_pool_t *pool, const char *code); void CYSetArgs(int argc, const char *argv[]); @@ -92,8 +92,10 @@ const char *CYPoolCString(apr_pool_t *pool, JSContextRef context, JSStringRef va JSValueRef CYGetProperty(JSContextRef context, JSObjectRef object, size_t index); JSValueRef CYGetProperty(JSContextRef context, JSObjectRef object, JSStringRef name); + void CYSetProperty(JSContextRef context, JSObjectRef object, size_t index, JSValueRef value); void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, JSValueRef value, JSPropertyAttributes attributes = kJSPropertyAttributeNone); +void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, JSValueRef (*callback)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef *), JSPropertyAttributes attributes = kJSPropertyAttributeNone); JSObjectRef CYGetCachedObject(JSContextRef context, JSStringRef name); -- 2.45.2