#ifndef CYCRIPT_HPP
#define CYCRIPT_HPP
+#ifdef __APPLE__
+#include <JavaScriptCore/JavaScriptCore.h>
+#else
#include <JavaScriptCore/JavaScript.h>
+#endif
#include <apr_pools.h>
#include <ffi.h>
#include <sqlite3.h>
+void CYInitialize();
+
bool CYRecvAll_(int socket, uint8_t *data, size_t size);
bool CYSendAll_(int socket, const uint8_t *data, size_t size);
bool CYCastBool(JSContextRef context, JSValueRef value);
double CYCastDouble(JSContextRef context, JSValueRef value);
+
+CYUTF8String CYPoolUTF8String(apr_pool_t *pool, JSContextRef context, JSStringRef value);
const char *CYPoolCString(apr_pool_t *pool, JSContextRef context, JSStringRef value);
JSValueRef CYGetProperty(JSContextRef context, JSObjectRef object, size_t index);
const char *CYPoolCCYON(apr_pool_t *pool, JSContextRef context, JSObjectRef object);
struct CYHooks {
- void *(*ExecuteStart)();
- void (*ExecuteEnd)(void *);
+ void *(*ExecuteStart)(JSContextRef);
+ void (*ExecuteEnd)(JSContextRef, void *);
+
JSValueRef (*RuntimeProperty)(JSContextRef, CYUTF8String);
+ void (*CallFunction)(JSContextRef, ffi_cif *, void (*)(), uint8_t *, void **);
+ void (*SetupContext)(JSContextRef);
+
bool (*PoolFFI)(apr_pool_t *, JSContextRef, sig::Type *, ffi_type *, void *, JSValueRef);
JSValueRef (*FromFFI)(JSContextRef, sig::Type *, ffi_type *, void *, bool, JSObjectRef);
};