You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/12/17 10:51:12 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler XSLTC.java
morten 01/12/17 01:51:12
Modified: java/src/org/apache/xalan/xsltc/compiler XSLTC.java
Log:
Removed the main() method from the XSLTC class. This class represents the
native API of the compiler.
PR: none
Obtained from: n/a
Submitted by: morten@xml.apache.org
Reviewed by: morten@xml.apache.org
Revision Changes Path
1.34 +1 -115 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java
Index: XSLTC.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- XSLTC.java 2001/11/09 13:40:05 1.33
+++ XSLTC.java 2001/12/17 09:51:12 1.34
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: XSLTC.java,v 1.33 2001/11/09 13:40:05 morten Exp $
+ * @(#)$Id: XSLTC.java,v 1.34 2001/12/17 09:51:12 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -729,119 +729,5 @@
public boolean debug() {
return _debug;
}
-
- /**
- * This method implements the command line compiler. See the USAGE_STRING
- * constant for a description. It may make sense to move the command-line
- * handling to a separate package (ie. make one xsltc.cmdline.Compiler
- * class that contains this main() method and one xsltc.cmdline.Transform
- * class that contains the DefaultRun stuff).
- */
- public static void main(String[] args) {
- try {
- boolean inputIsURL = false;
-
- final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhs");
- if (args.length < 1) {
- printUsage();
- return;
- }
-
- final XSLTC xsltc = new XSLTC();
- xsltc.init();
-
- int c;
- while ((c = getopt.getNextOption()) != -1) {
- switch(c) {
- case 'o':
- xsltc.setClassName(getopt.getOptionArg());
- break;
- case 'd':
- xsltc.setDestDirectory(getopt.getOptionArg());
- break;
- case 'p':
- xsltc.setPackageName(getopt.getOptionArg());
- break;
- case 'j':
- xsltc.setJarFileName(getopt.getOptionArg());
- break;
- case 'x':
- xsltc.setDebug(true);
- break;
- case 'u':
- inputIsURL = true;
- break;
- case 's':
- allowSystemExit = false;
- break;
- case 'h':
- default:
- printUsage();
- break;
- }
- }
-
- // Generate a vector containg URLs for all stylesheets specified
- final String[] stylesheetNames = getopt.getCmdArgs();
- final Vector stylesheetVector = new Vector();
- for (int i = 0; i < stylesheetNames.length; i++) {
- final String stylesheetName = stylesheetNames[i];
- final URL stylesheetURL;
- if (inputIsURL) {
- stylesheetVector.addElement(new URL(stylesheetName));
- }
- else {
- stylesheetVector.addElement((new File(stylesheetName)).toURL());
- }
-
- }
- // Compile the stylesheet and output class/jar file(s)
- if (xsltc.compile(stylesheetVector)) {
- if (xsltc.getJarFileName() != null) xsltc.outputToJar();
- }
- else {
- Util.println("compilation failed");
- doSystemExit(1); return;
- }
- }
- catch (GetOptsException ex) {
- System.err.println(ex);
- printUsage();
- }
- catch (Exception e) {
- e.printStackTrace();
- doSystemExit(1);
- }
- }
-
- /** If we should call System.exit or not */
- protected static boolean allowSystemExit = true;
-
- /** Worker method to call System.exit or not */
- protected static void doSystemExit(int retVal) {
- if (allowSystemExit)
- System.exit(retVal);
- }
-
- private final static String USAGE_STRING =
- "Usage:\n" +
- " xsltc [-o <output>] [-d <directory>] [-j <jarfile>]\n"+
- " [-p <package name>] [-x] [-s] [-u] <stylesheet>... \n\n"+
- " Where <output> is the name to give the the generated translet.\n"+
- " <stylesheet> is one or more stylesheet file names, or if,\n"+
- " the -u options is specified, one or more stylesheet URLs.\n"+
- " <directory> is the output directory.\n"+
- " <jarfile> is the name of a JAR-file to put all generated classes in.\n"+
- " <package-name> is a package name to prefix all class names with.\n\n"+
- " Notes:\n"+
- " The -o option is ignored when multiple stylesheets are specified.\n"+
- " The -x option switched on debug messages.\n"+
- " The -s option prevents the compiler from exiting\n";
-
- public static void printUsage() {
- System.err.println(USAGE_STRING);
- doSystemExit(1);
- return;
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org