throw new IOException("Bad generate prefix in " + defFile);
int ibang = firstLine.indexOf('!'); if (ibang > -1) { gen = firstLine.substring(ibang+1).trim(); } else { throw new IOException("Bad generate prefix in " + defFile); }
  public void makeDirs( PrintStream out )  {      // Create a list of directories.      Vector dirs = getCachedResult(DirsCacheKey);      if( dirs == null ) { throw new RuntimeException("No Directory Names Cached"); }      // Create a list of files.      Vector files = getCachedResult(FilesCacheKey);      if( files == null ) { throw new RuntimeException("No File Names Cached"); }      // Print statistics on the number of files and directories.      out.println();      out.println("found " + files.size() + " files in " + dirs.size() + " directories.");      out.println();           String path_sep = System.getProperty("path.separator"); // We're generating stuff for UNIX and NT.      // Build a classpath string from the environment var CLASSPATH, and      // add the source and destination directories to the front.      String classpath = sourceDirectory + 			 path_sep + 			 classDirectory + 			 path_sep + 			 System.getProperty("java.class.path");       // Set the compiler name and flags.          String compilerName  = new String();  // Name of the compiler.      String compilerFlags = new String();  // Compiler options, including classpath.      String cmd           = new String();  // Full command to be executed.        if (usingJikes==true) {        // Using Jikes?? (Not supported)	compilerName  = "jikes";	compilerFlags = " +D -g  -classpath \"" + classpath + "\" -d " + classDirectory;      } // if      else {                         // Using javac??	compilerName  = "javac";	compilerFlags = " ";	compilerFlags = compilerFlags + " -J-mx64m -g -nowarn -classpath \"" + classpath + "\" -d " + classDirectory;        if (deprecation==true) {     // Deprecation specified from command line??	  compilerFlags = compilerFlags + " -deprecation "; 	} // if        if (bootclasspath != null) {          compilerFlags = compilerFlags + " -bootclasspath \"" + bootclasspath + "\"  ";	} // if      } // else      // Write compile commands to a .sh and .bat file, which will be executed later.      try {        // Create the .bat and .sh files that will call javac.	DataOutputStream bat = new DataOutputStream(new FileOutputStream("alp_compile.bat"));	DataOutputStream sh  = new DataOutputStream(new FileOutputStream("alp_compile.sh"));        // 1st line of generated file.	sh.writeBytes("#!/bin/sh" + "\n\n");	bat.writeBytes("@echo off" + "\n\n");              // Read the .def files, and generate the apporpriate commands. 	for (Enumeration defs = getDefFilesFromSourceTree(dirs); defs.hasMoreElements(); ) {	  File defFile = (File) defs.nextElement();          try {            BufferedReader in = new BufferedReader(new FileReader(defFile));            try {              String firstLine = in.readLine();              if (firstLine.startsWith(GEN_PREFIX)) {                String gen = firstLine.substring(GEN_PREFIX.length());                sh.writeBytes("\n");                sh.writeBytes("echo   " + "\n");		sh.writeBytes("echo \"=> .def file: " +  defFile + "\"" + "\n");                sh.writeBytes("cd " + defFile.getParent() + "\n");                sh.writeBytes("java -classpath \"" + classpath + "\" " + gen + "\n");		bat.writeBytes("\n");                bat.writeBytes("echo   " + "\n");		bat.writeBytes("echo \"=> .def file: " +  defFile + "\"" + "\n");                bat.writeBytes("cd " + defFile.getParent() + "\n");                bat.writeBytes("java -classpath \"" + classpath + "\" " + gen + "\n");              } else {                throw new IOException("Bad generate prefix in " + defFile);              }            }            finally {              in.close();            }          }          catch (IOException ioe) {            System.err.println(ioe);          }	} // for        // Generate a line for building every dir that contains a .java file...	int i;	Enumeration e = dirs.elements();       	for(i=0; e.hasMoreElements(); i++) {	  File f = (File) e.nextElement();		  // for (i=dirs.size()-1; i>=0; i--) {	  //   File f = (File) dirs.elementAt(i);	  String dname = f.getAbsolutePath();	  // No .java files in the current directory.	  if (dirHasJavaFiles(f) == false) {	    continue;  // Next dir...	  } // if	  // Now pickup up when scanning directories.	  //      	  if (dirHasSkipCompileFile(f) == true) {	  //       	    continue; // Next dir...	  //       	  } // if	  // Build the command.	  cmd = compilerName + " " + compilerFlags + " " + dname +  f.separator + "*.java";	  	  // Print the command about to be executed.	  //	  out.println("COMPILING: <" + i + "> " + f.getAbsolutePath());	  //	  out.println(cmd);           	  // Write the command to the .bat file:	  bat.writeBytes("echo  ." + "\n");          bat.writeBytes("echo COMPILING: " + dname  + "\n");	  bat.writeBytes(cmd + "\n\n");	  // Write the command to the .sh file:	  sh.writeBytes("echo   " + "\n");	  sh.writeBytes("echo COMPILING: " + dname  + "\n");	  sh.writeBytes(cmd + "\n\n");	} // for      } catch (Exception x) {  // If the file can't be written, dump stach, and abort.	x.printStackTrace();	System.exit(1);      }  } // makeDirs( PrintStream)