diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-21 19:31:25 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-21 19:31:25 (GMT) |
commit | 0192f99e8ad75bab4041cca11d94d32503cc9666 (patch) | |
tree | dcf1e28be714f244f61406a18261c9f2cceaf2a9 /contrib/dom | |
parent | 8e3cca4a153a5178a77ae6956292606563f4b8fe (diff) | |
download | uscxml-0192f99e8ad75bab4041cca11d94d32503cc9666.zip uscxml-0192f99e8ad75bab4041cca11d94d32503cc9666.tar.gz uscxml-0192f99e8ad75bab4041cca11d94d32503cc9666.tar.bz2 |
More complete JSC ECMA datamodel
Diffstat (limited to 'contrib/dom')
-rw-r--r-- | contrib/dom/scripts/CodeGeneratorArabicaJSC.pm | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm b/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm index 390bee0..2de92a9 100644 --- a/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm +++ b/contrib/dom/scripts/CodeGeneratorArabicaJSC.pm @@ -208,12 +208,12 @@ END push(@headerContent, "\n static JSValueRef ${getter}(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception);"); } - # if ($extensions->{'CustomIndexedGetter'}) { - # push(@headerContent, "\n static JSValueRef indexedPropertyCustomGetter(uint32_t, const JSC::AccessorInfo&);"); - # } - # if ($extensions->{'CustomIndexedSetter'}) { - # push(@headerContent, "\n static JSValueRef indexedPropertyCustomSetter(uint32_t, JSC::Local<JSC::Value>, const JSC::AccessorInfo&);"); - # } + if ($extensions->{'CustomIndexedGetter'}) { + push(@headerContent, "\n static JSValueRef indexedPropertyCustomGetter(uint32_t, const JSC::AccessorInfo&);"); + } + if ($extensions->{'CustomIndexedSetter'}) { + push(@headerContent, "\n static JSValueRef indexedPropertyCustomSetter(uint32_t, JSC::Local<JSC::Value>, const JSC::AccessorInfo&);"); + } push(@headerContent, "\n"); push(@headerContent, <<END); @@ -355,7 +355,7 @@ END } elsif($JSCType eq "Number") { push(@implContent, "\n return JSValueMakeNumber(ctx, privData->nativeObj->${wrapperGetter});\n"); } elsif($JSCType eq "Boolean") { - push(@implContent, "\n return JSValueMakeNumber(ctx, privData->nativeObj->${wrapperGetter});\n"); + push(@implContent, "\n return JSValueMakeBoolean(ctx, privData->nativeObj->${wrapperGetter});\n"); } } push(@implContent, " }\n\n"); @@ -378,6 +378,28 @@ END } } } + foreach my $constant (@{$interface->constants}) { + my $name = $constant->name; + my $value = $constant->value; + my $getter = "${name}ConstGetter"; + push(@implContent, " JSValueRef JSC${interfaceName}::${getter}(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef *exception) {"); + my $JSCType = IdlToJSCType($constant->type); + if ($JSCType eq "String") { + push(@implContent, + "\n JSStringRef jscString = JSStringCreateWithUTF8CString(" . $constant->value . ");". + "\n return JSValueMakeString(ctx, jscString);\n"); + } elsif($JSCType eq "Number") { + push(@implContent, "\n return JSValueMakeNumber(ctx, " . $constant->value . ");\n"); + } elsif($JSCType eq "Boolean") { + push(@implContent, "\n return JSValueMakeBoolean(ctx, " . $constant->value . ");\n"); + } + push(@implContent, <<END); + } + +END + + } + } sub GenerateConditionalUndefReturn @@ -491,6 +513,7 @@ sub GenerateImplementation } push(@implContent, "namespace Arabica {\n"); push(@implContent, "namespace DOM {\n\n"); + push(@implContent, "JSClassRef JSC${interfaceName}::Tmpl;\n"); GenerateClassDefStatics($interface); GenerateImplementationAttributes($interface); |