added -J option to preserve unmodified files in preexisting jarfile
[org.ibex.tool.git] / src / org / ibex / tool / Preprocessor.java
index 0df4c0f..8ab48ba 100644 (file)
@@ -1,7 +1,6 @@
-// You may modify, copy, and redistribute this code under the terms of
-// the GNU Library Public License version 2.1, with the exception of
-// the portion of clause 6a after the semicolon (aka the "obnoxious
-// relink clause").
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
 
 package org.ibex.tool;
 
@@ -233,14 +232,14 @@ PROCESS:
                 }
                 out.println("//#endif "+expr);
 
-            } else if (trimmed.startsWith("//#switch")) {
+            } else if (trimmed.startsWith("//#switch") || trimmed.startsWith("//#jsswitch")) {
                 int expStart = trimmed.indexOf('(') +1;
                 if (expStart < 1) { err.add(new Error("expected ( in #switch")); continue PROCESS; }
                 int expEnd = trimmed.lastIndexOf(')');
                 if (expEnd == -1) { err.add(new Error("expected ) in #switch")); continue PROCESS; }
                 if (expEnd - expStart <= 1) { err.add(new Error("badly formed #switch statement")); continue PROCESS; }
                 String expr = trimmed.substring(expStart, expEnd);
-
+                if (trimmed.startsWith("//#jsswitch")) expr = "JSU.toString("+expr+")";
                 out.print("final String ccSwitch"+enumSwitch+" = (String)("+expr+");  ");
                 out.print("SUCCESS:do { switch(ccSwitch"+enumSwitch+".length()) {\n");