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 CIDLtoCIDL 43 extends CompilerGeneratorBase 44 implements org.objectweb.openccm.command.api.CIDLtoCIDL 45 { 46 52 58 59 public 60 CIDLtoCIDL() 61 { 62 super(new DefaultCommandLine("cidl", 64 "file", 65 "Compile a file and regenerate the OMG CIDL part only", 66 true), 67 "generated.cidl"); 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_cidl(fileScope, filename, getOutputFileName())) 111 return -1; 112 113 return 0; 115 } 116 117 123 129 135 141 147 159 public boolean 160 generate_cidl(org.objectweb.openccm.ast.api.FileScope filescope, 161 String inputfile, 162 String outputfile) 163 { 164 org.objectweb.openccm.generator.cidl.api.CIDLGenerator gen = 166 new org.objectweb.openccm.generator.cidl.lib.CIDLGenerator(getAST()); 167 gen.initialize(outputfile, "CIDLtoCIDL"); 168 169 getConsole().message("Generating CIDL from " + inputfile + "..."); 171 try 172 { 173 gen.generate( filescope, org.objectweb.openccm.ast.api.DeclarationKind.dk_cidl ); 174 } 175 catch(org.objectweb.openccm.generator.common.lib.GenerationException ex) 176 { 177 report_exception(ex); 178 return false; 179 } 180 181 getConsole().message("CIDL generated in " + outputfile + "."); 182 return true; 183 } 184 185 191 196 public static void 197 main(String [] args) 198 { 199 CIDLtoCIDL cidl2cidl = new CIDLtoCIDL(); 200 cidl2cidl.runMain(args); 201 } 202 } 203 | Popular Tags |