2012-08-28 10:22:36 +08:00
|
|
|
//
|
|
|
|
// Created by Rohan Kuruvilla
|
|
|
|
// Copyright (c) 2012 Zynga Inc. All rights reserved.
|
|
|
|
//
|
2012-09-24 11:47:33 +08:00
|
|
|
#ifndef __JS_MANUAL_CONVERSIONS_H__
|
|
|
|
#define __JS_MANUAL_CONVERSIONS_H__
|
2012-08-28 10:22:36 +08:00
|
|
|
|
2012-09-21 08:09:40 +08:00
|
|
|
#include "jsapi.h"
|
2012-11-14 07:03:35 +08:00
|
|
|
#include "js_bindings_core.h"
|
2012-08-28 10:22:36 +08:00
|
|
|
|
2012-09-24 13:57:45 +08:00
|
|
|
//#ifdef __cplusplus
|
|
|
|
//extern "C" {
|
|
|
|
//#endif
|
2012-08-28 10:22:36 +08:00
|
|
|
|
2012-09-24 13:57:45 +08:00
|
|
|
extern JSBool jsval_to_opaque( JSContext *cx, jsval vp, void **out );
|
|
|
|
extern JSBool jsval_to_int( JSContext *cx, jsval vp, int *out);
|
2012-11-14 07:03:35 +08:00
|
|
|
extern JSBool jsval_to_uint( JSContext *cx, jsval vp, unsigned int *out);
|
2012-09-24 13:57:45 +08:00
|
|
|
extern JSBool jsval_to_long( JSContext *cx, jsval vp, long *out);
|
|
|
|
extern JSBool jsval_to_longlong( JSContext *cx, jsval vp, long long *out);
|
|
|
|
extern jsval opaque_to_jsval( JSContext *cx, void* opaque);
|
2012-11-14 07:03:35 +08:00
|
|
|
extern jsval c_class_to_jsval( JSContext *cx, void* handle, JSObject* object, JSClass *klass, const char* class_name);
|
|
|
|
extern JSBool jsval_to_c_class( JSContext *cx, jsval vp, void **out_native, struct jsb_c_proxy_s **out_proxy);
|
|
|
|
extern jsval int_to_jsval( JSContext *cx, int number );
|
|
|
|
extern jsval uint_to_jsval( JSContext *cx, unsigned int number );
|
|
|
|
extern jsval long_to_jsval( JSContext *cx, long number );
|
|
|
|
extern jsval longlong_to_jsval( JSContext *cx, long long number );
|
2013-03-28 14:55:47 +08:00
|
|
|
/** converts a jsval (JS string) into a char */
|
2012-12-21 18:07:45 +08:00
|
|
|
extern JSBool jsval_to_charptr( JSContext *cx, jsval vp, const char **out);
|
2013-03-28 14:55:47 +08:00
|
|
|
/* Converts a char ptr into a jsval (using JS string) */
|
2012-12-21 18:07:45 +08:00
|
|
|
extern jsval charptr_to_jsval( JSContext *cx, const char *str);
|
2013-03-28 14:55:47 +08:00
|
|
|
|
|
|
|
extern JSBool JSB_jsval_to_int32( JSContext *cx, jsval vp, int32_t *outval );
|
|
|
|
extern JSBool JSB_jsval_to_uint32( JSContext *cx, jsval vp, uint32_t *outval);
|
|
|
|
extern JSBool JSB_jsval_typedarray_to_dataptr( JSContext *cx, jsval vp, GLsizei *count, void **data, JSArrayBufferViewType t);
|
|
|
|
extern JSBool JSB_get_arraybufferview_dataptr( JSContext *cx, jsval vp, GLsizei *count, GLvoid **data );
|
|
|
|
extern JSBool JSB_jsval_to_uint16( JSContext *cx, jsval vp, uint16_t *outval );
|
|
|
|
|
2012-09-24 13:57:45 +08:00
|
|
|
//#ifdef __cplusplus
|
|
|
|
//}
|
|
|
|
//#endif
|
2012-09-24 11:47:33 +08:00
|
|
|
|
|
|
|
#endif /* __JS_MANUAL_CONVERSIONS_H__ */
|
|
|
|
|