35 36 package com.sun.tools.corba.se.idl; 37 38 // NOTES: 39 // -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.). 40 // -D58319<daz> Display version info. for -version option. 41 42 import java.io.FileNotFoundException; 43 import java.io.IOException; 44 import java.util.Enumeration; 45 import java.util.Hashtable; 46 import java.util.Vector; 47 48 import com.sun.tools.corba.se.idl.constExpr.ExprFactory; 49 import com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory; 50 51 /** 52 * Compiler usage: 53 * <br><br> 54 * 55 * java com.sun.tools.corba.se.idl.toJava.compile [options] <idl file> 56 * <br><br> 57 * 58 * where <idl file> is the name of a file containing IDL definitions, 59 * and [options] is any combination of the options listed below. The options 60 * and the idl file name can appear in any order. 61 * <br><br> 62 * 63 * Options: 64 * <dl> 65 * <dt>-i <include path> 66 * <dd>By default, the current directory is scanned for included files. 67 * This option adds another directory. See also Note 1 below. 68 * 69 * <dt>-d <symbol> 70 * <dd>This is equivalent to the following line in an IDL file: #define <symbol> 71 * 72 * <dt>-emitAll 73 * <dd>Emit all types, including those found in #included files. 74 * 75 * <dt>-v 76 * <dd>Verbose mode. 77 * </dl> 78 * 79 * Note 1: If you have an include path or paths that you will always be using, 80 * it can get tedious putting these on the command with the -i option all the 81 * time. Instead, these can be placed into a config file called idl.config. 82 * This file must be in the CLASSPATH. The format of the includes line is: 83 * 84 * <pre> 85 * includes=<path1>;<path2>;...;<pathN> 86 * </pre> 87 * 88 * Note that the path separator character, here shown as a semicolon, is 89 * machine dependent. For instance, on Windows 95 this character is a 90 * semicolon, on UNIX it is a colon. 91 * 92 * <p> 93 * Note 2: If you are directly invoking the main method on this class (not 94 * a subclass), then it will only check that the IDL file is syntactically 95 * correct. It does not generate any files. Only extensions to this 96 * framework generate files, therefore an extension must be invoked if you 97 * want files to be generated. 98 * <br><br> 99 * 100 * To Extend the compiler: 101 * <br><br> 102 * 103 * You only need to extend the compiler if you want it to generate something 104 * other than what it currently generates. 105 * <br><br> 106 * 464 TypedefEntry.typedefGen = tgen == null ? noop : tgen; 465 466 UnionGen ugen = genFactory.createUnionGen (); 467 UnionEntry.unionGen = ugen == null ? noop : ugen; 468 } // initGenerators 469 470 /** 471 * Write the version number of this compiler to standard out. 472 **/ 473 protected void displayVersion () 474 { 475 String message = Util.getMessage ("Version.product", Util.getMessage ("Version.number")); 476 System.out.println (message); 477 } 478 479 /** 480 * This is the repository of emitter arguments. 481 **/ 482 public Arguments arguments = null; 483 /** 484 * This hashtable contains <real name, alias> pairs. It is filled in by 485 * extenders in cases where they wish to override an IDL type name with 486 * some other name. For instance, when mapping to Java, there could be 487 * an overrideNames entry of <"TRUE", "true">. NOTE: Do NOT change this 488 * variable to a new Hash table. Just add elements to it. 489 **/ 490 protected Hashtable overrideNames = new Hashtable (); 491 /** 492 * This is the symbol table. It will be empty until the parse method 493 * executes. If errors are encountered, the state of the symbol table 494 * is undefined. 495 **/ 496 protected Hashtable symbolTable = new Hashtable (); 497 /** 498 * This is a vector of strings of the form "IDLfile" or <IDLfile>. It is 499 * a list of the files included in the given IDL file. It will be empty 500 * until the parse method executes. If errors are encountered, the state 501 * of this vector is undefined. 502 **/ 503 protected Vector includes = new Vector (); 504 /** 505 * This is a vector of IncludeEntry's. It is a list of the files included 506 * in the given IDL file. It mirrors the includes vector. It will be empty 507 * until the parse method executes. If errors are encountered, the state of 508 * this vector is undefined. 509 **/ 510 protected Vector includeEntries = new Vector (); 511 static Noop noop = new Noop (); 512 private GenFactory genFactory = null; 513 private SymtabFactory symtabFactory = null; 514 private ExprFactory exprFactory = null; 515 private Parser parser = null; 516 Preprocessor preprocessor = new Preprocessor (); 517 private NoPragma noPragma = new NoPragma (); 518 private Enumeration emitList = null; 519 private String[] keywords = null; | 35 36 package com.sun.tools.corba.se.idl; 37 38 // NOTES: 39 // -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.). 40 // -D58319<daz> Display version info. for -version option. 41 42 import java.io.FileNotFoundException; 43 import java.io.IOException; 44 import java.util.Enumeration; 45 import java.util.Hashtable; 46 import java.util.Vector; 47 48 import com.sun.tools.corba.se.idl.constExpr.ExprFactory; 49 import com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory; 50 51 /** 52 * Compiler usage: 53 * <br><br> 54 * 55 * {@code java com.sun.tools.corba.se.idl.toJava.compile [options] <idl file>} 56 * <br><br> 57 * 58 * where <idl file> is the name of a file containing IDL definitions, 59 * and [options] is any combination of the options listed below. The options 60 * and the idl file name can appear in any order. 61 * <br><br> 62 * 63 * Options: 64 * <dl> 65 * <dt>{@code -i <include path>} 66 * <dd>By default, the current directory is scanned for included files. 67 * This option adds another directory. See also Note 1 below. 68 * 69 * <dt>{@code -d <symbol>} 70 * <dd>This is equivalent to the following line in an IDL file: {@code #define <symbol>} 71 * 72 * <dt>{@code -emitAll} 73 * <dd>Emit all types, including those found in #included files. 74 * 75 * <dt>{@code -v} 76 * <dd>Verbose mode. 77 * </dl> 78 * 79 * Note 1: If you have an include path or paths that you will always be using, 80 * it can get tedious putting these on the command with the -i option all the 81 * time. Instead, these can be placed into a config file called idl.config. 82 * This file must be in the CLASSPATH. The format of the includes line is: 83 * 84 * <pre>{@code 85 * includes=<path1>;<path2>;...;<pathN> 86 * }</pre> 87 * 88 * Note that the path separator character, here shown as a semicolon, is 89 * machine dependent. For instance, on Windows 95 this character is a 90 * semicolon, on UNIX it is a colon. 91 * 92 * <p> 93 * Note 2: If you are directly invoking the main method on this class (not 94 * a subclass), then it will only check that the IDL file is syntactically 95 * correct. It does not generate any files. Only extensions to this 96 * framework generate files, therefore an extension must be invoked if you 97 * want files to be generated. 98 * <br><br> 99 * 100 * To Extend the compiler: 101 * <br><br> 102 * 103 * You only need to extend the compiler if you want it to generate something 104 * other than what it currently generates. 105 * <br><br> 106 * 464 TypedefEntry.typedefGen = tgen == null ? noop : tgen; 465 466 UnionGen ugen = genFactory.createUnionGen (); 467 UnionEntry.unionGen = ugen == null ? noop : ugen; 468 } // initGenerators 469 470 /** 471 * Write the version number of this compiler to standard out. 472 **/ 473 protected void displayVersion () 474 { 475 String message = Util.getMessage ("Version.product", Util.getMessage ("Version.number")); 476 System.out.println (message); 477 } 478 479 /** 480 * This is the repository of emitter arguments. 481 **/ 482 public Arguments arguments = null; 483 /** 484 * This hashtable contains {@code <real name, alias>} pairs. It is filled in by 485 * extenders in cases where they wish to override an IDL type name with 486 * some other name. For instance, when mapping to Java, there could be 487 * an overrideNames entry of {@code <"TRUE", "true">}. NOTE: Do NOT change this 488 * variable to a new Hash table. Just add elements to it. 489 **/ 490 protected Hashtable overrideNames = new Hashtable (); 491 /** 492 * This is the symbol table. It will be empty until the parse method 493 * executes. If errors are encountered, the state of the symbol table 494 * is undefined. 495 **/ 496 protected Hashtable symbolTable = new Hashtable (); 497 /** 498 * This is a vector of strings of the form {@code "IDLfile"} or {@code <IDLfile>}. 499 * It is a list of the files included in the given IDL file. It will be empty 500 * until the parse method executes. If errors are encountered, the state 501 * of this vector is undefined. 502 **/ 503 protected Vector includes = new Vector (); 504 /** 505 * This is a vector of IncludeEntry's. It is a list of the files included 506 * in the given IDL file. It mirrors the includes vector. It will be empty 507 * until the parse method executes. If errors are encountered, the state of 508 * this vector is undefined. 509 **/ 510 protected Vector includeEntries = new Vector (); 511 static Noop noop = new Noop (); 512 private GenFactory genFactory = null; 513 private SymtabFactory symtabFactory = null; 514 private ExprFactory exprFactory = null; 515 private Parser parser = null; 516 Preprocessor preprocessor = new Preprocessor (); 517 private NoPragma noPragma = new NoPragma (); 518 private Enumeration emitList = null; 519 private String[] keywords = null; |