Merge jdk7-b53

Tue, 31 Mar 2009 08:53:16 -0700

author
xdono
date
Tue, 31 Mar 2009 08:53:16 -0700
changeset 63
3c4d73194f6f
parent 62
2e02b4137dad
parent 61
61116c9789b9
child 64
8130ac858d67

Merge

src/share/classes/com/sun/tools/corba/se/logutil/lib/jscheme.jar file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/corba/se/logutil/lib/jschemelogutil.jar file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/corba/se/logutil/scripts/mc file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/corba/se/logutil/scripts/mc.scm file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/corba/se/logutil/scripts/run file | annotate | diff | comparison | revisions
     1.1 --- a/make/com/sun/corba/se/sources/Makefile	Fri Mar 27 14:11:32 2009 -0700
     1.2 +++ b/make/com/sun/corba/se/sources/Makefile	Tue Mar 31 08:53:16 2009 -0700
     1.3 @@ -46,8 +46,6 @@
     1.4  include $(CORBA_JMK_DIRECTORY)com_sun_corba_se_PortableActivationIDL.jmk
     1.5  include $(CORBA_JMK_DIRECTORY)com_sun_corba_se_impl_logging.jmk
     1.6  
     1.7 -FILES_java += com/sun/corba/se/org/omg/CORBA/ORB.java
     1.8 -
     1.9  #
    1.10  # Dirs
    1.11  #
    1.12 @@ -80,11 +78,11 @@
    1.13  POA.MC          = $(SRC_DIR)/com/sun/corba/se/spi/logging/data/POA.mc
    1.14  UTIL.MC         = $(SRC_DIR)/com/sun/corba/se/spi/logging/data/Util.mc
    1.15  
    1.16 -MC_GENERATE_CLASS = $(SRC_DIR)/com/sun/tools/corba/se/logutil/scripts/mc.scm -main main make-class
    1.17 -MC_GENERATE_LOG_RB = $(SRC_DIR)/com/sun/tools/corba/se/logutil/scripts/mc.scm -main main make-resource 
    1.18 +MC_GENERATE_CLASS = make-class
    1.19 +MC_GENERATE_LOG_RB = make-resource 
    1.20  
    1.21 -JSCHEME_GENERATE_CLASS = $(BOOT_JAVA_CMD) jscheme.REPL $(MC_GENERATE_CLASS) 
    1.22 -JSCHEME_GENERATE_LOG_RB = $(BOOT_JAVA_CMD) jscheme.REPL $(MC_GENERATE_LOG_RB) 
    1.23 +JSCHEME_GENERATE_CLASS = $(BOOT_JAVA_CMD) com.sun.tools.corba.se.logutil.MC $(MC_GENERATE_CLASS) 
    1.24 +JSCHEME_GENERATE_LOG_RB = $(BOOT_JAVA_CMD) com.sun.tools.corba.se.logutil.MC $(MC_GENERATE_LOG_RB) 
    1.25  
    1.26  
    1.27  #
     2.1 --- a/make/sun/rmi/corbalogsources/Makefile	Fri Mar 27 14:11:32 2009 -0700
     2.2 +++ b/make/sun/rmi/corbalogsources/Makefile	Tue Mar 31 08:53:16 2009 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  #
     2.5 -# Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
     2.6 +# Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
     2.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8  #
     2.9  # This code is free software; you can redistribute it and/or modify it
    2.10 @@ -75,15 +75,14 @@
    2.11  POA.MC          = $(SRC_DIR)/com/sun/corba/se/spi/logging/data/POA.mc
    2.12  UTIL.MC         = $(SRC_DIR)/com/sun/corba/se/spi/logging/data/Util.mc
    2.13  
    2.14 -MC_GENERATE_CLASS = $(SRC_DIR)/com/sun/tools/corba/se/logutil/scripts/mc.scm -main main make-class
    2.15 -MC_GENERATE_LOG_RB = $(SRC_DIR)/com/sun/tools/corba/se/logutil/scripts/mc.scm -main main make-resource 
    2.16 +MC_GENERATE_CLASS = make-class
    2.17 +MC_GENERATE_LOG_RB = make-resource 
    2.18  
    2.19 -JSCHEME_LIB_DIRECTORY=$(SRC_DIR)/com/sun/tools/corba/se/logutil/lib
    2.20 -JSCHEME_CLASSPATH=$(JSCHEME_LIB_DIRECTORY)/jscheme.jar$(CLASSPATH_SEPARATOR)$(JSCHEME_LIB_DIRECTORY)/jschemelogutil.jar
    2.21 -JSCHEME_GENERATE_CLASS = $(BOOT_JAVA_CMD) \
    2.22 -    -cp "$(JSCHEME_CLASSPATH)" jscheme.REPL $(MC_GENERATE_CLASS) 
    2.23 -JSCHEME_GENERATE_LOG_RB = $(BOOT_JAVA_CMD) \
    2.24 -    -cp "$(JSCHEME_CLASSPATH)" jscheme.REPL $(MC_GENERATE_LOG_RB) 
    2.25 +MC_CLASSPATH=$(BUILDTOOLJARDIR)/MC.jar
    2.26 +MCJ_GENERATE_CLASS = $(BOOT_JAVA_CMD) \
    2.27 +    -cp "$(MC_CLASSPATH)" com.sun.tools.corba.se.logutil.MC $(MC_GENERATE_CLASS) 
    2.28 +MCJ_GENERATE_LOG_RB = $(BOOT_JAVA_CMD) \
    2.29 +    -cp "$(MC_CLASSPATH)" com.sun.tools.corba.se.logutil.MC $(MC_GENERATE_LOG_RB) 
    2.30  
    2.31  
    2.32  #
    2.33 @@ -104,28 +103,28 @@
    2.34  	$(MKDIR) -p $(LOG_GENDIRECTORY)
    2.35  
    2.36  $(LOG_GENDIRECTORY)/ActivationSystemException.java : $(ACTIVATION.MC)
    2.37 -	$(JSCHEME_GENERATE_CLASS) $(ACTIVATION.MC) $(LOG_GENDIRECTORY)
    2.38 +	$(MCJ_GENERATE_CLASS) $(ACTIVATION.MC) $(LOG_GENDIRECTORY)
    2.39  
    2.40  $(LOG_GENDIRECTORY)/IORSystemException.java : $(IOR.MC)
    2.41 -	$(JSCHEME_GENERATE_CLASS) $(IOR.MC) $(LOG_GENDIRECTORY)
    2.42 +	$(MCJ_GENERATE_CLASS) $(IOR.MC) $(LOG_GENDIRECTORY)
    2.43  
    2.44  $(LOG_GENDIRECTORY)/InterceptorsSystemException.java : $(INTERCEPTORS.MC)
    2.45 -	$(JSCHEME_GENERATE_CLASS) $(INTERCEPTORS.MC) $(LOG_GENDIRECTORY)
    2.46 +	$(MCJ_GENERATE_CLASS) $(INTERCEPTORS.MC) $(LOG_GENDIRECTORY)
    2.47  
    2.48  $(LOG_GENDIRECTORY)/NamingSystemException.java : $(NAMING.MC)
    2.49 -	$(JSCHEME_GENERATE_CLASS) $(NAMING.MC) $(LOG_GENDIRECTORY)
    2.50 +	$(MCJ_GENERATE_CLASS) $(NAMING.MC) $(LOG_GENDIRECTORY)
    2.51  
    2.52  $(LOG_GENDIRECTORY)/OMGSystemException.java : $(OMG.MC)
    2.53 -	$(JSCHEME_GENERATE_CLASS) $(OMG.MC) $(LOG_GENDIRECTORY)
    2.54 +	$(MCJ_GENERATE_CLASS) $(OMG.MC) $(LOG_GENDIRECTORY)
    2.55  
    2.56  $(LOG_GENDIRECTORY)/ORBUtilSystemException.java : $(ORBUTIL.MC)
    2.57 -	$(JSCHEME_GENERATE_CLASS) $(ORBUTIL.MC) $(LOG_GENDIRECTORY)
    2.58 +	$(MCJ_GENERATE_CLASS) $(ORBUTIL.MC) $(LOG_GENDIRECTORY)
    2.59  
    2.60  $(LOG_GENDIRECTORY)/POASystemException.java : $(POA.MC)
    2.61 -	$(JSCHEME_GENERATE_CLASS) $(POA.MC) $(LOG_GENDIRECTORY)
    2.62 +	$(MCJ_GENERATE_CLASS) $(POA.MC) $(LOG_GENDIRECTORY)
    2.63  
    2.64  $(LOG_GENDIRECTORY)/UtilSystemException.java : $(UTIL.MC)
    2.65 -	$(JSCHEME_GENERATE_CLASS) $(UTIL.MC) $(LOG_GENDIRECTORY)
    2.66 +	$(MCJ_GENERATE_CLASS) $(UTIL.MC) $(LOG_GENDIRECTORY)
    2.67  
    2.68  logresource.generate: $(LOG_GENDIRECTORY)/LogStrings.properties
    2.69  
    2.70 @@ -142,28 +141,28 @@
    2.71  	$(CAT) $(LOG_GENDIRECTORY)/*.resource > $(LOG_GENDIRECTORY)/LogStrings.properties
    2.72  
    2.73  $(LOG_GENDIRECTORY)/ActivationSystemException.resource : $(ACTIVATION.MC)
    2.74 -	$(JSCHEME_GENERATE_LOG_RB) $(ACTIVATION.MC) $(LOG_GENDIRECTORY)
    2.75 +	$(MCJ_GENERATE_LOG_RB) $(ACTIVATION.MC) $(LOG_GENDIRECTORY)
    2.76  
    2.77  $(LOG_GENDIRECTORY)/IORSystemException.resource : $(IOR.MC)
    2.78 -	$(JSCHEME_GENERATE_LOG_RB) $(IOR.MC) $(LOG_GENDIRECTORY)
    2.79 +	$(MCJ_GENERATE_LOG_RB) $(IOR.MC) $(LOG_GENDIRECTORY)
    2.80  
    2.81  $(LOG_GENDIRECTORY)/InterceptorsSystemException.resource : $(INTERCEPTORS.MC)
    2.82 -	$(JSCHEME_GENERATE_LOG_RB) $(INTERCEPTORS.MC) $(LOG_GENDIRECTORY)
    2.83 +	$(MCJ_GENERATE_LOG_RB) $(INTERCEPTORS.MC) $(LOG_GENDIRECTORY)
    2.84  
    2.85  $(LOG_GENDIRECTORY)/NamingSystemException.resource : $(NAMING.MC)
    2.86 -	$(JSCHEME_GENERATE_LOG_RB) $(NAMING.MC) $(LOG_GENDIRECTORY)
    2.87 +	$(MCJ_GENERATE_LOG_RB) $(NAMING.MC) $(LOG_GENDIRECTORY)
    2.88  
    2.89  $(LOG_GENDIRECTORY)/OMGSystemException.resource : $(OMG.MC)
    2.90 -	$(JSCHEME_GENERATE_LOG_RB) $(OMG.MC) $(LOG_GENDIRECTORY)
    2.91 +	$(MCJ_GENERATE_LOG_RB) $(OMG.MC) $(LOG_GENDIRECTORY)
    2.92  
    2.93  $(LOG_GENDIRECTORY)/ORBUtilSystemException.resource : $(ORBUTIL.MC)
    2.94 -	$(JSCHEME_GENERATE_LOG_RB) $(ORBUTIL.MC) $(LOG_GENDIRECTORY)
    2.95 +	$(MCJ_GENERATE_LOG_RB) $(ORBUTIL.MC) $(LOG_GENDIRECTORY)
    2.96  
    2.97  $(LOG_GENDIRECTORY)/POASystemException.resource : $(POA.MC)
    2.98 -	$(JSCHEME_GENERATE_LOG_RB) $(POA.MC) $(LOG_GENDIRECTORY)
    2.99 +	$(MCJ_GENERATE_LOG_RB) $(POA.MC) $(LOG_GENDIRECTORY)
   2.100  
   2.101  $(LOG_GENDIRECTORY)/UtilSystemException.resource : $(UTIL.MC)
   2.102 -	$(JSCHEME_GENERATE_LOG_RB) $(UTIL.MC) $(LOG_GENDIRECTORY)
   2.103 +	$(MCJ_GENERATE_LOG_RB) $(UTIL.MC) $(LOG_GENDIRECTORY)
   2.104  
   2.105  
   2.106  #
     3.1 --- a/make/tools/Makefile	Fri Mar 27 14:11:32 2009 -0700
     3.2 +++ b/make/tools/Makefile	Tue Mar 31 08:53:16 2009 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright 1998-2005 Sun Microsystems, Inc.  All Rights Reserved.
     3.6 +# Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -33,6 +33,7 @@
    3.11  SUBDIRS =                   \
    3.12    strip_properties          \
    3.13    idlj                      \
    3.14 +  logutil		    \
    3.15  
    3.16  all build clean clobber::
    3.17  	$(SUBDIRS-loop)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/make/tools/logutil/Makefile	Tue Mar 31 08:53:16 2009 -0700
     4.3 @@ -0,0 +1,43 @@
     4.4 +#
     4.5 +# Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     4.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 +#
     4.8 +# This code is free software; you can redistribute it and/or modify it
     4.9 +# under the terms of the GNU General Public License version 2 only, as
    4.10 +# published by the Free Software Foundation.  Sun designates this
    4.11 +# particular file as subject to the "Classpath" exception as provided
    4.12 +# by Sun in the LICENSE file that accompanied this code.
    4.13 +#
    4.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 +# version 2 for more details (a copy is included in the LICENSE file that
    4.18 +# accompanied this code).
    4.19 +#
    4.20 +# You should have received a copy of the GNU General Public License version
    4.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    4.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 +#
    4.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    4.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    4.26 +# have any questions.
    4.27 +#
    4.28 +
    4.29 +#
    4.30 +# Makefile for building the idlj tool
    4.31 +#
    4.32 +
    4.33 +BUILDDIR = ../..
    4.34 +PACKAGE = com.sun.tools.corba.se.logutil
    4.35 +PRODUCT = tools
    4.36 +PROGRAM = MC
    4.37 +include $(BUILDDIR)/common/Defs.gmk
    4.38 +
    4.39 +BUILDTOOL_SOURCE_ROOT = $(SHARE_SRC)/classes
    4.40 +BUILDTOOL_MAIN        = $(PKGDIR)/MC.java
    4.41 +
    4.42 +#
    4.43 +# Build tool jar rules.
    4.44 +#
    4.45 +include $(BUILDDIR)/common/BuildToolJar.gmk
    4.46 +
     5.1 --- a/src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java	Fri Mar 27 14:11:32 2009 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java	Tue Mar 31 08:53:16 2009 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
     5.6 + * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -30,7 +30,6 @@
    5.11  import java.io.OutputStream ;
    5.12  import java.io.BufferedWriter ;
    5.13  import java.io.OutputStreamWriter ;
    5.14 -import jsint.Pair ;
    5.15  import java.util.StringTokenizer ;
    5.16  
    5.17  public class IndentingPrintWriter extends PrintWriter {
    5.18 @@ -38,22 +37,20 @@
    5.19      private int indentWidth = 4 ;
    5.20      private String indentString = "" ;
    5.21  
    5.22 -    public void printMsg( String msg, Pair data )
    5.23 +    public void printMsg( String msg, Object... data )
    5.24      {
    5.25          // System.out.println( "printMsg called with msg=" + msg + " data=" + data ) ;
    5.26          StringTokenizer st = new StringTokenizer( msg, "@", true ) ;
    5.27          StringBuffer result = new StringBuffer() ;
    5.28 -        Object head = data.first ;
    5.29 -        Pair tail = (Pair)data.rest ;
    5.30          String token = null ;
    5.31 +        int pos = 0;
    5.32  
    5.33          while (st.hasMoreTokens()) {
    5.34              token = st.nextToken() ;
    5.35              if (token.equals("@")) {
    5.36 -                if (head != null) {
    5.37 -                    result.append( head ) ;
    5.38 -                    head = tail.first ;
    5.39 -                    tail = (Pair)tail.rest ;
    5.40 +                if (pos < data.length) {
    5.41 +                    result.append( data[pos] );
    5.42 +                    ++pos;
    5.43                  } else {
    5.44                      throw new Error( "List too short for message" ) ;
    5.45                  }
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/share/classes/com/sun/tools/corba/se/logutil/Input.java	Tue Mar 31 08:53:16 2009 -0700
     6.3 @@ -0,0 +1,211 @@
     6.4 +/*
     6.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + *
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.  Sun designates this
    6.11 + * particular file as subject to the "Classpath" exception as provided
    6.12 + * by Sun in the LICENSE file that accompanied this code.
    6.13 + *
    6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.17 + * version 2 for more details (a copy is included in the LICENSE file that
    6.18 + * accompanied this code).
    6.19 + *
    6.20 + * You should have received a copy of the GNU General Public License version
    6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.23 + *
    6.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    6.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    6.26 + * have any questions.
    6.27 + */
    6.28 +
    6.29 +package com.sun.tools.corba.se.logutil;
    6.30 +
    6.31 +import java.io.BufferedReader;
    6.32 +import java.io.File;
    6.33 +import java.io.FileInputStream;
    6.34 +import java.io.FileNotFoundException;
    6.35 +import java.io.InputStreamReader;
    6.36 +import java.io.IOException;
    6.37 +
    6.38 +import java.util.LinkedList;
    6.39 +import java.util.Queue;
    6.40 +
    6.41 +import java.util.regex.Matcher;
    6.42 +import java.util.regex.Pattern;
    6.43 +
    6.44 +public class Input {
    6.45 +
    6.46 +  /**
    6.47 +   * The name of the package this class will inhabit.
    6.48 +   */
    6.49 +  private String packageName;
    6.50 +
    6.51 +  /**
    6.52 +   * The name of the generated class.
    6.53 +   */
    6.54 +  private String className;
    6.55 +
    6.56 +  /**
    6.57 +   * The name of the group of exceptions handled by the class.
    6.58 +   */
    6.59 +  private String groupName;
    6.60 +
    6.61 +  /**
    6.62 +   * The group of exceptions.
    6.63 +   */
    6.64 +  private Queue<InputException> exceptions;
    6.65 +
    6.66 +  /**
    6.67 +   * Represents the current state of parsing the input.
    6.68 +   */
    6.69 +  private enum State
    6.70 +  {
    6.71 +    OUTER,
    6.72 +    IN_CLASS,
    6.73 +    IN_EXCEPTION_LIST
    6.74 +  };
    6.75 +
    6.76 +  /**
    6.77 +   * Regular expression to match each code line.
    6.78 +   */
    6.79 +  private static final Pattern EXCEPTION_INFO_REGEX =
    6.80 +    Pattern.compile("(\\w+)\\s*(\\d+)\\s*(\\w+)");
    6.81 +
    6.82 +  /**
    6.83 +   * Parses the specified file to create a new {@link Input}
    6.84 +   * object.
    6.85 +   *
    6.86 +   * @param filename the file to parse.
    6.87 +   * @throws FileNotFoundException if the file can't be found.
    6.88 +   * @throws IOException if an I/O error occurs.
    6.89 +   */
    6.90 +  public Input(final String filename)
    6.91 +  throws FileNotFoundException, IOException {
    6.92 +    BufferedReader r =
    6.93 +      new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
    6.94 +    State state = State.OUTER;
    6.95 +    InputException current = null;
    6.96 +    exceptions = new LinkedList<InputException>();
    6.97 +    String line;
    6.98 +    while ((line = r.readLine()) != null) {
    6.99 +      // Skip ; comments
   6.100 +      if (line.startsWith(";"))
   6.101 +        continue;
   6.102 +
   6.103 +      int index = line.indexOf("(");
   6.104 +      if (index == -1)
   6.105 +        continue;
   6.106 +
   6.107 +      switch (state) {
   6.108 +      case OUTER:
   6.109 +        state = State.IN_CLASS;
   6.110 +        String[] classInfo = line.substring(index).split(" ");
   6.111 +        packageName = classInfo[0].substring(2, classInfo[0].length() - 1);
   6.112 +        className = classInfo[1].substring(1, classInfo[1].length() - 1);
   6.113 +        groupName = classInfo[2];
   6.114 +        break;
   6.115 +      case IN_CLASS:
   6.116 +        state = State.IN_EXCEPTION_LIST;
   6.117 +        break;
   6.118 +      case IN_EXCEPTION_LIST:
   6.119 +        boolean inQuote = false;
   6.120 +        boolean inCode = false;
   6.121 +        boolean end = false;
   6.122 +        int start = index + 1;
   6.123 +        Queue<String> lines = new LinkedList<String>();
   6.124 +        for (int a = start; a < line.length(); ++a) {
   6.125 +          if (line.charAt(a) == '(' && !inCode && !inQuote) {
   6.126 +            if (current == null)
   6.127 +              current =
   6.128 +                new InputException(line.substring(start, a).trim());
   6.129 +            start = a + 1;
   6.130 +            inCode = true;
   6.131 +          }
   6.132 +          if (line.charAt(a) == '"')
   6.133 +            inQuote = !inQuote;
   6.134 +          if (line.charAt(a) == ')' && !inQuote) {
   6.135 +            if (inCode) {
   6.136 +              lines.offer(line.substring(start, a));
   6.137 +              inCode = false;
   6.138 +            } else
   6.139 +              end = true;
   6.140 +          }
   6.141 +          if (!end && a == line.length() - 1)
   6.142 +            line += r.readLine();
   6.143 +        }
   6.144 +        for (String l : lines) {
   6.145 +          int stringStart = l.indexOf("\"") + 1;
   6.146 +          int stringEnd = l.indexOf("\"", stringStart);
   6.147 +          Matcher matcher = EXCEPTION_INFO_REGEX.matcher(l.substring(0, stringStart));
   6.148 +          if (matcher.find())
   6.149 +            current.add(new InputCode(matcher.group(1),
   6.150 +                                      Integer.parseInt(matcher.group(2)),
   6.151 +                                      matcher.group(3),
   6.152 +                                      l.substring(stringStart, stringEnd)));
   6.153 +        }
   6.154 +        exceptions.offer(current);
   6.155 +        current = null;
   6.156 +        break;
   6.157 +      }
   6.158 +    }
   6.159 +  }
   6.160 +
   6.161 +  /**
   6.162 +   * Returns the name of this group of exceptions.
   6.163 +   *
   6.164 +   * @return the name of this group of exceptions.
   6.165 +   */
   6.166 +  public String getGroupName()
   6.167 +  {
   6.168 +    return groupName;
   6.169 +  }
   6.170 +
   6.171 +  /**
   6.172 +   * Returns the name of the package this class will go in.
   6.173 +   *
   6.174 +   * @return the name of the package.
   6.175 +   */
   6.176 +  public String getPackageName()
   6.177 +  {
   6.178 +    return packageName;
   6.179 +  }
   6.180 +
   6.181 +  /**
   6.182 +   * Returns the name of the generated class.
   6.183 +   *
   6.184 +   * @return the name of the class.
   6.185 +   */
   6.186 +  public String getClassName()
   6.187 +  {
   6.188 +    return className;
   6.189 +  }
   6.190 +
   6.191 +  /**
   6.192 +   * Returns the exceptions contained in this class.
   6.193 +   *
   6.194 +   * @return the exceptions.
   6.195 +   */
   6.196 +  public Queue<InputException> getExceptions() {
   6.197 +    return exceptions;
   6.198 +  }
   6.199 +
   6.200 +  /**
   6.201 +   * Returns a textual representation of this input.
   6.202 +   *
   6.203 +   * @return a textual representation.
   6.204 +   */
   6.205 +  public String toString() {
   6.206 +    return getClass().getName() +
   6.207 +      "[packageName=" + packageName +
   6.208 +      ",className=" + className +
   6.209 +      ",groupName=" + groupName +
   6.210 +      ",exceptions=" + exceptions +
   6.211 +      "]";
   6.212 +  }
   6.213 +
   6.214 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/share/classes/com/sun/tools/corba/se/logutil/InputCode.java	Tue Mar 31 08:53:16 2009 -0700
     7.3 @@ -0,0 +1,116 @@
     7.4 +/*
     7.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.  Sun designates this
    7.11 + * particular file as subject to the "Classpath" exception as provided
    7.12 + * by Sun in the LICENSE file that accompanied this code.
    7.13 + *
    7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.17 + * version 2 for more details (a copy is included in the LICENSE file that
    7.18 + * accompanied this code).
    7.19 + *
    7.20 + * You should have received a copy of the GNU General Public License version
    7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.23 + *
    7.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    7.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    7.26 + * have any questions.
    7.27 + */
    7.28 +package com.sun.tools.corba.se.logutil;
    7.29 +
    7.30 +public class InputCode {
    7.31 +
    7.32 +  /**
    7.33 +   * The name of this code.
    7.34 +   */
    7.35 +  private final String name;
    7.36 +
    7.37 +  /**
    7.38 +   * The code.
    7.39 +   */
    7.40 +  private final int code;
    7.41 +
    7.42 +  /**
    7.43 +   * The log level for this code.
    7.44 +   */
    7.45 +  private final String logLevel;
    7.46 +
    7.47 +  /**
    7.48 +   * The error message for this code.
    7.49 +   */
    7.50 +  private final String message;
    7.51 +
    7.52 +  /**
    7.53 +   * Creates a new error code with the specified name, code,
    7.54 +   * log level and error message.
    7.55 +   *
    7.56 +   * @param name the name of the new code.
    7.57 +   * @param code the code itself.
    7.58 +   * @param logLevel the level of severity of this error.
    7.59 +   * @param message the error message for this code.
    7.60 +   */
    7.61 +  public InputCode(final String name, final int code,
    7.62 +                   final String logLevel, final String message) {
    7.63 +    this.name = name;
    7.64 +    this.code = code;
    7.65 +    this.logLevel = logLevel;
    7.66 +    this.message = message;
    7.67 +  }
    7.68 +
    7.69 +  /**
    7.70 +   * Returns the name of this code.
    7.71 +   *
    7.72 +   * @return the name of the code.
    7.73 +   */
    7.74 +  public String getName() {
    7.75 +    return name;
    7.76 +  }
    7.77 +
    7.78 +  /**
    7.79 +   * Returns the code.
    7.80 +   *
    7.81 +   * @return the code.
    7.82 +   */
    7.83 +  public int getCode() {
    7.84 +    return code;
    7.85 +  }
    7.86 +
    7.87 +  /**
    7.88 +   * Returns the severity of this code.
    7.89 +   *
    7.90 +   * @return the log level severity of the code.
    7.91 +   */
    7.92 +  public String getLogLevel() {
    7.93 +    return logLevel;
    7.94 +  }
    7.95 +
    7.96 +  /**
    7.97 +   * Returns the error message for this code.
    7.98 +   *
    7.99 +   * @return the error message for this code.
   7.100 +   */
   7.101 +  public String getMessage() {
   7.102 +    return message;
   7.103 +  }
   7.104 +
   7.105 +  /**
   7.106 +   * Returns a textual representation of this code.
   7.107 +   *
   7.108 +   * @return a textual representation.
   7.109 +   */
   7.110 +  public String toString() {
   7.111 +    return getClass().getName() +
   7.112 +      "[name=" + name +
   7.113 +      ",code=" + code +
   7.114 +      ",logLevel=" + logLevel +
   7.115 +      ",message=" + message +
   7.116 +      "]";
   7.117 +  }
   7.118 +
   7.119 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/share/classes/com/sun/tools/corba/se/logutil/InputException.java	Tue Mar 31 08:53:16 2009 -0700
     8.3 @@ -0,0 +1,94 @@
     8.4 +/*
     8.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 + *
     8.8 + * This code is free software; you can redistribute it and/or modify it
     8.9 + * under the terms of the GNU General Public License version 2 only, as
    8.10 + * published by the Free Software Foundation.  Sun designates this
    8.11 + * particular file as subject to the "Classpath" exception as provided
    8.12 + * by Sun in the LICENSE file that accompanied this code.
    8.13 + *
    8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.17 + * version 2 for more details (a copy is included in the LICENSE file that
    8.18 + * accompanied this code).
    8.19 + *
    8.20 + * You should have received a copy of the GNU General Public License version
    8.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.23 + *
    8.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    8.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    8.26 + * have any questions.
    8.27 + */
    8.28 +package com.sun.tools.corba.se.logutil;
    8.29 +
    8.30 +import java.util.LinkedList;
    8.31 +import java.util.Queue;
    8.32 +
    8.33 +public class InputException {
    8.34 +
    8.35 +  /**
    8.36 +   * The name of this exception.
    8.37 +   */
    8.38 +  private final String name;
    8.39 +
    8.40 +  /**
    8.41 +   * The codes associated with this exception.
    8.42 +   */
    8.43 +  private final Queue<InputCode> codes;
    8.44 +
    8.45 +  /**
    8.46 +   * Constructs a new {@link InputException} with the
    8.47 +   * specified name.
    8.48 +   *
    8.49 +   * @param name the name of the new exception;
    8.50 +   */
    8.51 +  public InputException(final String name) {
    8.52 +    this.name = name;
    8.53 +    codes = new LinkedList<InputCode>();
    8.54 +  }
    8.55 +
    8.56 +  /**
    8.57 +   * Adds a new code to this exception.
    8.58 +   *
    8.59 +   * @param c the code to add.
    8.60 +   */
    8.61 +  public void add(InputCode c)
    8.62 +  {
    8.63 +    codes.offer(c);
    8.64 +  }
    8.65 +
    8.66 +  /**
    8.67 +   * Returns the name of this exception.
    8.68 +   *
    8.69 +   * @return the exception's name.
    8.70 +   */
    8.71 +  public String getName() {
    8.72 +    return name;
    8.73 +  }
    8.74 +
    8.75 +  /**
    8.76 +   * Returns the codes associated with this exception.
    8.77 +   *
    8.78 +   * @return the exception's codes.
    8.79 +   */
    8.80 +  public Queue<InputCode> getCodes() {
    8.81 +    return codes;
    8.82 +  }
    8.83 +
    8.84 +  /**
    8.85 +   * Returns a textual representation of this exception.
    8.86 +   *
    8.87 +   * @return a textual representation.
    8.88 +   */
    8.89 +  public String toString() {
    8.90 +    return getClass().getName()
    8.91 +      + "[name=" + name
    8.92 +      + ",codes=" + codes
    8.93 +      + "]";
    8.94 +  }
    8.95 +
    8.96 +}
    8.97 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/share/classes/com/sun/tools/corba/se/logutil/MC.java	Tue Mar 31 08:53:16 2009 -0700
     9.3 @@ -0,0 +1,559 @@
     9.4 +/*
     9.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Sun designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Sun in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    9.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    9.26 + * have any questions.
    9.27 + */
    9.28 +package com.sun.tools.corba.se.logutil;
    9.29 +
    9.30 +import java.io.File;
    9.31 +import java.io.FileNotFoundException;
    9.32 +import java.io.FileOutputStream;
    9.33 +import java.io.IOException;
    9.34 +
    9.35 +import java.util.Arrays;
    9.36 +import java.util.Date;
    9.37 +import java.util.Formatter;
    9.38 +import java.util.List;
    9.39 +import java.util.Queue;
    9.40 +
    9.41 +public class MC {
    9.42 +
    9.43 +  private static final String VERSION = "1.0";
    9.44 +
    9.45 +  private static final List<String> SUN_EXCEPTION_GROUPS = Arrays.asList(new String[]
    9.46 +    { "SUNBASE", "ORBUTIL", "ACTIVATION", "NAMING", "INTERCEPTORS", "POA", "IOR", "UTIL" });
    9.47 +
    9.48 +  private static final List<String> EXCEPTIONS = Arrays.asList(new String[]
    9.49 +    { "UNKNOWN", "BAD_PARAM", "NO_MEMORY", "IMP_LIMIT", "COMM_FAILURE", "INV_OBJREF", "NO_PERMISSION",
    9.50 +      "INTERNAL", "MARSHAL", "INITIALIZE", "NO_IMPLEMENT", "BAD_TYPECODE", "BAD_OPERATION", "NO_RESOURCES",
    9.51 +      "NO_RESPONSE", "PERSIST_STORE", "BAD_INV_ORDER", "TRANSIENT", "FREE_MEM", "INV_IDENT", "INV_FLAG",
    9.52 +      "INTF_REPOS", "BAD_CONTEXT", "OBJ_ADAPTER", "DATA_CONVERSION", "OBJECT_NOT_EXIST", "TRANSACTION_REQUIRED",
    9.53 +      "TRANSACTION_ROLLEDBACK", "INVALID_TRANSACTION", "INV_POLICY", "CODESET_INCOMPATIBLE", "REBIND",
    9.54 +      "TIMEOUT", "TRANSACTION_UNAVAILABLE", "BAD_QOS", "INVALID_ACTIVITY", "ACTIVITY_COMPLETED",
    9.55 +      "ACTIVITY_REQUIRED" });
    9.56 +
    9.57 +  /**
    9.58 +   * Read the minor codes from the input file and
    9.59 +   * write out a resource file.
    9.60 +   *
    9.61 +   * @param inFile the file to read the codes from.
    9.62 +   * @param outDir the directory to write the resource file to.
    9.63 +   * @throws FileNotFoundException if the input file can not be found.
    9.64 +   * @throws IOException if an I/O error occurs.
    9.65 +   */
    9.66 +  private void makeResource(String inFile, String outDir)
    9.67 +  throws FileNotFoundException, IOException {
    9.68 +    writeResource(outDir, new Input(inFile));
    9.69 +  }
    9.70 +
    9.71 +  /**
    9.72 +   * Create a new Java source file using the specified Scheme input file,
    9.73 +   * and writing the result to the given output directory.
    9.74 +   *
    9.75 +   * @param inFile the file to read the data from.
    9.76 +   * @param outDir the directory to write the Java class to.
    9.77 +   * @throws FileNotFoundException if the input file can not be found.
    9.78 +   * @throws IOException if an I/O error occurs.
    9.79 +   */
    9.80 +  private void makeClass(String inFile, String outDir)
    9.81 +  throws FileNotFoundException, IOException {
    9.82 +    writeClass(inFile, outDir, new Input(inFile));
    9.83 +  }
    9.84 +
    9.85 +  /**
    9.86 +   * Writes out a Java source file using the data from the given
    9.87 +   * {@link Input} object.  The result is written to {@code outDir}.
    9.88 +   * The name of the input file is just used in the header of the
    9.89 +   * resulting source file.
    9.90 +   *
    9.91 +   * @param inFile the name of the file the data was read from.
    9.92 +   * @param outDir the directory to write the Java class to.
    9.93 +   * @param input the parsed input data.
    9.94 +   * @throws FileNotFoundException if the output file can't be written.
    9.95 +   */
    9.96 +  private void writeClass(String inFile, String outDir, Input input)
    9.97 +    throws FileNotFoundException {
    9.98 +    String packageName = input.getPackageName();
    9.99 +    String className = input.getClassName();
   9.100 +    String groupName = input.getGroupName();
   9.101 +    Queue<InputException> exceptions = input.getExceptions();
   9.102 +    FileOutputStream file = new FileOutputStream(outDir + File.separator + className + ".java");
   9.103 +    IndentingPrintWriter pw = new IndentingPrintWriter(file);
   9.104 +
   9.105 +    writeClassHeader(inFile, groupName, pw);
   9.106 +    pw.printMsg("package @ ;", packageName);
   9.107 +    pw.println();
   9.108 +    pw.println("import java.util.logging.Logger ;");
   9.109 +    pw.println("import java.util.logging.Level ;");
   9.110 +    pw.println();
   9.111 +    pw.println("import org.omg.CORBA.OMGVMCID ;");
   9.112 +    pw.println( "import com.sun.corba.se.impl.util.SUNVMCID ;");
   9.113 +    pw.println( "import org.omg.CORBA.CompletionStatus ;");
   9.114 +    pw.println( "import org.omg.CORBA.SystemException ;");
   9.115 +    pw.println();
   9.116 +    pw.println( "import com.sun.corba.se.spi.orb.ORB ;");
   9.117 +    pw.println();
   9.118 +    pw.println( "import com.sun.corba.se.spi.logging.LogWrapperFactory;");
   9.119 +    pw.println();
   9.120 +    pw.println( "import com.sun.corba.se.spi.logging.LogWrapperBase;");
   9.121 +    pw.println();
   9.122 +    writeImports(exceptions, pw);
   9.123 +    pw.println();
   9.124 +    pw.indent();
   9.125 +    pw.printMsg("public class @ extends LogWrapperBase {", className);
   9.126 +    pw.println();
   9.127 +    pw.printMsg("public @( Logger logger )", className);
   9.128 +    pw.indent();
   9.129 +    pw.println( "{");
   9.130 +    pw.undent();
   9.131 +    pw.println( "super( logger ) ;");
   9.132 +    pw.println( "}");
   9.133 +    pw.println();
   9.134 +    pw.flush();
   9.135 +    writeFactoryMethod(className, groupName, pw);
   9.136 +    writeExceptions(groupName, exceptions, className, pw);
   9.137 +    pw.undent();
   9.138 +    pw.println( );
   9.139 +    pw.println( "}");
   9.140 +    pw.flush();
   9.141 +    pw.close();
   9.142 +  }
   9.143 +
   9.144 +  /**
   9.145 +   * Writes out the header of a Java source file.
   9.146 +   *
   9.147 +   * @param inFile the input file the file was generated from.
   9.148 +   * @param groupName the group of exceptions the Java source file is for.
   9.149 +   * @param pw the print writer used to write the output.
   9.150 +   */
   9.151 +  private void writeClassHeader(String inFile, String groupName,
   9.152 +                                IndentingPrintWriter pw) {
   9.153 +    if (groupName.equals("OMG"))
   9.154 +      pw.println("// Log wrapper class for standard exceptions");
   9.155 +    else
   9.156 +      pw.printMsg("// Log wrapper class for Sun private system exceptions in group @",
   9.157 +                  groupName);
   9.158 +    pw.println("//");
   9.159 +    pw.printMsg("// Generated by MC.java version @, DO NOT EDIT BY HAND!", VERSION);
   9.160 +    pw.printMsg("// Generated from input file @ on @", inFile, new Date());
   9.161 +    pw.println();
   9.162 +  }
   9.163 +
   9.164 +  /**
   9.165 +   * Write out the import list for the exceptions.
   9.166 +   *
   9.167 +   * @param groups the exceptions that were parsed.
   9.168 +   * @param pw the {@link IndentingPrintWriter} for writing to the file.
   9.169 +   */
   9.170 +  private void writeImports(Queue<InputException> exceptions,
   9.171 +                            IndentingPrintWriter pw) {
   9.172 +    if (exceptions == null)
   9.173 +      return;
   9.174 +    for (InputException e : exceptions)
   9.175 +      pw.println("import org.omg.CORBA." + e.getName() + " ;");
   9.176 +  }
   9.177 +
   9.178 +  /**
   9.179 +   * Write out the factory method for this group of exceptions.
   9.180 +   *
   9.181 +   * @param className the name of the generated class.
   9.182 +   * @param groupName the name of this group of exceptions.
   9.183 +   * @param pw the {@link IndentingPrintWriter} for writing to the file.
   9.184 +   */
   9.185 +  private void writeFactoryMethod(String className, String groupName,
   9.186 +                                  IndentingPrintWriter pw) {
   9.187 +    pw.indent();
   9.188 +    pw.println( "private static LogWrapperFactory factory = new LogWrapperFactory() {");
   9.189 +    pw.println( "public LogWrapperBase create( Logger logger )" );
   9.190 +    pw.indent();
   9.191 +    pw.println( "{");
   9.192 +    pw.undent();
   9.193 +    pw.printMsg("return new @( logger ) ;", className);
   9.194 +    pw.undent();
   9.195 +    pw.println( "}" );
   9.196 +    pw.println( "} ;" );
   9.197 +    pw.println();
   9.198 +    pw.printMsg("public static @ get( ORB orb, String logDomain )", className);
   9.199 +    pw.indent();
   9.200 +    pw.println( "{");
   9.201 +    pw.indent();
   9.202 +    pw.printMsg( "@ wrapper = ", className);
   9.203 +    pw.indent();
   9.204 +    pw.printMsg( "(@) orb.getLogWrapper( logDomain, ", className);
   9.205 +    pw.undent();
   9.206 +    pw.undent();
   9.207 +    pw.printMsg( "\"@\", factory ) ;", groupName);
   9.208 +    pw.undent();
   9.209 +    pw.println( "return wrapper ;" );
   9.210 +    pw.println( "} " );
   9.211 +    pw.println();
   9.212 +    pw.printMsg( "public static @ get( String logDomain )", className);
   9.213 +    pw.indent();
   9.214 +    pw.println( "{");
   9.215 +    pw.indent();
   9.216 +    pw.printMsg( "@ wrapper = ", className);
   9.217 +    pw.indent();
   9.218 +    pw.printMsg( "(@) ORB.staticGetLogWrapper( logDomain, ", className);
   9.219 +    pw.undent();
   9.220 +    pw.undent();
   9.221 +    pw.printMsg( "\"@\", factory ) ;", groupName);
   9.222 +    pw.undent();
   9.223 +    pw.println( "return wrapper ;" );
   9.224 +    pw.println( "} " );
   9.225 +    pw.println();
   9.226 +  }
   9.227 +
   9.228 +  /**
   9.229 +   * Writes out the exceptions themselves.
   9.230 +   *
   9.231 +   * @param groupName the name of this group of exceptions.
   9.232 +   * @param exceptions the exceptions to write out.
   9.233 +   * @param className the name of the generated class.
   9.234 +   * @param pw the {@link IndentingPrintWriter} for writing to the file.
   9.235 +   */
   9.236 +  private void writeExceptions(String groupName, Queue<InputException> exceptions,
   9.237 +                               String className, IndentingPrintWriter pw) {
   9.238 +    for (InputException e : exceptions) {
   9.239 +      pw.println("///////////////////////////////////////////////////////////");
   9.240 +      pw.printMsg("// @", e.getName());
   9.241 +      pw.println("///////////////////////////////////////////////////////////");
   9.242 +      pw.println();
   9.243 +      for (InputCode c : e.getCodes())
   9.244 +        writeMethods(groupName, e.getName(), c.getName(), c.getCode(),
   9.245 +                     c.getLogLevel(), className, StringUtil.countArgs(c.getMessage()), pw);
   9.246 +      pw.flush();
   9.247 +    }
   9.248 +  }
   9.249 +
   9.250 +  /**
   9.251 +   * Writes out the methods for a particular error.
   9.252 +   *
   9.253 +   * @param groupName the name of this group of exceptions.
   9.254 +   * @param exceptionName the name of this particular exception.
   9.255 +   * @param errorName the name of this particular error.
   9.256 +   * @param code the minor code for this particular error.
   9.257 +   * @param ident the name of the error in mixed-case identifier form.
   9.258 +   * @param level the level at which to place log messages.
   9.259 +   * @param className the name of the class for this group of exceptions.
   9.260 +   * @param numParams the number of parameters the detail message takes.
   9.261 +   * @param pw the print writer for writing to the file.
   9.262 +   */
   9.263 +  private void writeMethods(String groupName, String exceptionName, String errorName,
   9.264 +                            int code, String level, String className, int numParams,
   9.265 +                            IndentingPrintWriter pw) {
   9.266 +    String ident = StringUtil.toMixedCase(errorName);
   9.267 +    pw.printMsg("public static final int @ = @ ;", errorName, getBase(groupName, code));
   9.268 +    pw.println();
   9.269 +    pw.flush();
   9.270 +    writeMethodStatusCause(groupName, exceptionName, errorName, ident, level,
   9.271 +                           numParams, className, pw);
   9.272 +    pw.println();
   9.273 +    pw.flush();
   9.274 +    writeMethodStatus(exceptionName, ident, numParams, pw);
   9.275 +    pw.println();
   9.276 +    pw.flush();
   9.277 +    writeMethodCause(exceptionName, ident, numParams, pw);
   9.278 +    pw.println();
   9.279 +    pw.flush();
   9.280 +    writeMethodNoArgs(exceptionName, ident, numParams, pw);
   9.281 +    pw.println();
   9.282 +    pw.flush();
   9.283 +  }
   9.284 +
   9.285 +  /**
   9.286 +   * Writes out a method for an error that takes a
   9.287 +   * {@link org.omg.CORBA.CompletionStatus} and a cause.
   9.288 +   *
   9.289 +   * @param groupName the name of this group of exceptions.
   9.290 +   * @param exceptionName the name of this particular exception.
   9.291 +   * @param errorName the name of this particular error.
   9.292 +   * @param ident the name of the error in mixed-case identifier form.
   9.293 +   * @param logLevel the level at which to place log messages.
   9.294 +   * @param numParams the number of parameters the detail message takes.
   9.295 +   * @param className the name of the class for this group of exceptions.
   9.296 +   * @param pw the print writer for writing to the file.
   9.297 +   */
   9.298 +  private void writeMethodStatusCause(String groupName, String exceptionName,
   9.299 +                                      String errorName, String ident,
   9.300 +                                      String logLevel, int numParams,
   9.301 +                                      String className, IndentingPrintWriter pw) {
   9.302 +    pw.indent();
   9.303 +    pw.printMsg( "public @ @( CompletionStatus cs, Throwable t@) {", exceptionName,
   9.304 +                 ident, makeDeclArgs(true, numParams));
   9.305 +    pw.printMsg( "@ exc = new @( @, cs ) ;", exceptionName, exceptionName, errorName);
   9.306 +    pw.indent();
   9.307 +    pw.println( "if (t != null)" );
   9.308 +    pw.undent();
   9.309 +    pw.println( "exc.initCause( t ) ;" );
   9.310 +    pw.println();
   9.311 +    pw.indent();
   9.312 +    pw.printMsg( "if (logger.isLoggable( Level.@ )) {", logLevel);
   9.313 +    if (numParams > 0) {
   9.314 +      pw.printMsg( "Object[] parameters = new Object[@] ;", numParams);
   9.315 +      for (int a = 0; a < numParams; ++a)
   9.316 +        pw.printMsg("parameters[@] = arg@ ;", a, a);
   9.317 +    } else
   9.318 +      pw.println( "Object[] parameters = null ;");
   9.319 +    pw.indent();
   9.320 +    pw.printMsg( "doLog( Level.@, \"@.@\",", logLevel, groupName, ident);
   9.321 +    pw.undent();
   9.322 +    pw.undent();
   9.323 +    pw.printMsg( "parameters, @.class, exc ) ;", className);
   9.324 +    pw.println( "}");
   9.325 +    pw.println();
   9.326 +
   9.327 +    pw.undent();
   9.328 +    pw.println( "return exc ;");
   9.329 +    pw.println( "}");
   9.330 +  }
   9.331 +
   9.332 +  /**
   9.333 +   * Writes out a method for an error that takes a
   9.334 +   * {@link org.omg.CORBA.CompletionStatus}.
   9.335 +   *
   9.336 +   * @param exceptionName the name of this particular exception.
   9.337 +   * @param ident the name of the error in mixed-case identifier form.
   9.338 +   * @param numParams the number of parameters the detail message takes.
   9.339 +   * @param pw the print writer for writing to the file.
   9.340 +   */
   9.341 +  private void writeMethodStatus(String exceptionName, String ident,
   9.342 +                                 int numParams, IndentingPrintWriter pw) {
   9.343 +    pw.indent();
   9.344 +    pw.printMsg("public @ @( CompletionStatus cs@) {", exceptionName,
   9.345 +                ident, makeDeclArgs(true, numParams));
   9.346 +    pw.undent();
   9.347 +    pw.printMsg("return @( cs, null@ ) ;", ident, makeCallArgs(true, numParams));
   9.348 +    pw.println("}");
   9.349 +  }
   9.350 +
   9.351 +  /**
   9.352 +   * Writes out a method for an error that takes a cause.
   9.353 +   *
   9.354 +   * @param exceptionName the name of this particular exception.
   9.355 +   * @param ident the name of the error in mixed-case identifier form.
   9.356 +   * @param numParams the number of parameters the detail message takes.
   9.357 +   * @param pw the print writer for writing to the file.
   9.358 +   */
   9.359 +  private void writeMethodCause(String exceptionName, String ident,
   9.360 +                                int numParams, IndentingPrintWriter pw) {
   9.361 +    pw.indent();
   9.362 +    pw.printMsg("public @ @( Throwable t@) {", exceptionName, ident,
   9.363 +                makeDeclArgs(true, numParams));
   9.364 +    pw.undent();
   9.365 +    pw.printMsg("return @( CompletionStatus.COMPLETED_NO, t@ ) ;", ident,
   9.366 +                makeCallArgs(true, numParams));
   9.367 +    pw.println("}");
   9.368 +  }
   9.369 +
   9.370 +  /**
   9.371 +   * Writes out a method for an error that takes no arguments.
   9.372 +   *
   9.373 +   * @param exceptionName the name of this particular exception.
   9.374 +   * @param ident the name of the error in mixed-case identifier form.
   9.375 +   * @param numParams the number of parameters the detail message takes.
   9.376 +   * @param pw the print writer for writing to the file.
   9.377 +   */
   9.378 +  private void writeMethodNoArgs(String exceptionName, String ident,
   9.379 +                                 int numParams, IndentingPrintWriter pw) {
   9.380 +
   9.381 +    pw.indent();
   9.382 +    pw.printMsg("public @ @( @) {", exceptionName, ident,
   9.383 +                makeDeclArgs(false, numParams));
   9.384 +    pw.undent();
   9.385 +    pw.printMsg("return @( CompletionStatus.COMPLETED_NO, null@ ) ;",
   9.386 +                ident, makeCallArgs(true, numParams));
   9.387 +    pw.println("}");
   9.388 +  }
   9.389 +
   9.390 +  /**
   9.391 +   * Returns a list of comma-separated arguments with type declarations.
   9.392 +   *
   9.393 +   * @param leadingComma true if the list should start with a comma.
   9.394 +   * @param numArgs the number of arguments to generate.
   9.395 +   * @return the generated string.
   9.396 +   */
   9.397 +  private String makeDeclArgs(boolean leadingComma, int numArgs) {
   9.398 +    return makeArgString("Object arg", leadingComma, numArgs);
   9.399 +  }
   9.400 +
   9.401 +  /**
   9.402 +   * Returns a list of comma-separated arguments without type declarations.
   9.403 +   *
   9.404 +   * @param leadingComma true if the list should start with a comma.
   9.405 +   * @param numArgs the number of arguments to generate.
   9.406 +   * @return the generated string.
   9.407 +   */
   9.408 +  private String makeCallArgs(boolean leadingComma, int numArgs) {
   9.409 +    return makeArgString("arg", leadingComma, numArgs);
   9.410 +  }
   9.411 +
   9.412 +  /**
   9.413 +   * Returns a list of comma-separated arguments.
   9.414 +   *
   9.415 +   * @param prefixString the string with which to prefix each argument.
   9.416 +   * @param leadingComma true if the list should start with a comma.
   9.417 +   * @param numArgs the number of arguments to generate.
   9.418 +   * @return the generated string.
   9.419 +   */
   9.420 +  private String makeArgString(String prefixString, boolean leadingComma,
   9.421 +                               int numArgs) {
   9.422 +    if (numArgs == 0)
   9.423 +      return " ";
   9.424 +    if (numArgs == 1) {
   9.425 +      if (leadingComma)
   9.426 +        return ", " + prefixString + (numArgs - 1);
   9.427 +      else
   9.428 +        return " " + prefixString + (numArgs - 1);
   9.429 +    }
   9.430 +    return makeArgString(prefixString, leadingComma, numArgs - 1) +
   9.431 +      ", " + prefixString + (numArgs - 1);
   9.432 +  }
   9.433 +
   9.434 +  /**
   9.435 +   * Returns the {@link String} containing the calculation of the
   9.436 +   * error code.
   9.437 +   *
   9.438 +   * @param groupName the group of exception to which the code belongs.
   9.439 +   * @param code the minor code number representing the exception within the group.
   9.440 +   * @return the unique error code.
   9.441 +   */
   9.442 +  private String getBase(String groupName, int code) {
   9.443 +    if (groupName.equals("OMG"))
   9.444 +      return "OMGVMCID.value + " + code;
   9.445 +    else
   9.446 +      return "SUNVMCID.value + " + (code + getSunBaseNumber(groupName));
   9.447 +  }
   9.448 +
   9.449 +  /**
   9.450 +   * Returns the base number for Sun-specific exceptions.
   9.451 +   *
   9.452 +   * @return the base number.
   9.453 +   */
   9.454 +  private int getSunBaseNumber(String groupName) {
   9.455 +    return 200 * SUN_EXCEPTION_GROUPS.indexOf(groupName);
   9.456 +  }
   9.457 +
   9.458 +  /**
   9.459 +   * Writes out a resource file using the data from the given
   9.460 +   * {@link Input} object.  The result is written to {@code outDir}.
   9.461 +   *
   9.462 +   * @param outDir the directory to write the Java class to.
   9.463 +   * @param input the parsed input data.
   9.464 +   * @throws FileNotFoundException if the output file can't be written.
   9.465 +   */
   9.466 +  private void writeResource(String outDir, Input input)
   9.467 +    throws FileNotFoundException {
   9.468 +    FileOutputStream file = new FileOutputStream(outDir + File.separator +
   9.469 +                                                 input.getClassName() + ".resource");
   9.470 +    IndentingPrintWriter pw = new IndentingPrintWriter(file);
   9.471 +    String groupName = input.getGroupName();
   9.472 +    for (InputException e : input.getExceptions()) {
   9.473 +      String exName = e.getName();
   9.474 +      for (InputCode c : e.getCodes()) {
   9.475 +        String ident = StringUtil.toMixedCase(c.getName());
   9.476 +        pw.printMsg("@.@=\"@: (@) @\"", groupName, ident,
   9.477 +                    getMessageID(groupName, exName, c.getCode()), exName, c.getMessage());
   9.478 +      }
   9.479 +      pw.flush();
   9.480 +    }
   9.481 +    pw.close();
   9.482 +  }
   9.483 +
   9.484 +  /**
   9.485 +   * Returns the message ID corresponding to the given group name,
   9.486 +   * exception name and error code.
   9.487 +   *
   9.488 +   * @param groupName the name of the group of exceptions.
   9.489 +   * @param exception the name of the particular exception.
   9.490 +   * @param code an error code from the given exception.
   9.491 +   * @return the message ID.
   9.492 +   */
   9.493 +  private String getMessageID(String groupName, String exceptionName, int code) {
   9.494 +    if (groupName.equals("OMG"))
   9.495 +      return getStandardMessageID(exceptionName, code);
   9.496 +    else
   9.497 +      return getSunMessageID(groupName, exceptionName, code);
   9.498 +  }
   9.499 +
   9.500 +  /**
   9.501 +   * Returns the standard (OMG) message ID corresponding to the given
   9.502 +   * exception name and error code.
   9.503 +   *
   9.504 +   * @param exceptionName the name of the particular exception.
   9.505 +   * @param code an error code from the given exception.
   9.506 +   * @return the message ID.
   9.507 +   */
   9.508 +  private String getStandardMessageID(String exceptionName, int code) {
   9.509 +    return new Formatter().format("IOP%s0%04d", getExceptionID(exceptionName),
   9.510 +                                  code).toString();
   9.511 +  }
   9.512 +
   9.513 +  /**
   9.514 +   * Returns the Sun message ID corresponding to the given group name,
   9.515 +   * exception name and error code.
   9.516 +   *
   9.517 +   * @param groupName the name of the group of exceptions.
   9.518 +   * @param exceptionName the name of the particular exception.
   9.519 +   * @param code an error code from the given exception.
   9.520 +   * @return the message ID.
   9.521 +   */
   9.522 +  private String getSunMessageID(String groupName, String exceptionName, int code) {
   9.523 +    return new Formatter().format("IOP%s1%04d", getExceptionID(exceptionName),
   9.524 +                                  getSunBaseNumber(groupName) + code).toString();
   9.525 +  }
   9.526 +
   9.527 +  /**
   9.528 +   * Returns the exception ID corresponding to the given exception name.
   9.529 +   *
   9.530 +   * @param exceptionName the name of the particular exception.
   9.531 +   * @return the message ID.
   9.532 +   */
   9.533 +  private String getExceptionID(String exceptionName) {
   9.534 +    return new Formatter().format("%03d", EXCEPTIONS.indexOf(exceptionName)).toString();
   9.535 +  }
   9.536 +
   9.537 +  /**
   9.538 +   * Entry point for running the generator from the command
   9.539 +   * line.  Users can specify either "make-class" or "make-resource"
   9.540 +   * as the first argument to generate the specified type of file.
   9.541 +   *
   9.542 +   * @param args the command-line arguments.
   9.543 +   * @throws FileNotFoundException if the input file can not be found.
   9.544 +   * @throws IOException if an I/O error occurs.
   9.545 +   */
   9.546 +  public static void main(String[] args)
   9.547 +    throws FileNotFoundException, IOException
   9.548 +  {
   9.549 +    if (args.length < 3)
   9.550 +      {
   9.551 +        System.err.println("(make-class|make-resource) <input file> <output dir>");
   9.552 +        System.exit(-1);
   9.553 +      }
   9.554 +    if (args[0].equals("make-class"))
   9.555 +      new MC().makeClass(args[1], args[2]);
   9.556 +    else if (args[0].equals("make-resource"))
   9.557 +      new MC().makeResource(args[1], args[2]);
   9.558 +    else
   9.559 +      System.err.println("Invalid command: " + args[0]);
   9.560 +  }
   9.561 +
   9.562 +}
    10.1 Binary file src/share/classes/com/sun/tools/corba/se/logutil/lib/jscheme.jar has changed
    11.1 Binary file src/share/classes/com/sun/tools/corba/se/logutil/lib/jschemelogutil.jar has changed
    12.1 --- a/src/share/classes/com/sun/tools/corba/se/logutil/scripts/mc	Fri Mar 27 14:11:32 2009 -0700
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,2 +0,0 @@
    12.4 -#! /bin/sh
    12.5 -java -cp lib/jscheme.jar:lib/util.jar jscheme.REPL mc.scm -main main $@
    13.1 --- a/src/share/classes/com/sun/tools/corba/se/logutil/scripts/mc.scm	Fri Mar 27 14:11:32 2009 -0700
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,662 +0,0 @@
    13.4 -; Scheme program to produce CORBA standard exceptions class
    13.5 -; requires Jscheme Java extensions
    13.6 -; Makes use of some custom Java classes also
    13.7 -
    13.8 -(import "com.sun.tools.corba.se.logutil.IndentingPrintWriter" ) 
    13.9 -(import "com.sun.tools.corba.se.logutil.StringUtil" ) 
   13.10 -(import "java.io.FileOutputStream")
   13.11 -
   13.12 -(define version-string "1.3")
   13.13 -
   13.14 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   13.15 -;; Utility functions
   13.16 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   13.17 -
   13.18 -; reload this file (convenience definition)
   13.19 -(define (reload) (load "mc.scm"))
   13.20 -
   13.21 -; Simple little function to report an error
   13.22 -(define (error msg)
   13.23 -    (throw (Error. msg)))
   13.24 -
   13.25 -; some debug support
   13.26 -(define debug #f)
   13.27 -
   13.28 -(define (dprint msg)
   13.29 -    (if debug
   13.30 -	(.println System.out$ msg)))
   13.31 -
   13.32 -; Replace dprint with noprint to avoid seeing messages when debug is #t
   13.33 -(define (noprint msg) ())
   13.34 -
   13.35 -; Helper function present so that a scheme method taking strings as args 
   13.36 -; can be easily run from a command line.
   13.37 -; arg:	    vector containing argument strings. Element 0 is the function name
   13.38 -;	    to execute
   13.39 -(define (main arg)
   13.40 -    (let*
   13.41 -	(
   13.42 -	    (arg-list (vector->list arg))
   13.43 -	    (function-symbol (string->symbol (car arg-list)))
   13.44 -	    (args (cdr arg-list)))
   13.45 -	(apply (eval function-symbol) args)))
   13.46 -
   13.47 -; Returns the position of key in lst, numbering from 0.  key is matched using eqv?
   13.48 -(define (get-list-position key lst)
   13.49 -    (letrec
   13.50 -	(
   13.51 -	    (helper (lambda (k l accum)
   13.52 -		(cond 
   13.53 -		    ((null? l) (error (string-append "Could not find " k)))
   13.54 -		    ((eqv? k (car l)) accum)
   13.55 -		    (else (helper k (cdr l) (+ accum 1))) ))))
   13.56 -	(begin 
   13.57 -	    (noprint (string-append "get-list-position called with key " key " lst " lst ))
   13.58 -	    (helper key lst 0))))
   13.59 -
   13.60 -; Return a string representing number in decimal padded to length with leading 0s.
   13.61 -(define (pad-number-string number length)
   13.62 -    (let*
   13.63 -	(
   13.64 -	    (number-string (number->string number))
   13.65 -	    (pad-length (- length (string-length number-string)))
   13.66 -	)
   13.67 -	(string-append (make-string pad-length #\0) number-string)))
   13.68 -
   13.69 -; Read an S-expression from a file that contains all of the data.
   13.70 -;
   13.71 -; The S-expression used for minor codes must have the structure
   13.72 -;   (package-name class-name exception-group-name
   13.73 -;	(exception
   13.74 -;	    (name value level explanation)
   13.75 -;	    ...
   13.76 -;	)
   13.77 -;	...
   13.78 -;   )
   13.79 -(define (read-file fname)
   13.80 -    (read (open-input-file fname)))
   13.81 -
   13.82 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   13.83 -;; Functions for handling major system exceptions and exception groups
   13.84 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   13.85 -
   13.86 -; Function to find the base ID given an exception group name.  Result is a function that
   13.87 -; maps the minor code into the Java expression for that minor code's actual value.
   13.88 -(define (get-base group-name)
   13.89 -	(if (eqv? group-name 'OMG)
   13.90 -	    (lambda (minor-code)
   13.91 -		(string-append "OMGVMCID.value + " (number->string minor-code)))
   13.92 -	    (let  ; bind base-number outside the lambda so it is only evaluated once
   13.93 -		(
   13.94 -		    (base-number (get-sun-base-number group-name)))
   13.95 -		(lambda (minor-code)
   13.96 -		    (string-append "SUNVMCID.value + " (number->string (+ base-number minor-code)))))))
   13.97 -
   13.98 -; Function to get a base value for the group-name
   13.99 -(define (get-sun-base-number group-name)
  13.100 -    (let*
  13.101 -	(
  13.102 -	    (lst (list 'SUNBASE 'ORBUTIL 'ACTIVATION 'NAMING 'INTERCEPTORS 'POA 'IOR 'UTIL))
  13.103 -	    (subsystem-size 200))
  13.104 -	(* subsystem-size (get-list-position group-name lst))))
  13.105 -
  13.106 -; Function to get a 3 digit number for a system exception
  13.107 -(define (get-exception-id exception-name)
  13.108 -    (let
  13.109 -	(
  13.110 -	    (lst (list 'UNKNOWN 'BAD_PARAM 'NO_MEMORY 'IMP_LIMIT 'COMM_FAILURE 'INV_OBJREF 'NO_PERMISSION 
  13.111 -		'INTERNAL 'MARSHAL 'INITIALIZE 'NO_IMPLEMENT 'BAD_TYPECODE 'BAD_OPERATION 'NO_RESOURCES 
  13.112 -		'NO_RESPONSE 'PERSIST_STORE 'BAD_INV_ORDER 'TRANSIENT 'FREE_MEM 'INV_IDENT 'INV_FLAG 
  13.113 -		'INTF_REPOS 'BAD_CONTEXT 'OBJ_ADAPTER 'DATA_CONVERSION 'OBJECT_NOT_EXIST 'TRANSACTION_REQUIRED 
  13.114 -		'TRANSACTION_ROLLEDBACK 'INVALID_TRANSACTION 'INV_POLICY 'CODESET_INCOMPATIBLE 'REBIND 
  13.115 -		'TIMEOUT 'TRANSACTION_UNAVAILABLE 'BAD_QOS 'INVALID_ACTIVITY 'ACTIVITY_COMPLETED 
  13.116 -		'ACTIVITY_REQUIRED )))
  13.117 -	(pad-number-string (get-list-position exception-name lst) 3)))
  13.118 -
  13.119 -; Return the message id string for any system exception
  13.120 -;
  13.121 -(define (get-message-id exception-type group-name minor)
  13.122 -    (if (eqv? group-name 'OMG)
  13.123 -	(get-standard-message-id exception-type minor)
  13.124 -	(get-sun-message-id exception-type group-name minor)))
  13.125 -
  13.126 -; Return the message id string for a particular standard exception
  13.127 -;
  13.128 -(define (get-standard-message-id exception-type minor)
  13.129 -    (string-append 
  13.130 -	"IOP" 
  13.131 -	(get-exception-id exception-type) 
  13.132 -	"0" 
  13.133 -	(pad-number-string (number->string minor) 4)))
  13.134 -
  13.135 -; Return the sun message id for this exception-type, group-name, and minor code.
  13.136 -(define (get-sun-message-id exception-type group-name minor)
  13.137 -    (string-append 
  13.138 -	"IOP" 
  13.139 -	(get-exception-id exception-type) 
  13.140 -	"1"
  13.141 -	(pad-number-string (+ (get-sun-base-number group-name) minor) 4)))
  13.142 -
  13.143 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.144 -; visitor framework for the input file format
  13.145 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.146 -
  13.147 -(define (visit-top obj func1)
  13.148 -    (let*
  13.149 -	(
  13.150 -	    (package (car obj))
  13.151 -	    (class (cadr obj))
  13.152 -	    (group (caddr obj))
  13.153 -	    (func2 (func1 package class group))
  13.154 -	    (exceptions (cadddr obj)))
  13.155 -	(visit-exceptions exceptions func2)))
  13.156 -
  13.157 -; visit the elements of an arbitrary list
  13.158 -; lst:		the list to visit
  13.159 -; func:		the function to apply to each element of lst
  13.160 -; next-level	the function on lst element and func that visits the next level
  13.161 -(define (visit-list lst func next-level)
  13.162 -    (if (null? (cdr lst))
  13.163 -	(next-level #t (car lst) func)
  13.164 -	(begin
  13.165 -	    (next-level #f (car lst) func)
  13.166 -	    (visit-list (cdr lst) func next-level))))
  13.167 -
  13.168 -(define (visit-exceptions exceptions func2)
  13.169 -    (visit-list exceptions func2 (lambda (last-flag element func) (visit-exception last-flag element func))))
  13.170 -
  13.171 -(define (visit-exception last-flag exception func2)
  13.172 -    (let*
  13.173 -	(
  13.174 -	    (major (car exception))
  13.175 -	    (minor-codes (cdr exception))
  13.176 -	    (func3 (func2 last-flag major)))
  13.177 -	(visit-minor-codes minor-codes func3)))
  13.178 -
  13.179 -(define (visit-minor-codes minor-codes func3)
  13.180 -    (visit-list minor-codes func3 (lambda (last-flag element func) (visit-minor-code last-flag element func))))
  13.181 -
  13.182 -(define (visit-minor-code last-flag minor-code func3)
  13.183 -    (let*   
  13.184 -	(
  13.185 -	    (name (car minor-code))
  13.186 -	    (minor (cadr minor-code))
  13.187 -	    (level (caddr minor-code))
  13.188 -	    (msg (cadddr minor-code)))
  13.189 -	(func3 last-flag name minor level msg)))
  13.190 -
  13.191 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.192 -;; The visitors
  13.193 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.194 -
  13.195 -; A simple visitor that just echoes the input for test purposes
  13.196 -(define (simple-visitor package class group)
  13.197 -    (let* 
  13.198 -	(
  13.199 -	    (pw (IndentingPrintWriter. System.out$)))
  13.200 -	(begin
  13.201 -	    (.indent pw)
  13.202 -	    (.printMsg pw "package=@ class=@ group=@" (list package class group))
  13.203 -	    (.flush pw)
  13.204 -	    (lambda (last-flag major)
  13.205 -		(begin
  13.206 -		    (.indent pw)
  13.207 -		    (.printMsg pw "major=@" (list major))
  13.208 -		    (.flush pw)
  13.209 -		    (lambda (last-flag name minor level message)
  13.210 -			(begin
  13.211 -			    (if last-flag (.undent pw))
  13.212 -			    (.printMsg pw "name=@ minor=@ level=@ message=@" (list name minor level message))
  13.213 -			    (.flush pw))))))))
  13.214 -
  13.215 -; Function that returns a visitor that writes out the resource file in the form:
  13.216 -;   id="MSGID: explanation"
  13.217 -; outdir: Output directory 
  13.218 -(define (resource-visitor outdir)
  13.219 -    (lambda (package class group)
  13.220 -	(let* 
  13.221 -	    (
  13.222 -		(file-name (string-append outdir java.io.File.separator$ class ".resource"))
  13.223 -		(pw (IndentingPrintWriter. (FileOutputStream. file-name))))
  13.224 -	    (begin 
  13.225 -		(dprint (string-append "package= " package " class=" class " group=" group " file-name=" file-name))
  13.226 -		(lambda (last-flag1 major)
  13.227 -		    (begin
  13.228 -			; (dprint (string-append "last-flag1=" last-flag1 " major=" major))
  13.229 -			(lambda (last-flag2 name minor level message)
  13.230 -			    (begin
  13.231 -				; (dprint (string-append "last-flag2=" last-flag2 " name=" name 
  13.232 -				    ; " minor=" minor " level=" level " message=" message))
  13.233 -				(let*
  13.234 -				    (
  13.235 -					(msgid (get-message-id major group minor))
  13.236 -					(ident (StringUtil.toMixedCase (symbol->string name))))
  13.237 -				    (begin
  13.238 -					; (dprint (string-append "msgid=" msgid " ident=" ident))
  13.239 -					(.printMsg pw "@.@=\"@: (@) @\"" (list group ident msgid major message))
  13.240 -					(.flush pw)
  13.241 -					(if (and last-flag1 last-flag2) 
  13.242 -					    (begin
  13.243 -						; (dprint "closing file")
  13.244 -						(.close pw)))))))))))))
  13.245 -
  13.246 -
  13.247 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.248 -;; Top-level functions for creating the products.  All have names of the form make-xxx
  13.249 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.250 -
  13.251 -; Read the minor codes from the infile and write out a resource file. 
  13.252 -(define (make-resource infile outdir)
  13.253 -    (tryCatch 
  13.254 -	(visit-top (read-file infile) (resource-visitor outdir))
  13.255 -	(lambda (exc) 
  13.256 -	    (begin
  13.257 -		(.println System.out$ (string-append "make-resource failed with exception " (.toString exc)))
  13.258 -		(System.exit 1)))))
  13.259 -
  13.260 -; Read the minor codes from the infile and write a Java implementation to
  13.261 -; handle them to outfile under outdir
  13.262 -(define (make-class infile outdir)
  13.263 -    (tryCatch 
  13.264 -	(write-class infile outdir (read-file infile))
  13.265 -	(lambda (exc) 
  13.266 -	    (begin
  13.267 -		(.println System.out$ (string-append "make-class failed with exception " (.toString exc)))
  13.268 -		(System.exit 1)))))
  13.269 -	
  13.270 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.271 -;; The original make-class implementation (this should be replaced by two visitors)
  13.272 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.273 -
  13.274 -; Write out the Java source code for the StandardExceptions class
  13.275 -; outdir:  Output directory to write the generated files
  13.276 -; obj:	    the data from the input file
  13.277 -(define (write-class infile outdir obj)
  13.278 -    (let* 
  13.279 -	( 
  13.280 -	    (package-name (car obj))
  13.281 -	    (class-name (cadr obj))
  13.282 -	    (exception-group-name (caddr obj))
  13.283 -	    (exceptions (cadddr obj))
  13.284 -	    (file (FileOutputStream. (string-append outdir java.io.File.separator$  class-name ".java")))  
  13.285 -	    (pw   (IndentingPrintWriter. file))
  13.286 -	)
  13.287 -	(begin
  13.288 -	    (write-class-header infile package-name class-name exception-group-name pw)
  13.289 -	    (.printMsg pw "package @ ;"
  13.290 -		(list package-name))
  13.291 -	    (.println pw)
  13.292 -	    (.println pw "import java.util.logging.Logger ;")
  13.293 -	    (.println pw "import java.util.logging.Level ;")
  13.294 -	    (.println pw)
  13.295 -	    (.println pw "import org.omg.CORBA.OMGVMCID ;")
  13.296 -	    (.println pw "import com.sun.corba.se.impl.util.SUNVMCID ;")
  13.297 -	    (.println pw "import org.omg.CORBA.CompletionStatus ;")
  13.298 -	    (.println pw "import org.omg.CORBA.SystemException ;")
  13.299 -	    (.println pw)
  13.300 -	    (.println pw "import com.sun.corba.se.spi.orb.ORB ;")
  13.301 -	    (.println pw)
  13.302 -	    (.println pw "import com.sun.corba.se.spi.logging.LogWrapperFactory;")
  13.303 -	    (.println pw)
  13.304 -	    (.println pw "import com.sun.corba.se.spi.logging.LogWrapperBase;")
  13.305 -	    (.println pw)
  13.306 -	    (write-imports exceptions pw)
  13.307 -	    (.println pw)
  13.308 -	    (.indent pw)
  13.309 -	    (.printMsg pw "public class @ extends LogWrapperBase {"
  13.310 -		(list class-name))
  13.311 -	    (.println pw)
  13.312 -	    (.printMsg pw "public @( Logger logger )"
  13.313 -		(list class-name))
  13.314 -	    (.indent pw)
  13.315 -	    (.println pw "{")
  13.316 -	    (.undent pw)
  13.317 -	    (.println pw "super( logger ) ;")
  13.318 -	    (.println pw "}")
  13.319 -	    (.println pw)
  13.320 -	    (.flush pw)
  13.321 -	    (write-factory-method class-name exception-group-name pw)
  13.322 -	    (write-exceptions exception-group-name exceptions (get-base exception-group-name) class-name pw)
  13.323 -	    (.undent pw)
  13.324 -	    (.println pw )
  13.325 -	    (.println pw "}")
  13.326 -	    (.flush pw)
  13.327 -	    (.close pw)
  13.328 -	)))
  13.329 -
  13.330 -; Write out the header for the resource file
  13.331 -(define (write-class-header infile package class group pw)
  13.332 -    (begin
  13.333 -	(if (eqv? group 'OMG)
  13.334 -	    (.println pw "// Log wrapper class for standard exceptions")
  13.335 -	    (.printMsg pw "// Log wrapper class for Sun private system exceptions in group @" (list group)))
  13.336 -	(.println pw "//")
  13.337 -	(.printMsg pw "// Generated by mc.scm version @, DO NOT EDIT BY HAND!" (list version-string))
  13.338 -	(.printMsg pw "// Generated from input file @ on @" (list infile (java.util.Date.)))
  13.339 -	(.println pw)))
  13.340 -
  13.341 -(define (write-factory-method class-name exception-group-name pw)
  13.342 -    (begin
  13.343 -	(.indent pw)
  13.344 -	(.println pw "private static LogWrapperFactory factory = new LogWrapperFactory() {")
  13.345 -	(.println pw "public LogWrapperBase create( Logger logger )" )
  13.346 -	(.indent pw)
  13.347 -	(.println pw "{")
  13.348 -	(.undent pw)
  13.349 -	(.printMsg pw "return new @( logger ) ;" (list class-name))
  13.350 -	(.undent pw)
  13.351 -	(.println pw "}" )
  13.352 -	(.println pw "} ;" )
  13.353 -	(.println pw)
  13.354 -	(.printMsg pw "public static @ get( ORB orb, String logDomain )" (list class-name))
  13.355 -	(.indent pw)	
  13.356 -	(.println pw "{")
  13.357 -	(.indent pw)	
  13.358 -	(.printMsg pw "@ wrapper = "
  13.359 -	    (list class-name))
  13.360 -	(.indent pw)
  13.361 -	(.printMsg pw "(@) orb.getLogWrapper( logDomain, " 
  13.362 -	    (list class-name))
  13.363 -	(.undent pw)	
  13.364 -	(.undent pw)	
  13.365 -	(.printMsg pw "\"@\", factory ) ;" 
  13.366 -	    (list exception-group-name))
  13.367 -	(.undent pw)	
  13.368 -	(.println pw "return wrapper ;" )
  13.369 -	(.println pw "} " )
  13.370 -	(.println pw)
  13.371 -	(.printMsg pw "public static @ get( String logDomain )" (list class-name))
  13.372 -	(.indent pw)	
  13.373 -	(.println pw "{")
  13.374 -	(.indent pw)	
  13.375 -	(.printMsg pw "@ wrapper = "
  13.376 -	    (list class-name))
  13.377 -	(.indent pw)
  13.378 -	(.printMsg pw "(@) ORB.staticGetLogWrapper( logDomain, " 
  13.379 -	    (list class-name))
  13.380 -	(.undent pw)	
  13.381 -	(.undent pw)	
  13.382 -	(.printMsg pw "\"@\", factory ) ;" 
  13.383 -	    (list exception-group-name))
  13.384 -	(.undent pw)	
  13.385 -	(.println pw "return wrapper ;" )
  13.386 -	(.println pw "} " )
  13.387 -	(.println pw)))
  13.388 -
  13.389 -; Write out the import list for the exceptions listed in obj
  13.390 -; obj:	    the data from the input file
  13.391 -; pw:	    an IndentingPrintWriter for the output file
  13.392 -(define (write-imports obj pw)
  13.393 -    (if (null? obj)
  13.394 -	()
  13.395 -	(let 
  13.396 -	    (
  13.397 -		(exception (caar obj))
  13.398 -	    )
  13.399 -	    (begin
  13.400 -		(.print pw "import org.omg.CORBA.")
  13.401 -		(.print pw exception)
  13.402 -		(.println pw " ;")
  13.403 -		(write-imports (cdr obj) pw)
  13.404 -	    ))))
  13.405 -
  13.406 -; Write out the list of exceptions starting with the first one
  13.407 -; obj:	    the data from the input file
  13.408 -; base:	    the lambda that returns the string defining the minor code value
  13.409 -; pw:	    an IndentingPrintWriter for the output file
  13.410 -(define (write-exceptions group-name obj base class-name pw)
  13.411 -    (if (null? obj) 
  13.412 -	()
  13.413 -	(let* 
  13.414 -	    (
  13.415 -		(record (car obj))
  13.416 -		(exception (car record))
  13.417 -	        (minor-codes (cdr record))
  13.418 -	    )
  13.419 -	    (begin
  13.420 -		(write-exception group-name exception minor-codes base class-name pw)
  13.421 -		(write-exceptions group-name (cdr obj) base class-name pw)
  13.422 -	    ))))
  13.423 -
  13.424 -; Write out a single exception
  13.425 -; exception:	the CORBA SystemException type
  13.426 -; base:		the base for the minor code value
  13.427 -; minor-codes:	a list of minor code data for each minor exception type
  13.428 -; pw:		an IndentingPrintWriter for the output file
  13.429 -(define (write-exception group-name exception minor-codes base class-name pw)
  13.430 -    (begin
  13.431 -	(.println pw "///////////////////////////////////////////////////////////")
  13.432 -	(.printMsg pw "// @" (list exception))
  13.433 -	(.println pw "///////////////////////////////////////////////////////////")
  13.434 -	(.println pw)
  13.435 -	(write-methods group-name exception minor-codes base class-name pw)
  13.436 -	(.flush pw)))
  13.437 -
  13.438 -; Write all of the methods for a single exception
  13.439 -; exception:	the CORBA SystemException type
  13.440 -; base:		the base for the minor code value
  13.441 -; minor-codes:	a list of minor code data for each minor exception type
  13.442 -; pw:		an IndentingPrintWriter for the output file
  13.443 -(define (write-methods group-name exception minor-codes base class-name pw)
  13.444 -    (if (null? minor-codes)
  13.445 -	()
  13.446 -	(begin
  13.447 -	    (write-method group-name exception (car minor-codes) base class-name pw)
  13.448 -	    (write-methods group-name exception (cdr minor-codes) base class-name pw)
  13.449 -	)))
  13.450 -
  13.451 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.452 -;; Code that writes out the Java methods for exception handling
  13.453 -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.454 -
  13.455 -; Write the methods for a single minor code within an exception
  13.456 -; exception:	the CORBA SystemException type
  13.457 -; minor-code:	minor code data for one minor exception type 
  13.458 -;		(name value level explanation)
  13.459 -; base:		the base for the minor code value
  13.460 -; pw:		an IndentingPrintWriter for the output file
  13.461 -(define (write-method group-name exception minor-code base class-name pw)
  13.462 -    (let* 
  13.463 -	(
  13.464 -	    (x (symbol->string (car minor-code)))
  13.465 -	    (ident (cons x (StringUtil.toMixedCase x)))
  13.466 -	    (value (cadr minor-code))
  13.467 -	    (level (symbol->string (caddr minor-code)))
  13.468 -	    (explanation (cadddr minor-code))
  13.469 -	    (num-params (StringUtil.countArgs explanation)))
  13.470 -	(begin
  13.471 -	    (.printMsg pw "public static final int @ = @ ;"
  13.472 -		(list x (base value)))
  13.473 -	    (.println pw )
  13.474 -	    (.flush pw )
  13.475 -	    (write-method-status-cause group-name exception ident level num-params class-name pw)
  13.476 -	    (.println pw)
  13.477 -	    (.flush pw)
  13.478 -	    (write-method-status exception ident level num-params pw)
  13.479 -	    (.println pw)
  13.480 -	    (.flush pw)
  13.481 -	    (write-method-cause exception ident level num-params pw)
  13.482 -	    (.println pw)
  13.483 -	    (.flush pw)
  13.484 -	    (write-method-no-args exception ident level num-params pw)
  13.485 -	    (.println pw)
  13.486 -	    (.flush pw))))
  13.487 -
  13.488 -; Construct a string of the form arg1, ..., argn where n is num-params
  13.489 -(define (make-arg-string fixed leading-comma-flag num-args)
  13.490 -    (let
  13.491 -	(
  13.492 -	    (helper (lambda (lcf n)
  13.493 -		(let*
  13.494 -		    (
  13.495 -			(numstr (number->string (- n 1))))
  13.496 -		    (if (or lcf (> n 1))
  13.497 -			(string-append ", " fixed numstr)
  13.498 -			(string-append " " fixed numstr))))))
  13.499 -	(cond 
  13.500 -	    ((eqv? num-args 0) " ")
  13.501 -	    ((eqv? num-args 1) (helper leading-comma-flag 1))
  13.502 -	    (else (string-append 
  13.503 -		(make-arg-string fixed leading-comma-flag (- num-args 1)) 
  13.504 -		(helper leading-comma-flag num-args ))))))
  13.505 -
  13.506 -(define (make-decl-args leading-comma-flag num-args)
  13.507 -    (make-arg-string "Object arg" leading-comma-flag num-args))
  13.508 -
  13.509 -(define (make-call-args leading-comma-flag num-args)
  13.510 -    (make-arg-string "arg" leading-comma-flag num-args))
  13.511 -
  13.512 -; make-xxx-args patterns:
  13.513 -; leading-comma-flag #t
  13.514 -;
  13.515 -;   0   " "
  13.516 -;   1   ", arg0"
  13.517 -;   2   ", arg0, arg1"
  13.518 -;   3   ", arg0, arg1, arg2"
  13.519 -;
  13.520 -;   0   " "
  13.521 -;   1   ", Object arg0"
  13.522 -;   2   ", Object arg0, Object arg1"
  13.523 -;   3   ", Object arg0, Object arg1, Object arg2"
  13.524 -;
  13.525 -; leading-comma-flag #f
  13.526 -;
  13.527 -;   0   " "
  13.528 -;   1   " arg0"
  13.529 -;   2   " arg0, arg1"
  13.530 -;   3   " arg0, arg1, arg2"
  13.531 -;
  13.532 -;   0   " "
  13.533 -;   1   " Object arg0"
  13.534 -;   2   " Object arg0, Object arg1"
  13.535 -;   3   " Object arg0, Object arg1, Object arg2"
  13.536 -
  13.537 -(define (emit-assignments num pw)
  13.538 -    (let 
  13.539 -	(
  13.540 -	    (helper 
  13.541 -		(lambda (n) 
  13.542 -		    (.printMsg pw "parameters[@] = arg@ ;" (list n n)))))
  13.543 -	(if (= num 1)
  13.544 -	    (helper (- num 1))
  13.545 -	    (begin
  13.546 -		(emit-assignments (- num 1) pw)
  13.547 -		(helper (- num 1))))))
  13.548 -
  13.549 -; Write a method for an exception that takes a CompletionStatus and a cause
  13.550 -; exception:	the CORBA system exception type
  13.551 -; id:		the identifier for this exception in the form ( ident . mixed-case-ident )
  13.552 -; level:	the logging level
  13.553 -; num-params:	number of parameters in the explanation string, which determines
  13.554 -;		how many argn parameters we need
  13.555 -; pw:		the indenting print writer we are using
  13.556 -(define (write-method-status-cause group-name exception id level num-params class-name pw)
  13.557 -    (let*
  13.558 -	(
  13.559 -	    (ident (car id))
  13.560 -	    (ident-mc (cdr id)))
  13.561 -    (begin
  13.562 -	(.indent pw)
  13.563 -	(.printMsg pw "public @ @( CompletionStatus cs, Throwable t@) {"
  13.564 -	    (list exception ident-mc (make-decl-args #t num-params)))
  13.565 -	(.printMsg pw "@ exc = new @( @, cs ) ;"
  13.566 -	    (list exception exception ident ))
  13.567 -
  13.568 -	(.indent pw)
  13.569 -	(.println pw "if (t != null)" )
  13.570 -	(.undent pw)
  13.571 -	(.println pw "exc.initCause( t ) ;" )	
  13.572 -	(.println pw)
  13.573 -
  13.574 -	(.indent pw)
  13.575 -	(.printMsg pw "if (logger.isLoggable( Level.@ )) {"
  13.576 -	    (list level))
  13.577 -	
  13.578 -	(if (> num-params 0)
  13.579 -	    (begin
  13.580 -		(.printMsg pw "Object[] parameters = new Object[@] ;"
  13.581 -		    (list (number->string num-params)))
  13.582 -		(emit-assignments num-params pw)
  13.583 -	    )
  13.584 -	    (begin
  13.585 -		(.println pw "Object[] parameters = null ;"
  13.586 -	    )))
  13.587 -
  13.588 -	(.indent pw)
  13.589 -	(.printMsg pw "doLog( Level.@, \"@.@\"," (list level group-name ident-mc))
  13.590 -	(.undent pw)
  13.591 -	(.undent pw)
  13.592 -	(.printMsg pw "parameters, @.class, exc ) ;" (list class-name))
  13.593 -	(.println pw "}")
  13.594 -	(.println pw)
  13.595 -
  13.596 -	(.undent pw)
  13.597 -	(.println pw "return exc ;")
  13.598 -
  13.599 -	(.println pw "}"))))
  13.600 -
  13.601 -; Write a method for an exception that takes a CompletionStatus.  The cause is null. 
  13.602 -;
  13.603 -; exception:	the CORBA system exception type
  13.604 -; id:		the identifier for this exception in the form ( ident . mixed-case-ident )
  13.605 -; level:	the logging level
  13.606 -; num-params:	number of parameters in the explanation string, which determines
  13.607 -;		how many argn parameters we need
  13.608 -; pw:		the indenting print writer we are using
  13.609 -(define (write-method-status exception id level num-params pw)
  13.610 -    (let*
  13.611 -	(
  13.612 -	    (ident-mc (cdr id)))
  13.613 -	(begin
  13.614 -	    (.indent pw)
  13.615 -	    (.printMsg pw "public @ @( CompletionStatus cs@) {"
  13.616 -		(list exception ident-mc (make-decl-args #t num-params)))
  13.617 -	    (.undent pw)
  13.618 -	    (.printMsg pw "return @( cs, null@ ) ;"
  13.619 -		(list ident-mc (make-call-args #t num-params)))
  13.620 -	    (.println pw "}"))))
  13.621 -
  13.622 -; Write a method for an exception that takes a cause.  The status is COMPLETED_NO. 
  13.623 -;
  13.624 -; exception:	the CORBA system exception type
  13.625 -; id:		the identifier for this exception in the form ( ident . mixed-case-ident )
  13.626 -; level:	the logging level
  13.627 -; num-params:	number of parameters in the explanation string, which determines
  13.628 -;		how many argn parameters we need
  13.629 -; pw:		the indenting print writer we are using
  13.630 -(define (write-method-cause exception id level num-params pw)
  13.631 -    (let*
  13.632 -	(
  13.633 -	    (ident-mc (cdr id)))
  13.634 -	(begin
  13.635 -	    (.indent pw)
  13.636 -	    (.printMsg pw "public @ @( Throwable t@) {"
  13.637 -		(list exception ident-mc (make-decl-args #t num-params)))
  13.638 -	    (.undent pw)
  13.639 -	    (.printMsg pw "return @( CompletionStatus.COMPLETED_NO, t@ ) ;"
  13.640 -		(list ident-mc (make-call-args #t num-params)))
  13.641 -	    (.println pw "}"))))
  13.642 -
  13.643 -; Write a method for an exception that takes no arguments.  This is COMPLETED_NO and
  13.644 -; a null cause.
  13.645 -;
  13.646 -; exception:	the CORBA system exception type
  13.647 -; id:		the identifier for this exception in the form ( ident . mixed-case-ident )
  13.648 -; level:	the logging level
  13.649 -; num-params:	number of parameters in the explanation string, which determines
  13.650 -;		how many argn parameters we need
  13.651 -; pw:		the indenting print writer we are using
  13.652 -(define (write-method-no-args exception id level num-params pw)
  13.653 -    (let*
  13.654 -	(
  13.655 -	    (ident-mc (cdr id)))
  13.656 -	(begin
  13.657 -	    (.indent pw)
  13.658 -	    (.printMsg pw "public @ @( @) {"
  13.659 -		(list exception ident-mc (make-decl-args #f num-params)))
  13.660 -	    (.undent pw)
  13.661 -	    (.printMsg pw "return @( CompletionStatus.COMPLETED_NO, null@ ) ;"
  13.662 -		(list ident-mc (make-call-args #t num-params)))
  13.663 -	    (.println pw "}"))))
  13.664 -
  13.665 -;;; end of file
    14.1 --- a/src/share/classes/com/sun/tools/corba/se/logutil/scripts/run	Fri Mar 27 14:11:32 2009 -0700
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,2 +0,0 @@
    14.4 -#! /bin/sh
    14.5 -java -cp ${CLASSPATH}:lib/jscheme.jar:lib/util.jar jscheme.REPL mc.scm

mercurial