summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-11-01 11:30:44 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2015-11-01 11:30:44 (GMT)
commitce20b3bef865c015890b7a499c7547606e724037 (patch)
treedc488703bee29391c1e6436799b8bbdb57f5b142
parentcb53cae2230eedbba7807ea4c60f469fea08ccb7 (diff)
downloadnsgenbind-ce20b3bef865c015890b7a499c7547606e724037.tar.gz
nsgenbind-ce20b3bef865c015890b7a499c7547606e724037.tar.bz2
Add generated code for short integer values
-rw-r--r--src/duk-libdom-generated.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/duk-libdom-generated.c b/src/duk-libdom-generated.c
index dd294ca..cf70758 100644
--- a/src/duk-libdom-generated.c
+++ b/src/duk-libdom-generated.c
@@ -82,6 +82,30 @@ output_generated_attribute_getter(FILE* outf,
"\treturn 1;\n");
break;
+ case WEBIDL_TYPE_SHORT:
+ if (atributee->type_modifier == WEBIDL_TYPE_MODIFIER_UNSIGNED) {
+ fprintf(outf, "\tdom_ushort s;\n");
+ } else {
+ fprintf(outf, "\tdom_short s;\n");
+ }
+ fprintf(outf,
+ "\tdom_exception exc;\n"
+ "\n");
+ fprintf(outf,
+ "\texc = dom_%s_get_%s((struct dom_%s *)((node_private_t*)priv)->node, &s);\n",
+ interfacee->class_name,
+ atributee->property_name,
+ interfacee->class_name);
+ fprintf(outf,
+ "\tif (exc != DOM_NO_ERR) {\n"
+ "\t\treturn 0;\n"
+ "\t}\n"
+ "\n"
+ "\tduk_push_number(ctx, (duk_double_t)s);\n"
+ "\n"
+ "\treturn 1;\n");
+ break;
+
case WEBIDL_TYPE_BOOL:
fprintf(outf,
"\tdom_exception exc;\n"
@@ -177,6 +201,35 @@ output_generated_attribute_setter(FILE* outf,
"\treturn 0;\n");
break;
+ case WEBIDL_TYPE_SHORT:
+ if (atributee->type_modifier == WEBIDL_TYPE_MODIFIER_UNSIGNED) {
+ fprintf(outf,
+ "\tdom_exception exc;\n"
+ "\tdom_ushort s;\n"
+ "\n"
+ "\ts = duk_get_uint(ctx, 0);\n"
+ "\n");
+ } else {
+ fprintf(outf,
+ "\tdom_exception exc;\n"
+ "\tdom_short s;\n"
+ "\n"
+ "\ts = duk_get_int(ctx, 0);\n"
+ "\n");
+ }
+ fprintf(outf,
+ "\texc = dom_%s_set_%s((struct dom_%s *)((node_private_t*)priv)->node, s);\n",
+ interfacee->class_name,
+ atributee->property_name,
+ interfacee->class_name);
+ fprintf(outf,
+ "\tif (exc != DOM_NO_ERR) {\n"
+ "\t\treturn 0;\n"
+ "\t}\n"
+ "\n"
+ "\treturn 0;\n");
+ break;
+
case WEBIDL_TYPE_BOOL:
fprintf(outf,
"\tdom_exception exc;\n"