[Laszlo-checkins] r11808 - in openlaszlo/trunk/WEB-INF/lps: lfc lfc/kernel lfc/kernel/swf9 server/src/org/openlaszlo/compiler server/src/org/openlaszlo/sc
hqm@openlaszlo.org
hqm at openlaszlo.org
Mon Nov 17 15:48:52 PST 2008
Author: hqm
Date: 2008-11-17 15:48:40 -0800 (Mon, 17 Nov 2008)
New Revision: 11808
Added:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/build.xml
openlaszlo/trunk/WEB-INF/lps/lfc/buildlfc
openlaszlo/trunk/WEB-INF/lps/lfc/buildlfcdebug
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/Library.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/Library.lzs
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/lzsc.java
Log:
Change 20081117-hqm-H by hqm at badtzmaru.home on 2008-11-17 16:58:08 EST
in /Users/hqm/openlaszlo/trunk4
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: refactor swf9 compilation to prepare for loadable libraries
New Features:
Bugs Fixed: LPP-7184
Technical Reviewer: dda
QA Reviewer: ptw
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ make SWF9Writer pass in boilerplate swf9 application code to the script compiler
This will allow SWF9Writer to generate an "application" skeleton class
for each <import> module, which will copy all the exported classes
from the module into the lz namespace object in the main app.
+ define a version of LzLibary in SWF9 kernel, not yet working, just a placeholder
+ start adding code to class compiler to keep a list of which classes are defined in
a compilation environment, and what their tag names are, so that these can be
explicitly copied from <import> apps into the main app
loadable modules don't work yet, this is just getting the substrate ready
Tests:
+ swf9 LFC and debug-LFC compiles in swf9, via ant and buildlfc, buildlfcdebug
+ test/smoke/smokecheck in swf8 and swf9 still work
+ debug evaluator still able compile statements and expressions on the server in swf9
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/build.xml
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/build.xml 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/build.xml 2008-11-17 23:48:40 UTC (rev 11808)
@@ -224,6 +224,9 @@
var ext = (v == 9) ? ".swc" : ".lzl";
var shlibopt = "--option buildSharedLibrary=true ";
+ if (v == 9) {
+ shlibopt += "--option SWF9MainClassName=LFCApplication --option SWF9WrapperClassName=LzSpriteApplication ";
+ }
// Check whether the options tell us to build this runtime at all
var buildThisRuntime = lfc.getProperty("build.lfc.runtime.swf" + v);
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/buildlfc
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/buildlfc 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/buildlfc 2008-11-17 23:48:40 UTC (rev 11808)
@@ -17,7 +17,8 @@
suffix="js"
fi
if [ "$runtime" == "swf9" ]; then
- options="${options} --option buildSharedLibrary=true"
+ options="${options} --option buildSharedLibrary=true --option SWF9MainClassName=LFCApplication \
+ --option SWF9WrapperClassName=LzSpriteApplication "
suffix="swc"
fi
ant -Dlfc.output=${output:-LFC${runtime#swf}.${suffix:-"lzl"}} -Dlfc.runtime=${runtime} -Dlfc.source=LaszloLibrary.lzs \
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/buildlfcdebug
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/buildlfcdebug 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/buildlfcdebug 2008-11-17 23:48:40 UTC (rev 11808)
@@ -23,7 +23,8 @@
suffix="js"
fi
if [ "$runtime" == "swf9" ]; then
- options="${options} -g --option buildSharedLibrary=true"
+ options="${options} -g --option buildSharedLibrary=true --option SWF9MainClassName=LFCApplication \
+ --option SWF9WrapperClassName=LzSpriteApplication "
suffix="swc"
fi
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/Library.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/Library.lzs 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/Library.lzs 2008-11-17 23:48:40 UTC (rev 11808)
@@ -10,10 +10,12 @@
if ($swf9) {
} else {
#include "kernel/LzIdleKernel.lzs"
- #include "kernel/LzLibraryCleanup.lzs"
}
+#include "kernel/LzLibraryCleanup.lzs"
+
+
//#include "kernel/LzRequires.lzs"
if ($swf9) {
#include "kernel/swf9/Library.lzs"
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/Library.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/Library.lzs 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/Library.lzs 2008-11-17 23:48:40 UTC (rev 11808)
@@ -19,13 +19,7 @@
#include "kernel/swf9/LzFontManager.as"
#include "kernel/swf9/LzTimeKernel.as"
- //#include "kernel/swf9/LzRequires.as"
- //#include "kernel/swf9/LzInputTextSprite.as"
- //#include "kernel/swf9/LzMakeLoadSprite.as"
- //#include "kernel/swf9/LzFontManager.as"
- //#include "kernel/swf9/LzFunctions.as"
- //#include "kernel/swf9/LzSoundMC.as"
- //#include "kernel/swf9/LzLibrary.lzs"
+#include "kernel/swf9/LzLibrary.as"
#include "kernel/swf9/LzXMLParser.as"
#include "kernel/swf9/LzXMLTranslator.as"
#include "kernel/swf9/LzHTTPLoader.as"
@@ -33,13 +27,11 @@
#include "kernel/swf9/LzMouseKernel.as"
#include "kernel/swf9/LzBrowserKernel.lzs"
#include "kernel/swf9/LzKeyboardKernel.as"
- //#include "kernel/swf9/LzAudio.as"
+
#include "kernel/swf9/LzScreenKernel.as"
#include "kernel/swf9/LzContextMenuKernel.lzs"
#include "kernel/swf9/LzAudioKernel.lzs"
#include "kernel/swf9/LzAsset.as"
- //#include "kernel/swf9/dojo/Library.lzs"
-
#include "kernel/swf9/DojoExternalInterface.as"
Added: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as
Property changes on: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzLibrary.as
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -73,6 +73,10 @@
} else {
this.className = LZXTag2JSClass(env.methodNameGenerator.next());
}
+
+ // Keep track of this class name, in case we're compiling an <import> library
+ env.addExportedClassDef(tagName, this.className);
+
this.superclass = superclass;
this.definition = definition;
if (definition != null) {
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -73,6 +73,13 @@
protected File mApplicationFile = null;
protected File mObjectFile = null;
+ /** List of class definitions that will be defined by a
+ * loadable library module.
+ * A map of tagname => classname , e.g.,
+ * lz['button'] = $lzc$class_button;
+ */
+ protected Map exportedClassDefs = new HashMap();
+
final SymbolGenerator methodNameGenerator;
/** Output is written here.
@@ -722,4 +729,13 @@
}
}
+ public void addExportedClassDef(String tagname, String classname) {
+ exportedClassDefs.put(tagname, classname);
+ }
+
+ public Map getExportedClassDefs() {
+ return exportedClassDefs;
+ }
+
+
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -597,6 +597,12 @@
props.put("compileTimeConstants", compileTimeConstants);
props.setProperty(CompilationEnvironment.DEBUG_EVAL_PROPERTY, "true");
props.setProperty(CompilationEnvironment.DEBUG_PROPERTY, "true");
+ props.put(org.openlaszlo.sc.Compiler.SWF9_APP_CLASSNAME, SWF9Writer.DEBUG_EVAL_CLASSNAME);
+ props.put(org.openlaszlo.sc.Compiler.SWF9_WRAPPER_CLASSNAME, SWF9Writer.DEBUG_EVAL_CLASSNAME);
+ props.put(org.openlaszlo.sc.Compiler.SWF9_APPLICATION_PREAMBLE,
+ "public class " + SWF9Writer.DEBUG_EVAL_CLASSNAME +
+ " extends " + SWF9Writer.DEBUG_EVAL_SUPERCLASS + " {\n " + SWF9Writer.imports + "}\n");
+
byte[] objcode;
String prog = "";
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -150,9 +150,11 @@
if (Compiler.SCRIPT_RUNTIMES.contains(runtime)) {
writer = new DHTMLWriter(props, ostream,
env.getMediaCache(), false, env);
+ } else if ("swf9".equals(runtime)) {
+ writer = new SWF9Writer(props, ostream, env.getMediaCache(), false, env);
} else if (Compiler.SWF_RUNTIMES.contains(runtime)) {
- // Set the "SWF_LOADABLE_LIB" flag to true for this compiler
- props.setProperty(org.openlaszlo.sc.Compiler.SWF_LOADABLE_LIB, "true");
+ // Set the "SWF8_LOADABLE_LIB" flag to true for this compiler
+ props.setProperty(org.openlaszlo.sc.Compiler.SWF8_LOADABLE_LIB, "true");
// Ensures that _level0 is prefixed where needed in snippets code
env.setGlobalPrefix("_level0.");
writer = new SWFWriter(props, ostream,
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -10,6 +10,7 @@
package org.openlaszlo.compiler;
import org.openlaszlo.sc.ScriptCompiler;
+import org.openlaszlo.sc.Compiler;
import org.openlaszlo.server.LPS;
import org.openlaszlo.utils.ChainedException;
import org.openlaszlo.utils.FileUtils;
@@ -70,7 +71,6 @@
CompilationEnvironment env) {
super(props, stream, cache, importLibrary, env);
-
scriptBuffer = new StringWriter();
scriptWriter= new PrintWriter(scriptBuffer);
@@ -371,14 +371,18 @@
addScript("Debug.makeDebugWindow()");
}
-
// Put the canvas sprite on the 'stage'.
addScript("addChild(canvas.sprite)");
// Tell the canvas we're done loading.
addScript("canvas.initDone()");
+ Properties props = (Properties)mProperties.clone();
+ // Set up the boilerplate code needed for the main swf9 application class
+ props.put(org.openlaszlo.sc.Compiler.SWF9_APPLICATION_PREAMBLE, makeApplicationPreamble());
+ props.put(org.openlaszlo.sc.Compiler.SWF9_APP_CLASSNAME, MAIN_APP_CLASSNAME);
+ props.put(org.openlaszlo.sc.Compiler.SWF9_WRAPPER_CLASSNAME, EXEC_APP_CLASSNAME);
+
try {
- Properties props = (Properties)mProperties.clone();
scriptWriter.close();
byte[] objcode = ScriptCompiler.compileToByteArray(scriptBuffer.toString(), props);
InputStream input = new ByteArrayInputStream(objcode);
@@ -396,6 +400,55 @@
this.liburl = url;
}
+ /** The user 'main' class, which extends LFCApplication */
+ public final static String MAIN_APP_CLASSNAME = "LzApplication";
+
+ /** The top level class executed first, it creates a LzApplication object */
+ public final static String EXEC_APP_CLASSNAME = "LzSpriteApplication";
+
+ public final static String LFC_CLASSNAME = "LFCApplication";
+
+ /** The class to use when compiling a debug eval statement */
+ public final static String DEBUG_EVAL_SUPERCLASS = "DebugExec";
+ public final static String DEBUG_EVAL_CLASSNAME = "DebugEvaluate";
+
+ /** The "main" class name for 'import' (runtime loadable) libraries */
+ public final static String LIBRARY_CLASSNAME = "LzRuntimeLoadedLib";
+
+ /** List of AS3 imports needed to compile an app */
+ public static final String imports = " #passthrough (toplevel:true) { \n" +
+ "import flash.display.*;\n" +
+ "import flash.events.*;\n" +
+ "import flash.utils.*;\n" +
+ "import flash.text.*;\n" +
+ "import flash.system.*;\n" +
+ "import flash.net.*;\n" +
+ "import flash.ui.*;\n" +
+ "import flash.text.Font;\n" +
+ "}#\n";
+
+ /** Create swf9 application boilerplate preamble as3 code
+ */
+ public String makeApplicationPreamble() {
+ // MOVE THIS TO SWF9WRITER boilerplate generator code
+ String source = "public class " + MAIN_APP_CLASSNAME +
+ " extends " + LFC_CLASSNAME + " {\n " + imports + "}\n";
+ source += "public class " + EXEC_APP_CLASSNAME +
+ " extends Sprite {\n " + imports + "var app:LzApplication;\n" +
+ " function " + EXEC_APP_CLASSNAME + "() {" +
+ " app = new LzApplication(this);}}\n";
+ return source;
+ }
+
+ /** Create swf9 import library boilerplate preamble as3 code
+ */
+ public String makeLibraryPreamble() {
+ return "NOT YET DEFINED";
+ }
+
+
+
+
public void closeSnippet() throws IOException {
// Callback to let library know we're done loading
addScript("LzLibrary.__LZsnippetLoaded('"+this.liburl+"')");
@@ -404,8 +457,13 @@
throw new IllegalStateException("SWF9Writer.close() called twice");
}
+ Properties props = (Properties)mProperties.clone();
+ // Pass in the table of lzx class defs
+ props.put(org.openlaszlo.sc.Compiler.EXPORTED_CLASS_DEFS, mEnv.getExportedClassDefs());
+ props.setProperty(org.openlaszlo.sc.Compiler.SWF9_APPLICATION_PREAMBLE, makeLibraryPreamble());
+
try {
- Properties props = (Properties)mProperties.clone();
+
scriptWriter.close();
byte[] objcode = ScriptCompiler.compileToByteArray(scriptBuffer.toString(), props);
InputStream input = new ByteArrayInputStream(objcode);
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -85,7 +85,7 @@
// does nothing here - may be overridden to set options
public void setGeneratorOptions() {
- globalprefix = this.options.getBoolean(Compiler.SWF_LOADABLE_LIB) ? "_level0." : "";
+ globalprefix = this.options.getBoolean(Compiler.SWF8_LOADABLE_LIB) ? "_level0." : "";
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -468,6 +468,7 @@
public static String DISABLE_CONSTANT_POOL = "disableConstantPool";
public static String DISABLE_TRACK_LINES = "disableTrackLines";
public static String DISABLE_PUBLIC_FOR_DEBUG = "disablePublicForDebug";
+ public static String EXPORTED_CLASS_DEFS = "exportedClassDefs";
public static String ELIMINATE_DEAD_EXPRESSIONS = "eliminateDeadExpressions";
public static String FLASH_COMPILER_COMPATABILITY = "flashCompilerCompatability";
public static String GENERATE_FUNCTION_2 = "generateFunction2";
@@ -489,6 +490,11 @@
public static String PRINT_INSTRUCTIONS = "printInstructions";
public static String RESOLVER = "resolver";
public static String SCRIPT_ELEMENT = "scriptElement";
+ public static String SWF9_APPLICATION_PREAMBLE = "SWF9applicationPreamble";
+ public static String SWF9_APP_CLASSNAME = "SWF9MainClassName";
+ public static String SWF9_WRAPPER_CLASSNAME = "SWF9WrapperClassName";
+ public static String SWF9_LFC_CLASSNAME = "SWF9LFCClassName";
+ public static String SWF8_LOADABLE_LIB = "SWFLoadableLib";
public static String TRACK_LINES = "trackLines";
public static String VALIDATE_CACHES = "validateCaches";
public static String WARN_UNDEFINED_REFERENCES = "warnUndefinedReferences";
@@ -496,8 +502,8 @@
public static String WARN_UNUSED_LOCALS = "warnUnusedLocals";
public static String WARN_UNUSED_PARAMETERS = "warnUnusedParameters";
public static String WITH_THIS = "withThis";
- public static String SWF_LOADABLE_LIB = "SWFLoadableLib";
+
//
// Parser
//
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -909,8 +909,7 @@
}
}
else {
- String mainclassname =
- (options.getBoolean(Compiler.DEBUG_EVAL)) ? SWF9Generator.DEBUG_EVAL_CLASSNAME : SWF9Generator.EXEC_APP_CLASSNAME;
+ String mainclassname = (String) options.get(Compiler.SWF9_WRAPPER_CLASSNAME);
// For the application, we just list one .as file
cmd.add(workdir.getPath() + File.separator + mainclassname + ".as");
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -34,19 +34,8 @@
public static final String PASSTHROUGH_TOPLEVEL = "toplevel";
- /** The user 'main' class, which extends LFCApplication */
- public final static String MAIN_APP_CLASSNAME = "LzApplication";
- /** The top level class executed first, it creates a LzApplication object */
- public final static String EXEC_APP_CLASSNAME = "LzSpriteApplication";
- /** The LFC 'main' class, which extends nothing */
- public final static String MAIN_LIB_CLASSNAME = "LFCApplication";
-
- /** The class to use when compiling a debug eval statement */
- public final static String DEBUG_EVAL_SUPERCLASS = "DebugExec";
- public final static String DEBUG_EVAL_CLASSNAME = "DebugEvaluate";
-
/** The first part of a every emitted javascript file */
public static final String DEFAULT_FILE_PREAMBLE = "package {\n";
@@ -553,36 +542,8 @@
}
public String preProcess(String source) {
-
- String imports = " #passthrough (toplevel:true) { \n" +
- "import flash.display.*;\n" +
- "import flash.events.*;\n" +
- "import flash.utils.*;\n" +
- "import flash.text.*;\n" +
- "import flash.system.*;\n" +
- "import flash.net.*;\n" +
- "import flash.ui.*;\n" +
- "import flash.text.Font;\n" +
- "}#\n";
-
-
- // TODO: [2007-1-14 dda] maybe tag compiler should emit app main class?
- // We need a 'main' application class to inherit from Sprite and do some
- // initialization, and currently there is no default one.
- // We'll add one here, doing it later adds too many special cases.
if (!options.getBoolean(Compiler.BUILD_SHARED_LIBRARY)) {
- if (options.getBoolean(Compiler.DEBUG_EVAL)) {
-
- source += "public class " + SWF9Generator.DEBUG_EVAL_CLASSNAME +
- " extends " + SWF9Generator.DEBUG_EVAL_SUPERCLASS + " {\n " + imports + "}\n";
- } else {
- source += "public class " + SWF9Generator.MAIN_APP_CLASSNAME +
- " extends " + SWF9Generator.MAIN_LIB_CLASSNAME + " {\n " + imports + "}\n";
- source += "public class " + SWF9Generator.EXEC_APP_CLASSNAME +
- " extends Sprite {\n " + imports + "var app:LzApplication;\n" +
- " function " + SWF9Generator.EXEC_APP_CLASSNAME + "() {" +
- " app = new LzApplication(this);}}\n";
- }
+ source += options.get(Compiler.SWF9_APPLICATION_PREAMBLE);
}
return source;
}
@@ -672,11 +633,11 @@
config.dumpLineAnnotationsFile = (String)options.get(Compiler.DUMP_LINE_ANNOTATIONS);
config.forcePublicMembers = options.getBoolean(Compiler.DEBUG_SWF9) && !options.getBoolean(Compiler.DISABLE_PUBLIC_FOR_DEBUG);
+ config.mainClassName = (String) options.get(Compiler.SWF9_APP_CLASSNAME);
+ System.err.println("mainClassName = "+config.mainClassName);
if (config.islib) {
- config.mainClassName = SWF9Generator.MAIN_LIB_CLASSNAME;
+ //
} else {
- config.mainClassName = options.getBoolean(Compiler.DEBUG_EVAL) ?
- SWF9Generator.DEBUG_EVAL_CLASSNAME : SWF9Generator.MAIN_APP_CLASSNAME;
config.trackLines = true; // needed to get error messages that relate to original source
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/lzsc.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/lzsc.java 2008-11-17 22:06:28 UTC (rev 11807)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/lzsc.java 2008-11-17 23:48:40 UTC (rev 11808)
@@ -203,7 +203,7 @@
String scriptFile = null;
boolean incremental = false;
- String defaultRuntime = LPS.getProperty("compiler.runtime.default", "swf7");
+ String defaultRuntime = LPS.getProperty("compiler.runtime.default", "swf8");
// default constants
compileTimeConstants.put("$debug", Boolean.FALSE);
compileTimeConstants.put("$profile", Boolean.FALSE);
More information about the Laszlo-checkins
mailing list