1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/api/package-info.java Mon May 20 10:59:47 2013 +0200
1.3 @@ -0,0 +1,21 @@
1.4 +/**
1.5 + * Back 2 Browser Bytecode Translator
1.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 + *
1.8 + * This program is free software: you can redistribute it and/or modify
1.9 + * it under the terms of the GNU General Public License as published by
1.10 + * the Free Software Foundation, version 2 of the License.
1.11 + *
1.12 + * This program is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 + * GNU General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU General Public License
1.18 + * along with this program. Look for COPYING file in the top folder.
1.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 + */
1.21 +@Exported
1.22 +package org.apidesign.bck2brwsr.htmlpage.api;
1.23 +
1.24 +import org.apidesign.bck2brwsr.core.Exported;
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/package-info.java Mon May 20 10:59:47 2013 +0200
2.3 @@ -0,0 +1,21 @@
2.4 +/**
2.5 + * Back 2 Browser Bytecode Translator
2.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details.
2.16 + *
2.17 + * You should have received a copy of the GNU General Public License
2.18 + * along with this program. Look for COPYING file in the top folder.
2.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 + */
2.21 +@Exported
2.22 +package org.apidesign.bck2brwsr.htmlpage;
2.23 +
2.24 +import org.apidesign.bck2brwsr.core.Exported;
3.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java Mon May 13 18:54:50 2013 +0200
3.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/Java2JavaScript.java Mon May 20 10:59:47 2013 +0200
3.3 @@ -67,6 +67,15 @@
3.4 @Parameter(defaultValue="NONE")
3.5 private ObfuscationLevel obfuscation;
3.6
3.7 + /**
3.8 + * Indicates whether to create an extension module instead of a standalone
3.9 + * JavaScript VM.
3.10 + *
3.11 + * @since 0.6
3.12 + */
3.13 + @Parameter(defaultValue="false")
3.14 + private boolean extension;
3.15 +
3.16 @Override
3.17 public void execute() throws MojoExecutionException {
3.18 if (!classes.isDirectory()) {
3.19 @@ -90,6 +99,7 @@
3.20 FileWriter w = new FileWriter(javascript);
3.21 Bck2Brwsr.newCompiler().
3.22 obfuscation(obfuscation).
3.23 + extension(extension).
3.24 resources(url).
3.25 addRootClasses(arr.toArray(new String[0])).
3.26 generate(w);
4.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Mon May 13 18:54:50 2013 +0200
4.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Mon May 20 10:59:47 2013 +0200
4.3 @@ -1587,7 +1587,7 @@
4.4 String s = jc.stringValue(entryIndex, classRef);
4.5 if (classRef[0] != null) {
4.6 if (classRef[0].startsWith("[")) {
4.7 - s = accessClass("java_lang_Class") + "(false).forName__Ljava_lang_Class_2Ljava_lang_String_2('" + classRef[0] + "');";
4.8 + s = accessClass("java_lang_Class") + "(false)['forName__Ljava_lang_Class_2Ljava_lang_String_2']('" + classRef[0] + "');";
4.9 } else {
4.10 addReference(classRef[0]);
4.11 s = accessClass(s.replace('/', '_')) + "(false).constructor.$class";
4.12 @@ -1819,7 +1819,7 @@
4.13 out.append(" var stA0 = e;");
4.14 out.append("} else {");
4.15 out.append(" var stA0 = vm.java_lang_Throwable(true);");
4.16 - out.append(" vm.java_lang_Throwable.cons__VLjava_lang_String_2.call(stA0, e.toString());");
4.17 + out.append(" vm.java_lang_Throwable['cons__VLjava_lang_String_2'].call(stA0, e.toString());");
4.18 out.append("}");
4.19 goTo(out, current, e.handler_pc, topMostLabel);
4.20 } else {
4.21 @@ -1874,7 +1874,7 @@
4.22 case 11: jvmType = "[J"; break;
4.23 default: throw new IllegalStateException("Array type: " + atype);
4.24 }
4.25 - emit(out, "var @2 = Array.prototype.newArray__Ljava_lang_Object_2ZLjava_lang_String_2I(true, '@3', @1);",
4.26 + emit(out, "var @2 = Array.prototype['newArray__Ljava_lang_Object_2ZLjava_lang_String_2I'](true, '@3', @1);",
4.27 smapper.popI(), smapper.pushA(), jvmType);
4.28 }
4.29
4.30 @@ -1885,7 +1885,7 @@
4.31 } else {
4.32 typeName = "[L" + typeName + ";";
4.33 }
4.34 - emit(out, "var @2 = Array.prototype.newArray__Ljava_lang_Object_2ZLjava_lang_String_2I(false, '@3', @1);",
4.35 + emit(out, "var @2 = Array.prototype['newArray__Ljava_lang_Object_2ZLjava_lang_String_2I'](false, '@3', @1);",
4.36 smapper.popI(), smapper.pushA(), typeName);
4.37 }
4.38
4.39 @@ -1901,7 +1901,7 @@
4.40 dims.insert(1, smapper.popI());
4.41 }
4.42 dims.append(']');
4.43 - emit(out, "var @2 = Array.prototype.multiNewArray__Ljava_lang_Object_2Ljava_lang_String_2_3II('@3', @1, 0);",
4.44 + emit(out, "var @2 = Array.prototype['multiNewArray__Ljava_lang_Object_2Ljava_lang_String_2_3II']('@3', @1, 0);",
4.45 dims.toString(), smapper.pushA(), typeName);
4.46 return i;
4.47 }
4.48 @@ -1956,7 +1956,7 @@
4.49 smapper.popA(), smapper.pushI(),
4.50 type.replace('/', '_'));
4.51 } else {
4.52 - emit(out, "var @2 = vm.java_lang_Class(false).forName__Ljava_lang_Class_2Ljava_lang_String_2('@3').isInstance__ZLjava_lang_Object_2(@1);",
4.53 + emit(out, "var @2 = vm.java_lang_Class(false)['forName__Ljava_lang_Class_2Ljava_lang_String_2']('@3')['isInstance__ZLjava_lang_Object_2'](@1);",
4.54 smapper.popA(), smapper.pushI(),
4.55 type
4.56 );
4.57 @@ -1970,7 +1970,7 @@
4.58 "if (@1 !== null && !@1['$instOf_@2']) throw vm.java_lang_ClassCastException(true);",
4.59 smapper.getA(0), type.replace('/', '_'));
4.60 } else {
4.61 - emit(out, "vm.java_lang_Class(false).forName__Ljava_lang_Class_2Ljava_lang_String_2('@2').cast__Ljava_lang_Object_2Ljava_lang_Object_2(@1);",
4.62 + emit(out, "vm.java_lang_Class(false)['forName__Ljava_lang_Class_2Ljava_lang_String_2']('@2')['cast__Ljava_lang_Object_2Ljava_lang_Object_2'](@1);",
4.63 smapper.getA(0), type
4.64 );
4.65 }