| java.lang.Object pnuts.tools.PnutsCompiler
PnutsCompiler | public class PnutsCompiler (Code) | | A batch compiler for Pnuts. It reads Pnuts scripts and generates class files
or a JAR file.
Usage:
pnutsc [ -d destination_directory ] [ -o jar_file ] [ -v ] [ -no_proxy ] [ -prefix name ] [ -main className ] [ -m module ] [ -impl pnutsImplClassName ] [ -encoding encoding_name ] [ -C dir ] { script_file | jar_file } ...
|
Method Summary | |
static String | className(String name) | public void | compileToFile(Pnuts p, String name, File dir) Compile a parsed expression and save the compiled code to class files. | void | compileToFile(File file, File dir, Vector classNames, String encoding) | public void | compileToFile(File dir, String[] files, String[] dirs, String[] modules, String mainClassName, String pnutsImplClassName, String encoding) Compile Pnuts scripts and save the generated code into class files. | public void | compileToZip(Pnuts p, String name, ZipOutputStream zout) | void | compileToZip(File file, ZipOutputStream zout, Vector classNames, String encoding) | public void | compileToZip(ZipOutputStream zout, String[] files, String[] dirs, String[] modules, String mainClassName, String pnutsImplClassName, String encoding) Compile Pnuts scripts and save the generated code into a ZIP file. | public static ClassFile | generateMainClass(String mainClassName, String arg0, String[] modules, String[] classNames, String pnutsImplClassName)
public class mainClassName extends Runtime {
public Object run(Context ctx){
ctx.usePackage(module1);
... | Compiler | getCompiler(String name) | public void | includeLineNumber(boolean flag) | public void | includeMainMethod(boolean flag) | public static void | main(String args) | public static void | setClassPrefix(String p) Set the prefix of the class name.
Parameters: prefix - the prefix. | static void | setProperty(String name, String value) | public void | setVerbose(boolean flag) | public void | useDynamicProxy(boolean flag) |
PnutsCompiler | public PnutsCompiler()(Code) | | |
compileToFile | public void compileToFile(Pnuts p, String name, File dir)(Code) | | Compile a parsed expression and save the compiled code to class files.
Parameters: p - a parsed expression Parameters: name - the class name of the compiled code Parameters: dir - the directory in which the class files are saved |
compileToFile | public void compileToFile(File dir, String[] files, String[] dirs, String[] modules, String mainClassName, String pnutsImplClassName, String encoding) throws IOException, ParseException(Code) | | Compile Pnuts scripts and save the generated code into class files.
Parameters: dir - the directory in which the generated byte code is saved Parameters: files - the script files Parameters: dirs - the directories in which each script file resides Parameters: modules - used modules Parameters: mainClassName - the main class name |
compileToZip | public void compileToZip(Pnuts p, String name, ZipOutputStream zout)(Code) | | Compile a parsed expression and save the compiled code to a Zip file
Parameters: p - a parsed expression Parameters: name - the class name of the compiled code Parameters: zout - a ZipOutputStream to which the compiled code is written |
compileToZip | public void compileToZip(ZipOutputStream zout, String[] files, String[] dirs, String[] modules, String mainClassName, String pnutsImplClassName, String encoding) throws IOException, ParseException(Code) | | Compile Pnuts scripts and save the generated code into a ZIP file.
Parameters: zout - the ZipOutputStream to which the generated byte code iswritten Parameters: files - the script files Parameters: dirs - the directories in which each script file resides Parameters: modules - used modules Parameters: mainClassName - the main class name |
generateMainClass | public static ClassFile generateMainClass(String mainClassName, String arg0, String[] modules, String[] classNames, String pnutsImplClassName)(Code) | |
public class mainClassName extends Runtime {
public Object run(Context ctx){
ctx.usePackage(module1);
...
new className1().run((Context)ctx.clone());
...
}
public static void main(String args[]) {
Context context = new Context();
context.getCurrentPackage().set("$args".intern(), args);
new mainClassName().run(context);
}
}
|
includeLineNumber | public void includeLineNumber(boolean flag)(Code) | | |
includeMainMethod | public void includeMainMethod(boolean flag)(Code) | | Parameters: flag - If true, main() method is generated. |
setClassPrefix | public static void setClassPrefix(String p)(Code) | | Set the prefix of the class name.
Parameters: prefix - the prefix. Default is null. |
setVerbose | public void setVerbose(boolean flag)(Code) | | Set verbose mode
Parameters: flag - If true, verbose message is printed |
useDynamicProxy | public void useDynamicProxy(boolean flag)(Code) | | Switch dynamic proxy generation
Parameters: flag - If true dynamic proxy is generated for everymethod/constructor call. |
|
|