1 26 27 package org.objectweb.openccm.command.lib; 28 29 import org.objectweb.util.cmdline.lib.DefaultCommandLine; 31 import org.objectweb.openccm.ast.api.FileScope; 32 33 41 42 public class PSDLtoPSDL 43 extends CompilerGeneratorBase 44 implements org.objectweb.openccm.command.api.PSDLtoPSDL 45 { 46 52 58 59 public 60 PSDLtoPSDL() 61 { 62 super(new DefaultCommandLine("psdl", 64 "file", 65 "Compile a file and regenerate the OMG PSDL part only", 66 true), 67 "generated.psdl"); 68 } 69 70 76 82 88 95 public int 96 run(java.lang.String [] args) 97 { 98 String filename = args[0]; 99 100 if(!initAST()) 102 return -1; 103 104 FileScope fileScope = compile(filename); 106 if(fileScope == null) 107 return -1; 108 109 if (!generate_psdl(fileScope, filename, getOutputFileName())) 111 return -1; 112 113 return 0; 115 } 116 117 123 129 135 141 147 159 public boolean 160 generate_psdl(org.objectweb.openccm.ast.api.FileScope filescope, 161 String inputfile, 162 String outputfile) 163 { 164 org.objectweb.openccm.generator.psdl.api.PSDLGenerator gen = 166 new org.objectweb.openccm.generator.psdl.lib.PSDLGenerator(getAST()); 167 gen.initialize(outputfile, "PSDLtoPSDL"); 168 169 getConsole().message("Generating PSDL from " + inputfile + "..."); 171 try 172 { 173 gen.generate( filescope, org.objectweb.openccm.ast.api.DeclarationKind.dk_psdl ); 174 } 175 catch(org.objectweb.openccm.generator.common.lib.GenerationException ex) 176 { 177 report_exception(ex); 178 return false; 179 } 180 181 getConsole().message("PSDL generated in " + outputfile + "."); 182 return true; 183 } 184 185 191 196 public static void 197 main(String [] args) 198 { 199 PSDLtoPSDL psdl2psdl = new PSDLtoPSDL(); 200 psdl2psdl.runMain(args); 201 } 202 } 203 | Popular Tags |