changeset 1719:daafdf4c2924

final files
author bachmann
date Wed, 30 Mar 2011 08:57:30 +0000
parents 437c0988ce71
children a614aebe854c
files make/tools/src/build/tools/charsetmapping/DuplicateFormatFlagsException.java make/tools/src/build/tools/charsetmapping/UnknownFormatFlagsException.java make/tools/src/build/tools/spp/Spp.java
diffstat 3 files changed, 149 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/src/build/tools/charsetmapping/DuplicateFormatFlagsException.java	Wed Mar 30 08:57:30 2011 +0000
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package build.tools.charsetmapping;
+
+/**
+ * Unchecked exception thrown when duplicate flags are provided in the format
+ * specifier.
+ *
+ * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
+ * method or constructor in this class will cause a {@link
+ * NullPointerException} to be thrown.
+ *
+ * @since 1.5
+ */
+public class DuplicateFormatFlagsException extends IllegalFormatException {
+
+    private static final long serialVersionUID = 18890531L;
+
+    private String flags;
+
+    /**
+     * Constructs an instance of this class with the specified flags.
+     *
+     * @param  f
+     *         The set of format flags which contain a duplicate flag.
+     */
+    public DuplicateFormatFlagsException(String f) {
+        if (f == null)
+            throw new NullPointerException();
+        this.flags = f;
+    }
+
+    /**
+     * Returns the set of flags which contains a duplicate flag.
+     *
+     * @return  The flags
+     */
+    public String getFlags() {
+        return flags;
+    }
+
+    public String getMessage() {
+    	Formatter formatter = new Formatter();
+    	formatter.format("Flags = '%s'", new Object[] { flags });
+        return formatter.out().toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/src/build/tools/charsetmapping/UnknownFormatFlagsException.java	Wed Mar 30 08:57:30 2011 +0000
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package build.tools.charsetmapping;
+
+/**
+ * Unchecked exception thrown when an unknown flag is given.
+ *
+ * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
+ * method or constructor in this class will cause a {@link
+ * NullPointerException} to be thrown.
+ *
+ * @since 1.5
+ */
+public class UnknownFormatFlagsException extends IllegalFormatException {
+
+    private static final long serialVersionUID = 19370506L;
+
+    private String flags;
+
+    /**
+     * Constructs an instance of this class with the specified flags.
+     *
+     * @param  f
+     *         The set of format flags which contain an unknown flag
+     */
+    public UnknownFormatFlagsException(String f) {
+        if (f == null)
+            throw new NullPointerException();
+        this.flags = f;
+    }
+
+    /**
+     * Returns the set of flags which contains an unknown flag.
+     *
+     * @return  The flags
+     */
+    public String getFlags() {
+        return flags;
+    }
+
+    // javadoc inherited from Throwable.java
+    public String getMessage() {
+        return "Flags = " + flags;
+    }
+}
--- a/make/tools/src/build/tools/spp/Spp.java	Wed Mar 30 08:39:34 2011 +0000
+++ b/make/tools/src/build/tools/spp/Spp.java	Wed Mar 30 08:57:30 2011 +0000
@@ -73,7 +73,7 @@
                 int i = arg.indexOf('=');
                 String key = arg.substring(2, i);
                 String value = arg.substring(i+1);
-                System.err.println(key + " : " + value);
+//                System.err.println(key + " : " + value);
                 vars.put(key,value);
             } else if (arg.startsWith("-K")) {
                 keys.add(arg.substring(2));
@@ -114,40 +114,33 @@
                 Set keys, Map vars) {
         vardef.reset(ln);
         while (vardef.find()) {
- 			System.err.println("...while...");
             String repl = "";
             if (vardef.group(GN_VAR) != null) {
                 String group = vardef.group(GN_VAR);
-                System.err.println("GN_VAR: " + group);
-				// repl = (String)vars.get(group);
-                Iterator iter = vars.entrySet().iterator();
-                while (iter.hasNext()) {
-                	Map.Entry entry = (Map.Entry)iter.next();
-                	String key = (String)entry.getKey();
-                	if (String.CASE_INSENSITIVE_ORDER.compare(key, group) == 0) {
-                		repl = (String)entry.getValue();
-                		break;
-                	}
-                }
+				repl = (String)vars.get(group);
+////                Iterator iter = vars.entrySet().iterator();
+////                while (iter.hasNext()) {
+////                	Map.Entry entry = (Map.Entry)iter.next();
+////                	String key = (String)entry.getKey();
+////                	if (String.CASE_INSENSITIVE_ORDER.compare(key, group) == 0) {
+////                		repl = (String)entry.getValue();
+////                		break;
+////                	}
+////                }
         	} else {
                 boolean test = keys.contains(vardef.group(GN_KEY));
                 if (vardef.group(GN_NOT) != null) {
-                	System.err.println("GN_NO");
                     test = !test;
 	        	}
                 if (test) {
- 					System.err.println("GN_YES");
                 	repl = vardef.group(GN_YES);
                 } else {
- 					System.err.println("GN_NO");
                 	repl = vardef.group(GN_NO);
                 }
                 if (repl == null) {
- 					System.err.println("null");
                     repl = "";
                 } else {  // embedded $var$
                     while (vardef2.reset(repl).find()) {
-	 					System.err.println("...finding...");
                     	Object group = vardef2.group(1);
                     	String string = (String)vars.get(group);
                         repl = vardef2.replaceFirst(string);