{NULL, NULL, 0}
};
+static JSObjectRef (*$JSObjectMakeArray)(JSContextRef, size_t, const JSValueRef[], JSValueRef *);
+
void CYSetArgs(int argc, const char *argv[]) {
JSContextRef context(CYGetJSContext());
JSValueRef args[argc];
for (int i(0); i != argc; ++i)
args[i] = CYCastJSValue(context, argv[i]);
-#ifdef __APPLE__
- JSValueRef exception(NULL);
- JSObjectRef array(JSObjectMakeArray(context, argc, args, &exception));
- CYThrow(context, exception);
-#else
- JSValueRef value(CYCallAsFunction(context, Array_, NULL, argc, args));
- JSObjectRef array(CYCastJSObject(context, value));
-#endif
+
+ JSObjectRef array;
+ if ($JSObjectMakeArray != NULL) {
+ JSValueRef exception(NULL);
+ array = (*$JSObjectMakeArray)(context, argc, args, &exception);
+ CYThrow(context, exception);
+ } else {
+ JSValueRef value(CYCallAsFunction(context, Array_, NULL, argc, args));
+ array = CYCastJSObject(context, value);
+ }
+
CYSetProperty(context, System_, CYJSString("args"), array);
}
_aprcall(apr_initialize());
_aprcall(apr_pool_create(&Pool_, NULL));
_sqlcall(sqlite3_open("/usr/lib/libcycript.db", &Bridge_));
+
+ $JSObjectMakeArray = reinterpret_cast<JSObjectRef (*)(JSContextRef, size_t, const JSValueRef[], JSValueRef *)>(dlsym(RTLD_DEFAULT, "JSObjectMakeArray"));
}
apr_pool_t *CYGetGlobalPool() {
target := $(PKG_TARG)-
endif
-flags :=
+paths := $(foreach path,$(paths),$(wildcard $(path)))
+flags := $(foreach path,$(paths),-I$(path) -L$(path))
objc :=
svn := $(shell svnversion)
console := $(apr) -lreadline
depends :=
+ifndef uname_s
uname_s := $(shell uname -s)
+endif
+
+ifndef uname_p
uname_p := $(shell uname -p)
+endif
+
-include $(uname_s).mk
-include $(uname_s)-$(uname_p).mk