diff options
author | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2013-06-03 15:15:05 +0100 |
---|---|---|
committer | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2013-06-03 15:15:05 +0100 |
commit | aab61ebdb4494309e688ea8afbd97c5a2f89e935 (patch) | |
tree | 716a29b96f3408ba2c7cf71534b97430c10b8ef4 /src/jsapi-libdom-property.c | |
parent | 85287e9287e29fd715470253b1075e726a2ec594 (diff) | |
download | nsgenbind-aab61ebdb4494309e688ea8afbd97c5a2f89e935.tar.gz nsgenbind-aab61ebdb4494309e688ea8afbd97c5a2f89e935.tar.bz2 |
add switch and implementation to enable debug trace logging in generated code
Diffstat (limited to 'src/jsapi-libdom-property.c')
-rw-r--r-- | src/jsapi-libdom-property.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c index 0f82c3f..2bd3068 100644 --- a/src/jsapi-libdom-property.c +++ b/src/jsapi-libdom-property.c @@ -26,11 +26,11 @@ static int generate_property_body(struct binding *binding, const char *interface static inline int output_private_get(struct binding *binding, const char *argname) { - if (!binding->has_private) { - return 0; - } + int ret = 0; - return fprintf(binding->outfile, + if (binding->has_private) { + + ret = fprintf(binding->outfile, "\tstruct jsclass_private *%s;\n" "\n" "\t%s = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n" @@ -38,6 +38,20 @@ output_private_get(struct binding *binding, const char *argname) "\t\treturn JS_FALSE;\n" "\t}\n\n", argname, argname, binding->interface, argname); + + if (options->dbglog) { + ret += fprintf(binding->outfile, + "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, %s);\n", argname); + } + } else { + if (options->dbglog) { + ret += fprintf(binding->outfile, + "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); + } + + } + + return ret; } /* generate vars for property name getter */ @@ -756,10 +770,13 @@ output_property_placeholder(struct binding *binding, binding->interface, ident); - fprintf(binding->outfile, - "\tJSLOG(\"property %s.%s has no implementation\");\n", - binding->interface, - ident); + + if (options->dbglog) { + fprintf(binding->outfile, + "\tJSLOG(\"property %s.%s has no implementation\");\n", + binding->interface, + ident); + } return 0; } |