cocos2d-x  3.0-beta2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spidermonkey_specifics.h File Reference
#include "jsapi.h"
#include "uthash.h"
#include <unordered_map>

Classes

struct  js_proxy_t
 
struct  js_type_class_t
 
class  TypeTest< DERIVED >
 

Macros

#define JS_NEW_PROXY(p, native_obj, js_obj)
#define JS_GET_PROXY(p, native_obj)
#define JS_GET_NATIVE_PROXY(p, js_obj)
#define JS_REMOVE_PROXY(nproxy, jsproxy)
#define TEST_NATIVE_OBJECT(cx, native_obj)

Variables

js_proxy_t_native_js_global_ht
var _native_js_global_ht
local _native_js_global_ht
js_proxy_t_js_native_global_ht
var _js_native_global_ht
local _js_native_global_ht
std::unordered_map
< std::string, js_type_class_t * > 
_js_global_type_map

Macro Definition Documentation

#define JS_GET_NATIVE_PROXY (   p,
  js_obj 
)
Value:
do { \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, p); \
} while (0)
#define JS_GET_PROXY (   p,
  native_obj 
)
Value:
do { \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, p); \
} while (0)
#define JS_NEW_PROXY (   p,
  native_obj,
  js_obj 
)
Value:
do { \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
js_proxy_t* native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_native_js_global_ht, ptr, p); \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_js_native_global_ht, obj, p); \
} while(0) \
var JS_NEW_PROXY (   var,
  var,
  var 
)
Value:
do { \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
js_proxy_t* native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_native_js_global_ht, ptr, p); \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_js_native_global_ht, obj, p); \
} while(0) \
local JS_NEW_PROXY (   local,
  local,
  local 
)
Value:
do { \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
js_proxy_t* native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_native_js_global_ht, &native_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_native_js_global_ht, ptr, p); \
p = (js_proxy_t *)malloc(sizeof(js_proxy_t)); \
assert(p); \
native_obj##js_obj##tmp = NULL; \
HASH_FIND_PTR(_js_native_global_ht, &js_obj, native_obj##js_obj##tmp); \
assert(!native_obj##js_obj##tmp); \
p->ptr = native_obj; \
p->obj = js_obj; \
HASH_ADD_PTR(_js_native_global_ht, obj, p); \
} while(0) \
#define JS_REMOVE_PROXY (   nproxy,
  jsproxy 
)
Value:
do { \
if (nproxy) { HASH_DEL(_native_js_global_ht, nproxy); free(nproxy); } \
if (jsproxy) { HASH_DEL(_js_native_global_ht, jsproxy); free(jsproxy); } \
} while (0)
#define TEST_NATIVE_OBJECT (   cx,
  native_obj 
)
Value:
if (!native_obj) { \
JS_ReportError(cx, "Invalid Native Object"); \
return JS_FALSE; \
}
var TEST_NATIVE_OBJECT (   var,
  var 
)
Value:
if (!native_obj) { \
JS_ReportError(cx, "Invalid Native Object"); \
return JS_FALSE; \
}
local TEST_NATIVE_OBJECT (   local,
  local 
)
Value:
if (!native_obj) { \
JS_ReportError(cx, "Invalid Native Object"); \
return JS_FALSE; \
}

Variable Documentation

std::unordered_map<std::string,
js_type_class_t*>
_js_global_type_map
var _js_global_type_map
local _js_global_type_map
js_proxy_t* _js_native_global_ht
var _js_native_global_ht
local _js_native_global_ht
js_proxy_t* _native_js_global_ht
var _native_js_global_ht
local _native_js_global_ht