DEADSOFTWARE

Remove batch
[gpcp-linux.git] / J2CPS / J2CPS.java
1 /**********************************************************************/
2 /* Main class for J2CPS */
3 /* */
4 /* (c) copyright QUT */
5 /**********************************************************************/
6 package J2CPS;
8 import java.io.IOException;
10 public class J2CPS {
12 /**
13 * Main program. Takes a package name as a parameter, produces the
14 * Component Pascal symbol file.
15 */
16 public static void main(String args[]) {
17 int argLen = args.length;
18 boolean anonPack = false;
19 J2CPSFiles.GetPaths();
20 String filename = null;
21 TypeDesc.InitTypes();
22 if (argLen == 0) {
23 System.err.println("J2CPS version 1.3.13.2 (August 2012)");
24 System.err.println("Usage: java J2CPS [options] packagename");
25 System.err.println("Options may be in any order.");
26 System.err.println(" -d dir symbol file directory");
27 System.err.println(" -u use unique names");
28 System.err.println(" -v verbose diagnostic messages");
29 System.exit(0);
30 }
31 else {
32 int argIx = 0;
33 filename = args[argIx];
34 while (filename.startsWith("-")) {
35 /* parse options here */
36 if (filename.charAt(1) == 'v') {
37 ClassDesc.verbose = true;
38 } else if (filename.charAt(1) == 'f') {
39 System.out.println("Class not package");
40 anonPack = true;
41 } else if (filename.charAt(1) == 'u') {
42 System.out.println("Using unique names");
43 ClassDesc.overloadedNames = false;
44 } else if (filename.charAt(1) == 'd') {
45 if (argIx + 1 < argLen) {
46 filename = args[++argIx];
47 J2CPSFiles.SetSymDir(filename);
48 } else {
49 System.err.println("-d option is missing directory name");
50 }
51 } else {
52 System.err.println("Unknown option " + filename);
53 }
54 if (argIx + 1 < argLen) {
55 filename = args[++argIx];
56 } else {
57 System.err.println("No package name given, terminating");
58 System.exit(1);
59 }
60 }
61 }
62 try {
63 PackageDesc thisPackage = PackageDesc.MakeNewPackageDesc(filename, anonPack);
64 PackageDesc.ReadPackages();
65 PackageDesc.WriteSymbolFiles();
66 }
67 catch (IOException e) {
68 System.err.println("IOException occurs while reading input file.");
69 System.err.println("Aborting...");
70 System.exit(1);
71 }
72 }
73 }