| function.h | | function.h | |
| | | | |
| skipping to change at line 32 | | skipping to change at line 32 | |
| */ | | */ | |
| | | | |
| #ifndef __GJS_FUNCTION_H__ | | #ifndef __GJS_FUNCTION_H__ | |
| #define __GJS_FUNCTION_H__ | | #define __GJS_FUNCTION_H__ | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| | | | |
| #include <jsapi.h> | | #include <jsapi.h> | |
| | | | |
| #include <girepository.h> | | #include <girepository.h> | |
|
| | | #include <girffi.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| | | typedef enum { | |
| | | PARAM_NORMAL, | |
| | | PARAM_SKIPPED, | |
| | | PARAM_ARRAY, | |
| | | PARAM_CALLBACK | |
| | | } GjsParamType; | |
| | | | |
| | | typedef struct { | |
| | | gint ref_count; | |
| | | JSRuntime *runtime; | |
| | | GICallableInfo *info; | |
| | | jsval js_function; | |
| | | ffi_cif cif; | |
| | | ffi_closure *closure; | |
| | | GIScopeType scope; | |
| | | gboolean is_vfunc; | |
| | | GjsParamType *param_types; | |
| | | } GjsCallbackTrampoline; | |
| | | | |
| | | GjsCallbackTrampoline* gjs_callback_trampoline_new(JSContext *context, | |
| | | jsval function | |
| | | , | |
| | | GICallableInfo *callable | |
| | | _info, | |
| | | GIScopeType scope, | |
| | | gboolean is_vfunc | |
| | | ); | |
| | | | |
| | | void gjs_callback_trampoline_unref(GjsCallbackTrampoline *trampoline); | |
| | | void gjs_callback_trampoline_ref(GjsCallbackTrampoline *trampoline); | |
| | | | |
| JSObject* gjs_define_function (JSContext *context, | | JSObject* gjs_define_function (JSContext *context, | |
| JSObject *in_object, | | JSObject *in_object, | |
|
| GIFunctionInfo *info); | | GType gtype, | |
| | | GICallableInfo *info); | |
| | | | |
| JSBool gjs_invoke_c_function_uncached (JSContext *context, | | JSBool gjs_invoke_c_function_uncached (JSContext *context, | |
| GIFunctionInfo *info, | | GIFunctionInfo *info, | |
| JSObject *obj, | | JSObject *obj, | |
| uintN argc, | | uintN argc, | |
| jsval *argv, | | jsval *argv, | |
| jsval *rval); | | jsval *rval); | |
| | | | |
| void gjs_init_cinvoke_profiling (); | | void gjs_init_cinvoke_profiling (); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 35 lines changed or added | |
|
| jsapi-util.h | | jsapi-util.h | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 164 | |
| gjs_##cname##_finalize, \ | | gjs_##cname##_finalize, \ | |
| NULL, \ | | NULL, \ | |
| NULL, \ | | NULL, \ | |
| NULL, \ | | NULL, \ | |
| NULL, NULL, NULL, NULL, NULL \ | | NULL, NULL, NULL, NULL, NULL \ | |
| }; \ | | }; \ | |
| jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, cons
t char *proto_name, JSObject *parent) \ | | jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, cons
t char *proto_name, JSObject *parent) \ | |
| { \ | | { \ | |
| jsval rval; \ | | jsval rval; \ | |
| JSObject *global = gjs_get_import_global(context); \ | | JSObject *global = gjs_get_import_global(context); \ | |
|
| if (!gjs_object_has_property(context, global, \ | | if (!gjs_object_get_property(context, global, \ | |
| gjs_##cname##_class.name)) { \ | | gjs_##cname##_class.name, &rval)) { \ | |
| JSObject *prototype = JS_InitClass(context, global, \ | | JSObject *prototype = JS_InitClass(context, global, \ | |
| parent, \ | | parent, \ | |
| &gjs_##cname##_class, \ | | &gjs_##cname##_class, \ | |
| ctor, \ | | ctor, \ | |
| 0, \ | | 0, \ | |
| &gjs_##cname##_proto_props[0], \ | | &gjs_##cname##_proto_props[0], \ | |
| &gjs_##cname##_proto_funcs[0], \ | | &gjs_##cname##_proto_funcs[0], \ | |
| NULL, \ | | NULL, \ | |
| NULL); \ | | NULL); \ | |
| if (prototype == NULL) { \ | | if (prototype == NULL) { \ | |
| return JSVAL_NULL; \ | | return JSVAL_NULL; \ | |
| } \ | | } \ | |
| if (!gjs_object_require_property( \ | | if (!gjs_object_require_property( \ | |
| context, global, NULL, \ | | context, global, NULL, \ | |
| gjs_##cname##_class.name, &rval)) { \ | | gjs_##cname##_class.name, &rval)) { \ | |
| return JSVAL_NULL; \ | | return JSVAL_NULL; \ | |
| } \ | | } \ | |
|
| | | if (!JS_DefineProperty(context, module, proto_name, \ | |
| | | rval, NULL, NULL, GJS_MODULE_PROP_FLAGS)) \ | |
| | | return JS_FALSE; \ | |
| } \ | | } \ | |
|
| if (!JS_DefineProperty(context, module, proto_name, \ | | | |
| rval, NULL, NULL, GJS_MODULE_PROP_FLAGS)) \ | | | |
| return JS_FALSE; \ | | | |
| return rval; \ | | return rval; \ | |
| } | | } | |
| | | | |
| gboolean gjs_init_context_standard (JSContext *context); | | gboolean gjs_init_context_standard (JSContext *context); | |
| | | | |
| void gjs_runtime_init (JSRuntime *runtime); | | void gjs_runtime_init (JSRuntime *runtime); | |
| void gjs_runtime_destroy (JSRuntime *runtime); | | void gjs_runtime_destroy (JSRuntime *runtime); | |
| | | | |
| JSContext* gjs_runtime_get_current_context (JSRuntime *runtime); | | JSContext* gjs_runtime_get_current_context (JSRuntime *runtime); | |
| void gjs_runtime_set_default_context (JSRuntime *runtime, | | void gjs_runtime_set_default_context (JSRuntime *runtime, | |
| | | | |
End of changes. 3 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|
| object.h | | object.h | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| #include <jsapi.h> | | #include <jsapi.h> | |
| | | | |
| #include <girepository.h> | | #include <girepository.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
| JSBool gjs_define_object_class (JSContext *context, | | JSBool gjs_define_object_class (JSContext *context, | |
| JSObject *in_object, | | JSObject *in_object, | |
| GType gtype, | | GType gtype, | |
| JSObject **constructor_p, | | JSObject **constructor_p, | |
|
| JSObject **prototype_p, | | JSObject **prototype_p); | |
| GIObjectInfo **class_info_p); | | | |
| JSObject* gjs_lookup_object_prototype (JSContext *context, | | JSObject* gjs_lookup_object_prototype (JSContext *context, | |
| GType gtype); | | GType gtype); | |
| JSObject* gjs_object_from_g_object (JSContext *context, | | JSObject* gjs_object_from_g_object (JSContext *context, | |
| GObject *gobj); | | GObject *gobj); | |
| GObject* gjs_g_object_from_object (JSContext *context, | | GObject* gjs_g_object_from_object (JSContext *context, | |
| JSObject *obj); | | JSObject *obj); | |
|
| GType gjs_gtype_from_value (JSContext *context, | | | |
| jsval value); | | | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif /* __GJS_OBJECT_H__ */ | | #endif /* __GJS_OBJECT_H__ */ | |
| | | | |
End of changes. 2 change blocks. |
| 4 lines changed or deleted | | 1 lines changed or added | |
|
| repo.h | | repo.h | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| #include <girepository.h> | | #include <girepository.h> | |
| | | | |
| #include <gjs/gjs-module.h> | | #include <gjs/gjs-module.h> | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
| JSBool gjs_define_repo (JSContext *context, | | JSBool gjs_define_repo (JSContext *context, | |
| JSObject *module_obj
, | | JSObject *module_obj
, | |
| const char *name); | | const char *name); | |
| const char* gjs_info_type_name (GIInfoType type); | | const char* gjs_info_type_name (GIInfoType type); | |
|
| | | JSObject* gjs_lookup_private_namespace (JSContext *context); | |
| JSObject* gjs_lookup_namespace_object (JSContext *context, | | JSObject* gjs_lookup_namespace_object (JSContext *context, | |
| GIBaseInfo *info); | | GIBaseInfo *info); | |
| JSObject* gjs_lookup_namespace_object_by_name (JSContext *context, | | JSObject* gjs_lookup_namespace_object_by_name (JSContext *context, | |
| const char *name); | | const char *name); | |
| JSObject* gjs_lookup_function_object (JSContext *context, | | JSObject* gjs_lookup_function_object (JSContext *context, | |
| GIFunctionInfo *info); | | GIFunctionInfo *info); | |
| JSBool gjs_define_info (JSContext *context, | | JSBool gjs_define_info (JSContext *context, | |
| JSObject *in_object, | | JSObject *in_object, | |
| GIBaseInfo *info); | | GIBaseInfo *info); | |
| char* gjs_camel_from_hyphen (const char *hyphen_nam
e); | | char* gjs_camel_from_hyphen (const char *hyphen_nam
e); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 1 lines changed or added | |
|