[gjs/wip/ptomato/mozjs31prep: 1/3] js: Use JS_FS and JS_PS macros
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep: 1/3] js: Use JS_FS and JS_PS macros
- Date: Fri, 7 Oct 2016 07:07:00 +0000 (UTC)
commit d744ff6d787b7bdc092aa8aa4111962305ae5ac9
Author: Philip Chimento <philip chimento gmail com>
Date: Thu Oct 6 23:03:03 2016 -0700
js: Use JS_FS and JS_PS macros
The layout of the JSFunctionSpec and JSPropertySpec changes in between
SpiderMonkey releases, so using these macros makes our code easier to
port to subsequent releases. It's also safer since we don't have to cast
all the function pointers to JSNative, though sadly that means we do need
to reintroduce JSBool in many places until we switch to mozjs31.
We don't convert JSFunctionSpecs yet because there are no JS_FS macros
for JSPropertyOp-style entries. These are removed, because broken, in a
subsequent SpiderMonkey release, though I'm not sure if it's 31:
https://bugzilla.mozilla.org/show_bug.cgi?id=992977
So, in a subsequent commit we will switch to JSNative property accessors.
Removing the casts has exposed a bug in imports._gi.add_interface() which
probably crashes if you try to call it from JS. This bug is not fixed
with this commit.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gi/boxed.cpp | 8 +-
gi/function.cpp | 2 +-
gi/fundamental.cpp | 8 +-
gi/gerror.cpp | 10 +-
gi/gtype.cpp | 8 +-
gi/interface.cpp | 4 +-
gi/keep-alive.cpp | 4 +-
gi/ns.cpp | 4 +-
gi/object.cpp | 49 +++++-----
gi/param.cpp | 6 +-
gi/repo.cpp | 4 +-
gi/union.cpp | 8 +-
gjs/byteArray.cpp | 20 ++--
gjs/context.cpp | 10 +-
gjs/coverage.cpp | 10 +-
gjs/importer.cpp | 4 +-
modules/cairo-context.cpp | 194 ++++++++++++++++++------------------
modules/cairo-gradient.cpp | 12 +-
modules/cairo-image-surface.cpp | 24 +++---
modules/cairo-linear-gradient.cpp | 4 +-
modules/cairo-path.cpp | 4 +-
modules/cairo-pattern.cpp | 8 +-
modules/cairo-pdf-surface.cpp | 4 +-
modules/cairo-ps-surface.cpp | 4 +-
modules/cairo-radial-gradient.cpp | 4 +-
modules/cairo-region.cpp | 36 ++++----
modules/cairo-solid-pattern.cpp | 12 +-
modules/cairo-surface-pattern.cpp | 20 ++--
modules/cairo-surface.cpp | 12 +-
modules/cairo-svg-surface.cpp | 4 +-
modules/system.cpp | 14 ++--
31 files changed, 258 insertions(+), 257 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 2182c9b..5c38c3d 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -892,7 +892,7 @@ define_boxed_class_fields (JSContext *context,
return true;
}
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -943,12 +943,12 @@ struct JSClass gjs_boxed_class = {
};
JSPropertySpec gjs_boxed_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_boxed_proto_funcs[] = {
- { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 },
- { NULL }
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS_END
};
static bool
diff --git a/gi/function.cpp b/gi/function.cpp
index 70c4808..2b66214 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -1494,7 +1494,7 @@ JSPropertySpec gjs_function_proto_props[] = {
JSOP_WRAPPER((JSPropertyOp)get_num_arguments),
JSOP_WRAPPER(JS_StrictPropertyStub)
},
- { NULL }
+ JS_PS_END
};
/* The original Function.prototype.toString complains when
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index b8a991c..faf4ebc 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -492,7 +492,7 @@ fundamental_finalize(JSFreeOp *fop,
}
}
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -561,12 +561,12 @@ struct JSClass gjs_fundamental_instance_class = {
};
static JSPropertySpec gjs_fundamental_instance_proto_props[] = {
- { NULL }
+ JS_PS_END
};
static JSFunctionSpec gjs_fundamental_instance_proto_funcs[] = {
- { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 },
- { NULL }
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS_END
};
static JSObject *
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index f3cb37b..c2c59b3 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -206,7 +206,7 @@ error_get_code(JSContext *context, JS::HandleObject obj,
return true;
}
-static bool
+static JSBool
error_to_string(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -262,7 +262,7 @@ error_to_string(JSContext *context,
return retval;
}
-static bool
+static JSBool
error_constructor_value_of(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -339,16 +339,16 @@ JSPropertySpec gjs_error_proto_props[] = {
JSOP_WRAPPER((JSPropertyOp)error_get_message),
JSOP_WRAPPER(JS_StrictPropertyStub)
},
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_error_proto_funcs[] = {
- { "toString", JSOP_WRAPPER((JSNative)error_to_string), 0, GJS_MODULE_PROP_FLAGS },
+ JS_FS("toString", error_to_string, 0, GJS_MODULE_PROP_FLAGS),
JS_FS_END
};
static JSFunctionSpec gjs_error_constructor_funcs[] = {
- { "valueOf", JSOP_WRAPPER((JSNative)error_constructor_value_of), 0, GJS_MODULE_PROP_FLAGS },
+ JS_FS("valueOf", error_constructor_value_of, 0, GJS_MODULE_PROP_FLAGS),
JS_FS_END
};
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index a9fca23..6f8ef45 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -61,7 +61,7 @@ gjs_gtype_finalize(JSFreeOp *fop,
g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), NULL);
}
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -118,13 +118,13 @@ JSPropertySpec gjs_gtype_proto_props[] = {
JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_SHARED,
JSOP_WRAPPER((JSPropertyOp)get_name_func),
JSOP_WRAPPER(JS_StrictPropertyStub) },
- { NULL },
+ JS_PS_END,
};
/* Functions */
JSFunctionSpec gjs_gtype_proto_funcs[] = {
- { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 },
- { NULL }
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS_END
};
JSObject *
diff --git a/gi/interface.cpp b/gi/interface.cpp
index c4e730b..b27a6b2 100644
--- a/gi/interface.cpp
+++ b/gi/interface.cpp
@@ -173,11 +173,11 @@ struct JSClass gjs_interface_class = {
};
JSPropertySpec gjs_interface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_interface_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
bool
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index 900562a..2923193 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -167,11 +167,11 @@ struct JSClass gjs_keep_alive_class = {
};
JSPropertySpec gjs_keep_alive_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_keep_alive_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
JSObject*
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 54fb1cf..3eafafb 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -192,11 +192,11 @@ struct JSClass gjs_ns_class = {
JSPropertySpec gjs_ns_proto_props[] = {
{ "__name__", 0, GJS_MODULE_PROP_FLAGS | JSPROP_READONLY, { (JSPropertyOp)get_name, NULL } },
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_ns_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
static JSObject*
diff --git a/gi/object.cpp b/gi/object.cpp
index d07ebfc..de7606c 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1649,7 +1649,7 @@ real_connect_func(JSContext *context,
return ret;
}
-static bool
+static JSBool
connect_after_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -1657,7 +1657,7 @@ connect_after_func(JSContext *context,
return real_connect_func(context, argc, vp, true);
}
-static bool
+static JSBool
connect_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -1665,7 +1665,7 @@ connect_func(JSContext *context,
return real_connect_func(context, argc, vp, false);
}
-static bool
+static JSBool
emit_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -1788,7 +1788,7 @@ emit_func(JSContext *context,
return ret;
}
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -1840,7 +1840,7 @@ struct JSClass gjs_object_instance_class = {
};
-static bool
+static JSBool
init_func (JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -1862,16 +1862,16 @@ init_func (JSContext *context,
}
JSPropertySpec gjs_object_instance_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_object_instance_proto_funcs[] = {
- { "_init", JSOP_WRAPPER((JSNative)init_func), 0, 0 },
- { "connect", JSOP_WRAPPER((JSNative)connect_func), 0, 0 },
- { "connect_after", JSOP_WRAPPER((JSNative)connect_after_func), 0, 0 },
- { "emit", JSOP_WRAPPER((JSNative)emit_func), 0, 0 },
- { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 },
- { NULL }
+ JS_FS("_init", init_func, 0, 0),
+ JS_FS("connect", connect_func, 0, 0),
+ JS_FS("connect_after", connect_after_func, 0, 0),
+ JS_FS("emit", emit_func, 0, 0),
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS_END
};
bool
@@ -2264,7 +2264,7 @@ find_vfunc_info (JSContext *context,
g_base_info_unref(struct_info);
}
-static bool
+static JSBool
gjs_hook_up_vfunc(JSContext *cx,
unsigned argc,
JS::Value *vp)
@@ -2517,7 +2517,7 @@ gjs_object_set_gproperty (GObject *object,
jsobj_set_gproperty(context, js_obj, value, pspec);
}
-static bool
+static JSBool
gjs_override_property(JSContext *cx,
unsigned argc,
JS::Value *vp)
@@ -2779,7 +2779,7 @@ save_properties_for_class_init(JSContext *cx,
return true;
}
-static bool
+static JSBool
gjs_register_interface(JSContext *cx,
unsigned argc,
JS::Value *vp)
@@ -2858,7 +2858,7 @@ gjs_register_interface(JSContext *cx,
return true;
}
-static bool
+static JSBool
gjs_register_type(JSContext *cx,
unsigned argc,
JS::Value *vp)
@@ -2968,7 +2968,7 @@ out:
return retval;
}
-static bool
+static JSBool
gjs_signal_new(JSContext *cx,
unsigned argc,
JS::Value *vp)
@@ -3049,13 +3049,14 @@ gjs_signal_new(JSContext *cx,
}
static JSFunctionSpec module_funcs[] = {
- { "override_property", JSOP_WRAPPER((JSNative) gjs_override_property), 2, GJS_MODULE_PROP_FLAGS },
- { "register_interface", JSOP_WRAPPER((JSNative) gjs_register_interface), 3, GJS_MODULE_PROP_FLAGS },
- { "register_type", JSOP_WRAPPER ((JSNative) gjs_register_type), 4, GJS_MODULE_PROP_FLAGS },
- { "add_interface", JSOP_WRAPPER ((JSNative) gjs_add_interface), 2, GJS_MODULE_PROP_FLAGS },
- { "hook_up_vfunc", JSOP_WRAPPER ((JSNative) gjs_hook_up_vfunc), 3, GJS_MODULE_PROP_FLAGS },
- { "signal_new", JSOP_WRAPPER ((JSNative) gjs_signal_new), 6, GJS_MODULE_PROP_FLAGS },
- { NULL },
+ JS_FS("override_property", gjs_override_property, 2, GJS_MODULE_PROP_FLAGS),
+ JS_FS("register_interface", gjs_register_interface, 3, GJS_MODULE_PROP_FLAGS),
+ JS_FS("register_type", gjs_register_type, 4, GJS_MODULE_PROP_FLAGS),
+ // FIXME this function will be totally broken if you try to use it from JS
+ JS_FS("add_interface", (JSNative)gjs_add_interface, 2, GJS_MODULE_PROP_FLAGS),
+ JS_FS("hook_up_vfunc", gjs_hook_up_vfunc, 3, GJS_MODULE_PROP_FLAGS),
+ JS_FS("signal_new", gjs_signal_new, 6, GJS_MODULE_PROP_FLAGS),
+ JS_FS_END,
};
bool
diff --git a/gi/param.cpp b/gi/param.cpp
index 12d4684..2bf5927 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -168,15 +168,15 @@ struct JSClass gjs_param_class = {
};
JSPropertySpec gjs_param_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_param_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
static JSFunctionSpec gjs_param_constructor_funcs[] = {
- { NULL }
+ JS_FS_END
};
static JSObject*
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 745fd0f..22b1b50 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -237,11 +237,11 @@ struct JSClass gjs_repo_class = {
};
JSPropertySpec gjs_repo_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_repo_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
static JSObject*
diff --git a/gi/union.cpp b/gi/union.cpp
index 86cc755..6781efb 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -282,7 +282,7 @@ union_finalize(JSFreeOp *fop,
g_slice_free(Union, priv);
}
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -327,12 +327,12 @@ struct JSClass gjs_union_class = {
};
JSPropertySpec gjs_union_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_union_proto_funcs[] = {
- { "toString", JSOP_WRAPPER((JSNative)to_string_func), 0, 0 },
- { NULL }
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS_END
};
bool
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 643d8d2..771a70b 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -405,7 +405,7 @@ byte_array_finalize(JSFreeOp *fop,
}
/* implement toString() with an optional encoding arg */
-static bool
+static JSBool
to_string_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -503,7 +503,7 @@ to_string_func(JSContext *context,
}
}
-static bool
+static JSBool
to_gbytes_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -857,20 +857,20 @@ JSPropertySpec gjs_byte_array_proto_props[] = {
JSOP_WRAPPER ((JSPropertyOp) byte_array_length_getter),
JSOP_WRAPPER ((JSStrictPropertyOp) byte_array_length_setter),
},
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_byte_array_proto_funcs[] = {
- { "toString", JSOP_WRAPPER ((JSNative) to_string_func), 0, 0 },
- { "toGBytes", JSOP_WRAPPER ((JSNative) to_gbytes_func), 0, 0 },
- { NULL }
+ JS_FS("toString", to_string_func, 0, 0),
+ JS_FS("toGBytes", to_gbytes_func, 0, 0),
+ JS_FS_END
};
static JSFunctionSpec gjs_byte_array_module_funcs[] = {
- { "fromString", JSOP_WRAPPER (from_string_func), 1, 0 },
- { "fromArray", JSOP_WRAPPER (from_array_func), 1, 0 },
- { "fromGBytes", JSOP_WRAPPER (from_gbytes_func), 1, 0 },
- { NULL }
+ JS_FS("fromString", from_string_func, 1, 0),
+ JS_FS("fromArray", from_array_func, 1, 0),
+ JS_FS("fromGBytes", from_gbytes_func, 1, 0),
+ JS_FS_END
};
bool
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 68837aa..ff39cd1 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -398,11 +398,11 @@ gjs_context_finalize(GObject *object)
}
static JSFunctionSpec global_funcs[] = {
- { "log", JSOP_WRAPPER (gjs_log), 1, GJS_MODULE_PROP_FLAGS },
- { "logError", JSOP_WRAPPER (gjs_log_error), 2, GJS_MODULE_PROP_FLAGS },
- { "print", JSOP_WRAPPER (gjs_print), 0, GJS_MODULE_PROP_FLAGS },
- { "printerr", JSOP_WRAPPER (gjs_printerr), 0, GJS_MODULE_PROP_FLAGS },
- { NULL },
+ JS_FS("log", gjs_log, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("logError", gjs_log_error, 2, GJS_MODULE_PROP_FLAGS),
+ JS_FS("print", gjs_print, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS("printerr", gjs_printerr, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS_END
};
static void
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 498916c..d7546bd 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1510,11 +1510,11 @@ coverage_get_file_contents(JSContext *context,
}
static JSFunctionSpec coverage_funcs[] = {
- { "log", JSOP_WRAPPER(coverage_log), 1, GJS_MODULE_PROP_FLAGS },
- { "getFileContents", JSOP_WRAPPER(coverage_get_file_contents), 1, GJS_MODULE_PROP_FLAGS },
- { "getFileModificationTime", JSOP_WRAPPER(coverage_get_file_modification_time), 1, GJS_MODULE_PROP_FLAGS
},
- { "getFileChecksum", JSOP_WRAPPER(coverage_get_file_checksum), 1, GJS_MODULE_PROP_FLAGS },
- { NULL }
+ JS_FS("log", coverage_log, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("getFileContents", coverage_get_file_contents, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("getFileModificationTime", coverage_get_file_modification_time, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("getFileChecksum", coverage_get_file_checksum, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS_END
};
static void
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 9e07c65..afcb1bc 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -925,11 +925,11 @@ struct JSClass gjs_importer_class = {
};
JSPropertySpec gjs_importer_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_importer_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
static JSObject*
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 9a59d72..d7f2514 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -31,7 +31,7 @@
#include "cairo-private.h"
#define _GJS_CAIRO_CONTEXT_DEFINE_FUNC_BEGIN(mname) \
-static bool \
+static JSBool \
mname##_func(JSContext *context, \
unsigned argc, \
JS::Value *vp) \
@@ -318,7 +318,7 @@ gjs_cairo_context_finalize(JSFreeOp *fop,
/* Properties */
JSPropertySpec gjs_cairo_context_proto_props[] = {
- { NULL }
+ JS_PS_END
};
/* Methods */
@@ -401,7 +401,7 @@ _GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDevice, cairo_user_to_device, "x", "y
_GJS_CAIRO_CONTEXT_DEFINE_FUNC2FFAFF(userToDeviceDistance, cairo_user_to_device_distance, "x", "y")
-static bool
+static JSBool
dispose_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -420,7 +420,7 @@ dispose_func(JSContext *context,
return true;
}
-static bool
+static JSBool
appendPath_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -448,7 +448,7 @@ appendPath_func(JSContext *context,
return true;
}
-static bool
+static JSBool
copyPath_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -468,7 +468,7 @@ copyPath_func(JSContext *context,
return true;
}
-static bool
+static JSBool
copyPathFlat_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -488,7 +488,7 @@ copyPathFlat_func(JSContext *context,
return true;
}
-static bool
+static JSBool
mask_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -520,7 +520,7 @@ mask_func(JSContext *context,
return true;
}
-static bool
+static JSBool
maskSurface_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -556,7 +556,7 @@ maskSurface_func(JSContext *context,
return true;
}
-static bool
+static JSBool
setDash_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -619,7 +619,7 @@ setDash_func(JSContext *context,
return retval;
}
-static bool
+static JSBool
setSource_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -653,7 +653,7 @@ setSource_func(JSContext *context,
return true;
}
-static bool
+static JSBool
setSourceSurface_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -690,7 +690,7 @@ setSourceSurface_func(JSContext *context,
return true;
}
-static bool
+static JSBool
showText_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -718,7 +718,7 @@ showText_func(JSContext *context,
return true;
}
-static bool
+static JSBool
selectFontFace_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -749,7 +749,7 @@ selectFontFace_func(JSContext *context,
return true;
}
-static bool
+static JSBool
popGroup_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -782,7 +782,7 @@ popGroup_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getSource_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -816,7 +816,7 @@ getSource_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getTarget_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -850,7 +850,7 @@ getTarget_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getGroupTarget_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -885,105 +885,105 @@ getGroupTarget_func(JSContext *context,
}
JSFunctionSpec gjs_cairo_context_proto_funcs[] = {
- { "$dispose", JSOP_WRAPPER((JSNative)dispose_func), 0, 0 },
- { "appendPath", JSOP_WRAPPER((JSNative)appendPath_func), 0, 0},
- { "arc", JSOP_WRAPPER((JSNative)arc_func), 0, 0 },
- { "arcNegative", JSOP_WRAPPER((JSNative)arcNegative_func), 0, 0 },
- { "clip", JSOP_WRAPPER((JSNative)clip_func), 0, 0 },
- { "clipExtents", JSOP_WRAPPER((JSNative)clipExtents_func), 0, 0 },
- { "clipPreserve", JSOP_WRAPPER((JSNative)clipPreserve_func), 0, 0 },
- { "closePath", JSOP_WRAPPER((JSNative)closePath_func), 0, 0 },
- { "copyPage", JSOP_WRAPPER((JSNative)copyPage_func), 0, 0 },
- { "copyPath", JSOP_WRAPPER((JSNative)copyPath_func), 0, 0 },
- { "copyPathFlat", JSOP_WRAPPER((JSNative)copyPathFlat_func), 0, 0 },
- { "curveTo", JSOP_WRAPPER((JSNative)curveTo_func), 0, 0 },
- { "deviceToUser", JSOP_WRAPPER((JSNative)deviceToUser_func), 0, 0 },
- { "deviceToUserDistance",JSOP_WRAPPER((JSNative)deviceToUserDistance_func), 0, 0 },
- { "fill", JSOP_WRAPPER((JSNative)fill_func), 0, 0 },
- { "fillPreserve", JSOP_WRAPPER((JSNative)fillPreserve_func), 0, 0 },
- { "fillExtents", JSOP_WRAPPER((JSNative)fillExtents_func), 0, 0 },
+ JS_FS("$dispose", dispose_func, 0, 0),
+ JS_FS("appendPath", appendPath_func, 0, 0),
+ JS_FS("arc", arc_func, 0, 0),
+ JS_FS("arcNegative", arcNegative_func, 0, 0),
+ JS_FS("clip", clip_func, 0, 0),
+ JS_FS("clipExtents", clipExtents_func, 0, 0),
+ JS_FS("clipPreserve", clipPreserve_func, 0, 0),
+ JS_FS("closePath", closePath_func, 0, 0),
+ JS_FS("copyPage", copyPage_func, 0, 0),
+ JS_FS("copyPath", copyPath_func, 0, 0),
+ JS_FS("copyPathFlat", copyPathFlat_func, 0, 0),
+ JS_FS("curveTo", curveTo_func, 0, 0),
+ JS_FS("deviceToUser", deviceToUser_func, 0, 0),
+ JS_FS("deviceToUserDistance", deviceToUserDistance_func, 0, 0),
+ JS_FS("fill", fill_func, 0, 0),
+ JS_FS("fillPreserve", fillPreserve_func, 0, 0),
+ JS_FS("fillExtents", fillExtents_func, 0, 0),
// fontExtents
- { "getAntialias", JSOP_WRAPPER((JSNative)getAntialias_func), 0, 0 },
- { "getCurrentPoint", JSOP_WRAPPER((JSNative)getCurrentPoint_func), 0, 0 },
+ JS_FS("getAntialias", getAntialias_func, 0, 0),
+ JS_FS("getCurrentPoint", getCurrentPoint_func, 0, 0),
// getDash
- { "getDashCount", JSOP_WRAPPER((JSNative)getDashCount_func), 0, 0 },
- { "getFillRule", JSOP_WRAPPER((JSNative)getFillRule_func), 0, 0 },
+ JS_FS("getDashCount", getDashCount_func, 0, 0),
+ JS_FS("getFillRule", getFillRule_func, 0, 0),
// getFontFace
// getFontMatrix
// getFontOptions
- { "getGroupTarget", JSOP_WRAPPER((JSNative)getGroupTarget_func), 0, 0 },
- { "getLineCap", JSOP_WRAPPER((JSNative)getLineCap_func), 0, 0 },
- { "getLineJoin", JSOP_WRAPPER((JSNative)getLineJoin_func), 0, 0 },
- { "getLineWidth", JSOP_WRAPPER((JSNative)getLineWidth_func), 0, 0 },
+ JS_FS("getGroupTarget", getGroupTarget_func, 0, 0),
+ JS_FS("getLineCap", getLineCap_func, 0, 0),
+ JS_FS("getLineJoin", getLineJoin_func, 0, 0),
+ JS_FS("getLineWidth", getLineWidth_func, 0, 0),
// getMatrix
- { "getMiterLimit", JSOP_WRAPPER((JSNative)getMiterLimit_func), 0, 0 },
- { "getOperator", JSOP_WRAPPER((JSNative)getOperator_func), 0, 0 },
+ JS_FS("getMiterLimit", getMiterLimit_func, 0, 0),
+ JS_FS("getOperator", getOperator_func, 0, 0),
// getScaledFont
- { "getSource", JSOP_WRAPPER((JSNative)getSource_func), 0, 0 },
- { "getTarget", JSOP_WRAPPER((JSNative)getTarget_func), 0, 0 },
- { "getTolerance", JSOP_WRAPPER((JSNative)getTolerance_func), 0, 0 },
+ JS_FS("getSource", getSource_func, 0, 0),
+ JS_FS("getTarget", getTarget_func, 0, 0),
+ JS_FS("getTolerance", getTolerance_func, 0, 0),
// glyphPath
// glyphExtents
- { "hasCurrentPoint", JSOP_WRAPPER((JSNative)hasCurrentPoint_func), 0, 0 },
- { "identityMatrix", JSOP_WRAPPER((JSNative)identityMatrix_func), 0, 0 },
- { "inFill", JSOP_WRAPPER((JSNative)inFill_func), 0, 0 },
- { "inStroke", JSOP_WRAPPER((JSNative)inStroke_func), 0, 0 },
- { "lineTo", JSOP_WRAPPER((JSNative)lineTo_func), 0, 0 },
- { "mask", JSOP_WRAPPER((JSNative)mask_func), 0, 0 },
- { "maskSurface", JSOP_WRAPPER((JSNative)maskSurface_func), 0, 0 },
- { "moveTo", JSOP_WRAPPER((JSNative)moveTo_func), 0, 0 },
- { "newPath", JSOP_WRAPPER((JSNative)newPath_func), 0, 0 },
- { "newSubPath", JSOP_WRAPPER((JSNative)newSubPath_func), 0, 0 },
- { "paint", JSOP_WRAPPER((JSNative)paint_func), 0, 0 },
- { "paintWithAlpha", JSOP_WRAPPER((JSNative)paintWithAlpha_func), 0, 0 },
- { "pathExtents", JSOP_WRAPPER((JSNative)pathExtents_func), 0, 0 },
- { "popGroup", JSOP_WRAPPER((JSNative)popGroup_func), 0, 0 },
- { "popGroupToSource", JSOP_WRAPPER((JSNative)popGroupToSource_func), 0, 0 },
- { "pushGroup", JSOP_WRAPPER((JSNative)pushGroup_func), 0, 0 },
- { "pushGroupWithContent", JSOP_WRAPPER((JSNative)pushGroupWithContent_func), 0, 0 },
- { "rectangle", JSOP_WRAPPER((JSNative)rectangle_func), 0, 0 },
- { "relCurveTo", JSOP_WRAPPER((JSNative)relCurveTo_func), 0, 0 },
- { "relLineTo", JSOP_WRAPPER((JSNative)relLineTo_func), 0, 0 },
- { "relMoveTo", JSOP_WRAPPER((JSNative)relMoveTo_func), 0, 0 },
- { "resetClip", JSOP_WRAPPER((JSNative)resetClip_func), 0, 0 },
- { "restore", JSOP_WRAPPER((JSNative)restore_func), 0, 0 },
- { "rotate", JSOP_WRAPPER((JSNative)rotate_func), 0, 0 },
- { "save", JSOP_WRAPPER((JSNative)save_func), 0, 0 },
- { "scale", JSOP_WRAPPER((JSNative)scale_func), 0, 0 },
- { "selectFontFace", JSOP_WRAPPER((JSNative)selectFontFace_func), 0, 0 },
- { "setAntialias", JSOP_WRAPPER((JSNative)setAntialias_func), 0, 0 },
- { "setDash", JSOP_WRAPPER((JSNative)setDash_func), 0, 0 },
+ JS_FS("hasCurrentPoint", hasCurrentPoint_func, 0, 0),
+ JS_FS("identityMatrix", identityMatrix_func, 0, 0),
+ JS_FS("inFill", inFill_func, 0, 0),
+ JS_FS("inStroke", inStroke_func, 0, 0),
+ JS_FS("lineTo", lineTo_func, 0, 0),
+ JS_FS("mask", mask_func, 0, 0),
+ JS_FS("maskSurface", maskSurface_func, 0, 0),
+ JS_FS("moveTo", moveTo_func, 0, 0),
+ JS_FS("newPath", newPath_func, 0, 0),
+ JS_FS("newSubPath", newSubPath_func, 0, 0),
+ JS_FS("paint", paint_func, 0, 0),
+ JS_FS("paintWithAlpha", paintWithAlpha_func, 0, 0),
+ JS_FS("pathExtents", pathExtents_func, 0, 0),
+ JS_FS("popGroup", popGroup_func, 0, 0),
+ JS_FS("popGroupToSource", popGroupToSource_func, 0, 0),
+ JS_FS("pushGroup", pushGroup_func, 0, 0),
+ JS_FS("pushGroupWithContent", pushGroupWithContent_func, 0, 0),
+ JS_FS("rectangle", rectangle_func, 0, 0),
+ JS_FS("relCurveTo", relCurveTo_func, 0, 0),
+ JS_FS("relLineTo", relLineTo_func, 0, 0),
+ JS_FS("relMoveTo", relMoveTo_func, 0, 0),
+ JS_FS("resetClip", resetClip_func, 0, 0),
+ JS_FS("restore", restore_func, 0, 0),
+ JS_FS("rotate", rotate_func, 0, 0),
+ JS_FS("save", save_func, 0, 0),
+ JS_FS("scale", scale_func, 0, 0),
+ JS_FS("selectFontFace", selectFontFace_func, 0, 0),
+ JS_FS("setAntialias", setAntialias_func, 0, 0),
+ JS_FS("setDash", setDash_func, 0, 0),
// setFontFace
// setFontMatrix
// setFontOptions
- { "setFontSize", JSOP_WRAPPER((JSNative)setFontSize_func), 0, 0 },
- { "setFillRule", JSOP_WRAPPER((JSNative)setFillRule_func), 0, 0 },
- { "setLineCap", JSOP_WRAPPER((JSNative)setLineCap_func), 0, 0 },
- { "setLineJoin", JSOP_WRAPPER((JSNative)setLineJoin_func), 0, 0 },
- { "setLineWidth", JSOP_WRAPPER((JSNative)setLineWidth_func), 0, 0 },
+ JS_FS("setFontSize", setFontSize_func, 0, 0),
+ JS_FS("setFillRule", setFillRule_func, 0, 0),
+ JS_FS("setLineCap", setLineCap_func, 0, 0),
+ JS_FS("setLineJoin", setLineJoin_func, 0, 0),
+ JS_FS("setLineWidth", setLineWidth_func, 0, 0),
// setMatrix
- { "setMiterLimit", JSOP_WRAPPER((JSNative)setMiterLimit_func), 0, 0 },
- { "setOperator", JSOP_WRAPPER((JSNative)setOperator_func), 0, 0 },
+ JS_FS("setMiterLimit", setMiterLimit_func, 0, 0),
+ JS_FS("setOperator", setOperator_func, 0, 0),
// setScaledFont
- { "setSource", JSOP_WRAPPER((JSNative)setSource_func), 0, 0 },
- { "setSourceRGB", JSOP_WRAPPER((JSNative)setSourceRGB_func), 0, 0 },
- { "setSourceRGBA", JSOP_WRAPPER((JSNative)setSourceRGBA_func), 0, 0 },
- { "setSourceSurface", JSOP_WRAPPER((JSNative)setSourceSurface_func), 0, 0 },
- { "setTolerance", JSOP_WRAPPER((JSNative)setTolerance_func), 0, 0 },
+ JS_FS("setSource", setSource_func, 0, 0),
+ JS_FS("setSourceRGB", setSourceRGB_func, 0, 0),
+ JS_FS("setSourceRGBA", setSourceRGBA_func, 0, 0),
+ JS_FS("setSourceSurface", setSourceSurface_func, 0, 0),
+ JS_FS("setTolerance", setTolerance_func, 0, 0),
// showGlyphs
- { "showPage", JSOP_WRAPPER((JSNative)showPage_func), 0, 0 },
- { "showText", JSOP_WRAPPER((JSNative)showText_func), 0, 0 },
+ JS_FS("showPage", showPage_func, 0, 0),
+ JS_FS("showText", showText_func, 0, 0),
// showTextGlyphs
- { "stroke", JSOP_WRAPPER((JSNative)stroke_func), 0, 0 },
- { "strokeExtents", JSOP_WRAPPER((JSNative)strokeExtents_func), 0, 0 },
- { "strokePreserve", JSOP_WRAPPER((JSNative)strokePreserve_func), 0, 0 },
+ JS_FS("stroke", stroke_func, 0, 0),
+ JS_FS("strokeExtents", strokeExtents_func, 0, 0),
+ JS_FS("strokePreserve", strokePreserve_func, 0, 0),
// textPath
// textExtends
// transform
- { "translate", JSOP_WRAPPER((JSNative)translate_func), 0, 0 },
- { "userToDevice", JSOP_WRAPPER((JSNative)userToDevice_func), 0, 0 },
- { "userToDeviceDistance", JSOP_WRAPPER((JSNative)userToDeviceDistance_func), 0, 0 },
- { NULL }
+ JS_FS("translate", translate_func, 0, 0),
+ JS_FS("userToDevice", userToDevice_func, 0, 0),
+ JS_FS("userToDeviceDistance", userToDeviceDistance_func, 0, 0),
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-gradient.cpp b/modules/cairo-gradient.cpp
index a4e81c6..15ba72e 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -38,12 +38,12 @@ gjs_cairo_gradient_finalize(JSFreeOp *fop,
/* Properties */
JSPropertySpec gjs_cairo_gradient_proto_props[] = {
- { NULL }
+ JS_PS_END
};
/* Methods */
-static bool
+static JSBool
addColorStopRGB_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -72,7 +72,7 @@ addColorStopRGB_func(JSContext *context,
return true;
}
-static bool
+static JSBool
addColorStopRGBA_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -102,9 +102,9 @@ addColorStopRGBA_func(JSContext *context,
}
JSFunctionSpec gjs_cairo_gradient_proto_funcs[] = {
- { "addColorStopRGB", JSOP_WRAPPER((JSNative)addColorStopRGB_func), 0, 0 },
- { "addColorStopRGBA", JSOP_WRAPPER((JSNative)addColorStopRGBA_func), 0, 0 },
+ JS_FS("addColorStopRGB", addColorStopRGB_func, 0, 0),
+ JS_FS("addColorStopRGBA", addColorStopRGBA_func, 0, 0),
// getColorStopRGB
// getColorStopRGBA
- { NULL }
+ JS_FS_END
};
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index 645257f..ba670b7 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -65,10 +65,10 @@ gjs_cairo_image_surface_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_image_surface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
-static bool
+static JSBool
createFromPNG_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -99,7 +99,7 @@ createFromPNG_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getFormat_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -125,7 +125,7 @@ getFormat_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getWidth_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -151,7 +151,7 @@ getWidth_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getHeight_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -177,7 +177,7 @@ getHeight_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getStride_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -204,13 +204,13 @@ getStride_func(JSContext *context,
}
JSFunctionSpec gjs_cairo_image_surface_proto_funcs[] = {
- { "createFromPNG", JSOP_WRAPPER((JSNative)createFromPNG_func), 0, 0},
+ JS_FS("createFromPNG", createFromPNG_func, 0, 0),
// getData
- { "getFormat", JSOP_WRAPPER((JSNative)getFormat_func), 0, 0 },
- { "getWidth", JSOP_WRAPPER((JSNative)getWidth_func), 0, 0 },
- { "getHeight", JSOP_WRAPPER((JSNative)getHeight_func), 0, 0 },
- { "getStride", JSOP_WRAPPER((JSNative)getStride_func), 0, 0 },
- { NULL }
+ JS_FS("getFormat", getFormat_func, 0, 0),
+ JS_FS("getWidth", getWidth_func, 0, 0),
+ JS_FS("getHeight", getHeight_func, 0, 0),
+ JS_FS("getStride", getStride_func, 0, 0),
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-linear-gradient.cpp b/modules/cairo-linear-gradient.cpp
index 37b9f92..b4ff0c6 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -65,12 +65,12 @@ gjs_cairo_linear_gradient_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_linear_gradient_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_linear_gradient_proto_funcs[] = {
// getLinearPoints
- { NULL }
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index 7921a3f..30ab957 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -50,11 +50,11 @@ gjs_cairo_path_finalize(JSFreeOp *fop,
/* Properties */
JSPropertySpec gjs_cairo_path_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_path_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
/**
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index ac60af6..d2d0c99 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -52,12 +52,12 @@ gjs_cairo_pattern_finalize(JSFreeOp *fop,
/* Properties */
JSPropertySpec gjs_cairo_pattern_proto_props[] = {
- { NULL }
+ JS_PS_END
};
/* Methods */
-static bool
+static JSBool
getType_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -85,9 +85,9 @@ getType_func(JSContext *context,
JSFunctionSpec gjs_cairo_pattern_proto_funcs[] = {
// getMatrix
- { "getType", JSOP_WRAPPER((JSNative)getType_func), 0, 0 },
+ JS_FS("getType", getType_func, 0, 0),
// setMatrix
- { NULL }
+ JS_FS_END
};
/* Public API */
diff --git a/modules/cairo-pdf-surface.cpp b/modules/cairo-pdf-surface.cpp
index 0aee113..cbbb415 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -72,11 +72,11 @@ gjs_cairo_pdf_surface_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_pdf_surface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_pdf_surface_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index a7e4736..dee145d 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -72,7 +72,7 @@ gjs_cairo_ps_surface_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_ps_surface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_ps_surface_proto_funcs[] = {
@@ -85,7 +85,7 @@ JSFunctionSpec gjs_cairo_ps_surface_proto_funcs[] = {
// dscBeginSetup
// dscBeginPageSetup
// dscComment
- { NULL }
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 9df421e..ca373f0 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -67,12 +67,12 @@ gjs_cairo_radial_gradient_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_radial_gradient_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_radial_gradient_proto_funcs[] = {
// getRadialCircles
- { NULL }
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index e635ecf..9263821 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -63,7 +63,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
return gjs_cairo_check_status(context, cairo_region_status(this_region), "region");
#define REGION_DEFINE_REGION_FUNC(method) \
- static bool \
+ static JSBool \
method##_func(JSContext *context, \
unsigned argc, \
JS::Value *vp) \
@@ -84,7 +84,7 @@ fill_rectangle(JSContext *context, JSObject *obj,
}
#define REGION_DEFINE_RECT_FUNC(method) \
- static bool \
+ static JSBool \
method##_rectangle_func(JSContext *context, \
unsigned argc, \
JS::Value *vp) \
@@ -165,7 +165,7 @@ make_rectangle(JSContext *context,
return rect_obj;
}
-static bool
+static JSBool
num_rectangles_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -181,7 +181,7 @@ num_rectangles_func(JSContext *context,
RETURN_STATUS;
}
-static bool
+static JSBool
get_rectangle_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -202,23 +202,23 @@ get_rectangle_func(JSContext *context,
}
JSPropertySpec gjs_cairo_region_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_region_proto_funcs[] = {
- { "union", { (JSNative)union_func, 0 }, 0 },
- { "subtract", { (JSNative)subtract_func, 0 }, 0 },
- { "intersect", { (JSNative)intersect_func, 0 }, 0 },
- { "xor", { (JSNative)xor_func, 0 }, 0 },
-
- { "unionRectangle", { (JSNative)union_rectangle_func, 0 }, 0 },
- { "subtractRectangle", { (JSNative)subtract_rectangle_func, 0 }, 0 },
- { "intersectRectangle", { (JSNative)intersect_rectangle_func, 0 }, 0 },
- { "xorRectangle", { (JSNative)xor_rectangle_func, 0 }, 0 },
-
- { "numRectangles", { (JSNative)num_rectangles_func, 0 }, 0 },
- { "getRectangle", { (JSNative)get_rectangle_func, 0 }, 0 },
- { NULL }
+ JS_FS("union", union_func, 0, 0),
+ JS_FS("subtract", subtract_func, 0, 0),
+ JS_FS("intersect", intersect_func, 0, 0),
+ JS_FS("xor", xor_func, 0, 0),
+
+ JS_FS("unionRectangle", union_rectangle_func, 0, 0),
+ JS_FS("subtractRectangle", subtract_rectangle_func, 0, 0),
+ JS_FS("intersectRectangle", intersect_rectangle_func, 0, 0),
+ JS_FS("xorRectangle", xor_rectangle_func, 0, 0),
+
+ JS_FS("numRectangles", num_rectangles_func, 0, 0),
+ JS_FS("getRectangle", get_rectangle_func, 0, 0),
+ JS_FS_END
};
static void
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index 3b8673d..5bb4a8b 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -37,10 +37,10 @@ gjs_cairo_solid_pattern_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_solid_pattern_proto_props[] = {
- { NULL }
+ JS_PS_END
};
-static bool
+static JSBool
createRGB_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -68,7 +68,7 @@ createRGB_func(JSContext *context,
return true;
}
-static bool
+static JSBool
createRGBA_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -98,9 +98,9 @@ createRGBA_func(JSContext *context,
}
JSFunctionSpec gjs_cairo_solid_pattern_proto_funcs[] = {
- { "createRGB", JSOP_WRAPPER((JSNative)createRGB_func), 0, 0 },
- { "createRGBA", JSOP_WRAPPER((JSNative)createRGBA_func), 0, 0 },
- { NULL }
+ JS_FS("createRGB", createRGB_func, 0, 0),
+ JS_FS("createRGBA", createRGBA_func, 0, 0),
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index 13f885b..1a3b3c6 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -70,11 +70,11 @@ gjs_cairo_surface_pattern_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_surface_pattern_proto_props[] = {
- { NULL }
+ JS_PS_END
};
-static bool
+static JSBool
setExtend_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -99,7 +99,7 @@ setExtend_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getExtend_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -126,7 +126,7 @@ getExtend_func(JSContext *context,
return true;
}
-static bool
+static JSBool
setFilter_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -151,7 +151,7 @@ setFilter_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getFilter_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -179,11 +179,11 @@ getFilter_func(JSContext *context,
}
JSFunctionSpec gjs_cairo_surface_pattern_proto_funcs[] = {
- { "setExtend", JSOP_WRAPPER((JSNative)setExtend_func), 0, 0 },
- { "getExtend", JSOP_WRAPPER((JSNative)getExtend_func), 0, 0 },
- { "setFilter", JSOP_WRAPPER((JSNative)setFilter_func), 0, 0 },
- { "getFilter", JSOP_WRAPPER((JSNative)getFilter_func), 0, 0 },
- { NULL }
+ JS_FS("setExtend", setExtend_func, 0, 0),
+ JS_FS("getExtend", getExtend_func, 0, 0),
+ JS_FS("setFilter", setFilter_func, 0, 0),
+ JS_FS("getFilter", getFilter_func, 0, 0),
+ JS_FS_END
};
JSObject *
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 5d51022..feba845 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -53,11 +53,11 @@ gjs_cairo_surface_finalize(JSFreeOp *fop,
/* Properties */
JSPropertySpec gjs_cairo_surface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
/* Methods */
-static bool
+static JSBool
writeToPNG_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -86,7 +86,7 @@ writeToPNG_func(JSContext *context,
return true;
}
-static bool
+static JSBool
getType_func(JSContext *context,
unsigned argc,
JS::Value *vp)
@@ -116,7 +116,7 @@ JSFunctionSpec gjs_cairo_surface_proto_funcs[] = {
// flush
// getContent
// getFontOptions
- { "getType", JSOP_WRAPPER((JSNative)getType_func), 0, 0},
+ JS_FS("getType", getType_func, 0, 0),
// markDirty
// markDirtyRectangle
// setDeviceOffset
@@ -126,8 +126,8 @@ JSFunctionSpec gjs_cairo_surface_proto_funcs[] = {
// copyPage
// showPage
// hasShowTextGlyphs
- { "writeToPNG", JSOP_WRAPPER((JSNative)writeToPNG_func), 0, 0 },
- { NULL }
+ JS_FS("writeToPNG", writeToPNG_func, 0, 0),
+ JS_FS_END
};
/* Public API */
diff --git a/modules/cairo-svg-surface.cpp b/modules/cairo-svg-surface.cpp
index 3b3eb6c..f305285 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -72,11 +72,11 @@ gjs_cairo_svg_surface_finalize(JSFreeOp *fop,
}
JSPropertySpec gjs_cairo_svg_surface_proto_props[] = {
- { NULL }
+ JS_PS_END
};
JSFunctionSpec gjs_cairo_svg_surface_proto_funcs[] = {
- { NULL }
+ JS_FS_END
};
JSObject *
diff --git a/modules/system.cpp b/modules/system.cpp
index 22b5a86..06f7367 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -140,13 +140,13 @@ gjs_clear_date_caches(JSContext *context,
}
static JSFunctionSpec module_funcs[] = {
- { "addressOf", JSOP_WRAPPER (gjs_address_of), 1, GJS_MODULE_PROP_FLAGS },
- { "refcount", JSOP_WRAPPER (gjs_refcount), 1, GJS_MODULE_PROP_FLAGS },
- { "breakpoint", JSOP_WRAPPER (gjs_breakpoint), 0, GJS_MODULE_PROP_FLAGS },
- { "gc", JSOP_WRAPPER (gjs_gc), 0, GJS_MODULE_PROP_FLAGS },
- { "exit", JSOP_WRAPPER (gjs_exit), 0, GJS_MODULE_PROP_FLAGS },
- { "clearDateCaches", JSOP_WRAPPER (gjs_clear_date_caches), 0, GJS_MODULE_PROP_FLAGS },
- { NULL },
+ JS_FS("addressOf", gjs_address_of, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("refcount", gjs_refcount, 1, GJS_MODULE_PROP_FLAGS),
+ JS_FS("breakpoint", gjs_breakpoint, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS("gc", gjs_gc, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS("exit", gjs_exit, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS("clearDateCaches", gjs_clear_date_caches, 0, GJS_MODULE_PROP_FLAGS),
+ JS_FS_END
};
bool
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]