| byteArray.h | | byteArray.h | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| #error "Only <gjs/gjs.h> can be included directly." | | #error "Only <gjs/gjs.h> can be included directly." | |
| #endif | | #endif | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "gjs/jsapi-util.h" | | #include "gjs/jsapi-util.h" | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
| JSBool gjs_typecheck_bytearray (JSContext *context, | | JSBool gjs_typecheck_bytearray (JSContext *context, | |
| JSObject *obj, | | JSObject *obj, | |
|
| JSBool throw); | | JSBool throw_error); | |
| | | | |
| JSBool gjs_define_byte_array_stuff (JSContext *context, | | JSBool gjs_define_byte_array_stuff (JSContext *context, | |
|
| JSObject *in_object); | | JSObject **module_out); | |
| | | | |
| JSObject * gjs_byte_array_from_byte_array (JSContext *context, | | JSObject * gjs_byte_array_from_byte_array (JSContext *context, | |
| GByteArray *array); | | GByteArray *array); | |
| JSObject * gjs_byte_array_from_bytes (JSContext *context, | | JSObject * gjs_byte_array_from_bytes (JSContext *context, | |
| GBytes *bytes); | | GBytes *bytes); | |
| | | | |
| GByteArray * gjs_byte_array_get_byte_array (JSContext *context, | | GByteArray * gjs_byte_array_get_byte_array (JSContext *context, | |
| JSObject *object); | | JSObject *object); | |
| | | | |
| GBytes * gjs_byte_array_get_bytes (JSContext *context, | | GBytes * gjs_byte_array_get_bytes (JSContext *context, | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| foreign.h | | foreign.h | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| typedef JSBool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext *context, | | typedef JSBool (*GjsArgOverrideReleaseGArgumentFunc) (JSContext *context, | |
| GITransfer transfer, | | GITransfer transfer, | |
| GArgument *arg); | | GArgument *arg); | |
| | | | |
| typedef struct { | | typedef struct { | |
| GjsArgOverrideToGArgumentFunc to_func; | | GjsArgOverrideToGArgumentFunc to_func; | |
| GjsArgOverrideFromGArgumentFunc from_func; | | GjsArgOverrideFromGArgumentFunc from_func; | |
| GjsArgOverrideReleaseGArgumentFunc release_func; | | GjsArgOverrideReleaseGArgumentFunc release_func; | |
| } GjsForeignInfo; | | } GjsForeignInfo; | |
| | | | |
|
| JSBool gjs_struct_foreign_register (const char *nam
espace, | | JSBool gjs_struct_foreign_register (const char *gi_
namespace, | |
| const char *typ
e_name, | | const char *typ
e_name, | |
| GjsForeignInfo *info); | | GjsForeignInfo *info); | |
| | | | |
| JSBool gjs_struct_foreign_convert_to_g_argument (JSContext *con
text, | | JSBool gjs_struct_foreign_convert_to_g_argument (JSContext *con
text, | |
| jsval val
ue, | | jsval val
ue, | |
| GIBaseInfo *int
erface_info, | | GIBaseInfo *int
erface_info, | |
| const char *arg
_name, | | const char *arg
_name, | |
| GjsArgumentType arg
ument_type, | | GjsArgumentType arg
ument_type, | |
| GITransfer tra
nsfer, | | GITransfer tra
nsfer, | |
| gboolean may
_be_null, | | gboolean may
_be_null, | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| jsapi-util.h | | jsapi-util.h | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 77 | |
| * do_base_typecheck: checks that object has the right JSClass, and possibl
y | | * do_base_typecheck: checks that object has the right JSClass, and possibl
y | |
| * throw a TypeError exception if the check fails | | * throw a TypeError exception if the check fails | |
| * priv_from_js: accesses the object private field; as a debug measure, | | * priv_from_js: accesses the object private field; as a debug measure, | |
| * it also checks that the object is of a compatible | | * it also checks that the object is of a compatible | |
| * JSClass, but it doesn't raise an exception (it | | * JSClass, but it doesn't raise an exception (it | |
| * wouldn't be of much use, if subsequent code crashes on | | * wouldn't be of much use, if subsequent code crashes on | |
| * NULL) | | * NULL) | |
| * priv_from_js_with_typecheck: a convenience function to call | | * priv_from_js_with_typecheck: a convenience function to call | |
| * do_base_typecheck and priv_from_js | | * do_base_typecheck and priv_from_js | |
| */ | | */ | |
|
| #define GJS_DEFINE_PRIV_FROM_JS(type, class) \ | | #define GJS_DEFINE_PRIV_FROM_JS(type, klass) \ | |
| __attribute__((unused)) static inline JSBool \ | | __attribute__((unused)) static inline JSBool \ | |
| do_base_typecheck(JSContext *context, \ | | do_base_typecheck(JSContext *context, \ | |
| JSObject *object, \ | | JSObject *object, \ | |
|
| JSBool throw) \ | | JSBool throw_error) \ | |
| { \ | | { \ | |
|
| return gjs_typecheck_instance(context, object, &class, throw); \ | | return gjs_typecheck_instance(context, object, &klass, throw_error)
; \ | |
| } \ | | } \ | |
| static inline type * \ | | static inline type * \ | |
| priv_from_js(JSContext *context, \ | | priv_from_js(JSContext *context, \ | |
| JSObject *object) \ | | JSObject *object) \ | |
| { \ | | { \ | |
| type *priv; \ | | type *priv; \ | |
| JS_BeginRequest(context); \ | | JS_BeginRequest(context); \ | |
|
| priv = JS_GetInstancePrivate(context, object, &class, NULL); \ | | priv = (type*) JS_GetInstancePrivate(context, object, &klass, NULL)
; \ | |
| JS_EndRequest(context); \ | | JS_EndRequest(context); \ | |
| return priv; \ | | return priv; \ | |
| } \ | | } \ | |
| __attribute__((unused)) static JSBool \ | | __attribute__((unused)) static JSBool \ | |
| priv_from_js_with_typecheck(JSContext *context, \ | | priv_from_js_with_typecheck(JSContext *context, \ | |
| JSObject *object, \ | | JSObject *object, \ | |
| type **out) \ | | type **out) \ | |
| { \ | | { \ | |
| if (!do_base_typecheck(context, object, JS_FALSE)) \ | | if (!do_base_typecheck(context, object, JS_FALSE)) \ | |
| return JS_FALSE; \ | | return JS_FALSE; \ | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 130 | |
| * @cn: The name of the prototype, separated by _ | | * @cn: The name of the prototype, separated by _ | |
| * | | * | |
| * A convenience macro for prototype implementations. | | * A convenience macro for prototype implementations. | |
| * Similar to GJS_DEFINE_PROTO but marks the prototype as abstract, | | * Similar to GJS_DEFINE_PROTO but marks the prototype as abstract, | |
| * you won't be able to instantiate it using the new keyword | | * you won't be able to instantiate it using the new keyword | |
| */ | | */ | |
| #define GJS_DEFINE_PROTO_ABSTRACT(tn, cn) \ | | #define GJS_DEFINE_PROTO_ABSTRACT(tn, cn) \ | |
| _GJS_DEFINE_PROTO_FULL(tn, cn, NULL) | | _GJS_DEFINE_PROTO_FULL(tn, cn, NULL) | |
| | | | |
| #define _GJS_DEFINE_PROTO_FULL(type_name, cname, ctor) \ | | #define _GJS_DEFINE_PROTO_FULL(type_name, cname, ctor) \ | |
|
| static JSPropertySpec gjs_##cname##_proto_props[]; \ | | extern JSPropertySpec gjs_##cname##_proto_props[]; \ | |
| static JSFunctionSpec gjs_##cname##_proto_funcs[]; \ | | extern JSFunctionSpec gjs_##cname##_proto_funcs[]; \ | |
| static void gjs_##cname##_finalize(JSFreeOp *fop, JSObject *obj); \ | | static void gjs_##cname##_finalize(JSFreeOp *fop, JSObject *obj); \ | |
| static JSBool gjs_##cname##_new_resolve(JSContext *context, \ | | static JSBool gjs_##cname##_new_resolve(JSContext *context, \ | |
| JSObject *obj, \ | | JSObject *obj, \ | |
| jsval id, \ | | jsval id, \ | |
| unsigned flags, \ | | unsigned flags, \ | |
| JSObject **objp) \ | | JSObject **objp) \ | |
| { \ | | { \ | |
| return JS_TRUE; \ | | return JS_TRUE; \ | |
| } \ | | } \ | |
| static struct JSClass gjs_##cname##_class = { \ | | static struct JSClass gjs_##cname##_class = { \ | |
| | | | |
End of changes. 5 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|
| native.h | | native.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| #if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION) | | #if !defined (__GJS_GJS_MODULE_H__) && !defined (GJS_COMPILATION) | |
| #error "Only <gjs/gjs-module.h> can be included directly." | | #error "Only <gjs/gjs-module.h> can be included directly." | |
| #endif | | #endif | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "gjs/jsapi-util.h" | | #include "gjs/jsapi-util.h" | |
| | | | |
| G_BEGIN_DECLS | | G_BEGIN_DECLS | |
| | | | |
|
| typedef enum { | | typedef JSBool (* GjsDefineModuleFunc) (JSContext *context, | |
| /* This means that the GjsDefineModuleFunc defines the module | | JSObject **module_out); | |
| * name in the parent module, as opposed to the normal process | | | |
| * where the GjsDefineModuleFunc defines module contents. When | | | |
| * importing imports.foo.bar, this flag means the native module is | | | |
| * given foo and defines bar in it, while normally the native | | | |
| * module is given bar and defines stuff in that. | | | |
| * | | | |
| * The purpose of this is to allow a module with lazy properties | | | |
| * by allowing module objects to be custom classes. It's used for | | | |
| * the gobject-introspection module for example. | | | |
| */ | | | |
| GJS_NATIVE_SUPPLIES_MODULE_OBJ = 1 << 0 | | | |
| | | | |
| } GjsNativeFlags; | | | |
| | | | |
| typedef JSBool (* GjsDefineModuleFunc) (JSContext *context, | | | |
| JSObject *module_obj); | | | |
| | | | |
| /* called on context init */ | | /* called on context init */ | |
| void gjs_register_native_module (const char *module_id, | | void gjs_register_native_module (const char *module_id, | |
|
| GjsDefineModuleFunc func, | | GjsDefineModuleFunc func); | |
| GjsNativeFlags flags); | | | |
| | | | |
| /* called by importer.c to to check for already loaded modules */ | | /* called by importer.c to to check for already loaded modules */ | |
| gboolean gjs_is_registered_native_module(JSContext *context, | | gboolean gjs_is_registered_native_module(JSContext *context, | |
| JSObject *parent, | | JSObject *parent, | |
| const char *name); | | const char *name); | |
| | | | |
| /* called by importer.c to load a statically linked native module */ | | /* called by importer.c to load a statically linked native module */ | |
|
| JSBool gjs_import_native_module (JSContext *context, | | JSBool gjs_import_native_module (JSContext *context, | |
| JSObject *module_obj, | | const char *name, | |
| const char *name); | | JSObject **module_out); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif /* __GJS_NATIVE_H__ */ | | #endif /* __GJS_NATIVE_H__ */ | |
| | | | |
End of changes. 3 change blocks. |
| 23 lines changed or deleted | | 6 lines changed or added | |
|
| repo.h | | repo.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| | | | |
| #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_out
, | |
| 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_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, | |
| jsid name); | | jsid name); | |
| JSObject* gjs_lookup_function_object (JSContext *context, | | JSObject* gjs_lookup_function_object (JSContext *context, | |
| GIFunctionInfo *info); | | GIFunctionInfo *info); | |
| JSObject * gjs_lookup_generic_prototype (JSContext *context, | | JSObject * gjs_lookup_generic_prototype (JSContext *context, | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| type-module.h | | type-module.h | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| #ifndef GJS_TYPE_MODULE_H | | #ifndef GJS_TYPE_MODULE_H | |
| #define GJS_TYPE_MODULE_H | | #define GJS_TYPE_MODULE_H | |
| | | | |
| #include <glib-object.h> | | #include <glib-object.h> | |
| | | | |
| typedef struct _GjsTypeModule GjsTypeModule; | | typedef struct _GjsTypeModule GjsTypeModule; | |
| typedef struct _GjsTypeModuleClass GjsTypeModuleClass; | | typedef struct _GjsTypeModuleClass GjsTypeModuleClass; | |
| | | | |
| #define GJS_TYPE_TYPE_MODULE (gjs_type_module_get_type ()) | | #define GJS_TYPE_TYPE_MODULE (gjs_type_module_get_type ()) | |
| #define GJS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((mod
ule), GJS_TYPE_TYPE_MODULE, GjsTypeModule)) | | #define GJS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((mod
ule), GJS_TYPE_TYPE_MODULE, GjsTypeModule)) | |
|
| #define GJS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class)
, GJS_TYPE_TYPE_MODULE, GjsTypeModuleClass)) | | #define GJS_TYPE_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass)
, GJS_TYPE_TYPE_MODULE, GjsTypeModuleClass)) | |
| #define GJS_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((mod
ule), GJS_TYPE_TYPE_MODULE)) | | #define GJS_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((mod
ule), GJS_TYPE_TYPE_MODULE)) | |
|
| #define GJS_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class)
, GJS_TYPE_TYPE_MODULE)) | | #define GJS_IS_TYPE_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass)
, GJS_TYPE_TYPE_MODULE)) | |
| #define GJS_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((modu
le), GJS_TYPE_TYPE_MODULE, GjsTypeModuleClass)) | | #define GJS_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((modu
le), GJS_TYPE_TYPE_MODULE, GjsTypeModuleClass)) | |
| | | | |
| GType gjs_type_module_get_type (void) G_GNUC_CONST; | | GType gjs_type_module_get_type (void) G_GNUC_CONST; | |
| | | | |
| GjsTypeModule *gjs_type_module_get (void); | | GjsTypeModule *gjs_type_module_get (void); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|